bug-cvs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [bug-gnulib] stdint vs cycle-check.h


From: Bruno Haible
Subject: Re: [bug-gnulib] stdint vs cycle-check.h
Date: Tue, 27 Jun 2006 15:10:49 +0200
User-agent: KMail/1.9.1

Mark D. Baushke wrote:
> I suspect that something as simple as altering the stdint.m4 existing
> code:
> 
>   other_includes='
> /* Get those types that are already defined in other system include files.  */
> #if defined(__FreeBSD__) && (__FreeBSD__ >= 3) && (__FreeBSD__ <= 4)
> # include <sys/inttypes.h>
> #endif
> #if defined(__OpenBSD__)
> # include <sys/types.h>
> # if HAVE_INTTYPES_H
> #  include FULL_PATH_INTTYPES_H
> # endif
> #endif
> #if defined(__linux__) && HAVE_SYS_BITYPES_H
> # include <sys/bitypes.h>
> #endif
> #if defined(__sun) && HAVE_SYS_INTTYPES_H
> # include <sys/inttypes.h>
> #endif
> #if (defined(__hpux) || defined(_AIX)) && HAVE_INTTYPES_H
> # include FULL_PATH_INTTYPES_H
> #endif
> #if HAVE_STDINT_H
> # include FULL_PATH_STDINT_H
> #endif
> '
> to use this in the stdint.m4 as an alternative:
> 
>   other_includes='
> /* Get those types that are already defined in other system include files.  */
> # include <sys/types.h>
> #if HAVE_SYS_INTTYPES_H
> # include <sys/inttypes.h>
> #endif
> 
> #if HAVE_INTTYPES_H
> # ifdef FULL_PATH_INTTYPES_H
> #  include FULL_PATH_INTTYPES_H
> # endif
> #endif
> 
> #if HAVE_SYS_BITYPES_H
> # include <sys/bitypes.h>
> #endif
> 
> #if HAVE_INTTYPES_H
> # ifdef FULL_PATH_INTTYPES_H
> #  include FULL_PATH_INTTYPES_H
> # endif
> #endif
> 
> #if HAVE_STDINT_H
> # ifdef FULL_PATH_STDINT_H
> #  include FULL_PATH_STDINT_H
> # endif
> #endif
> '
> 
> and similar code in the generated stdint.h file, would be sufficient to
> make things work... in other words, leave out all of the hacks as to
> which OS may or may not define those files and just test for them.

Paul Eggert writes:

> That would be fine with me.  Perhaps Bruno can comment, as he put
> those hacks in.

I have nothing in principle against what you propose. It's only
a matter of testing and testability:

1) I found out that on Linux libc5, <sys/bitypes.h> is needed. I have
   not tested whether FreeBSD or OSF/1 or Minix maybe also have a
   <sys/bitypes.h> and what that file contains.

   You cannot simply include all header files that exist. We saw just
   these days that
     - on IRIX 5.3 <inttypes.h> cannot be included because it collides
       with <sys/types.h>
     - on IRIX with that SGI compiler in !__c99 mode, <stdint.h> should
       not be included because it only contains warnings.
   It's a delicate judgement whether a file should be included or not.

2) If you find out in a year that on, say, Minix, a file <sys/stdint.h>
   needs to be included, I prefer to write it as

     #if defined _MINIX && HAVE_SYS_STDINT_H
     # include <sys/stdint.h>
     #endif

   rather than as

     #if HAVE_SYS_STDINT_H
     # include <sys/stdint.h>
     #endif

   because: do I know whether a <sys/stdint.h> exists on OpenBSD 3.8
   and what does it contain? And on OpenBSD 3.6? And NetBSD 2? And
   IRIX 5.3?

Bruno




reply via email to

[Prev in Thread] Current Thread [Next in Thread]