Skip to content

Commit

Permalink
Changed exception mismatch warning to error (clang only)
Browse files Browse the repository at this point in the history
Signed-off-by: Jared Duffey <[email protected]>
  • Loading branch information
JDuffeyBQ committed Apr 23, 2024
1 parent 9f0dff1 commit 61c30a8
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions cmake/Utility.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -73,12 +73,19 @@ function(simplnx_enable_warnings)
set(SHADOW_WARNING "shadow-all")
endif()

if("${CMAKE_CXX_COMPILER_ID}" MATCHES "Clang")
set(CLANG_WARNINGS
-Werror=implicit-exception-spec-mismatch # Wimplicit-exception-spec-mismatch: function previously declared with an explicit/implicit exception specification redeclared with an implicit/explicit exception specification
)
endif()

target_compile_options(${ARG_TARGET}
PRIVATE
# Warning to error
-Werror=parentheses # Wparentheses: Warn if parentheses are omitted in certain contexts, such as when there is an assignment in a context where a truth value is expected, or when operators are nested whose precedence people often get confused about
-Werror=return-type # Wreturn-type: Warn about any "return" statement with no return value in a function whose return type is not "void"
-Werror=${SHADOW_WARNING} # Wshadow: Warn whenever a local variable or type declaration shadows another variable, parameter, type, class member (in C++), or instance variable (in Objective-C) or whenever a built-in function is shadowed.
${CLANG_WARNINGS}
)

endif()
Expand Down

0 comments on commit 61c30a8

Please sign in to comment.