Skip to content

Commit

Permalink
Merge pull request #4059 from rouault/weffc++
Browse files Browse the repository at this point in the history
Enable -Weffc++ for gcc and clang
  • Loading branch information
rouault authored Feb 20, 2024
2 parents 81fecbc + 375a7c5 commit 498d409
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 2 deletions.
5 changes: 4 additions & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,9 @@ if("${CMAKE_C_COMPILER_ID}" STREQUAL "GNU")
set(PROJ_C_WARN_FLAGS ${PROJ_common_WARN_FLAGS}
-Wmissing-prototypes
)
set(PROJ_CXX_WARN_FLAGS ${PROJ_common_WARN_FLAGS})
set(PROJ_CXX_WARN_FLAGS ${PROJ_common_WARN_FLAGS}
-Weffc++
)
elseif("${CMAKE_C_COMPILER_ID}" MATCHES "Clang")
set(PROJ_C_WARN_FLAGS ${PROJ_common_WARN_FLAGS}
-Wmissing-prototypes
Expand All @@ -65,6 +67,7 @@ elseif("${CMAKE_C_COMPILER_ID}" MATCHES "Clang")
)
set(PROJ_CXX_WARN_FLAGS ${PROJ_common_WARN_FLAGS}
-Wfloat-conversion
-Weffc++
)
elseif("${CMAKE_C_COMPILER_ID}" STREQUAL "MSVC")
add_definitions(/D_CRT_SECURE_NO_WARNINGS) # Eliminate deprecation warnings
Expand Down
3 changes: 2 additions & 1 deletion test/unit/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,8 @@ include_directories(${PROJ_SOURCE_DIR}/include)
include_directories(${PROJ_BINARY_DIR}/src)

# Apply to targets in the current directory and below
add_compile_options(${PROJ_CXX_WARN_FLAGS})
add_compile_options("$<$<COMPILE_LANGUAGE:C>:${PROJ_C_WARN_FLAGS}>")
add_compile_options("$<$<COMPILE_LANGUAGE:CXX>:${PROJ_CXX_WARN_FLAGS}>")

set(PROJ_TEST_ENVIRONMENT
"PROJ_SKIP_READ_USER_WRITABLE_DIRECTORY=YES"
Expand Down

0 comments on commit 498d409

Please sign in to comment.