From sastdr@unx.sas.com  Fri Apr 17 17:01:04 1998
Received: from lamb.sas.com (root@lamb.sas.com [192.35.83.8])
          by hub.freebsd.org (8.8.8/8.8.8) with ESMTP id RAA01141
          for <FreeBSD-gnats-submit@freebsd.org>; Fri, 17 Apr 1998 17:00:59 GMT
          (envelope-from sastdr@unx.sas.com)
Received: from mozart (mozart.unx.sas.com [192.58.184.8])
	by lamb.sas.com (8.8.7/8.8.7) with SMTP id NAA27401
	for <FreeBSD-gnats-submit@freebsd.org>; Fri, 17 Apr 1998 13:00:57 -0400 (EDT)
Received: from wagner.unx.sas.com by mozart (5.65c/SAS/Domains/5-6-90)
	id AA13842; Fri, 17 Apr 1998 13:00:57 -0400
Received: from numb.pc.sas.com by wagner.unx.sas.com (5.65c/SAS/Generic 9.01/3-26-93)
	id AA26734; Fri, 17 Apr 1998 13:00:56 -0400
Received: (from sastdr@localhost) by numb.pc.sas.com (8.8.8/8.6.6) id MAA21525; Fri, 17 Apr 1998 12:51:23 -0400 (EDT)
Message-Id: <199804171651.MAA21525@numb.pc.sas.com>
Date: Fri, 17 Apr 1998 12:51:23 -0400 (EDT)
From: Thomas David Rivers <sastdr@unx.sas.com>
Reply-To: sastdr@unx.sas.com
To: FreeBSD-gnats-submit@freebsd.org
Subject: time.h doesn't compile with -traditional
X-Send-Pr-Version: 3.2

>Number:         6332
>Category:       bin
>Synopsis:       /usr/include/time.h doesn't compile with -traditional
>Confidential:   no
>Severity:       non-critical
>Priority:       medium
>Responsible:    bde
>State:          closed
>Quarter:        
>Keywords:       
>Date-Required:  
>Class:          sw-bug
>Submitter-Id:   current-users
>Arrival-Date:   Fri Apr 17 10:10:01 PDT 1998
>Closed-Date:    Sun Oct 28 05:04:05 PST 2001
>Last-Modified:  Sun Oct 28 05:10:27 PST 2001
>Originator:     Thomas David Rivers
>Release:        FreeBSD 2.2.6-RELEASE i386
>Organization:
SAS Institute
>Environment:


>Description:

  I continue to compile some software with -traditional; because
 it may not compile on other hosts and I'd like to "catch" this on
 FreeBSD before it gets there.

  Unfortunately, some system header files have had some ANSI-isms
 creep in, that prevent programs from compiling with the -traditional
 flag.

  This seems to mostly be the use of the 'const' keyword.
 
  .e.g: in time.h:

#if !defined(_ANSI_SOURCE) && !defined(_POSIX_SOURCE)
const char *strptime __P((const char *, const char *, struct tm *));
char *timezone __P((int, int));

>How-To-Repeat:

  foo.c:

	#include <time.h>

   cc -traditional foo.c


>Fix:

  Replace uses of 'const' with the __const keyword defined in cdefs.h.

>Release-Note:
>Audit-Trail:

From: Dmitrij Tejblum <tejblum@arc.hq.cti.ru>
To: sastdr@unx.sas.com
Cc: FreeBSD-gnats-submit@FreeBSD.ORG
Subject: Re: bin/6332: time.h doesn't compile with -traditional 
Date: Fri, 17 Apr 1998 21:36:46 +0400

 > >Fix:
 > 
 >   Replace uses of 'const' with the __const keyword defined in cdefs.h.
 > 
 
 No, strptime probably should return char* rather than const char*.
 I don't see any reason why user must not modify the return value.
 
 Dima
 
 

From: Bruce Evans <bde@zeta.org.au>
To: FreeBSD-gnats-submit@FreeBSD.ORG, sastdr@unx.sas.com
Cc:  Subject: Re: bin/6332: time.h doesn't compile with -traditional
Date: Sat, 18 Apr 1998 04:05:28 +1000

 >>Description:
 >
 >  I continue to compile some software with -traditional; because
 > it may not compile on other hosts and I'd like to "catch" this on
 > FreeBSD before it gets there.
 >...
 >>Fix:
 >
 >  Replace uses of 'const' with the __const keyword defined in cdefs.h.
 
 `const' is used on about 561 lines in /usr/include/*.h, 244 lines in
 /usr/include/sys/*.h, ...  It is too late to uglify them all.
 
 <sys/cdefs.h> defines away `const' (and other ANSI-only keywords)
 unless NO_ANSI_KEYWORDS or __GNUC__ is defined.  It is assumed that
 `gcc -traditional' is only used to compile dusty code that uses
 these keywords as normal identifiers.  If your code doesn't have
 such identifiers then you can easily define away the identifiers
 directly by compiling with `gcc -traditional -Dconst='.
 
 Bruce

