]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
libstdc++: Define INSTANTIATE_FACET_ACCESSORS macro in compat source [PR103755]
authorJonathan Wakely <jwakely@redhat.com>
Fri, 11 Nov 2022 22:36:01 +0000 (22:36 +0000)
committerJonathan Wakely <jwakely@redhat.com>
Sat, 12 Nov 2022 01:29:46 +0000 (01:29 +0000)
compatibility-ldbl-alt128.cc re-includes locale-inst-numeric.h and
locale-inst-monetary.h but wasn't defining the macros added in
r13-3888-gb3ac43a3c05744.

Put those macros in a new internal header that can be included everywhere
they're used.

libstdc++-v3/ChangeLog:

PR libstdc++/103755
* src/c++11/locale-inst-monetary.h: Include new header.
* src/c++11/locale-inst-numeric.h: Likewise.
* src/c++11/locale-inst.cc: Likewise.
(INSTANTIATE_USE_FACET, INSTANTIATE_FACET_ACCESSORS): Move
macro definitions to ...
* src/c++11/facet_inst_macros.h: New file.

libstdc++-v3/src/c++11/facet_inst_macros.h [new file with mode: 0644]
libstdc++-v3/src/c++11/locale-inst-monetary.h
libstdc++-v3/src/c++11/locale-inst-numeric.h
libstdc++-v3/src/c++11/locale-inst.cc

diff --git a/libstdc++-v3/src/c++11/facet_inst_macros.h b/libstdc++-v3/src/c++11/facet_inst_macros.h
new file mode 100644 (file)
index 0000000..e0a07b1
--- /dev/null
@@ -0,0 +1,17 @@
+#ifndef _FACET_INST_MACROS_H
+#define _FACET_INST_MACROS_H
+
+// These macros are used for explicit instantiation definitions in src/c++11/
+
+#define INSTANTIATE_USE_FACET(...)                         \
+  template const __VA_ARGS__*                              \
+    __try_use_facet< __VA_ARGS__ >(const locale&) noexcept; \
+  template const __VA_ARGS__&                              \
+    use_facet<__VA_ARGS__>(const locale&)
+
+#define INSTANTIATE_FACET_ACCESSORS(...)                   \
+  INSTANTIATE_USE_FACET(__VA_ARGS__);                      \
+  template bool                                                    \
+    has_facet<__VA_ARGS__>(const locale&) noexcept
+
+#endif // _FACET_INST_MACROS_H
index ff8439857d2e8985dd2355c95af0e64d51058e66..26b1e33d3a7387e5e12f8408e531c0d03cd4cda7 100644 (file)
@@ -26,6 +26,8 @@
 #define "This file should not be compiled directly, only included"
 #endif
 
+#include "facet_inst_macros.h"
+
 // This header is included multiple times, to instantiate these symbols
 // for char/wchar_t and for both std::string ABIs,
 // and (depending on the target) for two long double formats.
index 4b970f75f6ef3b76607fc3a5a31922caa21be6cf..18514e892afe0846cbaa60470f79b617b82e653d 100644 (file)
@@ -26,6 +26,8 @@
 #define "This file should not be compiled directly, only included"
 #endif
 
+#include "facet_inst_macros.h"
+
 namespace std _GLIBCXX_VISIBILITY(default)
 {
 #if ! _GLIBCXX_USE_CXX11_ABI
index b264cb381ec1987abaf0a40e48dddc5eee8028a0..6767da74b741ce392ec247f5c39a474ba1a5f59d 100644 (file)
 # define C_is_char
 #endif
 
-#define INSTANTIATE_USE_FACET(...)                         \
-  template const __VA_ARGS__*                              \
-    __try_use_facet< __VA_ARGS__ >(const locale&) noexcept; \
-  template const __VA_ARGS__&                              \
-    use_facet<__VA_ARGS__>(const locale&)                  \
-
-#define INSTANTIATE_FACET_ACCESSORS(...)                   \
-  INSTANTIATE_USE_FACET(__VA_ARGS__);                      \
-  template bool                                                    \
-    has_facet<__VA_ARGS__>(const locale&) noexcept
-
 #include "locale-inst-numeric.h"
 #include "locale-inst-monetary.h"
+#include "facet_inst_macros.h"
 
 namespace std _GLIBCXX_VISIBILITY(default)
 {