public inbox for libstdc++@gcc.gnu.org
 help / color / mirror / Atom feed
* [PATCH][_GLIBCXX_INLINE_VERSION] Fix <contracts>
@ 2023-09-20  4:51 François Dumont
  2023-09-20  9:32 ` Jonathan Wakely
  0 siblings, 1 reply; 7+ messages in thread
From: François Dumont @ 2023-09-20  4:51 UTC (permalink / raw)
  To: libstdc++; +Cc: gcc-patches

[-- Attachment #1: Type: text/plain, Size: 349 bytes --]

libstdc++: Remove std::constract_violation from versioned namespace

GCC expects this type to be in std namespace directly.

libstdc++-v3/ChangeLog:

     * include/experimental/contract:
     Remove _GLIBCXX_BEGIN_NAMESPACE_VERSION/_GLIBCXX_END_NAMESPACE_VERSION.

It does fix 29 g++.dg/contracts in gcc testsuite.

Ok to commit ?

François

[-- Attachment #2: contract.patch --]
[-- Type: text/x-patch, Size: 550 bytes --]

diff --git a/libstdc++-v3/include/experimental/contract b/libstdc++-v3/include/experimental/contract
index fbf5ed01d8b..8bc12380cec 100644
--- a/libstdc++-v3/include/experimental/contract
+++ b/libstdc++-v3/include/experimental/contract
@@ -39,7 +39,6 @@
 
 namespace std _GLIBCXX_VISIBILITY(default)
 {
-_GLIBCXX_BEGIN_NAMESPACE_VERSION
 
 namespace experimental
 {
@@ -71,7 +70,6 @@ namespace experimental
 
 } // namespace experimental
 
-_GLIBCXX_END_NAMESPACE_VERSION
 } // namespace std
 
 // To override the contract violation handler, define

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH][_GLIBCXX_INLINE_VERSION] Fix <contracts>
  2023-09-20  4:51 [PATCH][_GLIBCXX_INLINE_VERSION] Fix <contracts> François Dumont
@ 2023-09-20  9:32 ` Jonathan Wakely
  2023-09-20 17:51   ` François Dumont
  0 siblings, 1 reply; 7+ messages in thread
From: Jonathan Wakely @ 2023-09-20  9:32 UTC (permalink / raw)
  To: François Dumont; +Cc: libstdc++, gcc-patches

On Wed, 20 Sept 2023 at 05:51, François Dumont via Libstdc++
<libstdc++@gcc.gnu.org> wrote:
>
> libstdc++: Remove std::constract_violation from versioned namespace

Spelling mistake in contract_violation, and it's not
std::contract_violation, it's std::experimental::contract_violation

>
> GCC expects this type to be in std namespace directly.

Again, it's in std::experimental not in std directly.

Will this change cause problems when including another experimental
header, which does put experimental below std::__8?

I think std::__8::experimental and std::experimental will become ambiguous.

Maybe we do want to remove the inline __8 namespace from all
experimental headers. That needs a bit more thought though.

>
> libstdc++-v3/ChangeLog:
>
>      * include/experimental/contract:
>      Remove _GLIBCXX_BEGIN_NAMESPACE_VERSION/_GLIBCXX_END_NAMESPACE_VERSION.

This line is too long for the changelog.

>
> It does fix 29 g++.dg/contracts in gcc testsuite.
>
> Ok to commit ?
>
> François


^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH][_GLIBCXX_INLINE_VERSION] Fix <contracts>
  2023-09-20  9:32 ` Jonathan Wakely
@ 2023-09-20 17:51   ` François Dumont
  2023-09-21  4:41     ` François Dumont
  0 siblings, 1 reply; 7+ messages in thread
From: François Dumont @ 2023-09-20 17:51 UTC (permalink / raw)
  To: Jonathan Wakely; +Cc: libstdc++, gcc-patches

