This is the mail archive of the gcc@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: Getting glibfortran to build on newlib targets aka. missingstdint.h (PR 14325)


On Sun, 7 Nov 2004, Zack Weinberg wrote:

> Reasoning by analogy from the <limits.h> mess, I think it is important
> that GCC not ever override the system <stdint.h> where it exists (if
> it exists but is broken, that is a fixincludes problem).

Most of the mess is because POSIX adds its own definitions to <limits.h>.  
Otherwise it could simply be overridden outright with far fewer problems.

You'll still have some mess because of the systems which provide 
<inttypes.h> but not <stdint.h>.

> One way to make the distinction more sensible is to have three
> directories in libsubdir: call them include, include-fixed,
> include-freestanding.  The normal search order is include,
> include-fixed, /usr/include, include-freestanding; thus, C library
> versions of the headers in category 3 above automatically override the
> versions we provide.  Putting -ffreestanding on the command line
> causes include-fixed and /usr/include to be dropped from the search
> path, which is the Right Thing for kernels and suchlike.

This makes sense to me for <limits.h> and <stdint.h> at least (subject of 
course to it working with glibc's <limits.h> which for GCC expects to get 
the standard limits from GCC's header, but will use #include_next if it 
somehow gets included first).  <stdbool.h> is a header unlikely to cause 
problems either way; likewise <iso646.h>; as the standard defines their 
contents exactly and the only GCC-specific thing is how C++ is handled.  
<stdarg.h> and <stddef.h> have GCC-specific contents.  It also makes 
fairly clear, regarding the suggestion that was made to include 
<tgmath.h>, that the proper place for <tgmath.h> would be include-fixed, 
i.e. it is a fix if the library doesn't provide a suitable header.

<float.h> is an interesting case where some systems define FLT_ROUNDS to 
call a function to determine the current rounding mode - but while that's 
something we don't want to lose and do lose at present, the headers may 
well need fixing to add the C99 definitions they may not have.

Any change to the strategy for these headers will need thorough testcases 
that the headers used - both hosted and freestanding - follow the relevant 
standards.

-- 
Joseph S. Myers               http://www.srcf.ucam.org/~jsm28/gcc/
    jsm@polyomino.org.uk (personal mail)
    joseph@codesourcery.com (CodeSourcery mail)
    jsm28@gcc.gnu.org (Bugzilla assignments and CCs)


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]