This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [PATCH 0/4]: C++ P1423R3 char8_t remediation implementation


On 15/09/19 15:39 -0400, Tom Honermann wrote:
This series of patches provides an implementation of the changes for C++ proposal P1423R3 [1].

These changes do not impact default libstdc++ behavior for C++17 and earlier; they are only active for C++2a or when the -fchar8_t option is specified.

Tested x86_64-linux.

Patch 1: Decouple constraints for u8path from path constructors.
Patch 2: Update __cpp_lib_char8_t feature test macro value, add deleted operators, update u8path.
Patch 3: Updates to existing tests.
Patch 4: New tests.

Tom.

[1]: http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2019/p1423r3.html

It took a while, but I've committed these four patches, with just some
minor whitespace changes and changelog tweaks.

I'm also following it up with this patch, which corrects some
pre-existing problems that got worse with the new deleted operator<<
overloads.

Tested powerpc64le-linux, committed to trunk.


commit 81c954850d8422eaeefe3c9e833b75f8dbeb905f
Author: Jonathan Wakely <jwakely@redhat.com>
Date:   Fri Nov 29 17:15:25 2019 +0000

    libstdc++: Adjust some function templates for coding conventions
    
            * include/bits/fs_path.h (path::operator/=): Change template-head to
            use typename instead of class.
            * include/experimental/bits/fs_path.h (path::operator/=): Likewise.
            * include/std/ostream (operator<<): Likewise.

diff --git a/libstdc++-v3/include/bits/fs_path.h b/libstdc++-v3/include/bits/fs_path.h
index 643478292cd..b129372447b 100644
--- a/libstdc++-v3/include/bits/fs_path.h
+++ b/libstdc++-v3/include/bits/fs_path.h
@@ -272,7 +272,7 @@ namespace __detail
 
     path& operator/=(const path& __p);
 
