mirror of
https://github.com/curl/curl.git
synced 2026-08-25 14:53:34 +03: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
25 changed files with 56 additions and 68 deletions
|
|
@ -200,12 +200,12 @@ int tool_progress_cb(void *clientp,
|
|||
memset(line, '#', num);
|
||||
line[num] = '\0';
|
||||
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 ignored "-Wformat-nonliteral"
|
||||
#endif
|
||||
curl_mfprintf(bar->out, format, line, percent);
|
||||
#if defined(__GNUC__) || defined(__clang__)
|
||||
#ifdef CURL_HAVE_DIAG
|
||||
#pragma GCC diagnostic pop
|
||||
#endif
|
||||
}
|
||||
|
|
|
|||
|
|
@ -132,7 +132,7 @@ static void memory_tracking_init(void)
|
|||
** curl tool main function.
|
||||
*/
|
||||
#ifdef _UNICODE
|
||||
#if defined(__GNUC__) || defined(__clang__)
|
||||
#ifdef CURL_HAVE_DIAG
|
||||
/* GCC does not know about wmain() */
|
||||
#pragma GCC diagnostic push
|
||||
#pragma GCC diagnostic ignored "-Wmissing-prototypes"
|
||||
|
|
@ -205,7 +205,7 @@ int main(int argc, char *argv[])
|
|||
}
|
||||
|
||||
#ifdef _UNICODE
|
||||
#if defined(__GNUC__) || defined(__clang__)
|
||||
#ifdef CURL_HAVE_DIAG
|
||||
#pragma GCC diagnostic pop
|
||||
#endif
|
||||
#endif
|
||||
|
|
|
|||
|
|
@ -580,14 +580,14 @@ static const char *outtime(const char *ptr, /* %time{ ... */
|
|||
if(!result) {
|
||||
struct tm 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 ignored "-Wformat-nonliteral"
|
||||
#endif
|
||||
if(curlx_dyn_len(&format) && !result &&
|
||||
strftime(output, sizeof(output), curlx_dyn_ptr(&format), &utc))
|
||||
fputs(output, stream);
|
||||
#ifdef __GNUC__
|
||||
#ifdef CURL_HAVE_DIAG
|
||||
#pragma GCC diagnostic pop
|
||||
#endif
|
||||
curlx_dyn_free(&format);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue