summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authordevzero2000 <devzero2000>2012-02-10 13:49:41 +0000
committerdevzero2000 <devzero2000>2012-02-10 13:49:41 +0000
commit8aeccf75a9fa2b08f82dff505420fc978ed34a9b (patch)
treecf34438e04fd8bfa6eca52cf8a5b0c597ed7010a
parent4220cc4f137f9cf9e8557c8e31f7c82a459b7556 (diff)
downloadlibpopt-8aeccf75a9fa2b08f82dff505420fc978ed34a9b.tar.gz
Enable many more gcc warnings for popt
Inspired by http://www.spinics.net/lists/selinux/msg11726.html but popt can, unlike libselinux now, also detect if gcc support a compiler flag or not
-rw-r--r--CHANGES4
-rwxr-xr-xconfigure.ac65
2 files changed, 68 insertions, 1 deletions
diff --git a/CHANGES b/CHANGES
index 2581fb8..532265c 100644
--- a/CHANGES
+++ b/CHANGES
@@ -1,4 +1,8 @@
1.17 -> 2.0:
+ - devzero2000: Enable many more gcc warnings for popt
+ Inspired by http://www.spinics.net/lists/selinux/msg11726.html
+ but popt can, unlike libselinux now, also detect if
+ gcc support a compiler flag or not
- devzero2000: Fix move popt.m4 to acinclude.m4
so we can put it under version control
- devzero2000: give some color to autogen.sh
diff --git a/configure.ac b/configure.ac
index fcd2831..39eb6c0 100755
--- a/configure.ac
+++ b/configure.ac
@@ -54,6 +54,7 @@ AC_ARG_ENABLE([gcc-warnings],
AS_IF([test "x$popt_gcc_warnings" = xyes],
[ # Add/Delete as needed
+ MAX_STACK_SIZE=32768
popt_CFLAGS_ADD([-Wall], [POPT_CFLAGS])
popt_CFLAGS_ADD([-pedantic], [POPT_CFLAGS])
popt_CFLAGS_ADD([-Wextra], [POPT_CFLAGS])
@@ -64,6 +65,68 @@ AS_IF([test "x$popt_gcc_warnings" = xyes],
popt_CFLAGS_ADD([-Wstrict-overflow],[POPT_CFLAGS])
popt_CFLAGS_ADD([-fstrict-overflow],[POPT_CFLAGS])
popt_CFLAGS_ADD([-Wpointer-arith],[POPT_CFLAGS])
+ popt_CFLAGS_ADD([-Wundef],[POPT_CFLAGS])
+ popt_CFLAGS_ADD([-Wformat-security],[POPT_CFLAGS])
+ popt_CFLAGS_ADD([-Winit-self],[POPT_CFLAGS])
+ popt_CFLAGS_ADD([-Wmissing-include-dirs],[POPT_CFLAGS])
+ popt_CFLAGS_ADD([-Wunused],[POPT_CFLAGS])
+ popt_CFLAGS_ADD([-Wunknown-pragmas],[POPT_CFLAGS])
+ popt_CFLAGS_ADD([-Wstrict-aliasing],[POPT_CFLAGS])
+ popt_CFLAGS_ADD([-Wshadow],[POPT_CFLAGS])
+ popt_CFLAGS_ADD([-Wbad-function-cast],[POPT_CFLAGS])
+ popt_CFLAGS_ADD([-Wcast-align],[POPT_CFLAGS])
+ popt_CFLAGS_ADD([-Wwrite-strings],[POPT_CFLAGS])
+ popt_CFLAGS_ADD([-Wlogical-op],[POPT_CFLAGS])
+ popt_CFLAGS_ADD([-Waggregate-return],[POPT_CFLAGS])
+ popt_CFLAGS_ADD([-Wstrict-prototypes],[POPT_CFLAGS])
+ popt_CFLAGS_ADD([-Wold-style-definition],[POPT_CFLAGS])
+ popt_CFLAGS_ADD([-Wmissing-prototypes],[POPT_CFLAGS])
+ popt_CFLAGS_ADD([-Wmissing-declarations],[POPT_CFLAGS])
+ popt_CFLAGS_ADD([-Wmissing-noreturn],[POPT_CFLAGS])
+ popt_CFLAGS_ADD([-Wmissing-format-attribute],[POPT_CFLAGS])
+ popt_CFLAGS_ADD([-Wredundant-decls],[POPT_CFLAGS])
+ popt_CFLAGS_ADD([-Wnested-externs],[POPT_CFLAGS])
+ popt_CFLAGS_ADD([-Winline],[POPT_CFLAGS])
+ popt_CFLAGS_ADD([-Winvalid-pch],[POPT_CFLAGS])
+ popt_CFLAGS_ADD([-Wvolatile-register-var],[POPT_CFLAGS])
+ popt_CFLAGS_ADD([-Wdisabled-optimization],[POPT_CFLAGS])
+ popt_CFLAGS_ADD([-Wbuiltin-macro-redefined],[POPT_CFLAGS])
+ popt_CFLAGS_ADD([-Wmudflap],[POPT_CFLAGS])
+ popt_CFLAGS_ADD([-Wpacked-bitfield-compat],[POPT_CFLAGS])
+ popt_CFLAGS_ADD([-Wsync-nand],[POPT_CFLAGS])
+ popt_CFLAGS_ADD([-Wattributes],[POPT_CFLAGS])
+ popt_CFLAGS_ADD([-Wcoverage-mismatch],[POPT_CFLAGS])
+ popt_CFLAGS_ADD([-Wmultichar],[POPT_CFLAGS])
+ popt_CFLAGS_ADD([-Wcpp],[POPT_CFLAGS])
+ popt_CFLAGS_ADD([-Wdeprecated-declarations],[POPT_CFLAGS])
+ popt_CFLAGS_ADD([-Wdiv-by-zero],[POPT_CFLAGS])
+ popt_CFLAGS_ADD([-Wdouble-promotion],[POPT_CFLAGS])
+ popt_CFLAGS_ADD([-Wendif-labels],[POPT_CFLAGS])
+ popt_CFLAGS_ADD([-Wformat-contains-nul],[POPT_CFLAGS])
+ popt_CFLAGS_ADD([-Wformat-extra-args],[POPT_CFLAGS])
+ popt_CFLAGS_ADD([-Wformat-zero-length],[POPT_CFLAGS])
+ popt_CFLAGS_ADD([-Wformat=2],[POPT_CFLAGS])
+ popt_CFLAGS_ADD([-Wmultichar],[POPT_CFLAGS])
+ popt_CFLAGS_ADD([-Wnormalized=nfc],[POPT_CFLAGS])
+ popt_CFLAGS_ADD([-Woverflow],[POPT_CFLAGS])
+ popt_CFLAGS_ADD([-Wpointer-to-int-cast],[POPT_CFLAGS])
+ popt_CFLAGS_ADD([-Wpragmas],[POPT_CFLAGS])
+ popt_CFLAGS_ADD([-Wsuggest-attribute=const],[POPT_CFLAGS])
+ popt_CFLAGS_ADD([-Wsuggest-attribute=noreturn],[POPT_CFLAGS])
+ popt_CFLAGS_ADD([-Wsuggest-attribute=pure],[POPT_CFLAGS])
+ popt_CFLAGS_ADD([-Wtrampolines],[POPT_CFLAGS])
+ popt_CFLAGS_ADD([-Wno-missing-field-initializers],[POPT_CFLAGS])
+ popt_CFLAGS_ADD([-Wno-sign-compare],[POPT_CFLAGS])
+ popt_CFLAGS_ADD([-Wjump-misses-init],[POPT_CFLAGS])
+ popt_CFLAGS_ADD([-Wno-format-nonliteral],[POPT_CFLAGS])
+ popt_CFLAGS_ADD([-Wframe-larger-than=$MAX_STACK_SIZE],[POPT_CFLAGS])
+ popt_CFLAGS_ADD([-fstack-protector-all],[POPT_CFLAGS])
+ popt_CFLAGS_ADD([-fasynchronous-unwind-tables],[POPT_CFLAGS])
+ popt_CFLAGS_ADD([-fdiagnostics-show-option],[POPT_CFLAGS])
+ popt_CFLAGS_ADD([-funit-at-a-time],[POPT_CFLAGS])
+ popt_CFLAGS_ADD([-fipa-pure-const],[POPT_CFLAGS])
+ popt_CFLAGS_ADD([-Wno-aggregate-return],[POPT_CFLAGS])
+ popt_CFLAGS_ADD([-Wno-redundant-decls],[POPT_CFLAGS])
])
# build popt with mudflap instrumentation (GCC only)
@@ -133,7 +196,7 @@ AC_SUBST([POPT_LDFLAGS])
# -fno-delete-null-pointer as the kernel does http://patchwork.kernel.org/patch/36060/
# GNU GCC (usually "gcc")
AS_IF([test "x$GCC" != x],
- [ for c in -fno-delete-null-pointer-checks -D_FORTIFY_SOURCE=2 -fstack-protector -fexceptions
+ [ for c in -fno-delete-null-pointer-checks -Wp,-D_FORTIFY_SOURCE=2 -fstack-protector -fexceptions
do
popt_CFLAGS_ADD([$c], [POPT_CFLAGS])
done