1
0
mirror of https://github.com/mpv-player/mpv synced 2024-12-24 15:52:25 +00:00

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.
This commit is contained in:
Stefano Pigozzi 2014-04-26 23:44:15 +02:00
parent cdafc2f7d7
commit ae0c8ca219

View File

@ -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):