This is the mail archive of the libc-alpha@cygnus.com mailing list for the glibc project.


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

Re: glibc and gcc3


On Tue, 4 May 1999 10:47:20 +0100 (BST), "Joseph S. Myers" wrote:
>A few places in glibc 2.1.1pre2 use __GNUC_MINOR__ in a way that will
>break if we get gcc 3.0 with __GNUC__ == 3 && __GNUC_MINOR__ == 0.
>
>argp/argp.h:#  if defined __GNUC__ && defined __cplusplus && __GNUC_MINOR__ >=
> 8
>assert/assert.h:     __GNUC_MINOR__ < (defined __cplusplus ? 6 : 4))
>misc/sys/cdefs.h:# if defined __cplusplus && __GNUC_MINOR__ >= 8
>posix/sys/types.h:#if !defined __GNUC__ || __GNUC__ < 2 || __GNUC_MINOR__ < 7

Good eyes.  Patch follows.

>All other occurances of __GNUC_MINOR__ in the source tree look OK, except
>for a dubious one (only relevant if __NeXT__) in <obstack.h>.

This one is safe.

zw

1999-05-04 09:34 -0400  Zack Weinberg  <zack@rabi.phys.columbia.edu>

	* argp/argp.h, assert/assert.h, misc/sys/cdefs.h,
	posix/sys/types.h: Handle the case of __GNUC__=3,
	__GNUC_MINOR__=(anything).

===================================================================
Index: argp/argp.h
--- argp/argp.h	1998/12/04 20:53:50	1.18
+++ argp/argp.h	1999/05/04 13:32:35
@@ -38,12 +38,16 @@
 #endif
 
 #ifndef __P
-# if (defined __STDC__ && __STDC__) || defined __cplusplus
-#  if defined __GNUC__ && defined __cplusplus && __GNUC_MINOR__ >= 8
+# ifdef __cplusplus
+#  if defined __GNUC__ && (__GNUC__ > 2 || (__GNUC__ == 2 && __GNUC_MINOR__ > 7))
 #   define __P(args)	args throw ()
+#   define __PMT(args)	args
 #  else
 #   define __P(args)	args
+#   define __PMT(args)  args
 #  endif
+# elif defined __STDC__ && __STDC__ > 0
+#  define __P(args)	args
 #  define __PMT(args)	args
 # else
 #  define __P(args)	()
===================================================================
Index: assert/assert.h
--- assert/assert.h	1998/01/30 10:53:38	1.14
+++ assert/assert.h	1999/05/04 13:32:35
@@ -87,13 +87,21 @@
 
 /* Version 2.4 and later of GCC define a magical variable `__PRETTY_FUNCTION__'
    which contains the name of the function currently being defined.
-   This is broken in G++ before version 2.6.  */
-# if (!defined __GNUC__ || __GNUC__ < 2 || \
-     __GNUC_MINOR__ < (defined __cplusplus ? 6 : 4))
-#  define __ASSERT_FUNCTION	((__const char *) 0)
-# else
+   This is broken in G++ before version 2.6.
+   C9x has a similar variable called __func__, but prefer the GCC one since
+   it demangles C++ function names.  */
+#ifdef __GNUC__
+# if __GNUC__ > 2 || (__GNUC__ == 2 \
+		      && __GNUC_MINOR__ >= (defined __cplusplus ? 6 : 4))
 #  define __ASSERT_FUNCTION	__PRETTY_FUNCTION__
+# else
+#  define __ASSERT_FUNCTION	((__const char *) 0)
 # endif
-
+#else
+# if defined __STDC_VERSION__ && __STDC_VERSION__ >= 199901L
+#  define __ASSERT_FUNCTION	__func__
+# else
+#  define __ASSERT_FUNCTION	((__const char *) 0)
+#endif
 
 #endif /* NDEBUG.  */
===================================================================
Index: misc/sys/cdefs.h
--- misc/sys/cdefs.h	1999/02/16 09:37:08	1.25
+++ misc/sys/cdefs.h	1999/05/04 13:32:35
@@ -33,7 +33,7 @@
 /* GCC can always grok prototypes.  For C++ programs we add throw()
    to help it optimize the function calls.  But this works only with
    gcc 2.8.x and egcs.  */
-# if defined __cplusplus && __GNUC_MINOR__ >= 8
+# if defined __cplusplus && (__GNUC__ >= 3 || __GNUC_MINOR__ >= 8)
 #  define __THROW	throw ()
 # else
 #  define __THROW
===================================================================
Index: posix/sys/types.h
--- posix/sys/types.h	1999/01/21 14:50:44	1.31
+++ posix/sys/types.h	1999/05/04 13:32:35
@@ -132,7 +132,7 @@
 
 /* These size-specific names are used by some of the inet code.  */
 
-#if !defined __GNUC__ || __GNUC__ < 2 || __GNUC_MINOR__ < 7
+#if !defined __GNUC__ || __GNUC__ < 2 || (__GNUC__ == 2 && __GNUC_MINOR__ < 7)
 
 /* These types are defined by the ISO C 9x header <inttypes.h>. */
 # ifndef __int8_t_defined


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