From: Thomas David Rivers <rivers@dignus.com>
To: FreeBSD-gnats-submit@freebsd.org, sastdr@unx.sas.com
Cc:  Subject: Re: bin/6332: time.h doesn't compile with -traditional
Date: Fri, 17 Apr 1998 15:41:01 -0400 (EDT)

 > 
 > >Fix:
 > 
 >   Replace uses of 'const' with the __const keyword defined in cdefs.h.
 > 
 
  Let me add to that, that uses of "const" for prototype definitions
  aren't the problem; it's uses of "const" outside of the __P() macro.
 
  I imagine such uses are more infrequent.
 
 	- Dave Rivers -

From: Thomas David Rivers <rivers@dignus.com>
To: bde@zeta.org.au, FreeBSD-gnats-submit@FreeBSD.ORG
Cc:  Subject: Re: bin/6332: time.h doesn't compile with -traditional
Date: Fri, 17 Apr 1998 15:37:09 -0400 (EDT)

 Bruce Evans writes:
 
 > The following reply was made to PR bin/6332; it has been noted by GNATS.
 > 
 > From: Bruce Evans <bde@zeta.org.au>
 > To: FreeBSD-gnats-submit@FreeBSD.ORG, sastdr@unx.sas.com
 > Cc:  Subject: Re: bin/6332: time.h doesn't compile with -traditional
 > Date: Sat, 18 Apr 1998 04:05:28 +1000
 > 
 >  >>Description:
 >  >
 >  >  I continue to compile some software with -traditional; because
 >  > it may not compile on other hosts and I'd like to "catch" this on
 >  > FreeBSD before it gets there.
 >  >...
 >  >>Fix:
 >  >
 >  >  Replace uses of 'const' with the __const keyword defined in cdefs.h.
 >  
 >  `const' is used on about 561 lines in /usr/include/*.h, 244 lines in
 >  /usr/include/sys/*.h, ...  It is too late to uglify them all.
 
  It's too late?  I didn't know changes were limited by the calendar :-)
 Granted, it may be too late for 2.2.6 (certainly) and likely even 3.0,
 but what about future versions?
 
 
 >  
 >  <sys/cdefs.h> defines away `const' (and other ANSI-only keywords)
 >  unless NO_ANSI_KEYWORDS or __GNUC__ is defined.  It is assumed that
 >  `gcc -traditional' is only used to compile dusty code that uses
 >  these keywords as normal identifiers.  If your code doesn't have
 >  such identifiers then you can easily define away the identifiers
 >  directly by compiling with `gcc -traditional -Dconst='.
 
  Umm... that's not the assumption I was using.  
 
  And, it would seem that, even if that's the assumption, it doesn't
 work...   I can by the statement that "-traditional simply doesn't
 work" - if that's what we want to make... seems to me, given the
 assumption I was making (see next paragraph) that making -tradition
 "work" is worthwhile, for some...
 
  I was using gcc -traditional to ensure my code will compile on
 platforms where I don't have an ANSI compiler... as a test case.
 And, I then discovered FreeBSD's code wouldn't work there either...
 
  I agree,  your point of defining 'const' away is a good workaround.
 
 	- Dave Rivers -

From: Bruce Evans <bde@zeta.org.au>
To: bde@zeta.org.au, FreeBSD-gnats-submit@FreeBSD.ORG, rivers@dignus.com
Cc:  Subject: Re: bin/6332: time.h doesn't compile with -traditional
Date: Sat, 18 Apr 1998 14:10:35 +1000

 >>  `const' is used on about 561 lines in /usr/include/*.h, 244 lines in
 >>  /usr/include/sys/*.h, ...  It is too late to uglify them all.
 >
 > It's too late?  I didn't know changes were limited by the calendar :-)
 >Granted, it may be too late for 2.2.6 (certainly) and likely even 3.0,
 >but what about future versions?
 
 ANSI C has been standard for about 10 years now.  BSD4.4 never fully
 supported K&R 5 years ago (it requires separate libraries compiled
 with -traditional for compatibility ...), so why should we start now?
 
 >>  <sys/cdefs.h> defines away `const' (and other ANSI-only keywords)
 >>  unless NO_ANSI_KEYWORDS or __GNUC__ is defined.  It is assumed that
 >>  `gcc -traditional' is only used to compile dusty code that uses
 >>  these keywords as normal identifiers.  If your code doesn't have
 >>  such identifiers then you can easily define away the identifiers
 >>  directly by compiling with `gcc -traditional -Dconst='.
 >
 > Umm... that's not the assumption I was using.  
 
 You have to read the "documentation" for -traditional support (cdefs.h).
 
 Bruce
Responsible-Changed-From-To: freebsd-bugs->bde 
Responsible-Changed-By: phk 
Responsible-Changed-When: Sat Apr 18 23:56:51 PDT 1998 
Responsible-Changed-Why:  
Bruce seems to be on this one 
State-Changed-From-To: open->closed 
State-Changed-By: asmodai 
State-Changed-When: Sun Oct 28 05:04:05 PST 2001 
State-Changed-Why:  
strptime() lost its constness for the return type. 

http://www.FreeBSD.org/cgi/query-pr.cgi?pr=6332 
>Unformatted:
