[PATCH] D41064: Suppress -Wuser-defined-literals for <string> and <string_view>
Dimitry Andric via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Mon Dec 11 10:11:57 PST 2017
dim updated this revision to Diff 126397.
dim added a comment.
Updated to also include <chrono> and <complex>. I think all cases are
covered now.
Repository:
rCXX libc++
https://reviews.llvm.org/D41064
Files:
include/chrono
include/complex
include/string
include/string_view
Index: include/string_view
===================================================================
--- include/string_view
+++ include/string_view
@@ -792,6 +792,10 @@
{
inline namespace string_view_literals
{
+#if defined(__clang__)
+#pragma clang diagnostic push
+#pragma clang diagnostic ignored "-Wuser-defined-literals"
+#endif
inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR
basic_string_view<char> operator "" sv(const char *__str, size_t __len) _NOEXCEPT
{
@@ -815,6 +819,9 @@
{
return basic_string_view<char32_t> (__str, __len);
}
+#if defined(__clang__)
+#pragma clang diagnostic pop
+#endif
}
}
#endif
Index: include/string
===================================================================
--- include/string
+++ include/string
@@ -4042,6 +4042,10 @@
{
inline namespace string_literals
{
+#if defined(__clang__)
+#pragma clang diagnostic push
+#pragma clang diagnostic ignored "-Wuser-defined-literals"
+#endif
inline _LIBCPP_INLINE_VISIBILITY
basic_string<char> operator "" s( const char *__str, size_t __len )
{
@@ -4065,6 +4069,9 @@
{
return basic_string<char32_t> (__str, __len);
}
+#if defined(__clang__)
+#pragma clang diagnostic pop
+#endif
}
}
#endif
Index: include/complex
===================================================================
--- include/complex
+++ include/complex
@@ -1444,6 +1444,10 @@
{
inline namespace complex_literals
{
+#if defined(__clang__)
+#pragma clang diagnostic push
+#pragma clang diagnostic ignored "-Wuser-defined-literals"
+#endif
constexpr complex<long double> operator""il(long double __im)
{
return { 0.0l, __im };
@@ -1475,6 +1479,9 @@
{
return { 0.0f, static_cast<float>(__im) };
}
+#if defined(__clang__)
+#pragma clang diagnostic pop
+#endif
}
}
#endif
Index: include/chrono
===================================================================
--- include/chrono
+++ include/chrono
@@ -1086,6 +1086,10 @@
{
inline namespace chrono_literals
{
+#if defined(__clang__)
+#pragma clang diagnostic push
+#pragma clang diagnostic ignored "-Wuser-defined-literals"
+#endif
constexpr chrono::hours operator""h(unsigned long long __h)
{
@@ -1152,6 +1156,9 @@
return chrono::duration<long double, nano> (__ns);
}
+#if defined(__clang__)
+#pragma clang diagnostic pop
+#endif
}}
namespace chrono { // hoist the literals into namespace std::chrono
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D41064.126397.patch
Type: text/x-patch
Size: 2479 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20171211/4921b240/attachment.bin>
More information about the cfe-commits
mailing list