* [PATCH] testsuite: c++: Allow for std::printf in g++.dg/modules/stdio-1_a.H [PR98529] @ 2024-05-13 8:40 Rainer Orth 2024-05-13 11:48 ` Nathaniel Shead 0 siblings, 1 reply; 6+ messages in thread From: Rainer Orth @ 2024-05-13 8:40 UTC (permalink / raw) To: gcc-patches; +Cc: Nathan Sidwell, Nathaniel Shead [-- Attachment #1: Type: text/plain, Size: 1165 bytes --] 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 -- ----------------------------------------------------------------------------- Rainer Orth, Center for Biotechnology, Bielefeld University 2024-05-13 Rainer Orth <ro@CeBiTec.Uni-Bielefeld.DE> gcc/testsuite: PR c++/98529 * g++.dg/modules/stdio-1_a.H (scan-lang-dump): Allow for ::std::printf. [-- Warning: decoded text below may be mangled, UTF-8 assumed --] [-- Attachment #2: testsuite-c++-modules-stdio-1_a-std.patch --] [-- Type: text/x-patch, Size: 634 bytes --] 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 } } ^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH] testsuite: c++: Allow for std::printf in g++.dg/modules/stdio-1_a.H [PR98529] 2024-05-13 8:40 [PATCH] testsuite: c++: Allow for std::printf in g++.dg/modules/stdio-1_a.H [PR98529] Rainer Orth @ 2024-05-13 11:48 ` Nathaniel Shead 2024-05-13 11:59 ` Rainer Orth 0 siblings, 1 reply; 6+ messages in thread From: Nathaniel Shead @ 2024-05-13 11:48 UTC (permalink / raw) To: Rainer Orth; +Cc: gcc-patches, Nathan Sidwell, Jason Merrill 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 <ro@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 } } ^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH] testsuite: c++: Allow for std::printf in g++.dg/modules/stdio-1_a.H [PR98529] 2024-05-13 11:48 ` Nathaniel Shead @ 2024-05-13 11:59 ` Rainer Orth 2024-05-13 12:03 ` Nathaniel Shead 0 siblings, 1 reply; 6+ messages in thread From: Rainer Orth @ 2024-05-13 11:59 UTC (permalink / raw) To: Nathaniel Shead; +Cc: gcc-patches, Nathan Sidwell, Jason Merrill Hi Nathaniel, > 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 } } neither module file contains "Reachable GMF" at all, with ::printf or otherwise. > 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. Perhaps, but it would be useful to first understand what those tests are supposed to look like. WRT global-3_a.C, printf doesn't occur at all, so this may just be a case of copy-and-paste. Maybe Nathan, who authored the tests, can shed some light. > Otherwise LGTM. Thanks. I'll go ahead and commit the patch as is, asjusting the other two once it's become clear what they should look like. Rainer -- ----------------------------------------------------------------------------- Rainer Orth, Center for Biotechnology, Bielefeld University ^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH] testsuite: c++: Allow for std::printf in g++.dg/modules/stdio-1_a.H [PR98529] 2024-05-13 11:59 ` Rainer Orth @ 2024-05-13 12:03 ` Nathaniel Shead 2024-05-13 12:10 ` Rainer Orth 0 siblings, 1 reply; 6+ messages in thread From: Nathaniel Shead @ 2024-05-13 12:03 UTC (permalink / raw) To: Rainer Orth; +Cc: gcc-patches, Nathan Sidwell, Jason Merrill On Mon, May 13, 2024 at 01:59:51PM +0200, Rainer Orth wrote: > Hi Nathaniel, > > > 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 } } > > neither module file contains "Reachable GMF" at all, with ::printf or > otherwise. > Yes, I think the test is aiming to check that such a declaration is not added at all, and so that's correct. But if for some reason on some system it did add "::std::printf" that would be a bug that would not be caught by this test. > > 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. > > Perhaps, but it would be useful to first understand what those tests are > supposed to look like. WRT global-3_a.C, printf doesn't occur at all, > so this may just be a case of copy-and-paste. > > Maybe Nathan, who authored the tests, can shed some light. > > > Otherwise LGTM. > > Thanks. I'll go ahead and commit the patch as is, asjusting the other > two once it's become clear what they should look like. > Ah, I should have been clearer: I'm not sure I can approve, but I've CC'd Jason in. > Rainer > > -- > ----------------------------------------------------------------------------- > Rainer Orth, Center for Biotechnology, Bielefeld University ^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH] testsuite: c++: Allow for std::printf in g++.dg/modules/stdio-1_a.H [PR98529] 2024-05-13 12:03 ` Nathaniel Shead @ 2024-05-13 12:10 ` Rainer Orth 2024-05-14 22:11 ` Jason Merrill 0 siblings, 1 reply; 6+ messages in thread From: Rainer Orth @ 2024-05-13 12:10 UTC (permalink / raw) To: Nathaniel Shead; +Cc: gcc-patches, Nathan Sidwell, Jason Merrill Hi Nathaniel, >> > 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 } } >> >> neither module file contains "Reachable GMF" at all, with ::printf or >> otherwise. >> > > Yes, I think the test is aiming to check that such a declaration is not > added at all, and so that's correct. But if for some reason on some > system it did add "::std::printf" that would be a bug that would not be > caught by this test. understood. However, the question about global-3_a.C remains which contains no printf at all. >> > 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. >> >> Perhaps, but it would be useful to first understand what those tests are >> supposed to look like. WRT global-3_a.C, printf doesn't occur at all, >> so this may just be a case of copy-and-paste. >> >> Maybe Nathan, who authored the tests, can shed some light. >> >> > Otherwise LGTM. >> >> Thanks. I'll go ahead and commit the patch as is, asjusting the other >> two once it's become clear what they should look like. >> > > Ah, I should have been clearer: I'm not sure I can approve, but I've > CC'd Jason in. Sorry, I already committed the patch. I can revert, of course, if that's inappropriate. OTOH, it could be considered obvious ;-) Rainer -- ----------------------------------------------------------------------------- Rainer Orth, Center for Biotechnology, Bielefeld University ^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH] testsuite: c++: Allow for std::printf in g++.dg/modules/stdio-1_a.H [PR98529] 2024-05-13 12:10 ` Rainer Orth @ 2024-05-14 22:11 ` Jason Merrill 0 siblings, 0 replies; 6+ messages in thread From: Jason Merrill @ 2024-05-14 22:11 UTC (permalink / raw) To: Rainer Orth, Nathaniel Shead; +Cc: gcc-patches, Nathan Sidwell On 5/13/24 08:10, Rainer Orth wrote: > Hi Nathaniel, > >>>> 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 } } >>> >>> neither module file contains "Reachable GMF" at all, with ::printf or >>> otherwise. >>> >> >> Yes, I think the test is aiming to check that such a declaration is not >> added at all, and so that's correct. But if for some reason on some >> system it did add "::std::printf" that would be a bug that would not be >> caught by this test. > > understood. However, the question about global-3_a.C remains which > contains no printf at all. > >>>> 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. >>> >>> Perhaps, but it would be useful to first understand what those tests are >>> supposed to look like. WRT global-3_a.C, printf doesn't occur at all, >>> so this may just be a case of copy-and-paste. >>> >>> Maybe Nathan, who authored the tests, can shed some light. >>> >>>> Otherwise LGTM. >>> >>> Thanks. I'll go ahead and commit the patch as is, asjusting the other >>> two once it's become clear what they should look like. >>> >> >> Ah, I should have been clearer: I'm not sure I can approve, but I've >> CC'd Jason in. > > Sorry, I already committed the patch. I can revert, of course, if > that's inappropriate. OTOH, it could be considered obvious ;-) Indeed, it seems obvious to me, thanks. Jason ^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~2024-05-14 22:11 UTC | newest] Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed) -- links below jump to the message on this page -- 2024-05-13 8:40 [PATCH] testsuite: c++: Allow for std::printf in g++.dg/modules/stdio-1_a.H [PR98529] Rainer Orth 2024-05-13 11:48 ` Nathaniel Shead 2024-05-13 11:59 ` Rainer Orth 2024-05-13 12:03 ` Nathaniel Shead 2024-05-13 12:10 ` Rainer Orth 2024-05-14 22:11 ` Jason Merrill
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox; as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).