[-- Attachment #1: Type: text/plain, Size: 1438 bytes --]

libstdc++: [_GLIBCXX_INLINE_VERSION] Add handle_contract_violation 
symbol alias

libstdc++-v3/ChangeLog:

     * src/experimental/contract.cc
     [_GLIBCXX_INLINE_VERSION](handle_contract_violation): Provide 
symbol alias
     without version namespace decoration for gcc.

Here is what I'm testing eventually, ok to commit if successful ?

François

On 20/09/2023 11:32, Jonathan Wakely wrote:
> On Wed, 20 Sept 2023 at 05:51, François Dumont via Libstdc++
> <libstdc++@gcc.gnu.org> wrote:
>> libstdc++: Remove std::constract_violation from versioned namespace
> Spelling mistake in contract_violation, and it's not
> std::contract_violation, it's std::experimental::contract_violation
>
>> GCC expects this type to be in std namespace directly.
> Again, it's in std::experimental not in std directly.
>
> Will this change cause problems when including another experimental
> header, which does put experimental below std::__8?
>
> I think std::__8::experimental and std::experimental will become ambiguous.
>
> Maybe we do want to remove the inline __8 namespace from all
> experimental headers. That needs a bit more thought though.
>
>> libstdc++-v3/ChangeLog:
>>
>>       * include/experimental/contract:
>>       Remove _GLIBCXX_BEGIN_NAMESPACE_VERSION/_GLIBCXX_END_NAMESPACE_VERSION.
> This line is too long for the changelog.
>
>> It does fix 29 g++.dg/contracts in gcc testsuite.
>>
>> Ok to commit ?
>>
>> François

[-- Attachment #2: contract.patch --]
[-- Type: text/x-patch, Size: 743 bytes --]

diff --git a/libstdc++-v3/src/experimental/contract.cc b/libstdc++-v3/src/experimental/contract.cc
index 504a6c041f1..17daa3312ca 100644
--- a/libstdc++-v3/src/experimental/contract.cc
+++ b/libstdc++-v3/src/experimental/contract.cc
@@ -67,3 +67,14 @@ handle_contract_violation (const std::experimental::contract_violation &violatio
   std::cerr << std::endl;
 #endif
 }
+
+#if _GLIBCXX_INLINE_VERSION
+// Provide symbol alias without version namespace decoration for gcc.
+extern "C"
+void _Z25handle_contract_violationRKNSt12experimental18contract_violationE
+(const std::experimental::contract_violation &violation)
+__attribute__ (
+(alias
+ ("_Z25handle_contract_violationRKNSt3__812experimental18contract_violationE"),
+ weak));
+#endif

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH][_GLIBCXX_INLINE_VERSION] Fix <contracts>
  2023-09-20 17:51   ` François Dumont
@ 2023-09-21  4:41     ` François Dumont
  2023-10-08 14:06       ` Iain Sandoe
  0 siblings, 1 reply; 7+ messages in thread
From: François Dumont @ 2023-09-21  4:41 UTC (permalink / raw)
  To: Jonathan Wakely; +Cc: libstdc++, gcc-patches

Tests were successful, ok to commit ?

On 20/09/2023 19:51, François Dumont wrote:
> libstdc++: [_GLIBCXX_INLINE_VERSION] Add handle_contract_violation 
> symbol alias
>
> libstdc++-v3/ChangeLog:
>
>     * src/experimental/contract.cc
>     [_GLIBCXX_INLINE_VERSION](handle_contract_violation): Provide 
> symbol alias
>     without version namespace decoration for gcc.
>
> Here is what I'm testing eventually, ok to commit if successful ?
>
> François
>
> On 20/09/2023 11:32, Jonathan Wakely wrote:
>> On Wed, 20 Sept 2023 at 05:51, François Dumont via Libstdc++
>> <libstdc++@gcc.gnu.org> wrote:
>>> libstdc++: Remove std::constract_violation from versioned namespace
>> Spelling mistake in contract_violation, and it's not
>> std::contract_violation, it's std::experimental::contract_violation
>>
>>> GCC expects this type to be in std namespace directly.
>> Again, it's in std::experimental not in std directly.
>>
>> Will this change cause problems when including another experimental
>> header, which does put experimental below std::__8?
>>
>> I think std::__8::experimental and std::experimental will become 
>> ambiguous.
>>
>> Maybe we do want to remove the inline __8 namespace from all
>> experimental headers. That needs a bit more thought though.
>>
>>> libstdc++-v3/ChangeLog:
>>>
>>>       * include/experimental/contract:
>>>       Remove 
>>> _GLIBCXX_BEGIN_NAMESPACE_VERSION/_GLIBCXX_END_NAMESPACE_VERSION.
>> This line is too long for the changelog.
>>
>>> It does fix 29 g++.dg/contracts in gcc testsuite.
>>>
>>> Ok to commit ?
>>>
>>> François

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH][_GLIBCXX_INLINE_VERSION] Fix <contracts>
  2023-09-21  4:41     ` François Dumont
@ 2023-10-08 14:06       ` Iain Sandoe
  2023-10-09  5:06         ` François Dumont
  0 siblings, 1 reply; 7+ messages in thread
From: Iain Sandoe @ 2023-10-08 14:06 UTC (permalink / raw)
  To: François Dumont; +Cc: Jonathan Wakely, libstdc++, GCC Patches

Hi François,

> On 21 Sep 2023, at 05:41, François Dumont <frs.dumont@gmail.com> wrote:
> 
> Tests were successful, ok to commit ?
> 
> On 20/09/2023 19:51, François Dumont wrote:
>> libstdc++: [_GLIBCXX_INLINE_VERSION] Add handle_contract_violation symbol alias
>> 
>> libstdc++-v3/ChangeLog:
>> 
>>     * src/experimental/contract.cc
>>     [_GLIBCXX_INLINE_VERSION](handle_contract_violation): Provide symbol alias
>>     without version namespace decoration for gcc.

This does not work in the source on targets without support for symbol aliases (Darwin is one)
“../experimental/contract.cc:79:8: warning: alias definitions not supported in Mach-O; ignored”

- there might be a way to do it at link-time (for one symbol not too bad); I will have to poke at
  it a bit.
Iain

>> 
>> Here is what I'm testing eventually, ok to commit if successful ?
>> 
>> François
>> 
>> On 20/09/2023 11:32, Jonathan Wakely wrote:
>>> On Wed, 20 Sept 2023 at 05:51, François Dumont via Libstdc++
>>> <libstdc++@gcc.gnu.org> wrote:
>>>> libstdc++: Remove std::constract_violation from versioned namespace
>>> Spelling mistake in contract_violation, and it's not
>>> std::contract_violation, it's std::experimental::contract_violation
>>> 
>>>> GCC expects this type to be in std namespace directly.
>>> Again, it's in std::experimental not in std directly.
>>> 
>>> Will this change cause problems when including another experimental
>>> header, which does put experimental below std::__8?
>>> 
>>> I think std::__8::experimental and std::experimental will become ambiguous.
>>> 
>>> Maybe we do want to remove the inline __8 namespace from all
>>> experimental headers. That needs a bit more thought though.
>>> 
>>>> libstdc++-v3/ChangeLog:
>>>> 
>>>>       * include/experimental/contract:
>>>>       Remove _GLIBCXX_BEGIN_NAMESPACE_VERSION/_GLIBCXX_END_NAMESPACE_VERSION.
>>> This line is too long for the changelog.
>>> 
>>>> It does fix 29 g++.dg/contracts in gcc testsuite.
>>>> 
>>>> Ok to commit ?
>>>> 
>>>> François


^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH][_GLIBCXX_INLINE_VERSION] Fix <contracts>
  2023-10-08 14:06       ` Iain Sandoe
@ 2023-10-09  5:06         ` François Dumont
  2023-10-09  9:23           ` Iain Sandoe
  0 siblings, 1 reply; 7+ messages in thread
From: François Dumont @ 2023-10-09  5:06 UTC (permalink / raw)
  To: Iain Sandoe; +Cc: Jonathan Wakely, libstdc++, GCC Patches

[-- Attachment #1: Type: text/plain, Size: 2327 bytes --]

I think we can do the same without the symbol alias feature. It's even 
simpler cause do not require any maintenance when version symbol bump.

Here is what I'm testing, at least exported symbol is fine.

François


On 08/10/2023 16:06, Iain Sandoe wrote:
> Hi François,
>
>> On 21 Sep 2023, at 05:41, François Dumont <frs.dumont@gmail.com> wrote:
>>
>> Tests were successful, ok to commit ?
>>
>> On 20/09/2023 19:51, François Dumont wrote:
>>> libstdc++: [_GLIBCXX_INLINE_VERSION] Add handle_contract_violation symbol alias
>>>
>>> libstdc++-v3/ChangeLog:
>>>
>>>      * src/experimental/contract.cc
>>>      [_GLIBCXX_INLINE_VERSION](handle_contract_violation): Provide symbol alias
>>>      without version namespace decoration for gcc.
> This does not work in the source on targets without support for symbol aliases (Darwin is one)
> “../experimental/contract.cc:79:8: warning: alias definitions not supported in Mach-O; ignored”
>
> - there might be a way to do it at link-time (for one symbol not too bad); I will have to poke at
>    it a bit.
> Iain
>
>>> Here is what I'm testing eventually, ok to commit if successful ?
>>>
>>> François
>>>
>>> On 20/09/2023 11:32, Jonathan Wakely wrote:
>>>> On Wed, 20 Sept 2023 at 05:51, François Dumont via Libstdc++
>>>> <libstdc++@gcc.gnu.org> wrote:
>>>>> libstdc++: Remove std::constract_violation from versioned namespace
>>>> Spelling mistake in contract_violation, and it's not
>>>> std::contract_violation, it's std::experimental::contract_violation
>>>>
>>>>> GCC expects this type to be in std namespace directly.
>>>> Again, it's in std::experimental not in std directly.
>>>>
>>>> Will this change cause problems when including another experimental
>>>> header, which does put experimental below std::__8?
>>>>
>>>> I think std::__8::experimental and std::experimental will become ambiguous.
>>>>
>>>> Maybe we do want to remove the inline __8 namespace from all
>>>> experimental headers. That needs a bit more thought though.
>>>>
>>>>> libstdc++-v3/ChangeLog:
>>>>>
>>>>>        * include/experimental/contract:
>>>>>        Remove _GLIBCXX_BEGIN_NAMESPACE_VERSION/_GLIBCXX_END_NAMESPACE_VERSION.
>>>> This line is too long for the changelog.
>>>>
>>>>> It does fix 29 g++.dg/contracts in gcc testsuite.
>>>>>
>>>>> Ok to commit ?
>>>>>
>>>>> François

[-- Attachment #2: contract.patch --]
[-- Type: text/x-patch, Size: 688 bytes --]

diff --git a/libstdc++-v3/src/experimental/contract.cc b/libstdc++-v3/src/experimental/contract.cc
index 504a6c041f1..7918e5ae53a 100644
--- a/libstdc++-v3/src/experimental/contract.cc
+++ b/libstdc++-v3/src/experimental/contract.cc
@@ -67,3 +67,12 @@ handle_contract_violation (const std::experimental::contract_violation &violatio
   std::cerr << std::endl;
 #endif
 }
+
+#if _GLIBCXX_INLINE_VERSION
+// Provide symbol without version namespace decoration for gcc.
+extern "C"
+__attribute__ ((weak)) void
+_Z25handle_contract_violationRKNSt12experimental18contract_violationE
+(const std::experimental::contract_violation &violation)
+{ handle_contract_violation(violation); }
+#endif

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH][_GLIBCXX_INLINE_VERSION] Fix <contracts>
  2023-10-09  5:06         ` François Dumont
