mirror of
https://github.com/curl/curl.git
synced 2026-04-11 12:01:42 +08:00
gcc: guard #pragma diagnostic in core code for <4.6, disable picky warnings
Extend `#pragma diagnostic push`/`pop` guards to the whole codebase
(from tests and examples only) to disable it for GCC <4.6. Rename guard
to `CURL_HAVE_DIAG` and make it include llvm/clang to be interchangeable
with `__GNUC__ || __clang__` in this context.
The above means no longer disabling certain warnings locally, so pair
this with disabling all picky warnings for GCC <4.6.
Also:
- drop global workarounds for misbehaving GCC <4.6 compiler warnings.
Not needed with picky warnings disabled.
Reported-by: fds242 on github
Reported-by: Sergey Fedorov
Thanks-to: Orgad Shaneh
Follow-up to f07a98ae11 #20366
Fixes #20892
Fixes #20924
Closes #20902
Closes #20907
This commit is contained in:
parent
c3f04e76ae
commit
578ee6b79b
@ -60,7 +60,9 @@ elseif(BORLAND)
|
|||||||
endif()
|
endif()
|
||||||
|
|
||||||
if(PICKY_COMPILER)
|
if(PICKY_COMPILER)
|
||||||
if(CMAKE_C_COMPILER_ID STREQUAL "GNU" OR CMAKE_C_COMPILER_ID MATCHES "Clang")
|
# Leave disabled for GCC <4.6, because they lack #pragma features to silence locally.
|
||||||
|
if((CMAKE_C_COMPILER_ID STREQUAL "GNU" AND CMAKE_C_COMPILER_VERSION VERSION_GREATER_EQUAL 4.6) OR
|
||||||
|
CMAKE_C_COMPILER_ID MATCHES "Clang")
|
||||||
|
|
||||||
# https://clang.llvm.org/docs/DiagnosticsReference.html
|
# https://clang.llvm.org/docs/DiagnosticsReference.html
|
||||||
# https://gcc.gnu.org/onlinedocs/gcc/Warning-Options.html
|
# https://gcc.gnu.org/onlinedocs/gcc/Warning-Options.html
|
||||||
@ -378,15 +380,6 @@ if(PICKY_COMPILER)
|
|||||||
endforeach()
|
endforeach()
|
||||||
|
|
||||||
if(CMAKE_C_COMPILER_ID STREQUAL "GNU")
|
if(CMAKE_C_COMPILER_ID STREQUAL "GNU")
|
||||||
if(CMAKE_C_COMPILER_VERSION VERSION_LESS 4.5)
|
|
||||||
# Avoid false positives
|
|
||||||
list(APPEND _picky "-Wno-shadow")
|
|
||||||
list(APPEND _picky "-Wno-unreachable-code")
|
|
||||||
endif()
|
|
||||||
if(CMAKE_C_COMPILER_VERSION VERSION_GREATER_EQUAL 4.2 AND CMAKE_C_COMPILER_VERSION VERSION_LESS 4.6)
|
|
||||||
# GCC <4.6 do not support #pragma to suppress warnings locally. Disable them globally instead.
|
|
||||||
list(APPEND _picky "-Wno-overlength-strings")
|
|
||||||
endif()
|
|
||||||
if(CMAKE_C_COMPILER_VERSION VERSION_GREATER_EQUAL 4.0 AND CMAKE_C_COMPILER_VERSION VERSION_LESS 4.7)
|
if(CMAKE_C_COMPILER_VERSION VERSION_GREATER_EQUAL 4.0 AND CMAKE_C_COMPILER_VERSION VERSION_LESS 4.7)
|
||||||
list(APPEND _picky "-Wno-missing-field-initializers") # https://gcc.gnu.org/bugzilla/show_bug.cgi?id=36750
|
list(APPEND _picky "-Wno-missing-field-initializers") # https://gcc.gnu.org/bugzilla/show_bug.cgi?id=36750
|
||||||
endif()
|
endif()
|
||||||
|
|||||||
@ -34,7 +34,7 @@
|
|||||||
* warning: conversion to 'long unsigned int' from 'curl_socket_t' {aka 'int'}
|
* warning: conversion to 'long unsigned int' from 'curl_socket_t' {aka 'int'}
|
||||||
* may change the sign of the result [-Wsign-conversion]
|
* may change the sign of the result [-Wsign-conversion]
|
||||||
*/
|
*/
|
||||||
#ifdef __GNUC__
|
#ifdef __GNUC__ /* keep outside functions and without push/pop for GCC <4.6 */
|
||||||
#pragma GCC diagnostic ignored "-Wsign-conversion"
|
#pragma GCC diagnostic ignored "-Wsign-conversion"
|
||||||
#elif defined(_MSC_VER)
|
#elif defined(_MSC_VER)
|
||||||
#pragma warning(disable:4127) /* conditional expression is constant */
|
#pragma warning(disable:4127) /* conditional expression is constant */
|
||||||
|
|||||||
@ -31,13 +31,13 @@
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef HAVE_BROTLI
|
#ifdef HAVE_BROTLI
|
||||||
#if defined(__GNUC__) || defined(__clang__)
|
#ifdef CURL_HAVE_DIAG
|
||||||
/* Ignore -Wvla warnings in brotli headers */
|
/* Ignore -Wvla warnings in brotli headers */
|
||||||
#pragma GCC diagnostic push
|
#pragma GCC diagnostic push
|
||||||
#pragma GCC diagnostic ignored "-Wvla"
|
#pragma GCC diagnostic ignored "-Wvla"
|
||||||
#endif
|
#endif
|
||||||
#include <brotli/decode.h>
|
#include <brotli/decode.h>
|
||||||
#if defined(__GNUC__) || defined(__clang__)
|
#ifdef CURL_HAVE_DIAG
|
||||||
#pragma GCC diagnostic pop
|
#pragma GCC diagnostic pop
|
||||||
#endif
|
#endif
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
@ -55,7 +55,7 @@
|
|||||||
#define CURL_ALIGN8
|
#define CURL_ALIGN8
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if defined(__GNUC__) && defined(__APPLE__)
|
#if defined(CURL_HAVE_DIAG) && defined(__APPLE__)
|
||||||
#pragma GCC diagnostic push
|
#pragma GCC diagnostic push
|
||||||
#pragma GCC diagnostic ignored "-Wdeprecated-declarations"
|
#pragma GCC diagnostic ignored "-Wdeprecated-declarations"
|
||||||
#endif
|
#endif
|
||||||
@ -441,7 +441,7 @@ void Curl_gss_log_error(struct Curl_easy *data, const char *prefix,
|
|||||||
}
|
}
|
||||||
#endif /* CURLVERBOSE */
|
#endif /* CURLVERBOSE */
|
||||||
|
|
||||||
#if defined(__GNUC__) && defined(__APPLE__)
|
#if defined(CURL_HAVE_DIAG) && defined(__APPLE__)
|
||||||
#pragma GCC diagnostic pop
|
#pragma GCC diagnostic pop
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|||||||
@ -774,6 +774,16 @@
|
|||||||
#define USE_SSH
|
#define USE_SSH
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
/* GCC <4.6 does not support '#pragma GCC diagnostic push' and does not support
|
||||||
|
'pragma GCC diagnostic' inside functions.
|
||||||
|
Use CURL_HAVE_DIAG to guard the above in the curl codebase, instead of
|
||||||
|
defined(__GNUC__) || defined(__clang__).
|
||||||
|
*/
|
||||||
|
#if defined(__clang__) || (defined(__GNUC__) && \
|
||||||
|
((__GNUC__ > 4) || ((__GNUC__ == 4) && (__GNUC_MINOR__ >= 6))))
|
||||||
|
#define CURL_HAVE_DIAG
|
||||||
|
#endif
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Provide a mechanism to silence picky compilers, such as gcc 4.6+.
|
* Provide a mechanism to silence picky compilers, such as gcc 4.6+.
|
||||||
* Parameters should of course normally not be unused, but for example when
|
* Parameters should of course normally not be unused, but for example when
|
||||||
|
|||||||
@ -34,13 +34,13 @@ void curlx_win32_snprintf(char *buf, size_t maxlen, const char *fmt, ...)
|
|||||||
if(!maxlen)
|
if(!maxlen)
|
||||||
return;
|
return;
|
||||||
va_start(ap, fmt);
|
va_start(ap, fmt);
|
||||||
#if defined(__GNUC__) || defined(__clang__)
|
#ifdef CURL_HAVE_DIAG
|
||||||
#pragma GCC diagnostic push
|
#pragma GCC diagnostic push
|
||||||
#pragma GCC diagnostic ignored "-Wformat-nonliteral"
|
#pragma GCC diagnostic ignored "-Wformat-nonliteral"
|
||||||
#endif
|
#endif
|
||||||
/* !checksrc! disable BANNEDFUNC 1 */
|
/* !checksrc! disable BANNEDFUNC 1 */
|
||||||
(void)vsnprintf(buf, maxlen, fmt, ap);
|
(void)vsnprintf(buf, maxlen, fmt, ap);
|
||||||
#if defined(__GNUC__) || defined(__clang__)
|
#ifdef CURL_HAVE_DIAG
|
||||||
#pragma GCC diagnostic pop
|
#pragma GCC diagnostic pop
|
||||||
#endif
|
#endif
|
||||||
buf[maxlen - 1] = 0;
|
buf[maxlen - 1] = 0;
|
||||||
|
|||||||
@ -2567,7 +2567,7 @@ static CURLcode ftp_state_mdtm_resp(struct Curl_easy *data,
|
|||||||
/* If we asked for a time of the file and we actually got one as well,
|
/* If we asked for a time of the file and we actually got one as well,
|
||||||
we "emulate" an HTTP-style header in our output. */
|
we "emulate" an HTTP-style header in our output. */
|
||||||
|
|
||||||
#if defined(__GNUC__) && (defined(__DJGPP__) || defined(__AMIGA__))
|
#if defined(CURL_HAVE_DIAG) && (defined(__DJGPP__) || defined(__AMIGA__))
|
||||||
#pragma GCC diagnostic push
|
#pragma GCC diagnostic push
|
||||||
/* 'time_t' is unsigned in MSDOS and AmigaOS. Silence:
|
/* 'time_t' is unsigned in MSDOS and AmigaOS. Silence:
|
||||||
warning: comparison of unsigned expression in '>= 0' is always true */
|
warning: comparison of unsigned expression in '>= 0' is always true */
|
||||||
@ -2575,7 +2575,7 @@ static CURLcode ftp_state_mdtm_resp(struct Curl_easy *data,
|
|||||||
#endif
|
#endif
|
||||||
if(data->req.no_body && ftpc->file &&
|
if(data->req.no_body && ftpc->file &&
|
||||||
data->set.get_filetime && showtime) {
|
data->set.get_filetime && showtime) {
|
||||||
#if defined(__GNUC__) && (defined(__DJGPP__) || defined(__AMIGA__))
|
#if defined(CURL_HAVE_DIAG) && (defined(__DJGPP__) || defined(__AMIGA__))
|
||||||
#pragma GCC diagnostic pop
|
#pragma GCC diagnostic pop
|
||||||
#endif
|
#endif
|
||||||
char headerbuf[128];
|
char headerbuf[128];
|
||||||
|
|||||||
@ -210,13 +210,13 @@ if2ip_result_t Curl_if2ip(int af,
|
|||||||
memcpy(req.ifr_name, interf, len + 1);
|
memcpy(req.ifr_name, interf, len + 1);
|
||||||
req.ifr_addr.sa_family = AF_INET;
|
req.ifr_addr.sa_family = AF_INET;
|
||||||
|
|
||||||
#if defined(__GNUC__) && defined(_AIX)
|
#if defined(CURL_HAVE_DIAG) && defined(_AIX)
|
||||||
/* Suppress warning inside system headers */
|
/* Suppress warning inside system headers */
|
||||||
#pragma GCC diagnostic push
|
#pragma GCC diagnostic push
|
||||||
#pragma GCC diagnostic ignored "-Wshift-sign-overflow"
|
#pragma GCC diagnostic ignored "-Wshift-sign-overflow"
|
||||||
#endif
|
#endif
|
||||||
if(ioctl(dummy, SIOCGIFADDR, &req) < 0) {
|
if(ioctl(dummy, SIOCGIFADDR, &req) < 0) {
|
||||||
#if defined(__GNUC__) && defined(_AIX)
|
#if defined(CURL_HAVE_DIAG) && defined(_AIX)
|
||||||
#pragma GCC diagnostic pop
|
#pragma GCC diagnostic pop
|
||||||
#endif
|
#endif
|
||||||
sclose(dummy);
|
sclose(dummy);
|
||||||
|
|||||||
@ -27,7 +27,7 @@
|
|||||||
|
|
||||||
#if !defined(CURL_DISABLE_LDAP) && !defined(USE_OPENLDAP)
|
#if !defined(CURL_DISABLE_LDAP) && !defined(USE_OPENLDAP)
|
||||||
|
|
||||||
#if defined(__GNUC__) && defined(__APPLE__)
|
#if defined(CURL_HAVE_DIAG) && defined(__APPLE__)
|
||||||
#pragma GCC diagnostic push
|
#pragma GCC diagnostic push
|
||||||
#pragma GCC diagnostic ignored "-Wdeprecated-declarations"
|
#pragma GCC diagnostic ignored "-Wdeprecated-declarations"
|
||||||
#endif
|
#endif
|
||||||
@ -994,7 +994,7 @@ const struct Curl_protocol Curl_protocol_ldap = {
|
|||||||
ZERO_NULL, /* follow */
|
ZERO_NULL, /* follow */
|
||||||
};
|
};
|
||||||
|
|
||||||
#if defined(__GNUC__) && defined(__APPLE__)
|
#if defined(CURL_HAVE_DIAG) && defined(__APPLE__)
|
||||||
#pragma GCC diagnostic pop
|
#pragma GCC diagnostic pop
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|||||||
@ -672,7 +672,7 @@ static bool out_double(void *userp,
|
|||||||
|
|
||||||
/* NOTE NOTE NOTE!! Not all sprintf implementations return number of
|
/* NOTE NOTE NOTE!! Not all sprintf implementations return number of
|
||||||
output characters */
|
output characters */
|
||||||
#if defined(__GNUC__) || defined(__clang__)
|
#ifdef CURL_HAVE_DIAG
|
||||||
#pragma GCC diagnostic push
|
#pragma GCC diagnostic push
|
||||||
#pragma GCC diagnostic ignored "-Wformat-nonliteral"
|
#pragma GCC diagnostic ignored "-Wformat-nonliteral"
|
||||||
#endif
|
#endif
|
||||||
@ -687,7 +687,7 @@ static bool out_double(void *userp,
|
|||||||
/* float and double outputs do not work without snprintf support */
|
/* float and double outputs do not work without snprintf support */
|
||||||
work[0] = 0;
|
work[0] = 0;
|
||||||
#endif
|
#endif
|
||||||
#if defined(__GNUC__) || defined(__clang__)
|
#ifdef CURL_HAVE_DIAG
|
||||||
#pragma GCC diagnostic pop
|
#pragma GCC diagnostic pop
|
||||||
#endif
|
#endif
|
||||||
DEBUGASSERT(strlen(work) < BUFFSIZE);
|
DEBUGASSERT(strlen(work) < BUFFSIZE);
|
||||||
|
|||||||
@ -35,7 +35,7 @@
|
|||||||
#include "socks.h"
|
#include "socks.h"
|
||||||
#include "curlx/strdup.h"
|
#include "curlx/strdup.h"
|
||||||
|
|
||||||
#if defined(__GNUC__) && defined(__APPLE__)
|
#if defined(CURL_HAVE_DIAG) && defined(__APPLE__)
|
||||||
#pragma GCC diagnostic push
|
#pragma GCC diagnostic push
|
||||||
#pragma GCC diagnostic ignored "-Wdeprecated-declarations"
|
#pragma GCC diagnostic ignored "-Wdeprecated-declarations"
|
||||||
#endif
|
#endif
|
||||||
@ -526,7 +526,7 @@ CURLcode Curl_SOCKS5_gssapi_negotiate(struct Curl_cfilter *cf,
|
|||||||
return CURLE_OK;
|
return CURLE_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
#if defined(__GNUC__) && defined(__APPLE__)
|
#if defined(CURL_HAVE_DIAG) && defined(__APPLE__)
|
||||||
#pragma GCC diagnostic pop
|
#pragma GCC diagnostic pop
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|||||||
@ -33,7 +33,7 @@
|
|||||||
#include "curl_gssapi.h"
|
#include "curl_gssapi.h"
|
||||||
#include "curl_trc.h"
|
#include "curl_trc.h"
|
||||||
|
|
||||||
#if defined(__GNUC__) && defined(__APPLE__)
|
#if defined(CURL_HAVE_DIAG) && defined(__APPLE__)
|
||||||
#pragma GCC diagnostic push
|
#pragma GCC diagnostic push
|
||||||
#pragma GCC diagnostic ignored "-Wdeprecated-declarations"
|
#pragma GCC diagnostic ignored "-Wdeprecated-declarations"
|
||||||
#endif
|
#endif
|
||||||
@ -320,7 +320,7 @@ void Curl_auth_cleanup_gssapi(struct kerberos5data *krb5)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#if defined(__GNUC__) && defined(__APPLE__)
|
#if defined(CURL_HAVE_DIAG) && defined(__APPLE__)
|
||||||
#pragma GCC diagnostic pop
|
#pragma GCC diagnostic pop
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|||||||
@ -32,7 +32,7 @@
|
|||||||
#include "curl_gssapi.h"
|
#include "curl_gssapi.h"
|
||||||
#include "curl_trc.h"
|
#include "curl_trc.h"
|
||||||
|
|
||||||
#if defined(__GNUC__) && defined(__APPLE__)
|
#if defined(CURL_HAVE_DIAG) && defined(__APPLE__)
|
||||||
#pragma GCC diagnostic push
|
#pragma GCC diagnostic push
|
||||||
#pragma GCC diagnostic ignored "-Wdeprecated-declarations"
|
#pragma GCC diagnostic ignored "-Wdeprecated-declarations"
|
||||||
#endif
|
#endif
|
||||||
@ -288,7 +288,7 @@ void Curl_auth_cleanup_spnego(struct negotiatedata *nego)
|
|||||||
nego->havemultiplerequests = FALSE;
|
nego->havemultiplerequests = FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
#if defined(__GNUC__) && defined(__APPLE__)
|
#if defined(CURL_HAVE_DIAG) && defined(__APPLE__)
|
||||||
#pragma GCC diagnostic pop
|
#pragma GCC diagnostic pop
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|||||||
@ -56,13 +56,13 @@
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef HAVE_BROTLI
|
#ifdef HAVE_BROTLI
|
||||||
#if defined(__GNUC__) || defined(__clang__)
|
#ifdef CURL_HAVE_DIAG
|
||||||
/* Ignore -Wvla warnings in brotli headers */
|
/* Ignore -Wvla warnings in brotli headers */
|
||||||
#pragma GCC diagnostic push
|
#pragma GCC diagnostic push
|
||||||
#pragma GCC diagnostic ignored "-Wvla"
|
#pragma GCC diagnostic ignored "-Wvla"
|
||||||
#endif
|
#endif
|
||||||
#include <brotli/decode.h>
|
#include <brotli/decode.h>
|
||||||
#if defined(__GNUC__) || defined(__clang__)
|
#ifdef CURL_HAVE_DIAG
|
||||||
#pragma GCC diagnostic pop
|
#pragma GCC diagnostic pop
|
||||||
#endif
|
#endif
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
@ -974,7 +974,8 @@ AC_DEFUN([CURL_SET_COMPILER_WARNING_OPTS], [
|
|||||||
#
|
#
|
||||||
GNU_C)
|
GNU_C)
|
||||||
#
|
#
|
||||||
if test "$want_warnings" = "yes"; then
|
dnl Leave disabled for GCC <4.6, because they lack #pragma features to silence locally.
|
||||||
|
if test "$want_warnings" = "yes" && test "$compiler_num" -ge "406"; then
|
||||||
#
|
#
|
||||||
dnl Do not enable -pedantic when cross-compiling with a gcc older
|
dnl Do not enable -pedantic when cross-compiling with a gcc older
|
||||||
dnl than 3.0, to avoid warnings from third party system headers.
|
dnl than 3.0, to avoid warnings from third party system headers.
|
||||||
@ -1190,15 +1191,6 @@ AC_DEFUN([CURL_SET_COMPILER_WARNING_OPTS], [
|
|||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
if test "$compiler_num" -lt "405"; then
|
|
||||||
dnl Avoid false positives
|
|
||||||
tmp_CFLAGS="$tmp_CFLAGS -Wno-shadow"
|
|
||||||
tmp_CFLAGS="$tmp_CFLAGS -Wno-unreachable-code"
|
|
||||||
fi
|
|
||||||
if test "$compiler_num" -ge "402" && test "$compiler_num" -lt "406"; then
|
|
||||||
dnl GCC <4.6 do not support #pragma to suppress warnings locally. Disable globally instead.
|
|
||||||
tmp_CFLAGS="$tmp_CFLAGS -Wno-overlength-strings"
|
|
||||||
fi
|
|
||||||
if test "$compiler_num" -ge "400" && test "$compiler_num" -lt "407"; then
|
if test "$compiler_num" -ge "400" && test "$compiler_num" -lt "407"; then
|
||||||
dnl https://gcc.gnu.org/bugzilla/show_bug.cgi?id=84685
|
dnl https://gcc.gnu.org/bugzilla/show_bug.cgi?id=84685
|
||||||
tmp_CFLAGS="$tmp_CFLAGS -Wno-missing-field-initializers"
|
tmp_CFLAGS="$tmp_CFLAGS -Wno-missing-field-initializers"
|
||||||
|
|||||||
@ -200,12 +200,12 @@ int tool_progress_cb(void *clientp,
|
|||||||
memset(line, '#', num);
|
memset(line, '#', num);
|
||||||
line[num] = '\0';
|
line[num] = '\0';
|
||||||
curl_msnprintf(format, sizeof(format), "\r%%-%ds %%5.1f%%%%", barwidth);
|
curl_msnprintf(format, sizeof(format), "\r%%-%ds %%5.1f%%%%", barwidth);
|
||||||
#if defined(__GNUC__) || defined(__clang__)
|
#ifdef CURL_HAVE_DIAG
|
||||||
#pragma GCC diagnostic push
|
#pragma GCC diagnostic push
|
||||||
#pragma GCC diagnostic ignored "-Wformat-nonliteral"
|
#pragma GCC diagnostic ignored "-Wformat-nonliteral"
|
||||||
#endif
|
#endif
|
||||||
curl_mfprintf(bar->out, format, line, percent);
|
curl_mfprintf(bar->out, format, line, percent);
|
||||||
#if defined(__GNUC__) || defined(__clang__)
|
#ifdef CURL_HAVE_DIAG
|
||||||
#pragma GCC diagnostic pop
|
#pragma GCC diagnostic pop
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|||||||
@ -132,7 +132,7 @@ static void memory_tracking_init(void)
|
|||||||
** curl tool main function.
|
** curl tool main function.
|
||||||
*/
|
*/
|
||||||
#ifdef _UNICODE
|
#ifdef _UNICODE
|
||||||
#if defined(__GNUC__) || defined(__clang__)
|
#ifdef CURL_HAVE_DIAG
|
||||||
/* GCC does not know about wmain() */
|
/* GCC does not know about wmain() */
|
||||||
#pragma GCC diagnostic push
|
#pragma GCC diagnostic push
|
||||||
#pragma GCC diagnostic ignored "-Wmissing-prototypes"
|
#pragma GCC diagnostic ignored "-Wmissing-prototypes"
|
||||||
@ -205,7 +205,7 @@ int main(int argc, char *argv[])
|
|||||||
}
|
}
|
||||||
|
|
||||||
#ifdef _UNICODE
|
#ifdef _UNICODE
|
||||||
#if defined(__GNUC__) || defined(__clang__)
|
#ifdef CURL_HAVE_DIAG
|
||||||
#pragma GCC diagnostic pop
|
#pragma GCC diagnostic pop
|
||||||
#endif
|
#endif
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
@ -580,14 +580,14 @@ static const char *outtime(const char *ptr, /* %time{ ... */
|
|||||||
if(!result) {
|
if(!result) {
|
||||||
struct tm utc;
|
struct tm utc;
|
||||||
result = curlx_gmtime(secs, &utc);
|
result = curlx_gmtime(secs, &utc);
|
||||||
#ifdef __GNUC__ /* includes llvm/clang, but not affected as of v22.1.0 */
|
#ifdef CURL_HAVE_DIAG /* includes llvm/clang, but not affected as of v22.1.0 */
|
||||||
#pragma GCC diagnostic push
|
#pragma GCC diagnostic push
|
||||||
#pragma GCC diagnostic ignored "-Wformat-nonliteral"
|
#pragma GCC diagnostic ignored "-Wformat-nonliteral"
|
||||||
#endif
|
#endif
|
||||||
if(curlx_dyn_len(&format) && !result &&
|
if(curlx_dyn_len(&format) && !result &&
|
||||||
strftime(output, sizeof(output), curlx_dyn_ptr(&format), &utc))
|
strftime(output, sizeof(output), curlx_dyn_ptr(&format), &utc))
|
||||||
fputs(output, stream);
|
fputs(output, stream);
|
||||||
#ifdef __GNUC__
|
#ifdef CURL_HAVE_DIAG
|
||||||
#pragma GCC diagnostic pop
|
#pragma GCC diagnostic pop
|
||||||
#endif
|
#endif
|
||||||
curlx_dyn_free(&format);
|
curlx_dyn_free(&format);
|
||||||
|
|||||||
@ -58,13 +58,6 @@ extern int unitfail; /* for unittests */
|
|||||||
#include <sys/select.h>
|
#include <sys/select.h>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/* GCC <4.6 does not support '#pragma GCC diagnostic push' and
|
|
||||||
does not support 'pragma GCC diagnostic' inside functions. */
|
|
||||||
#if (defined(__GNUC__) && \
|
|
||||||
((__GNUC__ > 4) || ((__GNUC__ == 4) && (__GNUC_MINOR__ >= 6))))
|
|
||||||
#define CURL_GNUC_DIAG
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#define test_setopt(A, B, C) \
|
#define test_setopt(A, B, C) \
|
||||||
do { \
|
do { \
|
||||||
result = curl_easy_setopt(A, B, C); \
|
result = curl_easy_setopt(A, B, C); \
|
||||||
|
|||||||
@ -33,7 +33,7 @@
|
|||||||
# include <locale.h> /* for setlocale() */
|
# include <locale.h> /* for setlocale() */
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if defined(CURL_GNUC_DIAG) || defined(__clang__)
|
#ifdef CURL_HAVE_DIAG
|
||||||
#pragma GCC diagnostic push
|
#pragma GCC diagnostic push
|
||||||
#pragma GCC diagnostic ignored "-Wformat"
|
#pragma GCC diagnostic ignored "-Wformat"
|
||||||
#pragma GCC diagnostic ignored "-Wformat-extra-args"
|
#pragma GCC diagnostic ignored "-Wformat-extra-args"
|
||||||
@ -1542,6 +1542,6 @@ static CURLcode test_lib557(const char *URL)
|
|||||||
return CURLE_OK;
|
return CURLE_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
#if defined(CURL_GNUC_DIAG) || defined(__clang__)
|
#ifdef CURL_HAVE_DIAG
|
||||||
#pragma GCC diagnostic pop
|
#pragma GCC diagnostic pop
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
@ -85,12 +85,12 @@ void logmsg(const char *msg, ...)
|
|||||||
|
|
||||||
va_start(ap, msg);
|
va_start(ap, msg);
|
||||||
/* Suppress for builds where CURL_PRINTF() is not set */
|
/* Suppress for builds where CURL_PRINTF() is not set */
|
||||||
#if defined(__GNUC__) || defined(__clang__)
|
#ifdef CURL_HAVE_DIAG
|
||||||
#pragma GCC diagnostic push
|
#pragma GCC diagnostic push
|
||||||
#pragma GCC diagnostic ignored "-Wformat-nonliteral"
|
#pragma GCC diagnostic ignored "-Wformat-nonliteral"
|
||||||
#endif
|
#endif
|
||||||
vsnprintf(buffer, sizeof(buffer), msg, ap);
|
vsnprintf(buffer, sizeof(buffer), msg, ap);
|
||||||
#if defined(__GNUC__) || defined(__clang__)
|
#ifdef CURL_HAVE_DIAG
|
||||||
#pragma GCC diagnostic pop
|
#pragma GCC diagnostic pop
|
||||||
#endif
|
#endif
|
||||||
va_end(ap);
|
va_end(ap);
|
||||||
|
|||||||
@ -23,7 +23,7 @@
|
|||||||
***************************************************************************/
|
***************************************************************************/
|
||||||
#include "unitcheck.h"
|
#include "unitcheck.h"
|
||||||
|
|
||||||
#if defined(CURL_GNUC_DIAG) || defined(__clang__)
|
#ifdef CURL_HAVE_DIAG
|
||||||
#pragma GCC diagnostic push
|
#pragma GCC diagnostic push
|
||||||
#pragma GCC diagnostic ignored "-Wformat"
|
#pragma GCC diagnostic ignored "-Wformat"
|
||||||
#endif
|
#endif
|
||||||
@ -195,6 +195,6 @@ static CURLcode test_unit1398(const char *arg)
|
|||||||
UNITTEST_END_SIMPLE
|
UNITTEST_END_SIMPLE
|
||||||
}
|
}
|
||||||
|
|
||||||
#if defined(CURL_GNUC_DIAG) || defined(__clang__)
|
#ifdef CURL_HAVE_DIAG
|
||||||
#pragma GCC diagnostic pop
|
#pragma GCC diagnostic pop
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
@ -88,7 +88,7 @@ static CURLcode test_unit1652(const char *arg)
|
|||||||
|
|
||||||
UNITTEST_BEGIN(t1652_setup(&easy))
|
UNITTEST_BEGIN(t1652_setup(&easy))
|
||||||
|
|
||||||
#ifdef CURL_GNUC_DIAG
|
#if defined(CURL_HAVE_DIAG) && !defined(__clang__)
|
||||||
#pragma GCC diagnostic push
|
#pragma GCC diagnostic push
|
||||||
#pragma GCC diagnostic ignored "-Wformat" /* for GCC v5 to v8 */
|
#pragma GCC diagnostic ignored "-Wformat" /* for GCC v5 to v8 */
|
||||||
#pragma GCC diagnostic ignored "-Wformat-zero-length"
|
#pragma GCC diagnostic ignored "-Wformat-zero-length"
|
||||||
@ -157,7 +157,7 @@ static CURLcode test_unit1652(const char *arg)
|
|||||||
fail_unless(output[sizeof(output) - 1] == '\0',
|
fail_unless(output[sizeof(output) - 1] == '\0',
|
||||||
"Truncation of infof input 3");
|
"Truncation of infof input 3");
|
||||||
|
|
||||||
#ifdef CURL_GNUC_DIAG
|
#if defined(CURL_HAVE_DIAG) && !defined(__clang__)
|
||||||
#pragma GCC diagnostic pop
|
#pragma GCC diagnostic pop
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|||||||
@ -38,7 +38,7 @@ static CURLcode test_unit2604(const char *arg)
|
|||||||
CURLcode result;
|
CURLcode result;
|
||||||
};
|
};
|
||||||
|
|
||||||
#if defined(CURL_GNUC_DIAG) || defined(__clang__)
|
#ifdef CURL_HAVE_DIAG
|
||||||
#pragma GCC diagnostic push
|
#pragma GCC diagnostic push
|
||||||
#pragma GCC diagnostic ignored "-Woverlength-strings"
|
#pragma GCC diagnostic ignored "-Woverlength-strings"
|
||||||
#endif
|
#endif
|
||||||
@ -74,7 +74,7 @@ static CURLcode test_unit2604(const char *arg)
|
|||||||
{ NULL, NULL, NULL, NULL, CURLE_OK }
|
{ NULL, NULL, NULL, NULL, CURLE_OK }
|
||||||
};
|
};
|
||||||
|
|
||||||
#if defined(CURL_GNUC_DIAG) || defined(__clang__)
|
#ifdef CURL_HAVE_DIAG
|
||||||
#pragma GCC diagnostic pop
|
#pragma GCC diagnostic pop
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|||||||
@ -31,7 +31,7 @@ static CURLcode test_unit3200(const char *arg)
|
|||||||
#if !defined(CURL_DISABLE_COOKIES) || !defined(CURL_DISABLE_ALTSVC) || \
|
#if !defined(CURL_DISABLE_COOKIES) || !defined(CURL_DISABLE_ALTSVC) || \
|
||||||
!defined(CURL_DISABLE_HSTS) || !defined(CURL_DISABLE_NETRC)
|
!defined(CURL_DISABLE_HSTS) || !defined(CURL_DISABLE_NETRC)
|
||||||
|
|
||||||
#if defined(CURL_GNUC_DIAG) || defined(__clang__)
|
#ifdef CURL_HAVE_DIAG
|
||||||
#pragma GCC diagnostic push
|
#pragma GCC diagnostic push
|
||||||
#pragma GCC diagnostic ignored "-Woverlength-strings"
|
#pragma GCC diagnostic ignored "-Woverlength-strings"
|
||||||
#endif
|
#endif
|
||||||
@ -70,7 +70,7 @@ static CURLcode test_unit3200(const char *arg)
|
|||||||
"LINE1\x1aTEST"
|
"LINE1\x1aTEST"
|
||||||
};
|
};
|
||||||
|
|
||||||
#if defined(CURL_GNUC_DIAG) || defined(__clang__)
|
#ifdef CURL_HAVE_DIAG
|
||||||
#pragma GCC diagnostic pop
|
#pragma GCC diagnostic pop
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user