httpd-cvs mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From s.@apache.org
Subject svn commit: r1180331 - in /httpd/httpd/trunk: acinclude.m4 configure.in
Date Sat, 08 Oct 2011 07:48:01 GMT
Author: sf
Date: Sat Oct  8 07:48:01 2011
New Revision: 1180331

URL: http://svn.apache.org/viewvc?rev=1180331&view=rev
Log:
Add some CFLAGS in maintainer mode if supported by gcc:

-Wformat
-Wformat-security
-Werror=format-security
-Werror=declaration-after-statement

Add new macro APACHE_ADD_GCC_CFLAGS to do the compatibility check.

Modified:
    httpd/httpd/trunk/acinclude.m4
    httpd/httpd/trunk/configure.in

Modified: httpd/httpd/trunk/acinclude.m4
URL: http://svn.apache.org/viewvc/httpd/httpd/trunk/acinclude.m4?rev=1180331&r1=1180330&r2=1180331&view=diff
==============================================================================
--- httpd/httpd/trunk/acinclude.m4 (original)
+++ httpd/httpd/trunk/acinclude.m4 Sat Oct  8 07:48:01 2011
@@ -706,3 +706,25 @@ YES_IS_DEFINED
     CPPFLAGS="$apache_old_cppflags"
   ])
 ])
+
+dnl
+dnl APACHE_ADD_GCC_CFLAGS
+dnl
+dnl Check if compiler is gcc and supports flag. If yes, add to CFLAGS.
+dnl
+AC_DEFUN([APACHE_ADD_GCC_CFLAG], [
+  define([ap_gcc_ckvar], [ac_cv_gcc_]translit($1, [-:.=], [____]))
+  if test "$GCC" = "yes"; then
+    AC_CACHE_CHECK([whether gcc accepts $1], ap_gcc_ckvar, [
+      save_CFLAGS="$CFLAGS"
+      CFLAGS="$CFLAGS $1"
+      AC_COMPILE_IFELSE([AC_LANG_SOURCE([int foo() { return 0; }])],
+        [ap_gcc_ckvar=yes], [ap_gcc_ckvar=no])
+      CFLAGS="$save_CFLAGS"
+    ])
+    if test "$]ap_gcc_ckvar[" = "yes" ; then
+       APR_ADDTO(CFLAGS,[$1])
+    fi
+  fi
+  undefine([ap_gcc_ckvar])
+])

Modified: httpd/httpd/trunk/configure.in
URL: http://svn.apache.org/viewvc/httpd/httpd/trunk/configure.in?rev=1180331&r1=1180330&r2=1180331&view=diff
==============================================================================
--- httpd/httpd/trunk/configure.in (original)
+++ httpd/httpd/trunk/configure.in Sat Oct  8 07:48:01 2011
@@ -541,16 +541,11 @@ AC_ARG_ENABLE(maintainer-mode,APACHE_HEL
   APR_ADDTO(CPPFLAGS, -DAP_DEBUG)
   if test "$GCC" = "yes"; then
     APR_ADDTO(CFLAGS,[-Wall -Wmissing-prototypes -Wstrict-prototypes -Wmissing-declarations
-Wpointer-arith])
-    AC_CACHE_CHECK([whether gcc accepts -Wdeclaration-after-statement], [ap_cv_cc_Wdas],
[
-      save_CFLAGS=$CFLAGS
-      CFLAGS="$CFLAGS -Wdeclaration-after-statement"
-      AC_COMPILE_IFELSE([AC_LANG_SOURCE([int foo() { return 0; }])],
-        [ap_cv_cc_Wdas=yes], [ap_cv_cc_Wdas=no])
-      CFLAGS=$save_CFLAGS
-    ])
-    if test "$ap_cv_cc_Wdas" = "yes"; then
-      APR_ADDTO(CFLAGS,[-Wdeclaration-after-statement])
-    fi
+    APACHE_ADD_GCC_CFLAG([-Wdeclaration-after-statement])
+    APACHE_ADD_GCC_CFLAG([-Werror=declaration-after-statement])
+    APACHE_ADD_GCC_CFLAG([-Wformat])
+    APACHE_ADD_GCC_CFLAG([-Wformat-security])
+    APACHE_ADD_GCC_CFLAG([-Werror=format-security])
   elif test "$AIX_XLC" = "yes"; then
     APR_ADDTO(CFLAGS,-qfullpath -qinitauto=FE -qcheck=all -qinfo=pro)
   fi
@@ -561,16 +556,11 @@ AC_ARG_ENABLE(debugger-mode,APACHE_HELP_
   APR_ADDTO(CPPFLAGS, -DAP_DEBUG)
   if test "$GCC" = "yes"; then
     APR_ADDTO(CFLAGS,[-Wall -Wmissing-prototypes -Wstrict-prototypes -Wmissing-declarations
-Wpointer-arith -O0])
-    AC_CACHE_CHECK([whether gcc accepts -Wdeclaration-after-statement], [ap_cv_cc_Wdas],
[
-      save_CFLAGS=$CFLAGS
-      CFLAGS="$CFLAGS -Wdeclaration-after-statement"
-      AC_COMPILE_IFELSE([AC_LANG_SOURCE([int foo() { return 0; }])],
-        [ap_cv_cc_Wdas=yes], [ap_cv_cc_Wdas=no])
-      CFLAGS=$save_CFLAGS
-    ])
-    if test "$ap_cv_cc_Wdas" = "yes"; then
-      APR_ADDTO(CFLAGS,[-Wdeclaration-after-statement])
-    fi
+    APACHE_ADD_GCC_CFLAG([-Wdeclaration-after-statement])
+    APACHE_ADD_GCC_CFLAG([-Werror=declaration-after-statement])
+    APACHE_ADD_GCC_CFLAG([-Wformat])
+    APACHE_ADD_GCC_CFLAG([-Wformat-security])
+    APACHE_ADD_GCC_CFLAG([-Werror=format-security])
   elif test "$AIX_XLC" = "yes"; then
     APR_ADDTO(CFLAGS,-qfullpath -qinitauto=FE -qcheck=all -qinfo=pro)
   fi



Mime
View raw message