From 64513c9252bdfbf7fd34a83eb45cae21262f5220 Mon Sep 17 00:00:00 2001 From: Chia-I Wu Date: Fri, 11 Mar 2016 11:05:42 +0800 Subject: [PATCH] Turn on -Wextra Add -Wextra and silence all warnings with -Wno-*. Among them, we probably want to fix -Wunused-variable -Wunused-but-set-variable -Wtype-limits at some point. --- CMakeLists.txt | 10 +++++++++- renderdoc/CMakeLists.txt | 5 +++++ 2 files changed, 14 insertions(+), 1 deletion(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index dbe1c92dc..b41f33aa8 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -25,10 +25,18 @@ if(CMAKE_COMPILER_IS_GNUCXX OR CMAKE_CXX_COMPILER_ID MATCHES "Clang") set(warning_flags -Wall + -Wextra -Werror - -Wno-unused + -Wno-unused-variable + -Wno-type-limits + -Wno-unused-parameter + -Wno-missing-field-initializers -Wno-unknown-pragmas -Wno-reorder) + if(CMAKE_COMPILER_IS_GNUCXX) + list(APPEND warning_flags -Wno-unused-but-set-variable) + endif() + string(REPLACE ";" " " warning_flags "${warning_flags}") set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${warning_flags}") endif() diff --git a/renderdoc/CMakeLists.txt b/renderdoc/CMakeLists.txt index 15f2d3b88..f8f5b6af8 100644 --- a/renderdoc/CMakeLists.txt +++ b/renderdoc/CMakeLists.txt @@ -134,6 +134,11 @@ if(UNIX) list(APPEND sources os/linux/linux_libentry.cpp) endif() +if(CMAKE_COMPILER_IS_GNUCXX OR CMAKE_CXX_COMPILER_ID MATCHES "Clang") + set_source_files_properties(3rdparty/tinyexr/tinyexr.cpp + PROPERTIES COMPILE_FLAGS "-Wno-extra -Wno-unused-function") +endif() + add_library(rdoc OBJECT ${sources}) target_compile_definitions(rdoc ${RDOC_DEFINITIONS}) target_include_directories(rdoc ${RDOC_INCLUDES})