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
This commit is contained in:
Jonathan Wakely 2017-12-01 16:10:25 +00:00 committed by Jonathan Wakely
parent f9dcf14aae
commit f03858e51d
7 changed files with 27 additions and 2 deletions

View file

@ -1,5 +1,15 @@
2017-12-01 Jonathan Wakely <jwakely@redhat.com>
* 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.

View file

@ -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<char>
operator""s(const char* __str, size_t __len)
@ -6689,6 +6691,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
{ return basic_string<char32_t>{__str, __len}; }
#endif
#pragma GCC diagnostic pop
} // inline namespace string_literals
} // inline namespace literals

View file

@ -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<char>
operator""sv(const char* __str, size_t __len) noexcept
{ return basic_string_view<char>{__str, __len}; }
@ -663,6 +665,7 @@ namespace experimental
operator""sv(const char32_t* __str, size_t __len) noexcept
{ return basic_string_view<char32_t>{__str, __len}; }
#endif
#pragma GCC diagnostic pop
} // namespace string_literals
} // namespace literals
} // namespace experimental

View file

@ -884,6 +884,8 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
{
inline namespace chrono_literals
{
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wliteral-suffix"
template<typename _Rep, unsigned long long _Val>
struct _Checked_integral_constant
: integral_constant<_Rep, static_cast<_Rep>(_Val)>
@ -958,6 +960,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
operator""ns()
{ return __check_overflow<chrono::nanoseconds, _Digits...>(); }
#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

View file

@ -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<float>
@ -1967,6 +1969,7 @@ inline namespace complex_literals {
operator""il(unsigned long long __num)
{ return std::complex<long double>{0.0L, static_cast<long double>(__num)}; }
#pragma GCC diagnostic pop
} // inline namespace complex_literals
} // inline namespace literals

View file

@ -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<char>
operator""sv(const char* __str, size_t __len) noexcept
{ return basic_string_view<char>{__str, __len}; }
@ -645,6 +647,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
operator""sv(const char32_t* __str, size_t __len) noexcept
{ return basic_string_view<char32_t>{__str, __len}; }
#endif
#pragma GCC diagnostic pop
} // namespace string_literals
} // namespace literals

View file

@ -26,6 +26,6 @@ test01()
// std::numeric_limits<int64_t>::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