2009-04-18 Joseph Myers * include/stdc-predef.h: New. Extracted from features.h. * include/features.h: Include stdc-predef.h. * Makefile (headers): Add stdc-predef.h. * CONFORMANCE: Update. Index: CONFORMANCE =================================================================== RCS file: /cvs/glibc/libc/CONFORMANCE,v retrieving revision 1.13 diff -u -r1.13 CONFORMANCE --- CONFORMANCE 19 Jul 2007 17:28:56 -0000 1.13 +++ CONFORMANCE 18 Apr 2009 13:05:02 -0000 @@ -125,41 +125,33 @@ values. This conflicts with the glibc extension where %as, %a[ and %aS mean to allocate the string for the data read. A strictly conforming C99 program using %as, %a[ or %aS in a scanf format string -will misbehave under glibc. +will misbehave under glibc if it does not include and +instead declares scanf itself; if it gets the declaration of scanf +from , it will use a C99-conforming version. Compiler limitations ==================== The macros __STDC_IEC_559__, __STDC_IEC_559_COMPLEX__ and -__STDC_ISO_10646__ are properly supposed to be defined by the -compiler, and to be constant throughout the translation unit (before -and after any library headers are included). However, they mainly -relate to library features, and the necessary magic has yet to be -implemented for GCC to predefine them to the correct values for the -library in use, so glibc defines them in . Programs that -test them before including any standard headers may misbehave. +__STDC_ISO_10646__ are properly supposed to be constant throughout the +translation unit (before and after any library headers are included). +However, they mainly relate to library features, and GCC only knows to +preinclude to get their definitions in version 4.5 and +later. Programs that test them before including any standard headers +may misbehave with older compilers. GCC doesn't support the optional imaginary types. Nor does it understand the keyword _Complex before GCC 3.0. This has the corresponding impact on the relevant headers. -glibc's use of extern inline conflicts with C99: in C99, extern inline -means that an external definition is generated as well as possibly an -inline definition, but in GCC it means that no external definition is -generated. When GCC's C99 mode implements C99 inline semantics, this -will break the uses of extern inline in glibc's headers. (Actually, -glibc uses `extern __inline', which is beyond the scope of the -standard, but it would clearly be very confusing for `__inline' and -plain `inline' to have different meanings in C99 mode.) - glibc's implementation is arcane but thought to work correctly; a clean and comprehensible version requires compiler builtins. For most of the headers required of freestanding implementations, glibc relies on GCC to provide correct versions. (At present, glibc -provides , and GCC doesn't.) +provides , and GCC doesn't before version 4.5.) Implementing MATH_ERRNO, MATH_ERREXCEPT and math_errhandling in needs compiler support: see Index: Makefile =================================================================== RCS file: /cvs/glibc/libc/Makefile,v retrieving revision 1.257 diff -u -r1.257 Makefile --- Makefile 24 Feb 2009 23:45:59 -0000 1.257 +++ Makefile 18 Apr 2009 13:05:02 -0000 @@ -70,7 +70,7 @@ $(addprefix install-, no-libc.a bin lib data headers others) headers := limits.h values.h features.h gnu-versions.h bits/libc-lock.h \ - bits/xopen_lim.h gnu/libc-version.h + bits/xopen_lim.h gnu/libc-version.h stdc-predef.h echo-headers: subdir_echo-headers Index: include/features.h =================================================================== RCS file: /cvs/glibc/libc/include/features.h,v retrieving revision 1.53 diff -u -r1.53 features.h --- include/features.h 26 Feb 2009 01:43:33 -0000 1.53 +++ include/features.h 18 Apr 2009 13:05:03 -0000 @@ -307,12 +307,7 @@ # define __USE_FORTIFY_LEVEL 0 #endif -/* We do support the IEC 559 math functionality, real and complex. */ -#define __STDC_IEC_559__ 1 -#define __STDC_IEC_559_COMPLEX__ 1 - -/* wchar_t uses ISO 10646-1 (2nd ed., published 2000-09-15) / Unicode 3.1. */ -#define __STDC_ISO_10646__ 200009L +#include /* This macro indicates that the installed library is the GNU C Library. For historic reasons the value now is 6 and this will stay from now Index: include/stdc-predef.h =================================================================== RCS file: include/stdc-predef.h diff -N include/stdc-predef.h --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ include/stdc-predef.h 18 Apr 2009 13:05:03 -0000 @@ -0,0 +1,37 @@ +/* Copyright (C) 1991-1993,1995-2006,2007,2009 Free Software Foundation, Inc. + This file is part of the GNU C Library. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, write to the Free + Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA + 02111-1307 USA. */ + +#ifndef _STDC_PREDEF_H +#define _STDC_PREDEF_H 1 + +/* This header is separate from features.h so that the compiler can + include it implicitly at the start of every compilation. It must + not itself include or any other header that includes + because the implicit include comes before any feature + test macros that may be defined in a source file before it first + explicitly includes a system header. GCC knows the name of this + header in order to preinclude it. */ + +/* We do support the IEC 559 math functionality, real and complex. */ +#define __STDC_IEC_559__ 1 +#define __STDC_IEC_559_COMPLEX__ 1 + +/* wchar_t uses ISO 10646-1 (2nd ed., published 2000-09-15) / Unicode 3.1. */ +#define __STDC_ISO_10646__ 200009L + +#endif