From patchwork Wed Jun 6 16:36:15 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: [2/7] Added assert fixinclude hack for VxWorks. Date: Wed, 06 Jun 2012 06:36:15 -0000 From: rbmj X-Patchwork-Id: 163394 Message-Id: <4FCF86FF.9030100@verizon.net> To: gcc-patches@gcc.gnu.org Cc: nathan@codesourcery.com, bkorb@gnu.org VxWorks's assert.h relies on adjacent string tokens being joined, and uses macros for some of the strings (e.g. __FILE__). However, it does not put a space after the end quote and before the macro, so instead of replacing the macro, gcc >= 4.7.x thinks it's a user-defined literal token, and since the lookup obviously fails, compilation of libstdc++ dies. Changes: * fixincludes/inclhack.def: Added AAB_vxworks_assert fix. --- fixincludes/inclhack.def | 40 ++++++++++++++++++++++++++++++++++++++++ 1 files changed, 40 insertions(+), 0 deletions(-) >From d2cbe2a8f546abf5713e8a6ed614ef2eac1f749b Mon Sep 17 00:00:00 2001 From: rbmj Date: Mon, 4 Jun 2012 13:18:10 -0400 Subject: [PATCH 2/7] Added assert fixinclude hack for VxWorks. VxWorks's assert.h relies on adjacent string tokens being joined, and uses macros for some of the strings (e.g. __FILE__). However, it does not put a space after the end quote and before the macro, so instead of replacing the macro, gcc >= 4.7.x thinks it's a user-defined literal token, and since the lookup obviously fails, compilation of libstdc++ dies. Changes: * fixincludes/inclhack.def: Added AAB_vxworks_assert fix. --- fixincludes/inclhack.def | 40 ++++++++++++++++++++++++++++++++++++++++ 1 files changed, 40 insertions(+), 0 deletions(-) diff --git a/fixincludes/inclhack.def b/fixincludes/inclhack.def index 8a26f28..d66b1cb 100644 --- a/fixincludes/inclhack.def +++ b/fixincludes/inclhack.def @@ -354,6 +354,46 @@ fix = { _EndOfHeader_; }; +/* + * Fix assert.h on VxWorks: + */ +fix = { + hackname = AAB_vxworks_assert; + files = assert.h; + mach = "*-*-vxworks*"; + + replace = <<- _EndOfHeader_ + #ifndef _ASSERT_H + #define _ASSERT_H + + #ifdef assert + #undef assert + #endif + + #if defined(__STDC__) || defined(__cplusplus) + extern void __assert (const char*); + #else + extern void __assert (); + #endif + + #ifdef NDEBUG + #define assert(ign) ((void)0) + #else + + #define ASSERT_STRINGIFY(str) ASSERT_STRINGIFY_HELPER(str) + #define ASSERT_STRINGIFY_HELPER(str) #str + + #define assert(test) ((void) \ + ((test) ? ((void)0) : \ + __assert("Assertion failed: " ASSERT_STRINGIFY(test) ", file " \ + __FILE__ ", line " ASSERT_STRINGIFY(__LINE__) "\n"))) + + #endif + + #endif + _EndOfHeader_; +}; + /* * complex.h on AIX 5 and AIX 6 define _Complex_I and I in terms of __I, -- 1.7.5.4