[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
bison configure --enable-gcc-warnings patch for C++ tests
From: |
Paul Eggert |
Subject: |
bison configure --enable-gcc-warnings patch for C++ tests |
Date: |
Mon, 2 Jun 2003 00:27:41 -0700 (PDT) |
I was getting failures like this when I tested Bison with
--enable-gcc-warnings and GCC 3.3:
$ ./testsuite -v -d 80
## ---------------------------- ##
## GNU Bison 1.875b test suite. ##
## ---------------------------- ##
80. calc.at:615: testing Calculator %skeleton lalr1.cc %defines %locations...
calc.at:615: bison -o calc.c calc.y
calc.at:615: $CXX --version || exit 77
stderr:
stdout:
g++ (GCC) 3.3
Copyright (C) 2003 Free Software Foundation, Inc.
This is free software; see the source for copying conditions. There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
calc.at:615: $CXX $CFLAGS $CPPFLAGS calc.c -o calc
stderr:
cc1plus: warning: "-Wbad-function-cast" is valid for C/ObjC but not for C++
cc1plus: warning: "-Wmissing-declarations" is valid for C/ObjC but not for
C++
cc1plus: warning: "-Wnested-externs" is valid for C/ObjC but not for C++
The problem is that C-only warning options are passed to the C++ compiler.
I installed the following patch.
2003-06-01 Paul Eggert <address@hidden>
Don't pass C-only warning optins (e.g., -Wmissing-declarations)
to g++, as GCC 3.3 complains if you do it.
* configure.ac (WARNING_CXXFLAGS): New subst. Set it to
everything that WARNING_CFLAGS has, except omit warnings
not suitable for C++.
(AC_PROG_CXX): Use this instead of AC_CHECK_PROGS([CXX], [g++]).
* tests/atlocal.in (CXXFLAGS): New var.
* tests/local.at (AT_COMPILE_CXX): Use it instead of CFLAGS.
Index: configure.ac
===================================================================
RCS file: /cvsroot/bison/bison/configure.ac,v
retrieving revision 1.35
diff -p -u -r1.35 configure.ac
--- configure.ac 27 Apr 2003 05:27:15 -0000 1.35
+++ configure.ac 2 Jun 2003 06:51:20 -0000
@@ -46,16 +46,18 @@ if test "${enableval}" = yes; then
WARNING_CFLAGS=
BISON_WARNING(-Wall)
BISON_WARNING(-W)
- BISON_WARNING(-Wbad-function-cast)
BISON_WARNING(-Wcast-align)
BISON_WARNING(-Wcast-qual)
BISON_WARNING(-Wformat)
- BISON_WARNING(-Wmissing-declarations)
BISON_WARNING(-Wmissing-prototypes)
- BISON_WARNING(-Wnested-externs)
BISON_WARNING(-Wshadow)
BISON_WARNING(-Wstrict-prototypes)
BISON_WARNING(-Wwrite-strings)
+ AC_SUBST([WARNING_CXXFLAGS], [$WARNING_CFLAGS])
+ # The following warnings are not suitable for C++.
+ BISON_WARNING(-Wbad-function-cast)
+ BISON_WARNING(-Wmissing-declarations)
+ BISON_WARNING(-Wnested-externs)
AC_DEFINE([lint], 1, [Define to 1 if the compiler is checking for lint.])
fi
@@ -132,7 +134,7 @@ AC_CONFIG_TESTDIR(tests)
AC_CONFIG_FILES([tests/Makefile tests/atlocal])
AC_CONFIG_FILES([tests/bison], [chmod +x tests/bison])
AC_CHECK_PROGS([VALGRIND], [valgrind])
-AC_CHECK_PROGS([CXX], [g++])
+AC_PROG_CXX
AM_MISSING_PROG([AUTOM4TE], [autom4te])
# Needed by tests/atlocal.in.
AC_SUBST([GCC])
Index: tests/atlocal.in
===================================================================
RCS file: /cvsroot/bison/bison/tests/atlocal.in,v
retrieving revision 1.13
diff -p -u -r1.13 atlocal.in
--- tests/atlocal.in 18 Feb 2003 05:08:55 -0000 1.13
+++ tests/atlocal.in 2 Jun 2003 06:51:20 -0000
@@ -17,6 +17,9 @@ GCC='@GCC@'
# The GCC C++ compiler.
CXX='@CXX@'
+# We want no optimization with C++, too.
+CXXFLAGS='@O0CFLAGS@ @WARNING_CXXFLAGS@ @WERROR_CFLAGS@'
+
# Are special link options needed?
LDFLAGS='@LDFLAGS@'
Index: tests/local.at
===================================================================
RCS file: /cvsroot/bison/bison/tests/local.at,v
retrieving revision 1.1
diff -p -u -r1.1 local.at
--- tests/local.at 2 Mar 2003 11:14:07 -0000 1.1
+++ tests/local.at 2 Jun 2003 06:51:20 -0000
@@ -176,7 +176,7 @@ m4_define([AT_COMPILE],
m4_define([AT_COMPILE_CXX],
[AT_KEYWORDS(c++)
AT_CHECK([$CXX --version || exit 77], 0, ignore, ignore)
-AT_CHECK([$CXX $CFLAGS $CPPFLAGS m4_default([$2], [$1.c]) -o $1],
+AT_CHECK([$CXX $CXXFLAGS $CPPFLAGS m4_default([$2], [$1.c]) -o $1],
0, [], [ignore])])
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- bison configure --enable-gcc-warnings patch for C++ tests,
Paul Eggert <=