[OB PATCH] Build two gdb.cp testcases with -Wno-unused-comparison
Gary Benson
gbenson@redhat.com
Tue Jun 16 12:42:12 GMT 2020
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
More information about the Gdb-patches
mailing list