-Wignored-qualifiers # clang 2.8 gcc 4.3
-Wmissing-field-initializers # clang 2.7 gcc 4.1
-Wmissing-noreturn # clang 2.7 gcc 4.1
- -Wno-format-nonliteral # clang 1.0 gcc 2.96 (3.0)
-Wno-padded # clang 2.9 gcc 4.1 # Not used: We cannot change public structs
-Wno-sign-conversion # clang 2.9 gcc 4.3
-Wno-switch-default # clang 2.7 gcc 4.1 # Not used: Annoying to fix or silence
*fptr = 0; /* and a final null-termination */
-#ifdef __clang__
-#pragma clang diagnostic push
-#pragma clang diagnostic ignored "-Wformat-nonliteral"
-#endif
/* NOTE NOTE NOTE!! Not all sprintf implementations return number of
output characters */
#ifdef HAVE_SNPRINTF
+#if defined(__GNUC__) || defined(__clang__)
+#pragma GCC diagnostic push
+#pragma GCC diagnostic ignored "-Wformat-nonliteral"
+#endif
/* !checksrc! disable LONGLINE */
/* NOLINTNEXTLINE(clang-analyzer-security.insecureAPI.DeprecatedOrUnsafeBufferHandling) */
(snprintf)(work, BUFFSIZE, formatbuf, dnum);
+#if defined(__GNUC__) || defined(__clang__)
+#pragma GCC diagnostic pop
+#endif
#ifdef _WIN32
/* Old versions of the Windows CRT do not terminate the snprintf output
buffer if it reaches the max size so we do that here. */
#else
/* float and double outputs do not work without snprintf support */
work[0] = 0;
-#endif
-#ifdef __clang__
-#pragma clang diagnostic pop
#endif
DEBUGASSERT(strlen(work) < BUFFSIZE);
while(*work) {
CURL_ADD_COMPILER_WARNINGS([tmp_CFLAGS], [sign-compare])
tmp_CFLAGS="$tmp_CFLAGS -Wno-multichar"
CURL_ADD_COMPILER_WARNINGS([tmp_CFLAGS], [undef])
- tmp_CFLAGS="$tmp_CFLAGS -Wno-format-nonliteral"
CURL_ADD_COMPILER_WARNINGS([tmp_CFLAGS], [endif-labels strict-prototypes])
CURL_ADD_COMPILER_WARNINGS([tmp_CFLAGS], [declaration-after-statement])
CURL_ADD_COMPILER_WARNINGS([tmp_CFLAGS], [cast-align])
CURL_ADD_COMPILER_WARNINGS([tmp_CFLAGS], [undef])
fi
#
- dnl Only gcc 2.97 or later
- if test "$compiler_num" -ge "297"; then
- tmp_CFLAGS="$tmp_CFLAGS -Wno-format-nonliteral"
- fi
- #
dnl Only gcc 3.0 or later
if test "$compiler_num" -ge "300"; then
dnl -Wunreachable-code seems totally unreliable on my gcc 3.3.2 on
memset(line, '#', num);
line[num] = '\0';
curl_msnprintf(format, sizeof(format), "\r%%-%ds %%5.1f%%%%", barwidth);
-#ifdef __clang__
-#pragma clang diagnostic push
-#pragma clang diagnostic ignored "-Wformat-nonliteral"
+#if defined(__GNUC__) || defined(__clang__)
+#pragma GCC diagnostic push
+#pragma GCC diagnostic ignored "-Wformat-nonliteral"
#endif
curl_mfprintf(bar->out, format, line, percent);
-#ifdef __clang__
-#pragma clang diagnostic pop
+#if defined(__GNUC__) || defined(__clang__)
+#pragma GCC diagnostic pop
#endif
}
fflush(bar->out);
if(!result) {
struct tm utc;
result = curlx_gmtime(secs, &utc);
+#ifdef __GNUC__
+#pragma GCC diagnostic push
+#pragma GCC diagnostic ignored "-Wformat-nonliteral"
+#endif
if(curlx_dyn_len(&format) && !result &&
strftime(output, sizeof(output), curlx_dyn_ptr(&format), &utc))
fputs(output, stream);
+#ifdef __GNUC__
+#pragma GCC diagnostic pop
+#endif
curlx_dyn_free(&format);
}
ptr = end + 1;
now.tm_hour, now.tm_min, now.tm_sec, (long)tv.tv_usec);
va_start(ap, msg);
+/* Suppress for builds where CURL_PRINTF() is not set */
+#if defined(__GNUC__) || defined(__clang__)
+#pragma GCC diagnostic push
+#pragma GCC diagnostic ignored "-Wformat-nonliteral"
+#endif
vsnprintf(buffer, sizeof(buffer), msg, ap);
+#if defined(__GNUC__) || defined(__clang__)
+#pragma GCC diagnostic pop
+#endif
va_end(ap);
do {