[patch] assert.h causing problems with older GCC and XLC

Ken Werner ken@linux.vnet.ibm.com
Thu Jul 17 15:09:00 GMT 2008


Hi,

the assert function is using __func__ whenever __GNUC__ is defined, regardless 
of the language level provided by the compiler. This causes Problem with the 
XLC and probably older GCC versions. This patch first checks the __GNUC__ 
level then the __STDC_VERSION__. Ok to Apply?

Ken

newlib/ChangeLog:

2008-07-17  Ken Werner  <ken.werner@de.ibm.com>

        * libc/include/assert.h: Provide .type and .size directives

Index: src/newlib/libc/include/assert.h
===================================================================
--- src.orig/newlib/libc/include/assert.h
+++ src/newlib/libc/include/assert.h
@@ -21,8 +21,12 @@ extern "C" {
 #  if defined __cplusplus && defined __GNUC__
 #   define __ASSERT_FUNC __PRETTY_FUNCTION__
 
-  /* C99 requires the use of __func__, gcc also supports it.  */
-#  elif defined __GNUC__ || __STDC_VERSION__ >= 199901L
+  /* Older versions of GCC recognize __FUNCTION__.  */
+#  elif defined __GNUC__ >= 2
+#   define __ASSERT_FUNC __FUNCTION__
+
+  /* C99 requires the use of __func__.  */
+#  elif defined __STDC_VERSION__ >= 199901L
 #   define __ASSERT_FUNC __func__
 
   /* failed to detect __func__ support.  */



More information about the Newlib mailing list