[libcxx-commits] [PATCH] D113876: [libc++] Silence -Wformat-nonliteral warnings in __bsd_locale_fallbacks.h

Mikael Holmén via Phabricator via libcxx-commits libcxx-commits at lists.llvm.org
Mon Nov 15 02:55:40 PST 2021


uabelho created this revision.
uabelho added a reviewer: ldionne.
Herald added a subscriber: bjope.
uabelho requested review of this revision.
Herald added a project: libc++.
Herald added a subscriber: libcxx-commits.
Herald added a reviewer: libc++.

The warning was turned on in https://reviews.llvm.org/D112927 and in that
patch it was also disabled in a few placed. Some instances were missed
there though so let's silence those in this patch.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D113876

Files:
  libcxx/include/__bsd_locale_fallbacks.h


Index: libcxx/include/__bsd_locale_fallbacks.h
===================================================================
--- libcxx/include/__bsd_locale_fallbacks.h
+++ libcxx/include/__bsd_locale_fallbacks.h
@@ -113,7 +113,10 @@
     va_list __va;
     va_start(__va, __format);
     __libcpp_locale_guard __current(__l);
+#pragma clang diagnostic push
+#pragma clang diagnostic ignored "-Wformat-nonliteral"
     int __res = vsnprintf(__s, __n, __format, __va);
+#pragma clang diagnostic pop
     va_end(__va);
     return __res;
 }
@@ -123,7 +126,10 @@
     va_list __va;
     va_start(__va, __format);
     __libcpp_locale_guard __current(__l);
+#pragma clang diagnostic push
+#pragma clang diagnostic ignored "-Wformat-nonliteral"
     int __res = vasprintf(__s, __format, __va);
+#pragma clang diagnostic pop
     va_end(__va);
     return __res;
 }
@@ -133,7 +139,10 @@
     va_list __va;
     va_start(__va, __format);
     __libcpp_locale_guard __current(__l);
+#pragma clang diagnostic push
+#pragma clang diagnostic ignored "-Wformat-nonliteral"
     int __res = vsscanf(__s, __format, __va);
+#pragma clang diagnostic pop
     va_end(__va);
     return __res;
 }


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D113876.387187.patch
Type: text/x-patch
Size: 1169 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/libcxx-commits/attachments/20211115/c83f7fd4/attachment.bin>


More information about the libcxx-commits mailing list