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]

Re: warn against K&R compiler in glibc 2.2


>>>>> Andreas Jaeger writes:

>>>>> Ulrich Drepper writes:
Ulrich> Andreas Jaeger <aj@suse.de> writes:
>>> 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

Ulrich> If we are thinking about other compilers but gcc (which is legitimate
Ulrich> for the use of glibc) then this is not enough.  Most compilers beside
Ulrich> gcc do not define __STDC__ except if you direct the compiler to be
Ulrich> strictly compliant.  This is a weakness in the ISO C standard.
AJ> :-(

Ulrich> I don't know whether we can add any reasonable check.

AJ> We can at least check for gcc -traditional with:
AJ> #if defined __GNUC__ && __STDC__
AJ> # error "You need a ISO C conforming compiler to use the glibc headers"
AJ> #endif
The condition is wrong.

Here's a new patch.

2000-03-31  Andreas Jaeger  <aj@suse.de>

	* misc/sys/cdefs.h: Error out if compiled by gcc -traditional.

============================================================
Index: misc/sys/cdefs.h
--- misc/sys/cdefs.h	2000/03/31 04:17:23	1.31
+++ misc/sys/cdefs.h	2000/03/31 06:04:43
@@ -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.  */
+#if defined __GNUC__ && !defined  __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()

-- 
 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]