[PATCH] Fix coroutine tests for libstdc++ gnu-version-namespace mode

François Dumont frs.dumont@gmail.com
Wed Oct 11 04:49:02 GMT 2023


On 08/10/2023 15:59, Iain Sandoe wrote:
> Hi François,
>
>> On 23 Sep 2023, at 21:10, François Dumont <frs.dumont@gmail.com> wrote:
>>
>> I'm eventually fixing those tests the same way we manage this problem in libstdc++ testsuite.
>>
>>     testsuite: Add optional libstdc++ version namespace in expected diagnostic
>>
>>      When libstdc++ is build with --enable-symvers=gnu-versioned-namespace diagnostics are
>>      showing this namespace, currently __8.
>>
>>      gcc/testsuite/ChangeLog:
>>
>>              * testsuite/g++.dg/coroutines/coro-bad-alloc-00-bad-op-new.C: Add optional
>>              '__8' version namespace in expected diagnostic.
>>              * testsuite/g++.dg/coroutines/coro-bad-alloc-01-bad-op-del.C: Likewise.
>>              * testsuite/g++.dg/coroutines/coro-bad-alloc-02-no-op-new-nt.C: Likewise.
>>              * testsuite/g++.dg/coroutines/coro-bad-grooaf-01-grooaf-expected.C: Likewise.
>>              * testsuite/g++.dg/coroutines/pr97438.C: Likewise.
>>              * testsuite/g++.dg/coroutines/ramp-return-b.C: Likewise.
>>
>> Tested under Linux x86_64.
>>
>> I'm contributing to libstdc++ so I already have write access.
>>
>> Ok to commit ?
> As author of the tests, this LGTM as a suitable fix for now (at least, once the main
> patch to fix versioned namespaces lands).

I just realized it was a "go", no ? Then why after the main patch ?

The "main patch" do not fix the versioned namespace. It just makes it 
adopt the cxx11 abi.

This patch fixes a problem that is as old as the tests and that is 
totally unrelated with the main one. I just wanted to improve the 
situation so that versioned namespace mode do not look more buggy than 
necessary when someone (like you) run those.

>
> However, IMO, this could become quite painful as more g++ tests make use of std headers
> (which is not really optional for facilities like this that are tightly-coupled between the FE and
> the library).
>
> For the future, it does seem that a more complete solution might be to introduce a
> testsuite-wide definition for the C++ versioned std:: introducer, so that we can update it in one
> place as the version changes.
>
> So (as a thought experiment):
>   - we’d have something of the form “CXX_STD” as a tcl global
>   - we’d add the presence/absence of versioning to the relevant site.exp (which
>     means recognising the versioning choice also in the GCC configure)
>   - we’d migrate tests to using ${CXX_STD} instead of "std::__N”  in matches
>
> … I guess an alternative could be to cook up some alternate warning/error/etc
>     match functions that cater for arbitrary inline namespaces but that seems like a much
>     more tricky and invasive testsuite change.
>
> thoughts?

I considered amending gcc/testsuite/lib/prune.exp to simply remove the 
version from the diagnostic. But the reply on why it was not working 
scared me, so this patch.

https://gcc.gnu.org/pipermail/gcc/2023-September/242526.html



More information about the Gcc mailing list