diff options
author | Stefano Pigozzi <stefano.pigozzi@gmail.com> | 2014-04-26 23:44:15 +0200 |
---|---|---|
committer | Stefano Pigozzi <stefano.pigozzi@gmail.com> | 2014-04-26 23:53:09 +0200 |
commit | ae0c8ca219184bce33ec713b43868b6f5b22f055 (patch) | |
tree | 4dfb09df561ac7e599eaeffeaebe294dbb84a2e5 /waftools | |
parent | cdafc2f7d7537de02e25b8c86b9930b6762c6d91 (diff) | |
download | mpv-ae0c8ca219184bce33ec713b43868b6f5b22f055.tar.bz2 mpv-ae0c8ca219184bce33ec713b43868b6f5b22f055.tar.xz |
build: conditionally use -Wempty-body
-Wempty-body is not available on all gcc versions but we were using it
unconditionally. Also remove the usage from the clang case. clang still
defines `__GNUC__` so it still gets all the gcc specific flags.
This should fix the build on systems with older gcc versions like OpenBSD which
still comes bundled with gcc 4.2 for license issues.
Diffstat (limited to 'waftools')
-rw-r--r-- | waftools/detections/compiler.py | 10 |
1 files changed, 8 insertions, 2 deletions
diff --git a/waftools/detections/compiler.py b/waftools/detections/compiler.py index 1d854bf0ad..670a7b7fbc 100644 --- a/waftools/detections/compiler.py +++ b/waftools/detections/compiler.py @@ -11,6 +11,11 @@ def __get_cc_env_vars__(cc): except Exception: return "" +def __test_and_add_flags__(ctx, flags): + for flag in flags: + ctx.check_cc(cflags=flag, uselib_store="compiler", mandatory=False) + ctx.env.CFLAGS += ctx.env.CFLAGS_compiler + def __add_generic_flags__(ctx): ctx.env.CFLAGS += ["-D_ISOC99_SOURCE", "-D_GNU_SOURCE", "-D_LARGEFILE_SOURCE", "-D_FILE_OFFSET_BITS=64", @@ -21,16 +26,17 @@ def __add_generic_flags__(ctx): ctx.env.CFLAGS += ['-g'] def __add_gcc_flags__(ctx): - ctx.env.CFLAGS += ["-Wundef", "-Wmissing-prototypes", "-Wempty-body", + ctx.env.CFLAGS += ["-Wundef", "-Wmissing-prototypes", "-Wno-switch", "-Wno-parentheses", "-Wpointer-arith", "-Wredundant-decls", "-Wno-pointer-sign", "-Werror=implicit-function-declaration", "-Wno-error=deprecated-declarations", "-Wno-error=unused-function" ] + __test_and_add_flags__(ctx, ["-Wempty-body"]) def __add_clang_flags__(ctx): ctx.env.CFLAGS += ["-Wno-logical-op-parentheses", "-fcolor-diagnostics", - "-Wno-tautological-compare", "-Wempty-body", + "-Wno-tautological-compare", "-Wno-tautological-constant-out-of-range-compare" ] def __add_mingw_flags__(ctx): |