[libcxx-commits] [PATCH] D120684: [libc++] Define _LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER whenever we enable warnings in the test suite

Louis Dionne via Phabricator via libcxx-commits libcxx-commits at lists.llvm.org
Tue Mar 1 08:10:57 PST 2022


ldionne updated this revision to Diff 412116.
ldionne added a comment.

Fix GCC warnings


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D120684/new/

https://reviews.llvm.org/D120684

Files:
  libcxx/include/__chrono/duration.h
  libcxx/include/string
  libcxx/include/string_view
  libcxx/utils/libcxx/test/features.py
  libcxx/utils/libcxx/test/params.py


Index: libcxx/utils/libcxx/test/params.py
===================================================================
--- libcxx/utils/libcxx/test/params.py
+++ libcxx/utils/libcxx/test/params.py
@@ -117,9 +117,10 @@
 
   Parameter(name='enable_warnings', choices=[True, False], type=bool, default=True,
             help="Whether to enable warnings when compiling the test suite.",
-            actions=lambda warnings: [] if not warnings else [
-              AddOptionalWarningFlag(w) for w in _warningFlags
-            ]),
+            actions=lambda warnings: [] if not warnings else
+              [AddOptionalWarningFlag(w) for w in _warningFlags] +
+              [AddCompileFlag('-D_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER')]
+            ),
 
   Parameter(name='debug_level', choices=['', '0', '1'], type=str, default='',
             help="The debugging level to enable in the test suite.",
Index: libcxx/utils/libcxx/test/features.py
===================================================================
--- libcxx/utils/libcxx/test/features.py
+++ libcxx/utils/libcxx/test/features.py
@@ -103,8 +103,7 @@
   Feature(name=lambda cfg: 'apple-clang-{__clang_major__}.{__clang_minor__}'.format(**compilerMacros(cfg)),                        when=_isAppleClang),
   Feature(name=lambda cfg: 'apple-clang-{__clang_major__}.{__clang_minor__}.{__clang_patchlevel__}'.format(**compilerMacros(cfg)), when=_isAppleClang),
 
-  Feature(name='clang',                                                                                                            when=_isClang,
-          actions=[AddCompileFlag('-D_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER')]),
+  Feature(name='clang',                                                                                                            when=_isClang),
   Feature(name=lambda cfg: 'clang-{__clang_major__}'.format(**compilerMacros(cfg)),                                                when=_isClang),
   Feature(name=lambda cfg: 'clang-{__clang_major__}.{__clang_minor__}'.format(**compilerMacros(cfg)),                              when=_isClang),
   Feature(name=lambda cfg: 'clang-{__clang_major__}.{__clang_minor__}.{__clang_patchlevel__}'.format(**compilerMacros(cfg)),       when=_isClang),
Index: libcxx/include/string_view
===================================================================
--- libcxx/include/string_view
+++ libcxx/include/string_view
@@ -914,6 +914,9 @@
 {
   inline namespace string_view_literals
   {
+    _LIBCPP_DIAGNOSTIC_PUSH
+    _LIBCPP_CLANG_DIAGNOSTIC_IGNORED("-Wliteral-suffix")
+    _LIBCPP_GCC_DIAGNOSTIC_IGNORED("-Wliteral-suffix")
     inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR
     basic_string_view<char> operator "" sv(const char *__str, size_t __len) _NOEXCEPT
     {
@@ -947,6 +950,7 @@
     {
         return basic_string_view<char32_t> (__str, __len);
     }
+    _LIBCPP_DIAGNOSTIC_POP
   } // namespace string_view_literals
 } // namespace literals
 #endif
Index: libcxx/include/string
===================================================================
--- libcxx/include/string
+++ libcxx/include/string
@@ -4452,6 +4452,9 @@
 {
   inline namespace string_literals
   {
+    _LIBCPP_DIAGNOSTIC_PUSH
+    _LIBCPP_CLANG_DIAGNOSTIC_IGNORED("-Wliteral-suffix")
+    _LIBCPP_GCC_DIAGNOSTIC_IGNORED("-Wliteral-suffix")
     inline _LIBCPP_INLINE_VISIBILITY
     basic_string<char> operator "" s( const char *__str, size_t __len )
     {
@@ -4485,6 +4488,7 @@
     {
         return basic_string<char32_t> (__str, __len);
     }
+    _LIBCPP_DIAGNOSTIC_POP
   } // namespace string_literals
 } // namespace literals
 #endif
Index: libcxx/include/__chrono/duration.h
===================================================================
--- libcxx/include/__chrono/duration.h
+++ libcxx/include/__chrono/duration.h
@@ -534,6 +534,9 @@
   inline namespace chrono_literals
   {
 
+    _LIBCPP_DIAGNOSTIC_PUSH
+    _LIBCPP_CLANG_DIAGNOSTIC_IGNORED("-Wliteral-suffix")
+    _LIBCPP_GCC_DIAGNOSTIC_IGNORED("-Wliteral-suffix")
     constexpr chrono::hours operator""h(unsigned long long __h)
     {
         return chrono::hours(static_cast<chrono::hours::rep>(__h));
@@ -598,6 +601,7 @@
     {
         return chrono::duration<long double, nano> (__ns);
     }
+    _LIBCPP_DIAGNOSTIC_POP
 
 } // namespace chrono_literals
 } // namespace literals


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D120684.412116.patch
Type: text/x-patch
Size: 4328 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/libcxx-commits/attachments/20220301/f4fca3d2/attachment.bin>


More information about the libcxx-commits mailing list