From 02c6a1bf7ec18701a0f1a44bec20fc383b8f3565 Mon Sep 17 00:00:00 2001 From: Pierre Ossman Date: Sat, 20 Apr 2024 10:53:18 +0200 Subject: [PATCH] Enforce not shadowing variables Shadowing variable can easily lead to bugs, so let's enforce that this is not allowed. --- CMakeLists.txt | 1 + 1 file changed, 1 insertion(+) diff --git a/CMakeLists.txt b/CMakeLists.txt index 526c7f135f..1950e469b6 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -79,6 +79,7 @@ set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wall -Wextra -Wformat=2 -Wvla") set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall -Wextra -Wformat=2 -Wvla") set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wzero-as-null-pointer-constant") set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wsuggest-override") +set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wshadow") # Make sure we catch these issues whilst developing IF(CMAKE_BUILD_TYPE MATCHES Debug) set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Werror")