From f5774f0443f71a623f84f8f8fb688cf01a3360f6 Mon Sep 17 00:00:00 2001 From: Matt Morley Date: Wed, 8 Jan 2025 21:54:44 -0700 Subject: [PATCH] Enable extra warnings --- cmake/GtsamBuildTypes.cmake | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/cmake/GtsamBuildTypes.cmake b/cmake/GtsamBuildTypes.cmake index 12d4b3a39..55ddf61bc 100644 --- a/cmake/GtsamBuildTypes.cmake +++ b/cmake/GtsamBuildTypes.cmake @@ -111,7 +111,7 @@ if(MSVC) set(CMAKE_3_15 $) set(CMAKE_3_25 $) # Common to all configurations, next for each configuration: - set(GTSAM_COMPILE_OPTIONS_PRIVATE_COMMON /W3 /GR /EHsc /MP CACHE STRING "(User editable) Private compiler flags for all configurations.") + set(GTSAM_COMPILE_OPTIONS_PRIVATE_COMMON /W3 /WX /GR /EHsc /MP CACHE STRING "(User editable) Private compiler flags for all configurations.") set(GTSAM_COMPILE_OPTIONS_PRIVATE_DEBUG $<${CMAKE_3_15}:/MDd> $<${CMAKE_3_25}:/Zi> /Ob0 /Od /RTC1 CACHE STRING "(User editable) Private compiler flags for Debug configuration.") set(GTSAM_COMPILE_OPTIONS_PRIVATE_RELWITHDEBINFO $<${CMAKE_3_15}:/MD> /O2 $<${CMAKE_3_25}:/Zi> CACHE STRING "(User editable) Private compiler flags for RelWithDebInfo configuration.") set(GTSAM_COMPILE_OPTIONS_PRIVATE_RELEASE $<${CMAKE_3_15}:/MD> /O2 CACHE STRING "(User editable) Private compiler flags for Release configuration.") @@ -131,12 +131,15 @@ else() endif() set(GTSAM_COMPILE_OPTIONS_PRIVATE_COMMON + -Werror # Enable warnings as errors -Wall # Enable common warnings - $<$:-Wreturn-local-addr -Werror=return-local-addr> # Error: return local address - $<$:-Wreturn-stack-address -Werror=return-stack-address> # Error: return local address - $<$:-Wno-weak-template-vtables> # TODO(dellaert): don't know how to resolve + -Wpedantic # Enable pedantic warnings + $<$:-Wextra -Wno-unused-parameter> # Enable extra warnings, but ignore no-unused-parameter (as we ifdef out chunks of code) + $<$:-Wreturn-local-addr> # Error: return local address + $<$:-Wreturn-stack-address> # Error: return local address + $<$:-Wno-weak-template-vtables> # TODO(dellaert): don't know how to resolve $<$:-Wno-weak-vtables> # TODO(dellaert): don't know how to resolve - -Wreturn-type -Werror=return-type # Error on missing return() + -Wreturn-type # Error on missing return() -Wformat -Werror=format-security # Error on wrong printf() arguments $<$:${flag_override_}> # Enforce the use of the override keyword #