Add gcc's -Wundef to test suite and fix another warning from it.

* NEWS (2.4.2): Update description of -Wundef fix.
* configure.ac (WARN_CXXFLAGS_TEST): New substitution.
(WARN_CFLAGS_TEST): New substitution.
* data/glr.c: Avoid warning about __STRICT_ANSI__.
* tests/atlocal.in (CFLAGS): Use WARN_CFLAGS_TEST instead of
WARN_CFLAGS.
(CXXFLAGS): Use WARN_CXXFLAGS_TEST instead of WARN_CXXFLAGS.
(cherry picked from commit a603c6e0bb)

Conflicts:

	tests/atlocal.in
This commit is contained in:
Joel E. Denny
2009-12-16 13:19:19 -05:00
parent 39c2566994
commit 3d04b5673d
5 changed files with 24 additions and 5 deletions

View File

@@ -1,3 +1,14 @@
2009-12-16 Joel E. Denny <jdenny@clemson.edu>
Add gcc's -Wundef to test suite and fix another warning from it.
* NEWS (2.4.2): Update description of -Wundef fix.
* configure.ac (WARN_CXXFLAGS_TEST): New substitution.
(WARN_CFLAGS_TEST): New substitution.
* data/glr.c: Avoid warning about __STRICT_ANSI__.
* tests/atlocal.in (CFLAGS): Use WARN_CFLAGS_TEST instead of
WARN_CFLAGS.
(CXXFLAGS): Use WARN_CXXFLAGS_TEST instead of WARN_CXXFLAGS.
2009-12-16 Joel E. Denny <jdenny@clemson.edu>
Document gcc -Wundef fix.

5
NEWS
View File

@@ -5,8 +5,9 @@ Bison News
** Detection of GNU M4 1.4.6 or newer during configure is improved.
** Warnings from gcc's -Wundef option about undefined YYENABLE_NLS and
YYLTYPE_IS_TRIVIAL in C/C++ parsers are now avoided.
** Warnings from gcc's -Wundef option about undefined YYENABLE_NLS,
YYLTYPE_IS_TRIVIAL, and __STRICT_ANSI__ in C/C++ parsers are now
avoided.
** %code is now a permanent feature.

View File

@@ -68,6 +68,12 @@ if test "${enableval}" = yes; then
gl_WARN_ADD([-Wshadow])
gl_WARN_ADD([-Wstrict-prototypes])
AC_SUBST([WARN_CFLAGS])
# Warnings for the test suite only.
gl_WARN_ADD([-Wundef], [WARN_CFLAGS_TEST])
WARN_CXXFLAGS_TEST="$WARN_CXXFLAGS $WARN_CFLAGS_TEST"
WARN_CFLAGS_TEST="$WARN_CFLAGS $WARN_CFLAGS_TEST"
AC_SUBST([WARN_CXXFLAGS_TEST])
AC_SUBST([WARN_CFLAGS_TEST])
AC_DEFINE([lint], 1, [Define to 1 if the compiler is checking for lint.])
fi

View File

@@ -310,7 +310,8 @@ b4_percent_code_get[]dnl
#ifndef __attribute__
/* This feature is available in gcc versions 2.5 and later. */
# if (! defined __GNUC__ || __GNUC__ < 2 \
|| (__GNUC__ == 2 && __GNUC_MINOR__ < 5) || __STRICT_ANSI__)
|| (__GNUC__ == 2 && __GNUC_MINOR__ < 5) \
|| (defined __STRICT_ANSI__ && __STRICT_ANSI__))
# define __attribute__(Spec) /* empty */
# endif
#endif

View File

@@ -8,7 +8,7 @@
: ${CC='@CC@'}
# We want no optimization.
CFLAGS='@O0CFLAGS@ @WARN_CFLAGS@ @WERROR_CFLAGS@'
CFLAGS='@O0CFLAGS@ @WARN_CFLAGS_TEST@ @WERROR_CFLAGS@'
# We need `config.h'.
CPPFLAGS="-I$abs_top_builddir/lib @CPPFLAGS@"
@@ -23,7 +23,7 @@ GCC='@GCC@'
BISON_CXX_WORKS='@BISON_CXX_WORKS@'
# We want no optimization with C++, too.
CXXFLAGS='@O0CXXFLAGS@ @WARN_CXXFLAGS@ @WERROR_CFLAGS@'
CXXFLAGS='@O0CXXFLAGS@ @WARN_CXXFLAGS_TEST@ @WERROR_CFLAGS@'
# Are special link options needed?
LDFLAGS='@LDFLAGS@'