This is the mail archive of the libc-hacker@sourceware.cygnus.com mailing list for the glibc project.
Note that libc-hacker is a closed list. You may look at the archives of this list, but subscription and posting are not open.
Index Nav: | [Date Index] [Subject Index] [Author Index] [Thread Index] | |
---|---|---|
Message Nav: | [Date Prev] [Date Next] | [Thread Prev] [Thread Next] |
PR libc/1607 titled "sys/cdefs.h's __REDIRECT relies upon ANSI-ism" lead me to look at this issue. IMO we should warn the user that a K&R compiler is not supported with glibc 2.2. The easiest way is AFAIK to add the following to some file: #ifndef __STDC__ # error "You need a ISO C conforming compiler to use the glibc headers" #endif What do you think? I'm in favour of adding this to sys/cdefs.h and remove all K&R support stuff from that file. A patch is appended. Andreas 2000-03-30 Andreas Jaeger <aj@suse.de> * misc/sys/cdefs.h: Remove K&R support, error out if compiled by an K&R compiler. ============================================================ Index: misc/sys/cdefs.h --- misc/sys/cdefs.h 1999/12/19 08:31:26 1.30 +++ misc/sys/cdefs.h 2000/03/30 13:41:20 @@ -1,4 +1,4 @@ -/* Copyright (C) 1992,93,94,95,96,97,98,99 Free Software Foundation, Inc. +/* Copyright (C) 1992,93,94,95,96,97,98,99,2000 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 @@ -28,6 +28,12 @@ #undef __P #undef __PMT +/* The GNU C library can only be used by a ISO C compiler (conformant + to ISO C90 or ISO C99). gcc -traditional is not ISO c conformant. */ +#ifndef __STDC__ +# error "You need a ISO C conforming compiler to use the glibc headers" +#endif + #ifdef __GNUC__ /* GCC can always grok prototypes. For C++ programs we add throw() @@ -46,18 +52,9 @@ #else /* Not GCC. */ # define __inline /* No inline functions. */ - -# if (defined __STDC__ && __STDC__) || defined __cplusplus - -# define __P(args) args -# define __PMT(args) args -# else /* Not ANSI C or C++. */ - -# define __P(args) () /* No prototypes. */ -# define __PMT(args) () - -# endif /* ANSI C or C++. */ +# define __P(args) args +# define __PMT(args) args # define __const const # define __signed signed @@ -65,37 +62,13 @@ #endif /* GCC. */ -/* For these things, GCC behaves the ANSI way normally, - and the non-ANSI way under -traditional. */ +#define __CONCAT(x,y) x ## y +#define __STRING(x) #x -#if defined __STDC__ && __STDC__ - -# define __CONCAT(x,y) x ## y -# define __STRING(x) #x - /* This is not a typedef so `const __ptr_t' does the right thing. */ -# define __ptr_t void * -# define __long_double_t long double - -#else - -# define __CONCAT(x,y) x/**/y -# define __STRING(x) "x" - -# define __ptr_t char * -# define __long_double_t long double - -/* The BSD header files use the ANSI keywords unmodified (this means that - old programs may lose if they use the new keywords as identifiers), but - those names are not available under -traditional. We define them to - their __ versions, which are taken care of above. */ -# ifdef __USE_BSD -# define const __const -# define signed __signed -# define volatile __volatile -# endif +#define __ptr_t void * +#define __long_double_t long double -#endif /* __STDC__ */ /* C++ needs to know that types and declarations are C, not C++. */ -- Andreas Jaeger SuSE Labs aj@suse.de private aj@arthur.rhein-neckar.de
Index Nav: | [Date Index] [Subject Index] [Author Index] [Thread Index] | |
---|---|---|
Message Nav: | [Date Prev] [Date Next] | [Thread Prev] [Thread Next] |