mirror of
https://github.com/fmtlib/fmt.git
synced 2025-02-20 18:40:44 +00:00
🆕 Enable -Wshadow in pedantic mode
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. Notes: - Not enabling `-Wshadow` for gcc versions 4 or lower because the warning is much more aggressive there to the point that it's mostly just noise.
This commit is contained in:
parent
e904e891bd
commit
eb52ac7a35
@ -119,7 +119,7 @@ if (CMAKE_CXX_COMPILER_ID MATCHES "GNU")
|
|||||||
if (NOT CMAKE_CXX_COMPILER_VERSION VERSION_LESS 5.0)
|
if (NOT CMAKE_CXX_COMPILER_VERSION VERSION_LESS 5.0)
|
||||||
set(PEDANTIC_COMPILE_FLAGS ${PEDANTIC_COMPILE_FLAGS} -Wdouble-promotion
|
set(PEDANTIC_COMPILE_FLAGS ${PEDANTIC_COMPILE_FLAGS} -Wdouble-promotion
|
||||||
-Wtrampolines -Wzero-as-null-pointer-constant -Wuseless-cast
|
-Wtrampolines -Wzero-as-null-pointer-constant -Wuseless-cast
|
||||||
-Wvector-operation-performance -Wsized-deallocation)
|
-Wvector-operation-performance -Wsized-deallocation -Wshadow)
|
||||||
endif ()
|
endif ()
|
||||||
if (NOT CMAKE_CXX_COMPILER_VERSION VERSION_LESS 6.0)
|
if (NOT CMAKE_CXX_COMPILER_VERSION VERSION_LESS 6.0)
|
||||||
set(PEDANTIC_COMPILE_FLAGS ${PEDANTIC_COMPILE_FLAGS} -Wshift-overflow=2
|
set(PEDANTIC_COMPILE_FLAGS ${PEDANTIC_COMPILE_FLAGS} -Wshift-overflow=2
|
||||||
@ -130,7 +130,7 @@ endif ()
|
|||||||
|
|
||||||
if (CMAKE_CXX_COMPILER_ID MATCHES "Clang")
|
if (CMAKE_CXX_COMPILER_ID MATCHES "Clang")
|
||||||
set(PEDANTIC_COMPILE_FLAGS -Wall -Wextra -pedantic -Wconversion -Wundef
|
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)
|
check_cxx_compiler_flag(-Wzero-as-null-pointer-constant HAS_NULLPTR_WARNING)
|
||||||
if (HAS_NULLPTR_WARNING)
|
if (HAS_NULLPTR_WARNING)
|
||||||
set(PEDANTIC_COMPILE_FLAGS ${PEDANTIC_COMPILE_FLAGS}
|
set(PEDANTIC_COMPILE_FLAGS ${PEDANTIC_COMPILE_FLAGS}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user