public inbox for gdb-patches@sourceware.org
 help / color / mirror / Atom feed
From: Gary Benson <gbenson@redhat.com>
To: Pedro Alves <palves@redhat.com>
Cc: Tom Tromey <tom@tromey.com>, gdb-patches@sourceware.org
Subject: Re: [OB PATCH] Build two gdb.cp testcases with -Wno-unused-comparison
Date: Tue, 16 Jun 2020 13:42:12 +0100	[thread overview]
Message-ID: <20200616124212.GB30305@blade.nx> (raw)
In-Reply-To: <68fd1b3e-10ae-8f1d-b96d-f35ce7ae3037@redhat.com>

Pedro Alves wrote:
> On 5/29/20 7:08 PM, Tom Tromey wrote:
> >>>>>> "Gary" == Gary Benson via Gdb-patches <gdb-patches@sourceware.org> writes:
> > 
> > Gary> +if { [prepare_for_testing "failed to prepare" ${testfile} ${srcfile} \
> > Gary> +      {debug c++ additional_flags=-Wno-unused-comparison}] } {
> > 
> > Won't this cause build (and therefore test) failures if the compiler
> > does not accept this option?
> 
> I think that by design, while GCC errors out about unknown -Wfoo warnings,
> it ignores -Wno-foo, so that you can disable newer warnings without worrying
> about older compilers:
> 
>  $ gcc main.c -o main -g3 -O0 -Wfoo
>  gcc: error: unrecognized command line option ‘-Wfoo’
>  $ gcc main.c -o main -g3 -O0 -Wno-foo

Nice.

> However, Clang seems to output a warning in either case:
> 
>  $ clang main.c -o main -g3 -O0 -Wfoo
>  warning: unknown warning option '-Wfoo' [-Wunknown-warning-option]
>  1 warning generated.
>  $ clang main.c -o main -g3 -O0 -Wno-foo
>  warning: unknown warning option '-Wno-foo' [-Wunknown-warning-option]
>  1 warning generated.
> 
> (This was clang 5.0.2)
> 
> So that new option can break tests with older Clangs that don't
> know about the option.

Ugh.

clang 9.0.1 behaves the same too:

 $ clang -Werror -Wno-step-on-grass test.c
 error: unknown warning option '-Wno-step-on-grass' [-Werror,-Wunknown-warning-option]

> I guess to prevent this sort of thing going forward, we could make
> gcc_compile always add -Wno-unknown-warning-option to the build
> flags.  I don't know when was that option added to Clang, but maybe
> it's ancient enough.

Does this buy us much?  Any test with a warning I disable for clang is
a test that didn't compile with clang anyway.

Cheers,
Gary


  reply	other threads:[~2020-06-16 12:42 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-05-29 13:03 Gary Benson
2020-05-29 18:08 ` Tom Tromey
2020-05-29 18:31   ` Pedro Alves
2020-06-16 12:42     ` Gary Benson [this message]
2020-06-16 15:11       ` Pedro Alves
2020-06-17 17:29         ` Gary Benson
2020-06-17 19:53           ` [PATCH] W/ Clang, compile C/C++ testcases with -Wno-unknown-warning-option Pedro Alves
2020-06-18 16:18             ` Gary Benson
2020-06-24 22:26               ` Pedro Alves
2020-07-02 10:02                 ` Gary Benson
2020-06-16 12:38   ` [OB PATCH] Build two gdb.cp testcases with -Wno-unused-comparison Gary Benson

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=20200616124212.GB30305@blade.nx \
    --to=gbenson@redhat.com \
    --cc=gdb-patches@sourceware.org \
    --cc=palves@redhat.com \
    --cc=tom@tromey.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;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).