__STDC__ change in tz64code2006b

Paul Eggert eggert at CS.UCLA.EDU
Tue Feb 21 21:14:34 UTC 2006


Previously the tz code used "#ifdef __STDC__" to check whether the C
compiler is compatible with C89 or later, but tz64code2006b changes
this to "#if __STDC__".  This change has an undesirable affect on
Solaris, where Sun's C compiler by default defines __STDC__ to 0; you
must give it an option before it defines __STDC__ to 1.  (This is
because Sun enables certain traditional but incompatible extensions
like stdio.h's fileno by default, and __STDC__==0 signals this.)  As a
result, Sun's C compiler now compiles in K&R mode, and this doesn't
check the types as well.

Here is a proposed patch to revert to the previous way of doing
things.

If you like, I can propose a further patch to remove support for K&R
C.  This will simplify the code and ease our maintenance burden, as
nobody uses K&R C compilers any more except for computer museums
(which shouldn't count).

===================================================================
RCS file: RCS/date.c,v
retrieving revision 2006.2
retrieving revision 2006.2.0.1
diff -pu -r2006.2 -r2006.2.0.1
--- date.c	2006/02/20 15:08:17	2006.2
+++ date.c	2006/02/21 21:07:30	2006.2.0.1
@@ -352,7 +352,7 @@ dogmt()
 
 /*ARGSUSED*/
 static void
-#if __STDC__
+#ifdef __STDC__
 reset(const time_t newt, const int nflag)
 #else /* !__STDC__ */
 reset(newt, nflag)
@@ -623,7 +623,7 @@ register const struct tm * const btmp;
 #define ATOI2(ar)	(ar[0] - '0') * 10 + (ar[1] - '0'); ar += 2;
 
 static time_t
-#if __STDC__
+#ifdef __STDC__
 convert(register const char * const value, const int dousg, const time_t t)
 #else /* !__STDC__ */
 convert(value, dousg, t)
@@ -734,7 +734,7 @@ const time_t			t;
 */
 
 static void
-#if __STDC__
+#ifdef __STDC__
 checkfinal(const char * const	value,
 	   const int		didusg,
 	   const time_t		t,
@@ -804,7 +804,7 @@ const time_t		oldnow;
 }
 
 static void
-#if __STDC__
+#ifdef __STDC__
 iffy(const time_t thist, const time_t thatt,
 	const char * const value, const char * const reason)
 #else /* !__STDC__ */
===================================================================
RCS file: RCS/localtime.c,v
retrieving revision 2006.2
retrieving revision 2006.2.0.1
diff -pu -r2006.2 -r2006.2.0.1
--- localtime.c	2006/02/20 15:08:17	2006.2
+++ localtime.c	2006/02/21 21:07:30	2006.2.0.1
@@ -602,7 +602,7 @@ register const char *	strp;
 */
 
 static const char *
-#if __STDC__
+#ifdef __STDC__
 getqzname(register const char *strp, const int delim)
 #else /* !__STDC__ */
 getqzname(strp, delim)
===================================================================
RCS file: RCS/zdump.c,v
retrieving revision 2006.2
retrieving revision 2006.2.0.1
diff -pu -r2006.2 -r2006.2.0.1
--- zdump.c	2006/02/20 15:08:17	2006.2
+++ zdump.c	2006/02/21 21:07:30	2006.2.0.1
@@ -130,7 +130,7 @@ static char	elsieid[] = "@(#)zdump.c	8.1
 #endif /* !defined TZ_DOMAIN */
 
 #ifndef P
-#if __STDC__
+#ifdef __STDC__
 #define P(x)	x
 #else /* !__STDC__ */
 #define P(x)	()
@@ -475,7 +475,7 @@ const long	y;
 }
 
 static time_t
-#if __STDC__
+#ifdef __STDC__
 hunt(char *name, time_t lot, time_t hit)
 #else /* !__STDC__ */
 hunt(name, lot, hit)
@@ -552,7 +552,7 @@ struct tm *	oldp;
 }
 
 static void
-#if __STDC__
+#ifdef __STDC__
 show(char *zone, time_t t, int v)
 #else /* !__STDC__ */
 show(zone, t, v)
===================================================================
RCS file: RCS/private.h,v
retrieving revision 2006.2
retrieving revision 2006.2.0.1
diff -pu -r2006.2 -r2006.2.0.1
--- private.h	2006/02/20 15:08:17	2006.2
+++ private.h	2006/02/21 21:07:30	2006.2.0.1
@@ -156,7 +156,7 @@ typedef long		int_fast64_t;
 */
 
 #ifndef P
-#if __STDC__
+#ifdef __STDC__
 #define P(x)	x
 #else /* !__STDC__ */
 #define P(x)	()



More information about the tz mailing list