From f03858e51d91334e1645222fa40b1f6bd563fb61 Mon Sep 17 00:00:00 2001 From: Jonathan Wakely Date: Fri, 1 Dec 2017 16:10:25 +0000 Subject: [PATCH] Disable -Wliteral-suffix for standard UDLs * include/bits/basic_string.h (operator""s): Add pragmas to disable -Wliteral-suffix warnings. * include/experimental/string_view (operator""sv): Likewise. * include/std/chrono (operator""h, operator""min, operator""s) (operator""ms, operator""us, operator""ns): Likewise. * include/std/complex (operator""if, operator""i, operator""il): Likewise. * include/std/string_view (operator""sv): Likewise. * testsuite/20_util/duration/literals/range.cc: Adjust dg-error. From-SVN: r255320 --- libstdc++-v3/ChangeLog | 10 ++++++++++ libstdc++-v3/include/bits/basic_string.h | 3 +++ libstdc++-v3/include/experimental/string_view | 3 +++ libstdc++-v3/include/std/chrono | 5 ++++- libstdc++-v3/include/std/complex | 3 +++ libstdc++-v3/include/std/string_view | 3 +++ .../testsuite/20_util/duration/literals/range.cc | 2 +- 7 files changed, 27 insertions(+), 2 deletions(-) diff --git a/libstdc++-v3/ChangeLog b/libstdc++-v3/ChangeLog index d8308c3f6f4..14b65e3575e 100644 --- a/libstdc++-v3/ChangeLog +++ b/libstdc++-v3/ChangeLog @@ -1,5 +1,15 @@ 2017-12-01 Jonathan Wakely + * include/bits/basic_string.h (operator""s): Add pragmas to disable + -Wliteral-suffix warnings. + * include/experimental/string_view (operator""sv): Likewise. + * include/std/chrono (operator""h, operator""min, operator""s) + (operator""ms, operator""us, operator""ns): Likewise. + * include/std/complex (operator""if, operator""i, operator""il): + Likewise. + * include/std/string_view (operator""sv): Likewise. + * testsuite/20_util/duration/literals/range.cc: Adjust dg-error. + * include/bits/locale_facets_nonio.tcc (money_get::_M_extract): Add fallthrough comment. diff --git a/libstdc++-v3/include/bits/basic_string.h b/libstdc++-v3/include/bits/basic_string.h index a4b81137571..70373e7448a 100644 --- a/libstdc++-v3/include/bits/basic_string.h +++ b/libstdc++-v3/include/bits/basic_string.h @@ -6665,6 +6665,8 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION { inline namespace string_literals { +#pragma GCC diagnostic push +#pragma GCC diagnostic ignored "-Wliteral-suffix" _GLIBCXX_DEFAULT_ABI_TAG inline basic_string operator""s(const char* __str, size_t __len) @@ -6689,6 +6691,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION { return basic_string{__str, __len}; } #endif +#pragma GCC diagnostic pop } // inline namespace string_literals } // inline namespace literals diff --git a/libstdc++-v3/include/experimental/string_view b/libstdc++-v3/include/experimental/string_view index 8eaf9ec3d96..96d1f58f8e9 100644 --- a/libstdc++-v3/include/experimental/string_view +++ b/libstdc++-v3/include/experimental/string_view @@ -644,6 +644,8 @@ namespace experimental { inline namespace string_view_literals { +#pragma GCC diagnostic push +#pragma GCC diagnostic ignored "-Wliteral-suffix" inline constexpr basic_string_view operator""sv(const char* __str, size_t __len) noexcept { return basic_string_view{__str, __len}; } @@ -663,6 +665,7 @@ namespace experimental operator""sv(const char32_t* __str, size_t __len) noexcept { return basic_string_view{__str, __len}; } #endif +#pragma GCC diagnostic pop } // namespace string_literals } // namespace literals } // namespace experimental diff --git a/libstdc++-v3/include/std/chrono b/libstdc++-v3/include/std/chrono index 9491508e637..2419e82acce 100644 --- a/libstdc++-v3/include/std/chrono +++ b/libstdc++-v3/include/std/chrono @@ -884,6 +884,8 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION { inline namespace chrono_literals { +#pragma GCC diagnostic push +#pragma GCC diagnostic ignored "-Wliteral-suffix" template struct _Checked_integral_constant : integral_constant<_Rep, static_cast<_Rep>(_Val)> @@ -958,6 +960,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION operator""ns() { return __check_overflow(); } +#pragma GCC diagnostic pop } // inline namespace chrono_literals } // inline namespace literals @@ -966,7 +969,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION using namespace literals::chrono_literals; } // namespace chrono -#endif // __cplusplus > 201103L +#endif // C++14 // @} group chrono diff --git a/libstdc++-v3/include/std/complex b/libstdc++-v3/include/std/complex index bd8b09d84f0..61f8cc1fce3 100644 --- a/libstdc++-v3/include/std/complex +++ b/libstdc++-v3/include/std/complex @@ -1941,6 +1941,8 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION inline namespace literals { inline namespace complex_literals { +#pragma GCC diagnostic push +#pragma GCC diagnostic ignored "-Wliteral-suffix" #define __cpp_lib_complex_udls 201309 constexpr std::complex @@ -1967,6 +1969,7 @@ inline namespace complex_literals { operator""il(unsigned long long __num) { return std::complex{0.0L, static_cast(__num)}; } +#pragma GCC diagnostic pop } // inline namespace complex_literals } // inline namespace literals diff --git a/libstdc++-v3/include/std/string_view b/libstdc++-v3/include/std/string_view index 68b4b08f8f4..1266a07d04f 100644 --- a/libstdc++-v3/include/std/string_view +++ b/libstdc++-v3/include/std/string_view @@ -626,6 +626,8 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION { inline namespace string_view_literals { +#pragma GCC diagnostic push +#pragma GCC diagnostic ignored "-Wliteral-suffix" inline constexpr basic_string_view operator""sv(const char* __str, size_t __len) noexcept { return basic_string_view{__str, __len}; } @@ -645,6 +647,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION operator""sv(const char32_t* __str, size_t __len) noexcept { return basic_string_view{__str, __len}; } #endif +#pragma GCC diagnostic pop } // namespace string_literals } // namespace literals diff --git a/libstdc++-v3/testsuite/20_util/duration/literals/range.cc b/libstdc++-v3/testsuite/20_util/duration/literals/range.cc index c0d1a6e5885..20d82c5cdbe 100644 --- a/libstdc++-v3/testsuite/20_util/duration/literals/range.cc +++ b/libstdc++-v3/testsuite/20_util/duration/literals/range.cc @@ -26,6 +26,6 @@ test01() // std::numeric_limits::max() == 9223372036854775807; auto h = 9223372036854775808h; - // { dg-error "cannot be represented" "" { target *-*-* } 892 } + // { dg-error "cannot be represented" "" { target *-*-* } 894 } } // { dg-prune-output "in constexpr expansion" } // needed for -O0 -- 2.30.2