[libcxx-commits] [libcxx] bd03e0c - [libc++][NFC] Suppress -Wdeprecated-literal-operator

Po-yao Chang via libcxx-commits libcxx-commits at lists.llvm.org
Thu Jul 13 15:53:37 PDT 2023


Author: Po-yao Chang
Date: 2023-07-14T06:52:39+08:00
New Revision: bd03e0ca75727c6058cb34655b64301f0f9cfb32

URL: https://github.com/llvm/llvm-project/commit/bd03e0ca75727c6058cb34655b64301f0f9cfb32
DIFF: https://github.com/llvm/llvm-project/commit/bd03e0ca75727c6058cb34655b64301f0f9cfb32.diff

LOG: [libc++][NFC] Suppress -Wdeprecated-literal-operator

Remove spaces between operator"" and identifier to suppress
-Wdeprecated-literal-operator, and between operator and ""
like how they are written in [string.view.literals] and [basic.string.literals].

Differential Revision: https://reviews.llvm.org/D155200

Added: 
    

Modified: 
    libcxx/include/string
    libcxx/include/string_view
    libcxx/modules/std/string_view.cppm

Removed: 
    


################################################################################
diff  --git a/libcxx/include/string b/libcxx/include/string
index e8fbd1f871d5fb..69dcc8ea92e327 100644
--- a/libcxx/include/string
+++ b/libcxx/include/string
@@ -554,11 +554,11 @@ template <> struct hash<u16string>;
 template <> struct hash<u32string>;
 template <> struct hash<wstring>;
 
-basic_string<char>     operator "" s( const char *str,     size_t len );           // C++14, constexpr since C++20
-basic_string<wchar_t>  operator "" s( const wchar_t *str,  size_t len );           // C++14, constexpr since C++20
-constexpr basic_string<char8_t>  operator "" s( const char8_t *str,  size_t len ); // C++20
-basic_string<char16_t> operator "" s( const char16_t *str, size_t len );           // C++14, constexpr since C++20
-basic_string<char32_t> operator "" s( const char32_t *str, size_t len );           // C++14, constexpr since C++20
+basic_string<char>     operator""s( const char *str,     size_t len );           // C++14, constexpr since C++20
+basic_string<wchar_t>  operator""s( const wchar_t *str,  size_t len );           // C++14, constexpr since C++20
+constexpr basic_string<char8_t>  operator""s( const char8_t *str,  size_t len ); // C++20
+basic_string<char16_t> operator""s( const char16_t *str, size_t len );           // C++14, constexpr since C++20
+basic_string<char32_t> operator""s( const char32_t *str, size_t len );           // C++14, constexpr since C++20
 
 }  // std
 
