diff --git a/libcxx/src/support/win32/locale_win32.cpp b/libcxx/src/support/win32/locale_win32.cpp --- a/libcxx/src/support/win32/locale_win32.cpp +++ b/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; diff --git a/libcxx/src/support/win32/support.cpp b/libcxx/src/support/win32/support.cpp --- a/libcxx/src/support/win32/support.cpp +++ b/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; }