Skip to content

Commit

Permalink
🆕 Enable -Wshadow in pedantic mode
Browse files Browse the repository at this point in the history
Problem:
- All `-Wshadow` warnings are fixed but there is nothing stopping them
  from being reintroduced.

Solution:
- Fail pedantic builds on `-Wshadow` warnings. This allows CI to prevent
  reoccurrence of the warning.
  • Loading branch information
jgopel committed Oct 28, 2020
1 parent 5797c93 commit 609c5fb
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,8 @@ if (CMAKE_CXX_COMPILER_ID MATCHES "GNU")
-Wctor-dtor-privacy -Wdisabled-optimization
-Winvalid-pch -Woverloaded-virtual
-Wconversion -Wswitch-enum -Wundef
-Wno-ctor-dtor-privacy -Wno-format-nonliteral)
-Wno-ctor-dtor-privacy -Wno-format-nonliteral
-Wshadow)
if (NOT CMAKE_CXX_COMPILER_VERSION VERSION_LESS 4.6)
set(PEDANTIC_COMPILE_FLAGS ${PEDANTIC_COMPILE_FLAGS} -Wnoexcept
-Wno-dangling-else -Wno-unused-local-typedefs)
Expand All @@ -130,7 +131,7 @@ endif ()

if (CMAKE_CXX_COMPILER_ID MATCHES "Clang")
set(PEDANTIC_COMPILE_FLAGS -Wall -Wextra -pedantic -Wconversion -Wundef
-Wdeprecated -Wweak-vtables)
-Wdeprecated -Wweak-vtables -Wshadow)
check_cxx_compiler_flag(-Wzero-as-null-pointer-constant HAS_NULLPTR_WARNING)
if (HAS_NULLPTR_WARNING)
set(PEDANTIC_COMPILE_FLAGS ${PEDANTIC_COMPILE_FLAGS}
Expand Down

0 comments on commit 609c5fb

Please sign in to comment.