Skip to content

Commit

Permalink
configure: check more compile flags
Browse files Browse the repository at this point in the history
Check for clobbered (and put few others into same league)
  • Loading branch information
Zdenek Kabelac committed Oct 24, 2013
1 parent d95751c commit 7943a13
Show file tree
Hide file tree
Showing 4 changed files with 49 additions and 7 deletions.
1 change: 0 additions & 1 deletion acinclude.m4
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,6 @@ AC_DEFUN([AC_TRY_CCFLAG],
AC_REQUIRE([AC_PROG_CC])
ac_save_CFLAGS=$CFLAGS
CFLAGS=$1
AC_MSG_RESULT([KOUKEJ $name])
AC_CACHE_CHECK([whether $CC accepts $1 flag], [ac_cv_flag_$2],
[AC_COMPILE_IFELSE([AC_LANG_PROGRAM()],
[AS_VAR_SET([ac_cv_flag_$2], [yes])],
Expand Down
41 changes: 39 additions & 2 deletions configure
Original file line number Diff line number Diff line change
Expand Up @@ -708,6 +708,7 @@ CUNIT_CFLAGS
GENPNG
GENHTML
LCOV
HAVE_WCLOBBERED
HAVE_WJUMP
SACKPT_LIBS
SACKPT_CFLAGS
Expand Down Expand Up @@ -8682,8 +8683,6 @@ fi

ac_save_CFLAGS=$CFLAGS
CFLAGS=-Wjump-misses-init
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: KOUKEJ $name" >&5
$as_echo "KOUKEJ $name" >&6; }
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether $CC accepts -Wjump-misses-init flag" >&5
$as_echo_n "checking whether $CC accepts -Wjump-misses-init flag... " >&6; }
if test "${ac_cv_flag_HAVE_WJUMP+set}" = set; then :
Expand Down Expand Up @@ -8719,6 +8718,44 @@ $as_echo "$ac_cv_flag_HAVE_WJUMP" >&6; }




ac_save_CFLAGS=$CFLAGS
CFLAGS=-Wclobbered
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether $CC accepts -Wclobbered flag" >&5
$as_echo_n "checking whether $CC accepts -Wclobbered flag... " >&6; }
if test "${ac_cv_flag_HAVE_WCLOBBERED+set}" = set; then :
$as_echo_n "(cached) " >&6
else
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
/* end confdefs.h. */
int
main ()
{
;
return 0;
}
_ACEOF
if ac_fn_c_try_compile "$LINENO"; then :
ac_cv_flag_HAVE_WCLOBBERED=yes
else
ac_cv_flag_HAVE_WCLOBBERED=no
fi
rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
fi
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_flag_HAVE_WCLOBBERED" >&5
$as_echo "$ac_cv_flag_HAVE_WCLOBBERED" >&6; }
CFLAGS=$ac_save_CFLAGS
HAVE_WCLOBBERED=$ac_cv_flag_HAVE_WCLOBBERED
if test "HAVE_WCLOBBERED" = yes; then
:
else
:
fi



################################################################################
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for C optimisation flag" >&5
$as_echo_n "checking for C optimisation flag... " >&6; }
Expand Down
2 changes: 2 additions & 0 deletions configure.in
Original file line number Diff line number Diff line change
Expand Up @@ -838,6 +838,8 @@ fi
dnl -- Check if compiler supports -Wjump-misses-init
AC_TRY_CCFLAG([-Wjump-misses-init], [HAVE_WJUMP], [], [])
AC_SUBST(HAVE_WJUMP)
AC_TRY_CCFLAG([-Wclobbered], [HAVE_WCLOBBERED], [], [])
AC_SUBST(HAVE_WCLOBBERED)

################################################################################
dnl -- Override optimisation
Expand Down
12 changes: 8 additions & 4 deletions make.tmpl.in
Original file line number Diff line number Diff line change
Expand Up @@ -135,16 +135,20 @@ INSTALL_SCRIPT = $(INSTALL) -p $(M_INSTALL_PROGRAM)
WFLAGS += -Wall -Wundef -Wshadow -Wcast-align -Wwrite-strings \
-Wmissing-prototypes -Wmissing-declarations -Wnested-externs \
-Winline -Wmissing-noreturn -Wformat-security -Wredundant-decls \
-Wpointer-arith -Wclobbered -Wempty-body -Wignored-qualifiers \
-Wmissing-parameter-type -Wold-style-declaration -Woverride-init \
-Wtype-limits -Wuninitialized -Wmissing-include-dirs -Wsync-nand \
-Wfloat-equal -Wlogical-op -Wstrict-prototypes \
-Wpointer-arith -Wuninitialized -Wmissing-include-dirs \
-Wfloat-equal -Wstrict-prototypes \
-Wold-style-definition -Wmissing-format-attribute

ifeq ("@HAVE_WJUMP@", "yes")
WFLAGS += -Wjump-misses-init
endif

ifeq ("@HAVE_WCLOBBERED@", "yes")
WFLAGS += -Wclobbered -Wempty-body -Wignored-qualifiers \
-Wmissing-parameter-type -Wold-style-declaration -Woverride-init \
-Wtype-limits -Wsync-nand -Wlogical-op
endif

#WFLAGS += -W -Wno-sign-compare -Wno-unused-parameter -Wno-missing-field-initializers
#WFLAGS += -Wsign-compare -Wunused-parameter -Wmissing-field-initializers
#WFLAGS += -Wconversion -Wbad-function-cast -Wcast-qual -Waggregate-return -Wpacked
Expand Down

0 comments on commit 7943a13

Please sign in to comment.