This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC 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: 3.1 PATCH: Fix Tru64 UNIX assert.h for use with C++



> Ok for 3.1 branch and mainline?

OK, but please patch fixinc/tests/base/assert.h, too:


Index: fixinc/inclhack.def
===================================================================
RCS file: /cvs/gcc/gcc/gcc/fixinc/inclhack.def,v
retrieving revision 1.101.2.18
diff -u -r1.101.2.18 inclhack.def
--- inclhack.def	2001/12/13 02:20:27	1.101.2.18
+++ inclhack.def	2002/03/21 03:14:07
@@ -647,12 +647,27 @@
  *  Fix __assert declaration in assert.h on Alpha OSF/1.
  */
 fix = {
-    hackname  = alpha___assert;
+    hackname  = alpha_assert_decl;
     files     = "assert.h";
     select    = '__assert\(char \*, char \*, int\)';
     c_fix     = format;
     c_fix_arg = "__assert(const char *, const char *, int)";
     test_text = 'extern void __assert(char *, char *, int);';
+};
+
+
+/*
+ *  Fix assert macro in assert.h on Alpha OSF/1.
+ *  The superfluous int cast breaks C++.
+ */
+fix = {
+    hackname  = alpha_assert_macro;
+    files     = "assert.h";
+    select    = '(#define assert\(EX\).*)\(\(int\) \(EX\)\)';
+    c_fix     = format;
+    c_fix_arg = "%1(EX)";
+    test_text = '#define assert(EX) (((int) (EX)) ? (void)0 : '
+                '__assert(#EX, __FILE__, __LINE__))';
 };
 
 
Index: fixinc/tests/base/assert.h
===================================================================
RCS file: /cvs/gcc/gcc/gcc/fixinc/tests/base/assert.h,v
retrieving revision 1.2.6.1
diff -u -r1.2.6.1 assert.h
--- assert.h	2001/05/26 18:56:14	1.2.6.1
+++ assert.h	2002/03/21 03:14:07
@@ -19,9 +19,14 @@
 #include <stdio.h>
 
 
-#if defined( ALPHA___ASSERT_CHECK )
+#if defined( ALPHA_ASSERT_DECL_CHECK )
 extern void __assert(const char *, const char *, int);
-#endif  /* ALPHA___ASSERT_CHECK */
+#endif  /* ALPHA_ASSERT_DECL_CHECK */
+
+
+#if defined( ALPHA_ASSERT_MACRO_CHECK )
+#define assert(EX) ((EX) ? (void)0 : __assert(#EX, __FILE__, __LINE__))
+#endif  /* ALPHA_ASSERT_MACRO_CHECK */
 
 
 #if defined( BROKEN_ASSERT_STDIO_CHECK )


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