mirror of
https://github.com/curl/curl.git
synced 2026-07-26 00:27:16 +03:00
printf: fix mingw-w64 format checks
Change mingw-w64 printf format checks in public curl headers to use `__MINGW_PRINTF_FORMAT` instead of `gnu_printf`. This syncs the format checker with format string macros published via `curl/system.h`. (Also disable format checks for mingw-w64 older than 3.0.0 (2013-09-20) and classic-mingw, which do not support this macro.) This fixes bogus format checker `-Wformat` warnings in 3rd party code using curl format strings with the curl printf functions, when using mingw-w64 7.0.0 (2019-11-10) and older (with GCC, MSVCRT). It also allows to delete two workaounds for this within curl itself: - setting `-D__USE_MINGW_ANSI_STDIO=1` for mingw-w64 via cmake and configure for `docs/examples` and `tests/http/clients`. Ref:c730c8549b#14640 The format check macro is incompatible (depending on mingw-w64 version and configuration) with the C99 `%z` (`size_t`) format string used internally by curl. To work around this problem, override the format check style in curl public headers to use `gnu_printf`. This is compatible with `%z` in all mingw-w64 versions and allows keeping the C99 format strings internally. Also: - lib/ws.c: add missing space to an error message. - docs/examples/ftpgetinfo.c: fix to use standard printf. Ref: #14643 (take 1) Follow-up to3829759bd0#12489 Closes #14703
This commit is contained in:
parent
6004f96734
commit
e512fbfa67
12 changed files with 22 additions and 33 deletions
|
|
@ -29,6 +29,10 @@
|
|||
* *rintf() functions.
|
||||
*/
|
||||
|
||||
#ifndef CURL_TEMP_PRINTF
|
||||
#error "CURL_TEMP_PRINTF must be set before including curl/mprintf.h"
|
||||
#endif
|
||||
|
||||
#include <curl/mprintf.h>
|
||||
|
||||
#define MERR_OK 0
|
||||
|
|
|
|||
|
|
@ -28,6 +28,9 @@
|
|||
#define CURL_NO_OLDIES
|
||||
#endif
|
||||
|
||||
/* Tell "curl/curl.h" not to include "curl/mprintf.h" */
|
||||
#define CURL_SKIP_INCLUDE_MPRINTF
|
||||
|
||||
/* FIXME: Delete this once the warnings have been fixed. */
|
||||
#if !defined(CURL_WARN_SIGN_CONVERSION)
|
||||
#ifdef __GNUC__
|
||||
|
|
@ -345,6 +348,9 @@
|
|||
#define CURL_PRINTF(fmt, arg)
|
||||
#endif
|
||||
|
||||
/* Override default printf mask check rules in "curl/mprintf.h" */
|
||||
#define CURL_TEMP_PRINTF CURL_PRINTF
|
||||
|
||||
/* Workaround for mainline llvm v16 and earlier missing a built-in macro
|
||||
expected by macOS SDK v14 / Xcode v15 (2023) and newer.
|
||||
gcc (as of v14) is also missing it. */
|
||||
|
|
|
|||
|
|
@ -25,7 +25,6 @@
|
|||
#include "curl_setup.h"
|
||||
#include "dynbuf.h"
|
||||
#include "curl_printf.h"
|
||||
#include <curl/mprintf.h>
|
||||
|
||||
#include "curl_memory.h"
|
||||
/* The last #include file should be: */
|
||||
|
|
|
|||
2
lib/ws.c
2
lib/ws.c
|
|
@ -558,7 +558,7 @@ static ssize_t ws_enc_write_head(struct Curl_easy *data,
|
|||
|
||||
if(enc->payload_remain > 0) {
|
||||
/* trying to write a new frame before the previous one is finished */
|
||||
failf(data, "WS: starting new frame with %zd bytes from last one"
|
||||
failf(data, "WS: starting new frame with %zd bytes from last one "
|
||||
"remaining to be sent", (ssize_t)enc->payload_remain);
|
||||
*err = CURLE_SEND_ERROR;
|
||||
return -1;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue