[Bug c/103996] Provide Better diagnostic for invalid reuse of a function name

egallager at gcc dot gnu.org gcc-bugzilla@gcc.gnu.org
Thu Jan 13 11:40:16 GMT 2022


https://gcc.gnu.org/bugzilla/show_bug.cgi?id=103996

Eric Gallager <egallager at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           See Also|                            |https://gcc.gnu.org/bugzill
                   |                            |a/show_bug.cgi?id=87656
                 CC|                            |egallager at gcc dot gnu.org

--- Comment #3 from Eric Gallager <egallager at gcc dot gnu.org> ---
So, -Wshadow actually used to warn about this, but people didn't like it, so
that part of -Wshadow got removed from GCC in 4.8:
https://gcc.gnu.org/gcc-4.8/changes.html

See also: https://lkml.org/lkml/2006/11/28/239

However, as of GCC 7, the -Wshadow flag now takes additional arguments
(-Wshadow=global, -Wshadow=local, -Wshadow=compatible-local) to let users be
more specific about which shadowing warnings they want:
https://gcc.gnu.org/gcc-7/changes.html 

So, I'm wondering if the part of -Wshadow that got removed in 4.8 could get
added back to it as a non-default argument to the flag? e.g. -Wshadow=function

And maybe the arguments to -Wshadow could become a comma-separated list, too,
so users could do things like -Wshadow=function,global or
-Wshadow=function,local or something (in bug 87656 I was thinking that a
-Wshadow=compatible-global might make sense, too)


More information about the Gcc-bugs mailing list