public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
* [PATCH] libstdc++: Define _GLIBCXX_HAS_BUILTIN_TRAIT
@ 2023-07-18 22:32 Ken Matsui
  2023-07-19 18:48 ` Patrick Palka
  2023-07-19 19:32 ` [PATCH v2] " Ken Matsui
  0 siblings, 2 replies; 13+ messages in thread
From: Ken Matsui @ 2023-07-18 22:32 UTC (permalink / raw)
  To: gcc-patches; +Cc: libstdc++, Ken Matsui

This patch defines _GLIBCXX_HAS_BUILTIN_TRAIT, which will be used as a
flag to toggle built-in traits in the type_traits header. Through this
macro function and _GLIBCXX_NO_BUILTIN_TRAITS macro, we can switch the
use of built-in traits without needing to modify the source code.

libstdc++-v3/ChangeLog:

	* include/bits/c++config (_GLIBCXX_HAS_BUILTIN_TRAIT): Define.

Signed-off-by: Ken Matsui <kmatsui@gcc.gnu.org>
---
 libstdc++-v3/include/bits/c++config | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/libstdc++-v3/include/bits/c++config b/libstdc++-v3/include/bits/c++config
index dd47f274d5f..de13f61db71 100644
--- a/libstdc++-v3/include/bits/c++config
+++ b/libstdc++-v3/include/bits/c++config
@@ -854,7 +854,11 @@ namespace __gnu_cxx
 # define _GLIBCXX_HAVE_BUILTIN_LAUNDER 1
 #endif
 
-#undef _GLIBCXX_HAS_BUILTIN
+// Returns true if _GLIBCXX_NO_BUILTIN_TRAITS is not defined and the compiler
+// has a corresponding built-in type trait. _GLIBCXX_NO_BUILTIN_TRAITS is
+// defined to disable the use of built-in traits.
+#define _GLIBCXX_HAS_BUILTIN_TRAIT(BT)  \
+  (!defined(_GLIBCXX_NO_BUILTIN_TRAITS) && _GLIBCXX_HAS_BUILTIN(BT))
 
 // Mark code that should be ignored by the compiler, but seen by Doxygen.
 #define _GLIBCXX_DOXYGEN_ONLY(X)
-- 
2.41.0


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

end of thread, other threads:[~2023-09-11 14:59 UTC | newest]

Thread overview: 13+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-07-18 22:32 [PATCH] libstdc++: Define _GLIBCXX_HAS_BUILTIN_TRAIT 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
2023-09-11 14:50       ` Jonathan Wakely
2023-09-11 14:58         ` Ken Matsui

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