public inbox for libstdc++@gcc.gnu.org
 help / color / mirror / Atom feed
From: Ken Matsui <kmatsui@cs.washington.edu>
To: Jonathan Wakely <jwakely@redhat.com>
Cc: Ken Matsui <kmatsui@gcc.gnu.org>,
	gcc-patches@gcc.gnu.org, libstdc++@gcc.gnu.org
Subject: Re: [PATCH v2] libstdc++: Define _GLIBCXX_HAS_BUILTIN_TRAIT
Date: Thu, 31 Aug 2023 05:32:57 -0700	[thread overview]
Message-ID: <CAML+3pXSp6YLNC81rguEciX6zeDnJLkEvmevK=nV1S6gGfWYxQ@mail.gmail.com> (raw)
In-Reply-To: <CACb0b4m2_Ui0mSTyyNkY4EP0FTLs93i=iJK46a=Kyg8vKSsZZg@mail.gmail.com>

On Tue, Aug 8, 2023 at 1:23 PM Jonathan Wakely <jwakely@redhat.com> wrote:
>
>
>
> On Wed, 19 Jul 2023 at 20:33, Ken Matsui via Libstdc++ <libstdc++@gcc.gnu.org> wrote:
>>
>> This patch defines _GLIBCXX_HAS_BUILTIN_TRAIT macro, which will be used
>> as a flag to toggle the use of built-in traits in the type_traits header
>> through _GLIBCXX_NO_BUILTIN_TRAITS macro, without needing to modify the
>> source code.
>>
>> libstdc++-v3/ChangeLog:
>>
>>         * include/bits/c++config (_GLIBCXX_HAS_BUILTIN_TRAIT): Define.
>>         (_GLIBCXX_HAS_BUILTIN): Keep defined.
>
>
> I think this would be a little better as:
>
>         * include/bits/c++config (_GLIBCXX_HAS_BUILTIN): Do not undef.
>         (_GLIBCXX_HAS_BUILTIN_TRAIT): Define.
>
> OK for trunk with that change, thanks.
>
Thank you for your review! Patrick and I were discussing the naming
conventions for the macros _GLIBCXX_HAS_BUILTIN_TRAIT and
_GLIBCXX_NO_BUILTIN_TRAITS. It was brought to our attention that these
namings might be ambiguous, as there are implementations that have
corresponding built-ins but do not have fallback. Therefore, we
believe that using _GLIBCXX_USE_BUILTIN_TRAIT instead of
_GLIBCXX_HAS_BUILTIN_TRAIT would be more appropriate. Similarly, we
think that _GLIBCXX_AVOID_BUILTIN_TRAITS would be a better choice than
_GLIBCXX_NO_BUILTIN_TRAITS, as the latter implies that there are no
built-ins, when in fact it is meant to express that the use of
built-ins should be avoided when defining this macro. Could you please
let me know your thoughts on these updated namings?
>
>>
>>
>> Signed-off-by: Ken Matsui <kmatsui@gcc.gnu.org>
>> ---
>>  libstdc++-v3/include/bits/c++config | 10 +++++++++-
>>  1 file changed, 9 insertions(+), 1 deletion(-)
>>
>> diff --git a/libstdc++-v3/include/bits/c++config b/libstdc++-v3/include/bits/c++config
>> index dd47f274d5f..984985d6fff 100644
>> --- a/libstdc++-v3/include/bits/c++config
>> +++ b/libstdc++-v3/include/bits/c++config
>> @@ -854,7 +854,15 @@ namespace __gnu_cxx
>>  # define _GLIBCXX_HAVE_BUILTIN_LAUNDER 1
>>  #endif
>>
>> -#undef _GLIBCXX_HAS_BUILTIN
>> +// Returns 1 if _GLIBCXX_NO_BUILTIN_TRAITS is not defined and the compiler
>> +// has a corresponding built-in type trait, 0 otherwise.
>> +// _GLIBCXX_NO_BUILTIN_TRAITS can be defined to disable the use of built-in
>> +// traits.
>> +#ifndef _GLIBCXX_NO_BUILTIN_TRAITS
>> +# define _GLIBCXX_HAS_BUILTIN_TRAIT(BT) _GLIBCXX_HAS_BUILTIN(BT)
>> +#else
>> +# define _GLIBCXX_HAS_BUILTIN_TRAIT(BT) 0
>> +#endif
>>
>>  // Mark code that should be ignored by the compiler, but seen by Doxygen.
>>  #define _GLIBCXX_DOXYGEN_ONLY(X)
>> --
>> 2.41.0
>>

  reply	other threads:[~2023-08-31 12:33 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-07-18 22:32 [PATCH] " Ken Matsui
2023-07-19 18:48 ` Patrick Palka
2023-07-19 19:31   ` Ken Matsui
2023-08-08 20:22   ` Jonathan Wakely
2023-07-19 19:32 ` [PATCH v2] " Ken Matsui
2023-07-20 16:05   ` Patrick Palka
2023-07-28  3:57   ` [PATCH v3 1/2] " Ken Matsui
2023-07-28  3:57     ` [PATCH v3 2/2] libstdc++: Use _GLIBCXX_HAS_BUILTIN_TRAIT Ken Matsui
2023-08-01 17:24       ` Patrick Palka
2023-08-08 20:23   ` [PATCH v2] libstdc++: Define _GLIBCXX_HAS_BUILTIN_TRAIT Jonathan Wakely
2023-08-31 12:32     ` Ken Matsui [this message]
2023-09-11 14:50       ` Jonathan Wakely
2023-09-11 14:58         ` Ken Matsui

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to='CAML+3pXSp6YLNC81rguEciX6zeDnJLkEvmevK=nV1S6gGfWYxQ@mail.gmail.com' \
    --to=kmatsui@cs.washington.edu \
    --cc=gcc-patches@gcc.gnu.org \
    --cc=jwakely@redhat.com \
    --cc=kmatsui@gcc.gnu.org \
    --cc=libstdc++@gcc.gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).