This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
3.1 PATCH: Fix Tru64 UNIX assert.h for use with C++
- From: Rainer Orth <ro at TechFak dot Uni-Bielefeld dot DE>
- To: gcc-patches at gcc dot gnu dot org
- Cc: libstdc++ at gcc dot gnu dot org, Bruce Korb <bkorb at gnu dot org>
- Date: Wed, 20 Mar 2002 20:45:03 +0100 (MET)
- Subject: 3.1 PATCH: Fix Tru64 UNIX assert.h for use with C++
Checking Tru64 UNIX V4.0F and V5.1 testresults in gcc 3.1 20020313
http://gcc.gnu.org/ml/gcc-testresults/2002-03/msg00308.html (V4.0F)
http://gcc.gnu.org/ml/gcc-testresults/2002-03/msg00309.html (V5.1)
I noticed a couple of libstdc++ v3 testsuite failures:
FAIL: 27_io/filebuf_members.cc (test for excess errors)
WARNING: 27_io/filebuf_members.cc compilation failed to produce executable
FAIL: 27_io/instantiations.cc (test for excess errors)
WARNING: 27_io/instantiations.cc compilation failed to produce executable
FAIL: 27_io/streambuf.cc (test for excess errors)
WARNING: 27_io/streambuf.cc compilation failed to produce executable
The first and last failures are regressions from 3.0.5:
http://gcc.gnu.org/ml/gcc-testresults/2002-03/msg00290.html (V4.0F)
http://gcc.gnu.org/ml/gcc-testresults/2002-03/msg00291.html (V5.1)
whereas the second test is new since 3.0.x.
All three are due to a common problem:
libstdc++-v3/testsuite/27_io/filebuf_members.cc:190: invalid conversion from `void*' to `int'
line 190 has
VERIFY(scratch_file);
with scratch_file declared as
std::fstream scratch_file;
VERIFY is just assert (from testsuite_hooks.h), and the system's assert is
#define assert(EX) (((int) (EX)) ? (void)0 : __assert(#EX, __FILE__, __LINE__))
The following patch removes this (int) cast with fixincludes and thus fixes
those three failures.
Bootstrapped without regressions on alpha-dec-osf5.1.
Ok for 3.1 branch and mainline?
Rainer
-----------------------------------------------------------------------------
Rainer Orth, Faculty of Technology, Bielefeld University
Thu Mar 14 23:03:36 2002 Rainer Orth <ro@TechFak.Uni-Bielefeld.DE>
* fixinc/inclhack.def (alpha_assert): Fix assert macro in Tru64
UNIX assert.h.
* fixinc/fixincl.x: Regenerate.
Index: gcc/fixinc/inclhack.def
===================================================================
RCS file: /cvs/gcc/gcc/gcc/fixinc/inclhack.def,v
retrieving revision 1.120
diff -u -p -r1.120 inclhack.def
--- inclhack.def 2002/01/28 14:17:11 1.120
+++ inclhack.def 2002/03/20 19:43:40
@@ -586,6 +586,20 @@ fix = {
/*
+ * Fix assert macro in assert.h on Alpha OSF/1.
+ * The superfluous int cast breaks C++.
+ */
+fix = {
+ hackname = alpha_assert;
+ 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__))';
+};
+
+
+/*
* Fix getopt declarations in stdio.h and stdlib.h on Alpha OSF/1 and AIX.
*/
fix = {