From b13490f43afcd1784bf3d48430e63dd748d425ed Mon Sep 17 00:00:00 2001 From: Karl Schultz Date: Sat, 23 Dec 2017 09:16:40 -0700 Subject: build: Address clang compilation warnings --- layers/CMakeLists.txt | 8 ++++++++ loader/CMakeLists.txt | 6 ++++++ 2 files changed, 14 insertions(+) diff --git a/layers/CMakeLists.txt b/layers/CMakeLists.txt index 80fa6f23..bf800e89 100644 --- a/layers/CMakeLists.txt +++ b/layers/CMakeLists.txt @@ -188,6 +188,14 @@ else() set (CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wpointer-arith -Wno-unused-function -Wno-sign-compare") endif() +# Clang (and not gcc) warns about unused const variables. +# Generated files may purposely contain unused consts, so +# silence this warning in Clang. +if (CMAKE_C_COMPILER_ID MATCHES "Clang") + set_source_files_properties(parameter_validation.cpp PROPERTIES + COMPILE_FLAGS "-Wno-unused-const-variable") +endif() + run_vk_xml_generate(threading_generator.py thread_check.h) run_vk_xml_generate(parameter_validation_generator.py parameter_validation.cpp) run_vk_xml_generate(unique_objects_generator.py unique_objects_wrappers.h) diff --git a/loader/CMakeLists.txt b/loader/CMakeLists.txt index 9c8173fa..a2a70eba 100644 --- a/loader/CMakeLists.txt +++ b/loader/CMakeLists.txt @@ -188,6 +188,12 @@ if (WIN32) else() set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wpointer-arith") + # Clang (and not gcc) warns about redefining a typedef with the same types, so disable that warning. + # Note that it will still throw an error if a typedef is redefined with a different type. + if (CMAKE_C_COMPILER_ID MATCHES "Clang") + set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wno-typedef-redefinition") + endif() + add_library(${API_LOWERCASE} SHARED ${NORMAL_LOADER_SRCS} ${OPT_LOADER_SRCS}) add_dependencies(${API_LOWERCASE} generate_helper_files loader_gen_files loader_asm_gen_files) set_target_properties(${API_LOWERCASE} PROPERTIES SOVERSION "1" VERSION "1.0.${vk_header_version}") -- cgit v1.2.3