[PATCH 1/4] libstdc++: Introduce _GLIBCXX_EXPLICIT_THIS_PARAMETER internal FTM
Jonathan Wakely
jwakely@redhat.com
Tue Oct 14 08:19:49 GMT 2025
On Tue, 14 Oct 2025 at 09:18, Jonathan Wakely <jwakely@redhat.com> wrote:
>
> On Mon, 13 Oct 2025 at 17:16, Tomasz Kaminski <tkaminsk@redhat.com> wrote:
> >
> >
> >
> > On Mon, Oct 13, 2025 at 5:09 PM Patrick Palka <ppalka@redhat.com> wrote:
> >>
> >> Series tested on x86_64-pc-linux-gnu, does this look OK for trunk only?
> >>
> >> -- >8 --
> >>
> >> This FTM is like __cpp_explicit_this_parameter but is also defined
> >> in earlier C++ modes if deducing this is supported as an extension
> >> by the compiler. Currently only GCC supports this, Clang doesn't.
> >>
> >> libstdc++-v3/ChangeLog:
> >>
> >> * include/bits/c++config (_GLIBCXX_EXPLICIT_THIS_PARAMETER):
> >> New.
> >> ---
> >
> > As discussed, adjust the macro definition later, so this LGTM outside one comment.
OK for trunk, with a simplification to the macro definition to come later.
> >
> >
> >>
> >> libstdc++-v3/include/bits/c++config | 7 +++++++
> >> 1 file changed, 7 insertions(+)
> >>
> >> diff --git a/libstdc++-v3/include/bits/c++config b/libstdc++-v3/include/bits/c++config
> >> index eec3a4a499dd..e6d8f186d0d4 100644
> >> --- a/libstdc++-v3/include/bits/c++config
> >> +++ b/libstdc++-v3/include/bits/c++config
> >> @@ -927,6 +927,13 @@ namespace __gnu_cxx
> >> # define _GLIBCXX_USE_BUILTIN_TRAIT(BT) 0
> >> #endif
> >>
> >> +// Whether deducing this is usable either officially, if in C++23 mode, or
> >> +// as an extension (Clang doesn't support the latter).
> >> +#if __cpp_explicit_this_parameter \
> >> + || (__cplusplus >= 201103L && __GNUC__ >= 14 && !defined(_GLIBCXX_CLANG))
> >
> > We always target only the version of GCC that we are compiled with, as far as I understand,
> > so we could just make this #if __cpp_explicit_this_parameter && !defined(_GLIBCXX_CLANG)?
>
> I was wondering if it's relevant for Intel icx with the -fgnu-version
> option, but we defined _GLIBCXX_CLANG for icx, so it should be
> excluded by the _GLIBCXX_CLANG option.
>
> I don't think we need to support the EDG-based Intel icc on trunk
> now, so I agree that the __GNUC__ check seems redundant here.
>
> >>
> >> +# define _GLIBCXX_EXPLICIT_THIS_PARAMETER 202110L
> >> +#endif
> >> +
> >> // Mark code that should be ignored by the compiler, but seen by Doxygen.
> >> #define _GLIBCXX_DOXYGEN_ONLY(X)
> >>
> >> --
> >> 2.51.0.491.g4b71b29477
> >>
More information about the Libstdc++
mailing list