From 06ddccac056b8fbb6192486b5cbddabef64c5a52 Mon Sep 17 00:00:00 2001 From: Jacques Lucke Date: Mon, 24 Mar 2025 09:29:21 +0100 Subject: [PATCH] BLI: change strict flag from -Wshadow to -Wshadow=local Previously, including `BLI_strict_flags.h` caused compile errors for all shadowed values. Generally, this is fine, but sometimes it may catch more cases than desirable. For example, adding `int U;` in `init_data` in `MOD_correctivesmooth.cc` causes an error because there is the global `U` symbol (user prefs). While not an issue right now, this can cause unexpected compile errors when adding additional includes. I ran into this while working on a tool that adds additional includes automatically as part of its operation. Fortunately, GCC supports a slightly weaker variant of this error: `-Wshadow=local`. This only covers the case we mainly care about where local variables are shadowed by other local variables. Pull Request: https://projects.blender.org/blender/blender/pulls/136389 --- source/blender/blenlib/BLI_strict_flags.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/source/blender/blenlib/BLI_strict_flags.h b/source/blender/blenlib/BLI_strict_flags.h index 112156c2bc3..7320f0e3f34 100644 --- a/source/blender/blenlib/BLI_strict_flags.h +++ b/source/blender/blenlib/BLI_strict_flags.h @@ -20,7 +20,7 @@ # if !defined(__clang__) # pragma GCC diagnostic error "-Wsign-compare" # pragma GCC diagnostic error "-Wconversion" -# pragma GCC diagnostic error "-Wshadow" +# pragma GCC diagnostic error "-Wshadow=local" # pragma GCC diagnostic error "-Wsign-conversion" # endif /* pedantic gives too many issues, developers can define this for own use */