Skip to content

Remove cause of "whitespace in literal operator" warning in Clang 20 #61

New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Conversation

striezel
Copy link
Contributor

When string-view lite is compiled with Clang 20, it emits the following deprecation warnings:

/__w/string-view-lite/string-view-lite/include/nonstd/string_view.hpp:1539:57: warning: identifier '_sv' preceded by whitespace in a literal operator declaration is deprecated [-Wdeprecated-literal-operator]
 1539 | nssv_constexpr nonstd::sv_lite::string_view operator "" _sv( const char* str, size_t len ) nssv_noexcept  // (1)
      |                                             ~~~~~~~~~~~~^~~
      |                                             operator""_sv
/__w/string-view-lite/string-view-lite/include/nonstd/string_view.hpp:1544:60: warning: identifier '_sv' preceded by whitespace in a literal operator declaration is deprecated [-Wdeprecated-literal-operator]
 1544 | nssv_constexpr nonstd::sv_lite::u16string_view operator "" _sv( const char16_t* str, size_t len ) nssv_noexcept  // (2)
      |                                                ~~~~~~~~~~~~^~~
      |                                                operator""_sv
/__w/string-view-lite/string-view-lite/include/nonstd/string_view.hpp:1549:60: warning: identifier '_sv' preceded by whitespace in a literal operator declaration is deprecated [-Wdeprecated-literal-operator]
 1549 | nssv_constexpr nonstd::sv_lite::u32string_view operator "" _sv( const char32_t* str, size_t len ) nssv_noexcept  // (3)
      |                                                ~~~~~~~~~~~~^~~
      |                                                operator""_sv
/__w/string-view-lite/string-view-lite/include/nonstd/string_view.hpp:1554:58: warning: identifier '_sv' preceded by whitespace in a literal operator declaration is deprecated [-Wdeprecated-literal-operator]
 1554 | nssv_constexpr nonstd::sv_lite::wstring_view operator "" _sv( const wchar_t* str, size_t len ) nssv_noexcept  // (4)
      |                                              ~~~~~~~~~~~~^~~
      |                                              operator""_sv

An example of that can be seen in this workflow run in the "Build tests" step.

To fix that problem the space characters in the literal operator declarations are removed.

When string-view lite is compiled with Clang 20, it emits the
following deprecation warnings:

    /__w/string-view-lite/string-view-lite/include/nonstd/string_view.hpp:1539:57: warning: identifier '_sv' preceded by whitespace in a literal operator declaration is deprecated [-Wdeprecated-literal-operator]
     1539 | nssv_constexpr nonstd::sv_lite::string_view operator "" _sv( const char* str, size_t len ) nssv_noexcept  // (1)
          |                                             ~~~~~~~~~~~~^~~
          |                                             operator""_sv
    /__w/string-view-lite/string-view-lite/include/nonstd/string_view.hpp:1544:60: warning: identifier '_sv' preceded by whitespace in a literal operator declaration is deprecated [-Wdeprecated-literal-operator]
     1544 | nssv_constexpr nonstd::sv_lite::u16string_view operator "" _sv( const char16_t* str, size_t len ) nssv_noexcept  // (2)
          |                                                ~~~~~~~~~~~~^~~
          |                                                operator""_sv
    /__w/string-view-lite/string-view-lite/include/nonstd/string_view.hpp:1549:60: warning: identifier '_sv' preceded by whitespace in a literal operator declaration is deprecated [-Wdeprecated-literal-operator]
     1549 | nssv_constexpr nonstd::sv_lite::u32string_view operator "" _sv( const char32_t* str, size_t len ) nssv_noexcept  // (3)
          |                                                ~~~~~~~~~~~~^~~
          |                                                operator""_sv
    /__w/string-view-lite/string-view-lite/include/nonstd/string_view.hpp:1554:58: warning: identifier '_sv' preceded by whitespace in a literal operator declaration is deprecated [-Wdeprecated-literal-operator]
     1554 | nssv_constexpr nonstd::sv_lite::wstring_view operator "" _sv( const wchar_t* str, size_t len ) nssv_noexcept  // (4)
          |                                              ~~~~~~~~~~~~^~~
          |                                              operator""_sv

To fix that problem the space characters in the literal operator declarations are removed.
@martinmoene martinmoene merged commit d46fe4d into martinmoene:master Mar 24, 2025
8 checks passed
@striezel striezel deleted the deprecated-literal-warnings-clang-20 branch March 25, 2025 15:53
# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants