From 480f7807b9782eff98ce14b7342d350e2c1ee67f Mon Sep 17 00:00:00 2001 From: Roman Tsisyk <roman@tsisyk.com> Date: Sat, 23 Jan 2016 22:12:25 +0300 Subject: [PATCH] Fix warnings and errors on GCC 5.3.1 --- cmake/BuildLibEIO.cmake | 19 ++++++++++++++++--- cmake/BuildLibYAML.cmake | 5 +++++ cmake/compiler.cmake | 3 +++ extra/bin2c.c | 1 - third_party/lua-cjson/lua_cjson.c | 5 +---- 5 files changed, 25 insertions(+), 8 deletions(-) diff --git a/cmake/BuildLibEIO.cmake b/cmake/BuildLibEIO.cmake index 48e7582e5a..64d401b29c 100644 --- a/cmake/BuildLibEIO.cmake +++ b/cmake/BuildLibEIO.cmake @@ -3,9 +3,22 @@ macro(libeio_build) set(eio_compile_flags) - set(eio_compile_flags "${eio_compile_flags} -Wno-unused-result") - set(eio_compile_flags "${eio_compile_flags} -Wno-dangling-else") - set(eio_compile_flags "${eio_compile_flags} -Wno-unused-value") + set(eio_compile_flags "${eio_compile_flags} -Wno-unused") + if (CC_HAS_WNO_DANGLING_ELSE) + set(eio_compile_flags "${eio_compile_flags} -Wno-dangling-else") + endif() + if (CC_HAS_WNO_PARENTHESES) + set(eio_compile_flags "${eio_compile_flags} -Wno-parentheses") + endif() + if (CC_HAS_WNO_UNUSED_FUNCTION) + set(eio_compile_flags "${eio_compile_flags} -Wno-unused-function") + endif() + if (CC_HAS_WNO_UNUSED_VALUE) + set(eio_compile_flags "${eio_compile_flags} -Wno-unused-value") + endif() + if (CC_HAS_WNO_UNUSED_RESULT) + set(eio_compile_flags "${eio_compile_flags} -Wno-unused-result") + endif() set(eio_compile_flags "${eio_compile_flags} -DENABLE_BUNDLED_LIBEIO=1") set(eio_compile_flags "${eio_compile_flags} -DEIO_STACKSIZE=0") if (TARGET_OS_LINUX) diff --git a/cmake/BuildLibYAML.cmake b/cmake/BuildLibYAML.cmake index b6d6685d89..74ecc4c77c 100644 --- a/cmake/BuildLibYAML.cmake +++ b/cmake/BuildLibYAML.cmake @@ -11,6 +11,11 @@ macro(libyaml_build) ${PROJECT_SOURCE_DIR}/third_party/libyaml/writer.c) add_library(yaml STATIC ${yaml_src}) + set(yaml_compile_flags -Wno-unused) + if (CC_HAS_WNO_PARENTHESES_EQUALITY) + set(yaml_compile_flags "${yaml_compile_flags} -Wno-parentheses-equality") + endif() + set_target_properties(yaml PROPERTIES COMPILE_FLAGS "${yaml_compile_flags}") set(LIBYAML_INCLUDE_DIR ${PROJECT_SOURCE_DIR}/third_party/libyaml) set(LIBYAML_LIBRARIES yaml) diff --git a/cmake/compiler.cmake b/cmake/compiler.cmake index 17d5d7785c..487fe3e1ac 100644 --- a/cmake/compiler.cmake +++ b/cmake/compiler.cmake @@ -202,10 +202,13 @@ endif() check_c_compiler_flag("-Wno-unused-const-variable" CC_HAS_WNO_UNUSED_CONST_VARIABLE) check_c_compiler_flag("-Wno-unused-result" CC_HAS_WNO_UNUSED_RESULT) check_c_compiler_flag("-Wno-unused-value" CC_HAS_WNO_UNUSED_VALUE) +check_c_compiler_flag("-Wno-unused-function" CC_HAS_WNO_UNUSED_FUNCTION) check_c_compiler_flag("-fno-strict-aliasing" CC_HAS_FNO_STRICT_ALIASING) check_c_compiler_flag("-Wno-comment" CC_HAS_WNO_COMMENT) check_c_compiler_flag("-Wno-parentheses" CC_HAS_WNO_PARENTHESES) +check_c_compiler_flag("-Wno-parentheses-equality" CC_HAS_WNO_PARENTHESES_EQUALITY) check_c_compiler_flag("-Wno-undefined-inline" CC_HAS_WNO_UNDEFINED_INLINE) +check_c_compiler_flag("-Wno-dangling-else" CC_HAS_WNO_DANGLING_ELSE) if (CMAKE_COMPILER_IS_CLANG OR CMAKE_COMPILER_IS_GNUCC) set(HAVE_BUILTIN_CTZ 1) diff --git a/extra/bin2c.c b/extra/bin2c.c index 9776d55224..2722a9eea2 100644 --- a/extra/bin2c.c +++ b/extra/bin2c.c @@ -14,7 +14,6 @@ int main(int argc, char** argv) { const char *prefix = ""; const char *suffix = "\n"; - int no_quote = 0; /* if 1, do not prepend and append quotation marks (") */ FILE *in = stdin; FILE *out = stdout; diff --git a/third_party/lua-cjson/lua_cjson.c b/third_party/lua-cjson/lua_cjson.c index e0df6ad576..47038dde94 100644 --- a/third_party/lua-cjson/lua_cjson.c +++ b/third_party/lua-cjson/lua_cjson.c @@ -330,7 +330,7 @@ static void json_append_number(struct luaL_serializer *cfg, strbuf_t *json, static void json_append_object(lua_State *l, struct luaL_serializer *cfg, int current_depth, strbuf_t *json) { - int comma, keytype; + int comma; /* Object */ strbuf_append_char(json, '{'); @@ -344,8 +344,6 @@ static void json_append_object(lua_State *l, struct luaL_serializer *cfg, else comma = 1; - /* table, key, value */ - keytype = lua_type(l, -2); struct luaL_field field; luaL_checkfield(l, cfg, -2, &field); if (field.type == MP_UINT) { @@ -420,7 +418,6 @@ static void json_append_data(lua_State *l, struct luaL_serializer *cfg, static int json_encode(lua_State *l) { struct luaL_serializer *cfg = luaL_checkserializer(l); - strbuf_t local_encode_buf; char *json; int len; -- GitLab