[libcxx-commits] [PATCH] D119134: [libcxx] Silence -Wformat-nonliteral warnings in the Windows support code
Martin Storsjö via Phabricator via libcxx-commits
libcxx-commits at lists.llvm.org
Thu Feb 10 03:34:05 PST 2022
mstorsjo updated this revision to Diff 407456.
mstorsjo added a comment.
Herald added a subscriber: arichardson.
Enable LIBCXX_ENABLE_WERROR in the configurations that are fixed by this.
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D119134/new/
https://reviews.llvm.org/D119134
Files:
libcxx/src/support/win32/locale_win32.cpp
libcxx/src/support/win32/support.cpp
libcxx/utils/ci/run-buildbot
Index: libcxx/utils/ci/run-buildbot
===================================================================
--- libcxx/utils/ci/run-buildbot
+++ libcxx/utils/ci/run-buildbot
@@ -590,6 +590,7 @@
# further back in PATH. By calling the compiler with an explicit
# triple prefix, we use the one that is bundled with a mingw sysroot.
generate-cmake \
+ -DLIBCXX_ENABLE_WERROR=ON \
-DCMAKE_C_COMPILER=x86_64-w64-mingw32-clang \
-DCMAKE_CXX_COMPILER=x86_64-w64-mingw32-clang++ \
-DLIBCXX_TEST_CONFIG="llvm-libc++-mingw.cfg.in" \
@@ -600,6 +601,7 @@
mingw-static)
clean
generate-cmake \
+ -DLIBCXX_ENABLE_WERROR=ON \
-DCMAKE_C_COMPILER=x86_64-w64-mingw32-clang \
-DCMAKE_CXX_COMPILER=x86_64-w64-mingw32-clang++ \
-DLIBCXX_TEST_CONFIG="llvm-libc++-mingw.cfg.in" \
Index: libcxx/src/support/win32/support.cpp
===================================================================
--- libcxx/src/support/win32/support.cpp
+++ libcxx/src/support/win32/support.cpp
@@ -23,7 +23,10 @@
// Query the count required.
va_list ap_copy;
va_copy(ap_copy, ap);
+#pragma clang diagnostic push
+#pragma clang diagnostic ignored "-Wformat-nonliteral"
int count = vsnprintf( NULL, 0, format, ap_copy );
+#pragma clang diagnostic pop
va_end(ap_copy);
if (count < 0)
return count;
@@ -33,7 +36,10 @@
return -1;
// If we haven't used exactly what was required, something is wrong.
// Maybe bug in vsnprintf. Report the error and return.
+#pragma clang diagnostic push
+#pragma clang diagnostic ignored "-Wformat-nonliteral"
if (vsnprintf(p, buffer_size, format, ap) != count) {
+#pragma clang diagnostic pop
free(p);
return -1;
}
Index: libcxx/src/support/win32/locale_win32.cpp
===================================================================
--- libcxx/src/support/win32/locale_win32.cpp
+++ libcxx/src/support/win32/locale_win32.cpp
@@ -97,7 +97,10 @@
ret, n, format, loc, ap);
#else
__libcpp_locale_guard __current(loc);
+#pragma clang diagnostic push
+#pragma clang diagnostic ignored "-Wformat-nonliteral"
int result = vsnprintf( ret, n, format, ap );
+#pragma clang diagnostic pop
#endif
va_end(ap);
return result;
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D119134.407456.patch
Type: text/x-patch
Size: 2316 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/libcxx-commits/attachments/20220210/24e0aa81/attachment.bin>
More information about the libcxx-commits
mailing list