octave-maintainers
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Many repeated shadow warnings during build


From: Mike Miller
Subject: Re: Many repeated shadow warnings during build
Date: Wed, 13 Jul 2016 14:00:30 -0700
User-agent: Mutt/1.6.0 (2016-04-01)

On Wed, Jul 13, 2016 at 09:53:29 -0700, PhilipNienhuis wrote:
> During building dev Octave (67a5341edf15 tip  mkstemp: ensure file is opened
> in binary mode on Windows (bug #48326), about every module compile emits
> errors along the lines of:
> 
> :
> ./dev/liboctave/cruft/misc/quit.h:109:5: warning: declaration of
> 'exit_status' shadows a member of 'this' [-Wshadow]
> In file included from ../dev/liboctave/util/lo-utils.h:33:0,
>                  from ../dev/liboctave/array/Array.h:40,
>                  from ../dev/liboctave/array/Array-util.h:28,
>                  from liboctave/operators/mx-ui64-ui16nda.cc:5:
> ../dev/liboctave/cruft/misc/quit.h: In constructor
> 'octave_exit_exception::octave_exit_exception(int, bool)':
> ../dev/liboctave/cruft/misc/quit.h:109:5: warning: declaration of
> 'safe_to_return' shadows a member of 'this' [-Wshadow]
>      : m_exit_status (exit_status), m_safe_to_return (safe_to_return)
>      ^
> :
> 
> Anyone else seeing this?

Apparently anyone with gcc 4.9 or older will see this warning.

The gcc devs have decided that a local variable shadowing a method name
is a "false positive" and no longer worth warning about, so -Wshadow
will not emit warnings for these conditions in modern versions of gcc
(and clang, which is where the idea to allow this came from).

See Lachlan's patch to clean up some -Wshadow warnings here:

  https://savannah.gnu.org/bugs/?48493

I'm not sure if it touches on the "exit_status" and "safe_to_return"
variables that are mentioned here. But this specific instance does not
trigger a warning with gcc 5+.

I have no objection to fixing these, just be aware that there is no way
for users of modern compilers to check these types of name clashes now
since gcc has decided they are not worth warning about.

-- 
mike



reply via email to

[Prev in Thread] Current Thread [Next in Thread]