From: Andrey Smirnov <andrew.smirnov@gmail.com>
To: Mark Kettenis <mark.kettenis@xs4all.nl>
Cc: gdb-patches <gdb-patches@sourceware.org>
Subject: Re: [PATCH 18/348] Fix -Wsahdow warnings
Date: Thu, 24 Nov 2011 04:16:00 -0000 [thread overview]
Message-ID: <CAHQ1cqHjSYQL75PS8xqEASXXnh5jzMGH+JX7ti_9SKZ+5UOtKA@mail.gmail.com> (raw)
In-Reply-To: <201111232023.pANKNcLf022983@glazunov.sibelius.xs4all.nl>
On Thu, Nov 24, 2011 at 3:23 AM, Mark Kettenis <mark.kettenis@xs4all.nl> wrote:
>> From: Pedro Alves <pedro@codesourcery.com>
>> Date: Wed, 23 Nov 2011 18:20:40 +0000
>>
>> On Wednesday 23 November 2011 16:40:41, Ulrich Weigand wrote:
>> > Mark Kettenis wrote:
>> >
>> > > > From: Andrey Smirnov <andrew.smirnov@gmail.com>
>> > > > Date: Tue, 22 Nov 2011 17:25:56 +0700
>> > > > Subject: [PATCH 18/39] Fix -Wshadow warnings.
>> > > >
>> > > > * amd64-linux-tdep.c (amd64_canonicalize_syscall): Fix -Wshadow
>> > > > warnings.
>> > >
>> > > Why the hell does -Wshadow complain here?
>> >
>> > > > -amd64_canonicalize_syscall (enum amd64_syscall syscall)
>> > > > +amd64_canonicalize_syscall (enum amd64_syscall syscall_number)
>> >
>> > I'd expect this is because the parameter "syscall" shadows the global
>> > function declaration "syscall" provided by glibc headers:
>> >
>> > /usr/include/unistd.h:extern long int syscall (long int __sysno, ...) __THROW;
>>
>> Yeah, this is unfortunate because it means you trigger different
>> shadows on different hosts, or by configuring gdb differently.
>
> Indeed. And I'd say this means we can't add -Wshadow to the set of
> default flags for compiling gdb.
IMHO,
not setting the -Wshadow variable to the default set would only be
inviting for such warnings to accumulate and grow into snowball of
little instances where aforementioned rule has been violated, that
would require yet another 300+ patches to clean it up. Doing so would
be plugging the wholes instead of fixing the problem.
I'll admit you annoyed me real good when you started kicking all my
toys and called them stupid, and I apologize if my behavior is
childish, but now I see your argument as this:
"We can't have all the pretty names on for our variables on all the
platforms because of the -Wshadow, let's not use -Wshadow", maybe I'll
cool down and see the merit of your argument. Now I don't.
>> There was this gcc patch
>>
>> http://comments.gmane.org/gmane.comp.gcc.patches/244771
>>
>> to stop -Wshadow from complaning about shadowing of symbols in system
>> headers, but it doesn't seem to have been applied, though it was okayed.
>
> I'd argue that -Wshadow should never warn about a local variable
> shadowing a function. There'sno chance such shadowing is
> unintentional.
"There'sno chance such shadowing is unintentional." is either an
assumed conclusion or an argument from incredulity both of which are
logical fallacies, but even if the shadowing is always intentional I
still fail to see your point. You are trying to use the name that has
already been taken, since both the names of the functions and
variables reside in the same namespace it is an name clash. There is,
to the best of my knowledge, no means in the C language to help
compiler to resolve this ambiguity and when you ask compiler to slap
you for any naming ambiguities with -Wshadow you get what you asked
for. Why shouldn't it be so?
> It seems a lot of the changes posted up until now are dealing with
> that type of "conflict". I'd really like to see those dropped from
> this set.
>
It is not a "conflict". It is a conflict. Dropping such changes would
make it impossible to test wither the whole goal of the patch-set,
that is building with -Wshadow enabled, has been achieved.
Andrey Smirnov
next prev parent reply other threads:[~2011-11-24 4:16 UTC|newest]
Thread overview: 27+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-11-22 13:01 Andrey Smirnov
2011-11-22 18:03 ` Tom Tromey
2011-11-23 16:36 ` Mark Kettenis
2011-11-23 16:41 ` Ulrich Weigand
2011-11-23 18:21 ` Pedro Alves
2011-11-23 18:42 ` Joel Brobecker
2011-11-23 20:24 ` Mark Kettenis
2011-11-24 4:16 ` Andrey Smirnov [this message]
2011-11-24 11:36 ` Eli Zaretskii
2011-11-24 22:01 ` Joel Brobecker
2011-11-25 0:48 ` Andrey Smirnov
2011-11-25 14:26 ` Joel Brobecker
2011-11-25 15:52 ` About adding -Wshadow option by default (was Re: [PATCH 18/348] Fix -Wsahdow warnings) Pierre Muller
2011-11-25 16:36 ` Mark Kettenis
2011-11-29 19:18 ` [PATCH 18/348] Fix -Wsahdow warnings Tom Tromey
2011-11-30 3:48 ` Andrey Smirnov
2011-11-30 14:59 ` Tom Tromey
2011-12-01 4:15 ` Andrey Smirnov
2011-12-02 17:08 ` Tom Tromey
2011-11-25 12:03 ` Eli Zaretskii
2011-11-25 15:11 ` Mark Kettenis
2011-11-25 15:41 ` Eli Zaretskii
2011-11-25 16:26 ` Mark Kettenis
2011-11-25 18:20 ` Eli Zaretskii
2011-11-27 13:53 ` Mark Kettenis
2011-11-27 14:55 ` Pedro Alves
2011-11-27 16:35 ` Eli Zaretskii
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=CAHQ1cqHjSYQL75PS8xqEASXXnh5jzMGH+JX7ti_9SKZ+5UOtKA@mail.gmail.com \
--to=andrew.smirnov@gmail.com \
--cc=gdb-patches@sourceware.org \
--cc=mark.kettenis@xs4all.nl \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox