Skip to content

Commit

Permalink
Make strict compilation under scons behave like cmake
Browse files Browse the repository at this point in the history
This adds -Wold-style-cast to the CCFLAGS when compiling everything
but lua. Lua requires an exception from the flags and there's thus a
workaround added.
  • Loading branch information
aginor committed Jun 1, 2016
1 parent dc9db2e commit d350d91
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 2 deletions.
2 changes: 1 addition & 1 deletion SConstruct
Expand Up @@ -511,7 +511,7 @@ for env in [test_env, campaignd_env, client_env, env]:
env.AppendUnique(CXXFLAGS = ["-fopenmp"], LIBS = ["gomp"])

if env['strict']:
env.AppendUnique(CCFLAGS = Split("-Werror $(-Wno-unused-local-typedefs$)"))
env.AppendUnique(CCFLAGS = Split("-Werror -Wold-style-cast $(-Wno-unused-local-typedefs$)"))

env["OPT_FLAGS"] = "-O2"
env["DEBUG_FLAGS"] = Split("-O0 -DDEBUG -ggdb3")
Expand Down
6 changes: 5 additions & 1 deletion src/lua/SConscript
Expand Up @@ -37,8 +37,12 @@ linit.cpp
""")
liblua = env.Library("lua", lua_sources,
# Silence some Clang-specific warnings due to extra parentheses in if statements when comparing.
CCFLAGS = ["$CCFLAGS", "clang" in env["CXX"] and Split("-Wno-parentheses-equality -Wno-pointer-bool-conversion") or []],
CCFLAGS = ["$CCFLAGS", "clang" in env["CXX"] and Split("-Wno-parentheses-equality -Wno-pointer-bool-conversion") or [], "strict" in env and Split("-Wno-old-style-cast -Wno-useless-cast") or []],
CCCOM = env["CXXCOM"],
CPPPATH = ["$CPPPATH", Dir(".").srcnode()],
CPPDEFINES = ["$CPPDEFINES", env["PLATFORM"] != "win32" and "LUA_USE_POSIX" or []])

#if env['strict']:
# env.AppendUnique(CCFLAGS = Split("-Wno-old-style-cast -Wno-useless-cast"))

Return("liblua")

0 comments on commit d350d91

Please sign in to comment.