-    template <class _Source>
+    template<typename _Source>
       __detail::_Path<_Source>&
       operator/=(_Source const& __source)
       {
diff --git a/libstdc++-v3/include/experimental/bits/fs_path.h b/libstdc++-v3/include/experimental/bits/fs_path.h
index b924fbfd5f6..91202e5b008 100644
--- a/libstdc++-v3/include/experimental/bits/fs_path.h
+++ b/libstdc++-v3/include/experimental/bits/fs_path.h
@@ -278,7 +278,7 @@ namespace __detail
 
     path& operator/=(const path& __p) { return _M_append(__p._M_pathname); }
 
-    template <class _Source>
+    template<typename _Source>
       __detail::_Path<_Source>&
       operator/=(_Source const& __source)
       { return append(__source); }
diff --git a/libstdc++-v3/include/std/ostream b/libstdc++-v3/include/std/ostream
index 771c28db7b7..895e4d7ab4e 100644
--- a/libstdc++-v3/include/std/ostream
+++ b/libstdc++-v3/include/std/ostream
@@ -512,18 +512,18 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
     { return (__out << __out.widen(__c)); }
 
   // Specialization
-  template <class _Traits>
+  template<typename _Traits>
     inline basic_ostream<char, _Traits>&
     operator<<(basic_ostream<char, _Traits>& __out, char __c)
     { return __ostream_insert(__out, &__c, 1); }
 
   // Signed and unsigned
-  template<class _Traits>
+  template<typename _Traits>
     inline basic_ostream<char, _Traits>&
     operator<<(basic_ostream<char, _Traits>& __out, signed char __c)
     { return (__out << static_cast<char>(__c)); }
 
-  template<class _Traits>
+  template<typename _Traits>
     inline basic_ostream<char, _Traits>&
     operator<<(basic_ostream<char, _Traits>& __out, unsigned char __c)
     { return (__out << static_cast<char>(__c)); }
@@ -533,37 +533,37 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
   // numeric values.
 
 #ifdef _GLIBCXX_USE_WCHAR_T
-  template<class _Traits>
+  template<typename _Traits>
     basic_ostream<char, _Traits>&
     operator<<(basic_ostream<char, _Traits>&, wchar_t) = delete;
 #endif // _GLIBCXX_USE_WCHAR_T
 
 #ifdef _GLIBCXX_USE_CHAR8_T
-  template<class _Traits>
+  template<typename _Traits>
     basic_ostream<char, _Traits>&
     operator<<(basic_ostream<char, _Traits>&, char8_t) = delete;
 #endif
 
-  template<class _Traits>
+  template<typename _Traits>
     basic_ostream<char, _Traits>&
     operator<<(basic_ostream<char, _Traits>&, char16_t) = delete;
 
-  template<class _Traits>
+  template<typename _Traits>
     basic_ostream<char, _Traits>&
     operator<<(basic_ostream<char, _Traits>&, char32_t) = delete;
 
 #ifdef _GLIBCXX_USE_WCHAR_T
 #ifdef _GLIBCXX_USE_CHAR8_T
-  template<class _Traits>
+  template<typename _Traits>
     basic_ostream<wchar_t, _Traits>&
     operator<<(basic_ostream<wchar_t, _Traits>&, char8_t) = delete;
 #endif // _GLIBCXX_USE_CHAR8_T
 
-  template<class _Traits>
+  template<typename _Traits>
     basic_ostream<wchar_t, _Traits>&
     operator<<(basic_ostream<wchar_t, _Traits>&, char16_t) = delete;
 
-  template<class _Traits>
+  template<typename _Traits>
     basic_ostream<wchar_t, _Traits>&
     operator<<(basic_ostream<wchar_t, _Traits>&, char32_t) = delete;
 #endif // _GLIBCXX_USE_WCHAR_T
@@ -601,7 +601,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
     operator<<(basic_ostream<_CharT, _Traits>& __out, const char* __s);
 
   // Partial specializations
-  template<class _Traits>
+  template<typename _Traits>
     inline basic_ostream<char, _Traits>&
     operator<<(basic_ostream<char, _Traits>& __out, const char* __s)
     {
@@ -614,12 +614,12 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
     }
 
   // Signed and unsigned
-  template<class _Traits>
+  template<typename _Traits>
     inline basic_ostream<char, _Traits>&
     operator<<(basic_ostream<char, _Traits>& __out, const signed char* __s)
     { return (__out << reinterpret_cast<const char*>(__s)); }
 
-  template<class _Traits>
+  template<typename _Traits>
     inline basic_ostream<char, _Traits> &
     operator<<(basic_ostream<char, _Traits>& __out, const unsigned char* __s)
     { return (__out << reinterpret_cast<const char*>(__s)); }
@@ -629,37 +629,37 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
    // pointer values.
 
 #ifdef _GLIBCXX_USE_WCHAR_T
-  template<class _Traits>
+  template<typename _Traits>
     basic_ostream<char, _Traits>&
     operator<<(basic_ostream<char, _Traits>&, const wchar_t*) = delete;
 #endif // _GLIBCXX_USE_WCHAR_T
 
 #ifdef _GLIBCXX_USE_CHAR8_T
-  template<class _Traits>
+  template<typename _Traits>
     basic_ostream<char, _Traits>&
     operator<<(basic_ostream<char, _Traits>&, const char8_t*) = delete;
 #endif // _GLIBCXX_USE_CHAR8_T
 
-  template<class _Traits>
+  template<typename _Traits>
     basic_ostream<char, _Traits>&
     operator<<(basic_ostream<char, _Traits>&, const char16_t*) = delete;
 
-  template<class _Traits>
+  template<typename _Traits>
     basic_ostream<char, _Traits>&
     operator<<(basic_ostream<char, _Traits>&, const char32_t*) = delete;
 
 #ifdef _GLIBCXX_USE_WCHAR_T
 #ifdef _GLIBCXX_USE_CHAR8_T
-  template<class _Traits>
+  template<typename _Traits>
     basic_ostream<wchar_t, _Traits>&
     operator<<(basic_ostream<wchar_t, _Traits>&, const char8_t*) = delete;
 #endif
 
-  template<class _Traits>
+  template<typename _Traits>
     basic_ostream<wchar_t, _Traits>&
     operator<<(basic_ostream<wchar_t, _Traits>&, const char16_t*) = delete;
 
-  template<class _Traits>
+  template<typename _Traits>
     basic_ostream<wchar_t, _Traits>&
     operator<<(basic_ostream<wchar_t, _Traits>&, const char32_t*) = delete;
 #endif // _GLIBCXX_USE_WCHAR_T

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]