diff options
author | Thomas Haller <thaller@redhat.com> | 2017-02-09 11:01:04 +0100 |
---|---|---|
committer | Thomas Haller <thaller@redhat.com> | 2017-02-09 17:05:55 +0100 |
commit | eff1c6da6ae6ebf053ca9d65a1ab855e360aa199 (patch) | |
tree | 788b1db607b171ad3edac2c40b7797f2f4881331 | |
parent | c2728bbbf86bfc3acfc4a77114abe665629594a1 (diff) | |
download | network-manager-applet-eff1c6da6ae6ebf053ca9d65a1ab855e360aa199.tar.gz |
build: update m4/compiler_options.m4 with latest changes from NetworkManager
- new warning flags
- add -Wextra
- add -Wimplicit-fallthrough
- add -Wno-missing-field-initializers
- add -Wno-format-truncation
- compile with -gnu99 instead of -gnu89
- make the --enable-more-warning option configurable for the
NM_COMPILER_WARNINGS macro.
-rw-r--r-- | configure.ac | 2 | ||||
-rw-r--r-- | m4/compiler_options.m4 | 35 |
2 files changed, 26 insertions, 11 deletions
diff --git a/configure.ac b/configure.ac index 4e850e56..56e92fe2 100644 --- a/configure.ac +++ b/configure.ac @@ -145,7 +145,7 @@ AC_PATH_PROG(GLIB_COMPILE_RESOURCES, glib-compile-resources) dnl dnl Compiler flags dnl -NM_COMPILER_WARNINGS +NM_COMPILER_WARNINGS([yes]) AC_ARG_WITH(more-asserts, diff --git a/m4/compiler_options.m4 b/m4/compiler_options.m4 index fa11c522..c998711d 100644 --- a/m4/compiler_options.m4 +++ b/m4/compiler_options.m4 @@ -37,7 +37,7 @@ AC_DEFUN([NM_COMPILER_WARNING], [ AC_DEFUN([NM_COMPILER_WARNINGS], [AC_ARG_ENABLE(more-warnings, AS_HELP_STRING([--enable-more-warnings], [Possible values: no/yes/error]), - set_more_warnings="$enableval",set_more_warnings=yes) + set_more_warnings="$enableval",set_more_warnings=$1) AC_MSG_CHECKING(for more warnings) if test "$GCC" = "yes" -a "$set_more_warnings" != "no"; then AC_MSG_RESULT(yes) @@ -55,22 +55,37 @@ if test "$GCC" = "yes" -a "$set_more_warnings" != "no"; then dnl attach it to the CFLAGS. NM_COMPILER_WARNING([unknown-warning-option], []) - CFLAGS_MORE_WARNINGS="-Wall -std=gnu89" + CFLAGS_MORE_WARNINGS="-Wall -std=gnu99" if test "x$set_more_warnings" = xerror; then CFLAGS_MORE_WARNINGS="$CFLAGS_MORE_WARNINGS -Werror" fi - for option in -Wshadow -Wmissing-declarations -Wmissing-prototypes \ - -Wdeclaration-after-statement -Wformat-security \ - -Wfloat-equal -Wno-unused-parameter -Wno-sign-compare \ - -Wno-duplicate-decl-specifier \ + for option in \ + -Wextra \ + -Wdeclaration-after-statement \ + -Wfloat-equal \ + -Wformat-nonliteral \ + -Wformat-security \ + -Wimplicit-fallthrough \ + -Wimplicit-function-declaration \ + -Winit-self \ + -Wmissing-declarations \ + -Wmissing-include-dirs \ + -Wmissing-prototypes \ + -Wpointer-arith \ + -Wshadow \ -Wstrict-prototypes \ - -Wno-unused-but-set-variable \ + -Wundef \ + -Wno-duplicate-decl-specifier \ + -Wno-format-truncation \ -Wno-format-y2k \ - -Wundef -Wimplicit-function-declaration \ - -Wpointer-arith -Winit-self -Wformat-nonliteral \ - -Wmissing-include-dirs -Wno-pragmas; do + -Wno-missing-field-initializers \ + -Wno-pragmas \ + -Wno-sign-compare \ + -Wno-unused-but-set-variable \ + -Wno-unused-parameter \ + ; do dnl GCC 4.4 does not warn when checking for -Wno-* flags (https://gcc.gnu.org/wiki/FAQ#wnowarning) _NM_COMPILER_FLAG([$(printf '%s' "$option" | sed 's/^-Wno-/-W/')], [], [CFLAGS_MORE_WARNINGS="$CFLAGS_MORE_WARNINGS $option"], []) |