This is the mail archive of the mailing list for the newlib project.

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

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


Your patch should be test for C99 first and use __func__, then test for __GNUC__ >= 2 as a fall-back as per the information at

I have made the corresponding patch and checked it in.

-- Jeff J.

Ken Werner wrote:

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?



2008-07-17 Ken Werner <>

* 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__
- /* 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. */

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