From: Ben Pfaff Date: Thu, 30 Mar 2006 23:51:01 +0000 (+0000) Subject: Use -Wdeclaration-after-statement if available. X-Git-Tag: v0.6.0~1026 X-Git-Url: https://pintos-os.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=11815efff162eacc5a46666af7876035f665965c;p=pspp-builds.git Use -Wdeclaration-after-statement if available. --- diff --git a/ChangeLog b/ChangeLog index d0800c6d..ca0447e9 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,11 @@ +Thu Mar 30 15:50:05 2006 Ben Pfaff + + * Smake: Enable -Wdeclaration-after-statement warning if + available. + + * acinclude.m4: Add macro for checking whether a warning is + supported. + Mon Mar 20 16:32:11 2006 Ben Pfaff * Smake: Require "unistd" gnulib module. Removed tests for diff --git a/acinclude.m4 b/acinclude.m4 index e3ddb129..42ae613b 100644 --- a/acinclude.m4 +++ b/acinclude.m4 @@ -3,6 +3,22 @@ dnl This file is free software; the Free Software Foundation dnl gives unlimited permission to copy and/or distribute it, dnl with or without modifications, as long as this notice is preserved. +dnl Check whether a warning flag is accepted. +dnl If so, add it to CFLAGS. +dnl Example: PSPP_ENABLE_WARNING(-Wdeclaration-after-statement) +AC_DEFUN([PSPP_ENABLE_WARNING], +[ + m4_define([pspp_cv_name], [pspp_cv_[]m4_translit([$1], [-], [_])])dnl + AC_CACHE_CHECK([whether $CC accepts $1], [pspp_cv_name], + [pspp_save_CFLAGS="$CFLAGS" + CFLAGS="$CFLAGS $1" + AC_COMPILE_IFELSE([AC_LANG_PROGRAM(,)], [pspp_cv_name[]=yes], [pspp_cv_name[]=no]) + CFLAGS="$pspp_save_CFLAGS"]) + if test $pspp_cv_name = yes; then + CFLAGS="$CFLAGS $1" + fi +]) + dnl Check for readline and history libraries. dnl Modified for PSPP by Ben Pfaff, based on readline.m4 serial 3 from diff --git a/configure.ac b/configure.ac index aeeb16a3..6189010e 100644 --- a/configure.ac +++ b/configure.ac @@ -1,4 +1,4 @@ -0dnl Process this file with autoconf to produce a configure script. +dnl Process this file with autoconf to produce a configure script. dnl Initialize. AX_PREREQ(2.57) @@ -13,6 +13,8 @@ AM_PROG_CC_C_O AC_PROG_RANLIB gl_EARLY +PSPP_ENABLE_WARNING(-Wdeclaration-after-statement) + AM_CONDITIONAL(cc_is_gcc, test x"$GCC" = x"yes" )