[OB PATCH] Build two gdb.cp testcases with -Wno-unused-comparison

Gary Benson gbenson@redhat.com
Tue Jun 16 12:38:20 GMT 2020


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 wonder if there's a way to fix the warning in the C++ source file
> instead.

Yes, ideally, but by no means always.  I'm working my way through
these failures, and in many cases the "issue" the warning caught
was intended, some weird thing placed specifically to test some
functionality of GDB.  For example:

  Running /gdbtest/build/gdb/testsuite/../../../src/gdb/testsuite/gdb.cp/ambiguous.exp ...
  gdb compile failed, /gdbtest/build/gdb/testsuite/../../../src/gdb/testsuite/gdb.cp/ambiguous.cc:70:36:
  warning: direct base 'A1' is inaccessible due to ambiguity:
      class JVA1 -> class KV -> class A1
      class JVA1 -> class A1 [-Winaccessible-base]
  class JVA1 : public KV, public LV, public A1 {
                                     ^~~~~~~~~
  1 warning generated.

This one's obviously intentional, gdb.cp/abmigiuous.exp contains
"tests relating to ambiguous class members".  But a lot of these
cases aren't obvious, at least not to me.  Is something a mistake?
Some piece of K&R C from 1988 that was machine-converted in 1994?
Or some real thing put there to stop GCC optimizing something out?
I'm very much NOT someone to ask about code generation nuances!
If something's obvious or (ha!) documented I can fix the source;
places I've disabled warnings are where I couldn't tell what was
intended/expected.

Cheers,
Gary



More information about the Gdb-patches mailing list