From dad50c379c59f4b35daebe0db7f820f4eba5d5f3 Mon Sep 17 00:00:00 2001 From: wm4 Date: Fri, 4 Apr 2014 18:22:49 +0200 Subject: build: add -Wempty-body to compiler flags Warns against "if(0);" but not "if(0){}" - perfect for our purposes. --- old-configure | 4 ++-- waftools/detections/compiler.py | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/old-configure b/old-configure index db76f2123c..d8e675b7dc 100755 --- a/old-configure +++ b/old-configure @@ -1145,14 +1145,14 @@ if test -z "$CFLAGS" ; then WARNFLAGS="-wd167 -wd556 -wd144" elif test "$cc_vendor" = "clang"; then CFLAGS="$_opt $_debug $_pipe" - WARNFLAGS="-Wall -Wno-switch -Wno-logical-op-parentheses -Wpointer-arith -Wundef -Wno-pointer-sign -Wmissing-prototypes -Wshadow" + WARNFLAGS="-Wall -Wno-switch -Wno-logical-op-parentheses -Wpointer-arith -Wundef -Wno-pointer-sign -Wmissing-prototypes -Wshadow -Wempty-body" ERRORFLAGS="-Werror=implicit-function-declaration -Wno-error=deprecated-declarations -Wno-error=unused-function" elif test "$cc_vendor" != "gnu" ; then CFLAGS="$_opt $_debug $_pipe" else CFLAGS="$_opt $_debug $_pipe" WARNFLAGS="-Wall -Wno-switch -Wno-parentheses -Wpointer-arith -Wredundant-decls" - ERRORFLAGS="-Werror-implicit-function-declaration -Wno-error=deprecated-declarations -Wno-error=unused-function -Wshadow" + ERRORFLAGS="-Werror-implicit-function-declaration -Wno-error=deprecated-declarations -Wno-error=unused-function -Wshadow -Wempty-body" extra_ldflags="$extra_ldflags" fi else diff --git a/waftools/detections/compiler.py b/waftools/detections/compiler.py index fe607faa1c..1d854bf0ad 100644 --- a/waftools/detections/compiler.py +++ b/waftools/detections/compiler.py @@ -21,7 +21,7 @@ def __add_generic_flags__(ctx): ctx.env.CFLAGS += ['-g'] def __add_gcc_flags__(ctx): - ctx.env.CFLAGS += ["-Wundef", "-Wmissing-prototypes", + ctx.env.CFLAGS += ["-Wundef", "-Wmissing-prototypes", "-Wempty-body", "-Wno-switch", "-Wno-parentheses", "-Wpointer-arith", "-Wredundant-decls", "-Wno-pointer-sign", "-Werror=implicit-function-declaration", @@ -30,7 +30,7 @@ def __add_gcc_flags__(ctx): def __add_clang_flags__(ctx): ctx.env.CFLAGS += ["-Wno-logical-op-parentheses", "-fcolor-diagnostics", - "-Wno-tautological-compare", + "-Wno-tautological-compare", "-Wempty-body", "-Wno-tautological-constant-out-of-range-compare" ] def __add_mingw_flags__(ctx): -- cgit v1.2.3