On Mon, May 13, 2024 at 10:40:30AM +0200, Rainer Orth wrote: > g++.dg/modules/stdio-1_a.H currently FAILs on Solaris: > > FAIL: g++.dg/modules/stdio-1_a.H -std=c++17 scan-lang-dump module "Depset:0 > decl entity:[0-9]* function_decl:'::printf'" > FAIL: g++.dg/modules/stdio-1_a.H -std=c++2a scan-lang-dump module "Depset:0 > decl entity:[0-9]* function_decl:'::printf'" > FAIL: g++.dg/modules/stdio-1_a.H -std=c++2b scan-lang-dump module "Depset:0 > decl entity:[0-9]* function_decl:'::printf'" > > The problem is that the module file doesn't contain > > Depset:0 decl entity:95 function_decl:'::printf' > > as expected by the test, but > > Depset:0 decl entity:26 function_decl:'::std::printf' > > This happens because Solaris <stdio.h> declares printf in namespace std > as allowed by C++11, Annex D, D.5. > > This patch allows for both forms. > > Tested on i386-pc-solaris2.11, sparc-sun-solaris2.11, and > x86_64-pc-linux-gnu. > > Ok for trunk? > > Rainer
There are a couple of other tests that appear to potentially have a similar issue: global-2_a.C 21:// { dg-final { scan-lang-dump-not {Reachable GMF '::printf[^\n']*' added} module } } global-3_a.C 15:// { dg-final { scan-lang-dump-not {Reachable GMF '::printf[^'\n]*' added} module } } Which I suppose maybe also should be updated in the same way; I guess they don't fail on Solaris because they aren't actually correctly testing what they think they are. Otherwise LGTM. Nathaniel > > -- > ----------------------------------------------------------------------------- > Rainer Orth, Center for Biotechnology, Bielefeld University > > > 2024-05-13 Rainer Orth <r...@cebitec.uni-bielefeld.de> > > gcc/testsuite: > PR c++/98529 > * g++.dg/modules/stdio-1_a.H (scan-lang-dump): Allow for > ::std::printf. > > diff --git a/gcc/testsuite/g++.dg/modules/stdio-1_a.H > b/gcc/testsuite/g++.dg/modules/stdio-1_a.H > --- a/gcc/testsuite/g++.dg/modules/stdio-1_a.H > +++ b/gcc/testsuite/g++.dg/modules/stdio-1_a.H > @@ -10,5 +10,5 @@ > #endif > // There should be *lots* of depsets (209 for glibc today) > // { dg-final { scan-lang-dump {Writing section:60 } module } } > -// { dg-final { scan-lang-dump {Depset:0 decl entity:[0-9]* > function_decl:'::printf'} module } } > +// { dg-final { scan-lang-dump {Depset:0 decl entity:[0-9]* > function_decl:'(::std)?::printf'} module } } > // { dg-final { scan-lang-dump {Depset:1 binding namespace_decl:'::printf'} > module } }