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
This commit is contained in:
Jacques Lucke
2025-03-24 09:29:21 +01:00
parent 2a9ebda328
commit 06ddccac05

View File

@@ -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 */