aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJonathan Wakely <jwakely@redhat.com>2022-12-12 11:22:45 +0000
committerJonathan Wakely <jwakely@redhat.com>2022-12-12 14:00:09 +0000
commitcb363fd9f19eb791e1ee1eb0d5c61f5fdf21af32 (patch)
tree0230783396b11e025cd0e4dccd63e1b0b8f88922
parent320ac807da125e6dc952b3d4abf02daeead88d44 (diff)
downloadgcc-cb363fd9f19eb791e1ee1eb0d5c61f5fdf21af32.zip
gcc-cb363fd9f19eb791e1ee1eb0d5c61f5fdf21af32.tar.gz
gcc-cb363fd9f19eb791e1ee1eb0d5c61f5fdf21af32.tar.bz2
libstdc++: Change names that clash with Win32 or Clang
Clang now defines an __is_unsigned built-in, and Windows defines an _Out_ macro. Replace uses of those as identifiers. There might also be a problem with __is_signed, which we use in several places. libstdc++-v3/ChangeLog: * include/std/chrono (hh_mm_ss): Rename __is_unsigned member to _S_is_unsigned. * include/std/format (basic_format_context): Rename _Out_ template parameter to _Out2. * testsuite/17_intro/names.cc: Add Windows SAL annotation macros.
-rw-r--r--libstdc++-v3/include/std/chrono6
-rw-r--r--libstdc++-v3/include/std/format8
-rw-r--r--libstdc++-v3/testsuite/17_intro/names.cc11
3 files changed, 18 insertions, 7 deletions
diff --git a/libstdc++-v3/include/std/chrono b/libstdc++-v3/include/std/chrono
index 38ecd31..4c5fbfa 100644
--- a/libstdc++-v3/include/std/chrono
+++ b/libstdc++-v3/include/std/chrono
@@ -2344,7 +2344,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
constexpr bool
is_negative() const noexcept
{
- if constexpr (!__is_unsigned)
+ if constexpr (!_S_is_unsigned)
return _M_is_neg;
else
return false;
@@ -2373,7 +2373,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
constexpr precision
to_duration() const noexcept
{
- if constexpr (!__is_unsigned)
+ if constexpr (!_S_is_unsigned)
if (_M_is_neg)
return -(_M_h + _M_m + _M_s + subseconds());
return _M_h + _M_m + _M_s + subseconds();
@@ -2382,7 +2382,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
// TODO: Implement operator<<.
private:
- static constexpr bool __is_unsigned
+ static constexpr bool _S_is_unsigned
= __and_v<is_integral<typename _Duration::rep>,
is_unsigned<typename _Duration::rep>>;
diff --git a/libstdc++-v3/include/std/format b/libstdc++-v3/include/std/format
index 1072e2c..269f8f6 100644
--- a/libstdc++-v3/include/std/format
+++ b/libstdc++-v3/include/std/format
@@ -3345,10 +3345,10 @@ namespace __format
: _M_args(__args), _M_out(std::move(__out)), _M_loc(__loc)
{ }
- template<typename _Out_, typename _CharT_, typename _Context_>
- friend _Out_
- __format::__do_vformat_to(_Out_, basic_string_view<_CharT_>,
- const basic_format_args<_Context_>&,
+ template<typename _Out2, typename _CharT2, typename _Context2>
+ friend _Out2
+ __format::__do_vformat_to(_Out2, basic_string_view<_CharT2>,
+ const basic_format_args<_Context2>&,
const locale*);
public:
diff --git a/libstdc++-v3/testsuite/17_intro/names.cc b/libstdc++-v3/testsuite/17_intro/names.cc
index 963f74c..16c104a 100644
--- a/libstdc++-v3/testsuite/17_intro/names.cc
+++ b/libstdc++-v3/testsuite/17_intro/names.cc
@@ -205,6 +205,17 @@
#define ValueT ValueT is not a reserved name
#define ValueType ValueType is not a reserved name
+#ifndef _WIN32
+// Windows SAL annotations
+#define _In_ cannot be used as an identifier
+#define _Inout_ cannot be used as an identifier
+#define _Out_ cannot be used as an identifier
+#define _Reserved_ cannot be used as an identifier
+#define __inout cannot be used as an identifier
+#define __in_opt cannot be used as an identifier
+#define __out_opt cannot be used as an identifier
+#endif
+
#ifdef _AIX
// See https://gcc.gnu.org/ml/libstdc++/2017-03/msg00015.html
#undef f