This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
[PATCH 2/7] Added assert fixinclude hack for VxWorks.
- From: rbmj <rbmj at verizon dot net>
- To: gcc-patches at gcc dot gnu dot org
- Cc: nathan at codesourcery dot com, bkorb at gnu dot org
- Date: Wed, 06 Jun 2012 12:36:15 -0400
- Subject: [PATCH 2/7] Added assert fixinclude hack for VxWorks.
- References: <4FCF863E.6090400@verizon.net>
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 <rbmj@verizon.net>
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