On Tue, Mar 14, 2006 at 10:49:13AM -0500, Arthur David Olson wrote:
Proposed code changes are at the end of this message; the changes would: 1. eliminate conditionalization on __STDC__ by assuming a standard-conforming compiler is in use; 2. avoid gcc warnings about format strings in asctime; 3. introduce binary search logic in localtime.c.
Could you also please include the patch that Paul Eggert had in message <87k6blg49q.fsf@penguin.cs.ucla.edu> (Thu, 23 Feb 2006 13:21:37 -0800) for automatically setting HAVE_STDINT_H on glibc systems (like Linux)? (I've appended it below so you don't have to hunt the archives.) --Ken Pizzini --- private.h 2006/02/23 06:18:32 2006.2.0.5 +++ private.h 2006/02/23 21:16:15 2006.2.0.7 @@ -48,10 +48,6 @@ static char privatehid[] = "@(#)private. #define HAVE_SETTIMEOFDAY 3 #endif /* !defined HAVE_SETTIMEOFDAY */ -#ifndef HAVE_STDINT_H -#define HAVE_STDINT_H (199901 <= __STDC_VERSION__) -#endif /* !defined HAVE_STDINT_H */ - #ifndef HAVE_STRERROR #define HAVE_STRERROR 1 #endif /* !defined HAVE_STRERROR */ @@ -128,20 +124,30 @@ static char privatehid[] = "@(#)private. /* Unlike <ctype.h>'s isdigit, this also works if c < 0 | c > UCHAR_MAX. */ #define is_digit(c) ((unsigned)(c) - '0' <= 9) +/* Define HAVE_STDINT_H's default value here, rather than at the + start, since __GLIBC__'s value depends on previously-included + files. (glibc 2.1 and later have stdint.h, even with pre-C99 + compilers.) */ +#ifndef HAVE_STDINT_H +#define HAVE_STDINT_H \ + (199901 <= __STDC_VERSION__ || 2 < (__GLIBC__ + (0 < __GLIBC_MINOR__))) +#endif /* !defined HAVE_STDINT_H */ + #if HAVE_STDINT_H #include <stdint.h> #endif /* !HAVE_STDINT_H */ #ifndef INT_FAST64_MAX -#ifdef LLONG_MAX +/* Pre-C99 GCC compilers define __LONG_LONG_MAX__ instead of LLONG_MAX. */ +#if defined LLONG_MAX || defined __LONG_LONG_MAX__ typedef long long int_fast64_t; -#else /* !defined LLONG_MAX */ +#else /* ! (defined LLONG_MAX || defined __LONG_LONG_MAX__) */ #if (LONG_MAX >> 31) < 0xffffffff Please use a compiler that supports a 64-bit integer type (or wider); you may need to compile with "-DHAVE_STDINT_H". #endif /* (LONG_MAX >> 31) < 0xffffffff */ typedef long int_fast64_t; -#endif /* !defined LLONG_MAX */ +#endif /* ! (defined LLONG_MAX || defined __LONG_LONG_MAX__) */ #endif /* !defined INT_FAST64_MAX */ #ifndef INT32_MAX