@ 2023-10-09  9:23           ` Iain Sandoe
  0 siblings, 0 replies; 7+ messages in thread
From: Iain Sandoe @ 2023-10-09  9:23 UTC (permalink / raw)
  To: François Dumont; +Cc: Jonathan Wakely, libstdc++, GCC Patches



> On 9 Oct 2023, at 06:06, François Dumont <frs.dumont@gmail.com> wrote:
> 
> I think we can do the same without the symbol alias feature. It's even simpler cause do not require any maintenance when version symbol bump.
> 
> Here is what I'm testing, at least exported symbol is fine.

Thanks; works for me, (g++ tests with your patches + a local one to enable versioned-namespace on Darwin).

Iain

> 
> François
> 
> 
> On 08/10/2023 16:06, Iain Sandoe wrote:
>> Hi François,
>> 
>>> On 21 Sep 2023, at 05:41, François Dumont <frs.dumont@gmail.com> wrote:
>>> 
>>> Tests were successful, ok to commit ?
>>> 
>>> On 20/09/2023 19:51, François Dumont wrote:
>>>> libstdc++: [_GLIBCXX_INLINE_VERSION] Add handle_contract_violation symbol alias
>>>> 
>>>> libstdc++-v3/ChangeLog:
>>>> 
>>>>     * src/experimental/contract.cc
>>>>     [_GLIBCXX_INLINE_VERSION](handle_contract_violation): Provide symbol alias
>>>>     without version namespace decoration for gcc.
>> This does not work in the source on targets without support for symbol aliases (Darwin is one)
>> “../experimental/contract.cc:79:8: warning: alias definitions not supported in Mach-O; ignored”
>> 
>> - there might be a way to do it at link-time (for one symbol not too bad); I will have to poke at
>>   it a bit.
>> Iain
>> 
>>>> Here is what I'm testing eventually, ok to commit if successful ?
>>>> 
>>>> François
>>>> 
>>>> On 20/09/2023 11:32, Jonathan Wakely wrote:
>>>>> On Wed, 20 Sept 2023 at 05:51, François Dumont via Libstdc++
>>>>> <libstdc++@gcc.gnu.org> wrote:
>>>>>> libstdc++: Remove std::constract_violation from versioned namespace
>>>>> Spelling mistake in contract_violation, and it's not
>>>>> std::contract_violation, it's std::experimental::contract_violation
>>>>> 
>>>>>> GCC expects this type to be in std namespace directly.
>>>>> Again, it's in std::experimental not in std directly.
>>>>> 
>>>>> Will this change cause problems when including another experimental
>>>>> header, which does put experimental below std::__8?
>>>>> 
>>>>> I think std::__8::experimental and std::experimental will become ambiguous.
>>>>> 
>>>>> Maybe we do want to remove the inline __8 namespace from all
>>>>> experimental headers. That needs a bit more thought though.
>>>>> 
>>>>>> libstdc++-v3/ChangeLog:
>>>>>> 
>>>>>>       * include/experimental/contract:
>>>>>>       Remove _GLIBCXX_BEGIN_NAMESPACE_VERSION/_GLIBCXX_END_NAMESPACE_VERSION.
>>>>> This line is too long for the changelog.
>>>>> 
>>>>>> It does fix 29 g++.dg/contracts in gcc testsuite.
>>>>>> 
>>>>>> Ok to commit ?
>>>>>> 
>>>>>> François
> <contract.patch>


^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2023-10-09  9:23 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-09-20  4:51 [PATCH][_GLIBCXX_INLINE_VERSION] Fix <contracts> François Dumont
2023-09-20  9:32 ` Jonathan Wakely
2023-09-20 17:51   ` François Dumont
2023-09-21  4:41     ` François Dumont
2023-10-08 14:06       ` Iain Sandoe
2023-10-09  5:06         ` François Dumont
2023-10-09  9:23           ` Iain Sandoe

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).