[PATCH] libstdc++: Implement std::unreachable() for C++23 (P0627R6)

2022-03-31 Thread Jonathan Wakely via Gcc-patches
This is a tiny C++23 feature that I plan to add for GCC 12. Does anybody have any comments on the choices below in terms of when to make reaching std::unreachable do an assert/trap/unreachable? My thoughts on avoiding the overhead in the _GLIBCXX_ASSERTIONS case is that this differs from e.g. asse

Re: [PATCH] libstdc++: Implement std::unreachable() for C++23 (P0627R6)

2022-03-31 Thread Matthias Kretz via Gcc-patches
I like it. But I'd like it even more if we could have #elif defined _UBSAN __ubsan_invoke_ub("reached std::unreachable()"); But to my knowledge UBSAN has no hooks for the library like this (yet). and... On Thursday, 31 March 2022 17:30:29 CEST Jonathan Wakely via Gcc-patches wrote: > diff

Re: [PATCH] libstdc++: Implement std::unreachable() for C++23 (P0627R6)

2022-03-31 Thread Xi Ruoyao via Gcc-patches
On Thu, 2022-03-31 at 17:50 +0200, Matthias Kretz via Gcc-patches wrote: > I like it. But I'd like it even more if we could have > > #elif defined _UBSAN >     __ubsan_invoke_ub("reached std::unreachable()"); > > But to my knowledge UBSAN has no hooks for the library like this > (yet). UBSAN can

Re: [PATCH] libstdc++: Implement std::unreachable() for C++23 (P0627R6)

2022-03-31 Thread Marc Glisse via Gcc-patches
On Thu, 31 Mar 2022, Matthias Kretz via Gcc-patches wrote: I like it. But I'd like it even more if we could have #elif defined _UBSAN __ubsan_invoke_ub("reached std::unreachable()"); But to my knowledge UBSAN has no hooks for the library like this (yet). -fsanitize=undefined already repla

Re: [PATCH] libstdc++: Implement std::unreachable() for C++23 (P0627R6)

2022-03-31 Thread Jonathan Wakely via Gcc-patches
On Thu, 31 Mar 2022 at 16:51, Matthias Kretz via Libstdc++ wrote: > > I like it. But I'd like it even more if we could have > > #elif defined _UBSAN > __ubsan_invoke_ub("reached std::unreachable()"); > > But to my knowledge UBSAN has no hooks for the library like this (yet). As far as I know,

Re: [PATCH] libstdc++: Implement std::unreachable() for C++23 (P0627R6)

2022-03-31 Thread Jonathan Wakely via Gcc-patches
On Thu, 31 Mar 2022 at 17:03, Marc Glisse via Libstdc++ wrote: > > On Thu, 31 Mar 2022, Matthias Kretz via Gcc-patches wrote: > > > I like it. But I'd like it even more if we could have > > > > #elif defined _UBSAN > >__ubsan_invoke_ub("reached std::unreachable()"); > > > > But to my knowledge

Re: [PATCH] libstdc++: Implement std::unreachable() for C++23 (P0627R6)

2022-03-31 Thread Marc Glisse via Gcc-patches
On Thu, 31 Mar 2022, Jonathan Wakely wrote: On Thu, 31 Mar 2022 at 17:03, Marc Glisse via Libstdc++ wrote: On Thu, 31 Mar 2022, Matthias Kretz via Gcc-patches wrote: I like it. But I'd like it even more if we could have #elif defined _UBSAN __ubsan_invoke_ub("reached std::unreachable()"

Re: [PATCH] libstdc++: Implement std::unreachable() for C++23 (P0627R6)

2022-04-01 Thread Jonathan Wakely via Gcc-patches
On Thu, 31 Mar 2022 at 19:21, Marc Glisse wrote: > > On Thu, 31 Mar 2022, Jonathan Wakely wrote: > > > On Thu, 31 Mar 2022 at 17:03, Marc Glisse via Libstdc++ > > wrote: > >> > >> On Thu, 31 Mar 2022, Matthias Kretz via Gcc-patches wrote: > >> > >>> I like it. But I'd like it even more if we could

Re: [PATCH] libstdc++: Implement std::unreachable() for C++23 (P0627R6)

2022-04-01 Thread Matthias Kretz via Gcc-patches
On Friday, 1 April 2022 13:33:42 CEST Jonathan Wakely wrote: > Matthias didn't like my Princess Bride easter egg :-) > Would the attached be better? LGTM. -- ── Dr. Matthias Kretz https://mattkretz

Re: [PATCH] libstdc++: Implement std::unreachable() for C++23 (P0627R6)

2022-04-01 Thread Jonathan Wakely via Gcc-patches
On Fri, 1 Apr 2022 at 12:56, Matthias Kretz wrote: > > On Friday, 1 April 2022 13:33:42 CEST Jonathan Wakely wrote: > > Matthias didn't like my Princess Bride easter egg :-) > > Would the attached be better? > > LGTM. OK, thanks to everybody who commented. I've pushed that to trunk now.