This is the mail archive of the
gdb-patches@sourceware.org
mailing list for the GDB project.
Re: [testsuite patch] Fix C++11 compilation failure for gdb.cp/m-static.exp
On 09/15/2016 01:34 PM, Jan Kratochvil wrote:
> On Thu, 15 Sep 2016 14:22:54 +0200, Pedro Alves wrote:
>> Did you try moving the initialization to the .cc file? Like:
>>
>> const float gnu_obj_4::somewhere = 3.14159;
>>
>> Did you find a reason to not do that?
>
> I have found that it may invalidate the testcase some way so I stayed on the
> safe side. I have read now briefly the .exp file and it does have some XFAIL
> around "extra CU-level DW_TAG_variable as DW_AT_declaration".
>
> But those compiler bugs should be forgotten now so I am fine even with this
> new patch below.
>
Hmm, OK, now that I read the test, I think you were right in trying to
keep it safe, actually. The .exp file has:
# static const initialized in the class definition, PR gdb/11702.
if { $non_dwarf } { setup_xfail *-*-* }
gdb_test "print test4.everywhere" "\\$\[0-9\].* = 317" "static const int initialized in class definition"
if { $non_dwarf } { setup_xfail *-*-* }
gdb_test "print test4.somewhere" "\\$\[0-9\].* = 3.14\[0-9\]*" "static const float initialized in class definition"
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
Added by this:
https://sourceware.org/bugzilla/show_bug.cgi?id=11702
https://sourceware.org/ml/gdb-patches/2010-06/msg00677.html
https://sourceware.org/ml/gdb-patches/2010-06/txt00011.txt
So the new patch would make that highlighted tested above not
test what its test message says it is testing.
So I now think your original patch is better. Please push
that one instead.
(Even better would be to rewrite the test using the
dwarf assembler, but that'd of course be much more work.)
Thanks,
Pedro Alves