Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
From: Pedro Alves <palves@redhat.com>
To: Yao Qi <qiyaoltc@gmail.com>
Cc: gdb-patches@sourceware.org
Subject: Re: [PATCH OBV] Add nowarnings in gdb.base/fileio.exp
Date: Thu, 18 May 2017 11:51:00 -0000	[thread overview]
Message-ID: <46e0931c-1c64-eaa4-3811-f6c30af545d2@redhat.com> (raw)
In-Reply-To: <8637c28krq.fsf@gmail.com>

On 05/18/2017 12:30 PM, Yao Qi wrote:
> Pedro Alves <palves@redhat.com> writes:
> 
>> I don't think so.  I think that'd be the equivalent of saying that we
>> don't support debugging target code built with gcc versions earlier
>> than 4.6.  That's a totally different discussion from the discussion
>> about requirements for building gdb.
> 
> That is what I meant by "require gcc 4.6 to run testsuite".  If we use
> such diagnostic in tests, we need gcc 4.6 or later to compile gdb test
> cases.

Right, and I was replying to your "I am OK with this requirement."
by explaining why I don't think it's an OK requirement.

I knew that "#pragma GCC diagnostics ignored -Wwhatever" ignores
unknown warnings, and I thought that older GCCs just ignored
unknown #pragmas, but that's not actually true -- I tried it with
gcc 3, and "-Wall" makes it warn about unrecognized pragmas.

So I got confused for a while when you said the "diagnostic" was added
in gcc 4.6.  The warning (the diagnostic) is much older than gcc 4.6.
What I think was added in gcc 4.6 was "#pragma GCC diagnostic push/pop".
This means that we wrap the "#pragma GCC diagnostic ignore" under
a gcc 4.6 check, we'd still get a warning with older compilers.
Only with -Wall though, so maybe it was still OK.

BTW, what compiler are you testing with that enables -Wnonnull by default?

>> How about an even simpler fix: pass a global pointer variable that
>> happens to be NULL to stat, instead of a NULL literal.  The compiler can't
>> prove (without LTO) that the variable may still be NULL, so it doesn't
>> warn.  Works on all compilers I tried it on: gcc 3.4/5.3/7, clang 3.7.
>>
>> Let me send a mini series in reply to this email, which does that,
>> and also fixes a few other warnings that compiling the fileio.c with
>> -Wall exposes.
> 
> These three patches are good to me.

I'll push them in in a bit.

Thanks,
Pedro Alves


      reply	other threads:[~2017-05-18 11:51 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-05-17 13:46 Yao Qi
2017-05-17 14:17 ` Pedro Alves
2017-05-18  8:34   ` Yao Qi
2017-05-18 11:06     ` Pedro Alves
2017-05-18 11:09       ` [PATCH 2/3] gdb.base/fileio.c: Fix several -Wreturn-type warnings Pedro Alves
2017-05-18 11:09       ` [PATCH 3/3] gdb.base/fileio.c: Fix several -Wmaybe-uninitialized warnings Pedro Alves
2017-05-18 11:09       ` [PATCH 1/3] gdb.base/fileio.exp: Remove nowarnings Pedro Alves
2017-05-18 11:30       ` [PATCH OBV] Add nowarnings in gdb.base/fileio.exp Yao Qi
2017-05-18 11:51         ` Pedro Alves [this message]

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=46e0931c-1c64-eaa4-3811-f6c30af545d2@redhat.com \
    --to=palves@redhat.com \
    --cc=gdb-patches@sourceware.org \
    --cc=qiyaoltc@gmail.com \
    /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