Ping...
> From: Hans-Peter Nilsson <h...@axis.com> > Date: Mon, 19 Aug 2024 00:28:30 +0200 > > As noticed when verifying the dejagnu fix. Tested cris-elf > with a new newlib that arranges to emit the mentioned > warning, with/without the update in dejagnu to handle the > miniscule "in". Ok to commit? > > -- >8 -- > All testsuite compiler-calls pass default_target_compile in the > dejagnu installation (typically /usr/share/dejagnu/target.exp) which > also calls the dejagnu-installed prune_warnings. > > Normally, tests using the dg framework (most or all tests these days) > compile and link by calling various wrappers that end up calling > dg-test in the dejagnu installation, typically installed as > /usr/share/dejagnu/dg.exp. That, besides the compiler call, also > calls ${tool}-dg-prune (g++-dg-prune) on the messages, which in turn > ends up calling prune_gcc_output in gcc/testsuite/lib/prune.exp. That > gcc-specific "pruning" function handles more cases than the dejagnu > prune_warnings, and also has updated patterns. > > But, module_do_it in modules.exp calls the lower-level > ${tool}_target_compile "directly", i.e. g++_target_compile defined in > gcc/testsuite/lib/g++.exp. That does not call ${tool}-dg-prune, > meaning those test-cases miss the gcc-specific pruning. > > Noticed while testing a dejagnu update that handled the miniscule "in" > in the warning (line-breaks added below besides the original one after > "(void*)':") > > "/path/to/cris-elf/bin/ld: > /gccobj/cris-elf/./libstdc++-v3/src/.libs/libstdc++.a(random.o): in > function `std::(anonymous namespace)::__libc_getentropy(void*)': > /gccsrc/libstdc++-v3/src/c++11/random.cc:183: warning: _getentropy is > not implemented and will always fail" > > The line saying "in function" rather than "In function" (from the > binutils linker since 2018) is pruned by prune_gcc_output. The > prune_warnings in dejagnu-1.6.3 and earlier handles the second line > separately. It's an unfortunate wart that neither consumes the > delimiting line-break, leaving to the callers to prune residual empty > lines. See prune_warnings in dejagnu (default_target_compile and > dg-test) for those other line-break fixups, as alluded in the comment. > > * g++.dg/modules/modules.exp (module_do_it): Prune compilation > messages. > --- > gcc/testsuite/g++.dg/modules/modules.exp | 10 ++++++++++ > 1 file changed, 10 insertions(+) > > diff --git a/gcc/testsuite/g++.dg/modules/modules.exp > b/gcc/testsuite/g++.dg/modules/modules.exp > index 3e8df9b89309..e6bf28d8b1a0 100644 > --- a/gcc/testsuite/g++.dg/modules/modules.exp > +++ b/gcc/testsuite/g++.dg/modules/modules.exp > @@ -205,9 +205,19 @@ proc module_do_it { do_what testcase std asm_list } { > if { !$ok } { > unresolved "$ident link" > } else { > + global target_triplet > set out [${tool}_target_compile $asm_list \ > $execname executable $options] > eval $xfail > + > + # Do gcc-specific pruning. > + set out [${tool}-dg-prune $target_triplet $out] > + # Fix up remaining line-breaks similar to "regular" pruning > + # calls. Otherwise, a multi-line message stripped e.g. one > + # part by the default prune_warnings and one part part by the > + # gcc prune_gcc_output will have a residual line-break. > + regsub "^\[\r\n\]+" $out "" out > + > if { $out == "" } { > pass "$ident link" > } else { > -- > 2.30.2 >