@@ -4371,14 +4371,14 @@ inline namespace literals
   inline namespace string_literals
   {
     inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20
-    basic_string<char> operator "" s( const char *__str, size_t __len )
+    basic_string<char> operator""s( const char *__str, size_t __len )
     {
         return basic_string<char> (__str, __len);
     }
 
 #ifndef _LIBCPP_HAS_NO_WIDE_CHARACTERS
     inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20
-    basic_string<wchar_t> operator "" s( const wchar_t *__str, size_t __len )
+    basic_string<wchar_t> operator""s( const wchar_t *__str, size_t __len )
     {
         return basic_string<wchar_t> (__str, __len);
     }
@@ -4386,20 +4386,20 @@ inline namespace literals
 
 #ifndef _LIBCPP_HAS_NO_CHAR8_T
     inline _LIBCPP_HIDE_FROM_ABI constexpr
-    basic_string<char8_t> operator "" s(const char8_t *__str, size_t __len)
+    basic_string<char8_t> operator""s(const char8_t *__str, size_t __len)
     {
         return basic_string<char8_t> (__str, __len);
     }
 #endif
 
     inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20
-    basic_string<char16_t> operator "" s( const char16_t *__str, size_t __len )
+    basic_string<char16_t> operator""s( const char16_t *__str, size_t __len )
     {
         return basic_string<char16_t> (__str, __len);
     }
 
     inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20
-    basic_string<char32_t> operator "" s( const char32_t *__str, size_t __len )
+    basic_string<char32_t> operator""s( const char32_t *__str, size_t __len )
     {
         return basic_string<char32_t> (__str, __len);
     }

diff  --git a/libcxx/include/string_view b/libcxx/include/string_view
index 7d0edb8fca4244..2d00a4e0123660 100644
--- a/libcxx/include/string_view
+++ b/libcxx/include/string_view
@@ -191,11 +191,11 @@ namespace std {
   template <> struct hash<u32string_view>;
   template <> struct hash<wstring_view>;
 
-  constexpr basic_string_view<char>     operator "" sv(const char *str,     size_t len) noexcept;
-  constexpr basic_string_view<wchar_t>  operator "" sv(const wchar_t *str,  size_t len) noexcept;
-  constexpr basic_string_view<char8_t>  operator "" sv(const char8_t *str,  size_t len) noexcept; // C++20
-  constexpr basic_string_view<char16_t> operator "" sv(const char16_t *str, size_t len) noexcept;
-  constexpr basic_string_view<char32_t> operator "" sv(const char32_t *str, size_t len) noexcept;
+  constexpr basic_string_view<char>     operator""sv(const char *str,     size_t len) noexcept;
+  constexpr basic_string_view<wchar_t>  operator""sv(const wchar_t *str,  size_t len) noexcept;
+  constexpr basic_string_view<char8_t>  operator""sv(const char8_t *str,  size_t len) noexcept; // C++20
+  constexpr basic_string_view<char16_t> operator""sv(const char16_t *str, size_t len) noexcept;
+  constexpr basic_string_view<char32_t> operator""sv(const char32_t *str, size_t len) noexcept;
 
 }  // namespace std
 
@@ -1015,14 +1015,14 @@ inline namespace literals
   inline namespace string_view_literals
   {
     inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR
-    basic_string_view<char> operator "" sv(const char *__str, size_t __len) _NOEXCEPT
+    basic_string_view<char> operator""sv(const char *__str, size_t __len) _NOEXCEPT
     {
         return basic_string_view<char> (__str, __len);
     }
 
 #ifndef _LIBCPP_HAS_NO_WIDE_CHARACTERS
     inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR
-    basic_string_view<wchar_t> operator "" sv(const wchar_t *__str, size_t __len) _NOEXCEPT
+    basic_string_view<wchar_t> operator""sv(const wchar_t *__str, size_t __len) _NOEXCEPT
     {
         return basic_string_view<wchar_t> (__str, __len);
     }
@@ -1030,20 +1030,20 @@ inline namespace literals
 
 #ifndef _LIBCPP_HAS_NO_CHAR8_T
     inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR
-    basic_string_view<char8_t> operator "" sv(const char8_t *__str, size_t __len) _NOEXCEPT
+    basic_string_view<char8_t> operator""sv(const char8_t *__str, size_t __len) _NOEXCEPT
     {
         return basic_string_view<char8_t> (__str, __len);
     }
 #endif
 
     inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR
-    basic_string_view<char16_t> operator "" sv(const char16_t *__str, size_t __len) _NOEXCEPT
+    basic_string_view<char16_t> operator""sv(const char16_t *__str, size_t __len) _NOEXCEPT
     {
         return basic_string_view<char16_t> (__str, __len);
     }
 
     inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR
-    basic_string_view<char32_t> operator "" sv(const char32_t *__str, size_t __len) _NOEXCEPT
+    basic_string_view<char32_t> operator""sv(const char32_t *__str, size_t __len) _NOEXCEPT
     {
         return basic_string_view<char32_t> (__str, __len);
     }

diff  --git a/libcxx/modules/std/string_view.cppm b/libcxx/modules/std/string_view.cppm
index c81d2f75689282..ac90006797dacd 100644
--- a/libcxx/modules/std/string_view.cppm
+++ b/libcxx/modules/std/string_view.cppm
@@ -42,7 +42,7 @@ export namespace std {
   inline namespace literals {
     inline namespace string_view_literals {
       // [string.view.literals], suffix for basic_string_view literals
-      using std::literals::string_view_literals::operator"" sv;
+      using std::literals::string_view_literals::operator""sv;
     } // namespace string_view_literals
   }   // namespace literals
 } // namespace std


        


More information about the libcxx-commits mailing list