From 630f52125883755101f5958d3529b1df505ae5c7 Mon Sep 17 00:00:00 2001 From: Jesse Thilo Date: Thu, 13 Apr 2000 18:03:25 +0000 Subject: [PATCH] # added --enable-gcc-warnings (not for user consumption). --- configure.in | 23 +++++++++++++++++++++++ m4/warning.m4 | 11 +++++++++++ src/Makefile.am | 2 +- 3 files changed, 35 insertions(+), 1 deletion(-) create mode 100644 m4/warning.m4 diff --git a/configure.in b/configure.in index de916f17..9e5da4c6 100644 --- a/configure.in +++ b/configure.in @@ -16,6 +16,29 @@ AM_PROG_CC_STDC AC_PROG_INSTALL AC_PROG_RANLIB +AC_ARG_ENABLE(gcc-warnings, +[ --enable-gcc-warnings turn on lots of GCC warnings (not recommended)], +[case "${enableval}" in + yes|no) ;; + *) AC_MSG_ERROR([bad value ${enableval} for gcc-warnings option]) ;; + esac +], +enableval=no +) +if test "${enableval}" = yes; then + BISON_WARNING(-Wall) + BISON_WARNING(-W) + BISON_WARNING(-Wbad-function-cast) + BISON_WARNING(-Wcast-align) + BISON_WARNING(-Wcast-qual) + BISON_WARNING(-Wmissing-declarations) + BISON_WARNING(-Wmissing-prototypes) + BISON_WARNING(-Wnested-externs) + BISON_WARNING(-Wno-char-subscripts) + BISON_WARNING(-Wstrict-prototypes) + BISON_WARNING(-Wwrite-strings) +fi + dnl Checks for libraries. dnl Checks for header files. diff --git a/m4/warning.m4 b/m4/warning.m4 new file mode 100644 index 00000000..d169d5a7 --- /dev/null +++ b/m4/warning.m4 @@ -0,0 +1,11 @@ +AC_DEFUN(BISON_WARNING, +[AC_MSG_CHECKING(whether compiler accepts $1) +AC_SUBST(WARNING_CFLAGS) +ac_save_CFLAGS="$CFLAGS" +CFLAGS="$CFLAGS $1" +AC_TRY_COMPILE(, +[int x;], +WARNING_CFLAGS="$WARNING_CFLAGS $1" +AC_MSG_RESULT(yes), +AC_MSG_RESULT(no)) +CFLAGS="$ac_save_CFLAGS"]) diff --git a/src/Makefile.am b/src/Makefile.am index fbf8aa5c..42642db6 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -5,7 +5,7 @@ DEFS = @DEFS@ \ -DXPFILE=\"${datadir}/bison.simple\" \ -DXPFILE1=\"${datadir}/bison.hairy\" \ -DLOCALEDIR=\"${datadir}/locale\" -INCLUDES = -I../intl -I$(top_srcdir)/intl -I.. +INCLUDES = -I../intl -I$(top_srcdir)/intl -I.. $(WARNING_CFLAGS) LDADD = @INTLLIBS@ ../lib/libbison.a bin_PROGRAMS = bison -- 2.45.2