cmake : re-enable GCC -Wshadow

ggml-ci
This commit is contained in:
Georgi Gerganov 2025-01-12 15:29:33 +02:00
parent 34889bf810
commit 439e68c1e5
No known key found for this signature in database
GPG key ID: 449E073F9DC10735
16 changed files with 73 additions and 65 deletions

View file

@ -15,9 +15,12 @@ function(llama_add_compile_flags)
list(APPEND CXX_FLAGS -Wmissing-declarations -Wmissing-noreturn)
# GCC -Wshadow is way too agressive
if (CMAKE_CXX_COMPILER_ID MATCHES "Clang")
if (CMAKE_CXX_COMPILER_ID MATCHES "GNU" OR CMAKE_CXX_COMPILER_ID MATCHES "Clang")
list(APPEND CXX_FLAGS -Wshadow)
if (CMAKE_CXX_COMPILER_ID MATCHES "Clang")
list(APPEND CXX_FLAGS -Wshadow -Wshadow-field-in-constructor)
endif()
endif()
list(APPEND WARNING_FLAGS -Wall -Wextra -Wpedantic -Wcast-qual -Wno-unused-function)