src: fix potential macro confusion in cmake unity builds
Sources used `lib/curlx.h` with both `ENABLE_CURLX_PRINTF` set and unset
before including it.
In a cmake "unity" batch where the first included source had it unset,
the next sources did not get the macros requested with
`ENABLE_CURLX_PRINTF` because `lib/curl.x` had already been included
without them.
Fix it by by making the macros enabled permanently and globally for
internal sources, and dropping `ENABLE_CURLX_PRINTF`.
This came up while testing unity builds with smaller batches. The full,
default unity build where all `src` is bundled up in a single unit, was
not affected.
Fixes:
```
$ cmake -B build -DCMAKE_UNITY_BUILD=ON -DCMAKE_UNITY_BUILD_BATCH_SIZE=15
$ make -C build
...
curl/src/tool_getparam.c: In function ‘getparameter’:
curl/src/tool_getparam.c:2409:11: error: implicit declaration of function ‘msnprintf’; did you mean ‘vsnprintf’? [-Wimplicit-function-declaration]
2409 | msnprintf(buffer, sizeof(buffer), "%" CURL_FORMAT_CURL_OFF_T "-",
| ^~~~~~~~~
| vsnprintf
curl/src/tool_getparam.c:2409:11: warning: nested extern declaration of ‘msnprintf’ [-Wnested-externs]
[...]
```
Reported-by: Daniel Stenberg
Bug: https://github.com/curl/curl/pull/14626#issuecomment-2301663491
Closes #14632
This commit is contained in:
parent
6292a332f8
commit
c04504885d
@ -88,10 +88,9 @@
|
||||
#define curlx_mvprintf curl_mvprintf
|
||||
#define curlx_mvfprintf curl_mvfprintf
|
||||
|
||||
#ifdef ENABLE_CURLX_PRINTF
|
||||
/* If this define is set, we define all "standard" printf() functions to use
|
||||
the curlx_* version instead. It makes the source code transparent and
|
||||
easier to understand/patch. Undefine them first. */
|
||||
/* We define all "standard" printf() functions to use the curlx_* version
|
||||
instead. It makes the source code transparent and easier to
|
||||
understand/patch. Undefine them first. */
|
||||
# undef printf
|
||||
# undef fprintf
|
||||
# undef sprintf
|
||||
@ -111,6 +110,5 @@
|
||||
# define mvsnprintf curlx_mvsnprintf
|
||||
# define aprintf curlx_maprintf
|
||||
# define vaprintf curlx_mvaprintf
|
||||
#endif /* ENABLE_CURLX_PRINTF */
|
||||
|
||||
#endif /* HEADER_CURL_CURLX_H */
|
||||
|
||||
@ -23,8 +23,6 @@
|
||||
***************************************************************************/
|
||||
#include "tool_setup.h"
|
||||
|
||||
#define ENABLE_CURLX_PRINTF
|
||||
/* use our own printf() functions */
|
||||
#include "curlx.h"
|
||||
|
||||
#include "tool_cfgable.h"
|
||||
|
||||
@ -28,8 +28,6 @@
|
||||
#include <unistd.h>
|
||||
#endif
|
||||
|
||||
#define ENABLE_CURLX_PRINTF
|
||||
/* use our own printf() functions */
|
||||
#include "curlx.h"
|
||||
|
||||
#include "tool_cfgable.h"
|
||||
|
||||
@ -23,8 +23,6 @@
|
||||
***************************************************************************/
|
||||
#include "tool_setup.h"
|
||||
|
||||
#define ENABLE_CURLX_PRINTF
|
||||
/* use our own printf() functions */
|
||||
#include "curlx.h"
|
||||
|
||||
#include "tool_cfgable.h"
|
||||
|
||||
@ -27,8 +27,6 @@
|
||||
#include <sys/select.h>
|
||||
#endif
|
||||
|
||||
#define ENABLE_CURLX_PRINTF
|
||||
/* use our own printf() functions */
|
||||
#include "curlx.h"
|
||||
|
||||
#include "tool_cfgable.h"
|
||||
|
||||
@ -23,8 +23,6 @@
|
||||
***************************************************************************/
|
||||
#include "tool_setup.h"
|
||||
|
||||
#define ENABLE_CURLX_PRINTF
|
||||
/* use our own printf() functions */
|
||||
#include "curlx.h"
|
||||
|
||||
#include "tool_cfgable.h"
|
||||
|
||||
@ -30,8 +30,6 @@
|
||||
|
||||
#include <sys/stat.h>
|
||||
|
||||
#define ENABLE_CURLX_PRINTF
|
||||
/* use our own printf() functions */
|
||||
#include "curlx.h"
|
||||
|
||||
#include "tool_cfgable.h"
|
||||
|
||||
@ -29,8 +29,6 @@
|
||||
# include <direct.h>
|
||||
#endif
|
||||
|
||||
#define ENABLE_CURLX_PRINTF
|
||||
/* use our own printf() functions */
|
||||
#include "curlx.h"
|
||||
|
||||
#include "tool_dirhie.h"
|
||||
|
||||
@ -27,8 +27,6 @@
|
||||
|
||||
#ifndef CURL_DISABLE_LIBCURL_OPTION
|
||||
|
||||
#define ENABLE_CURLX_PRINTF
|
||||
/* use our own printf() functions */
|
||||
#include "curlx.h"
|
||||
|
||||
#include "tool_cfgable.h"
|
||||
|
||||
@ -25,8 +25,6 @@
|
||||
|
||||
#include "strcase.h"
|
||||
|
||||
#define ENABLE_CURLX_PRINTF
|
||||
/* use our own printf() functions */
|
||||
#include "curlx.h"
|
||||
|
||||
#include "tool_cfgable.h"
|
||||
|
||||
@ -25,8 +25,6 @@
|
||||
|
||||
#include "strcase.h"
|
||||
|
||||
#define ENABLE_CURLX_PRINTF
|
||||
/* use our own printf() functions */
|
||||
#include "curlx.h"
|
||||
|
||||
#include "tool_binmode.h"
|
||||
|
||||
@ -22,8 +22,7 @@
|
||||
*
|
||||
***************************************************************************/
|
||||
#include "tool_setup.h"
|
||||
#define ENABLE_CURLX_PRINTF
|
||||
/* use our own printf() functions */
|
||||
|
||||
#include "curlx.h"
|
||||
|
||||
#include "tool_help.h"
|
||||
|
||||
@ -25,8 +25,6 @@
|
||||
|
||||
#include "strcase.h"
|
||||
|
||||
#define ENABLE_CURLX_PRINTF
|
||||
/* use our own printf() functions */
|
||||
#include "curlx.h"
|
||||
|
||||
#include "tool_cfgable.h"
|
||||
|
||||
@ -23,8 +23,6 @@
|
||||
***************************************************************************/
|
||||
#include "tool_setup.h"
|
||||
|
||||
#define ENABLE_CURLX_PRINTF
|
||||
/* use our own printf() functions */
|
||||
#include "curlx.h"
|
||||
#include "dynbuf.h"
|
||||
|
||||
|
||||
@ -25,8 +25,6 @@
|
||||
|
||||
#include "strcase.h"
|
||||
|
||||
#define ENABLE_CURLX_PRINTF
|
||||
/* use our own printf() functions */
|
||||
#include "curlx.h"
|
||||
|
||||
#include "tool_libinfo.h"
|
||||
|
||||
@ -35,8 +35,6 @@
|
||||
#include <fcntl.h>
|
||||
#endif
|
||||
|
||||
#define ENABLE_CURLX_PRINTF
|
||||
/* use our own printf() functions */
|
||||
#include "curlx.h"
|
||||
|
||||
#include "tool_cfgable.h"
|
||||
|
||||
@ -23,8 +23,6 @@
|
||||
***************************************************************************/
|
||||
#include "tool_setup.h"
|
||||
|
||||
#define ENABLE_CURLX_PRINTF
|
||||
/* use our own printf() functions */
|
||||
#include "curlx.h"
|
||||
|
||||
#include "tool_cfgable.h"
|
||||
|
||||
@ -60,8 +60,6 @@
|
||||
#include <uv.h>
|
||||
#endif
|
||||
|
||||
#define ENABLE_CURLX_PRINTF
|
||||
/* use our own printf() functions */
|
||||
#include "curlx.h"
|
||||
|
||||
#include "tool_binmode.h"
|
||||
|
||||
@ -26,8 +26,6 @@
|
||||
|
||||
#include "strcase.h"
|
||||
|
||||
#define ENABLE_CURLX_PRINTF
|
||||
/* use our own printf() functions */
|
||||
#include "curlx.h"
|
||||
|
||||
#include "tool_cfgable.h"
|
||||
|
||||
@ -25,8 +25,6 @@
|
||||
|
||||
#include "strcase.h"
|
||||
|
||||
#define ENABLE_CURLX_PRINTF
|
||||
/* use our own printf() functions */
|
||||
#include "curlx.h"
|
||||
|
||||
#include "tool_cfgable.h"
|
||||
|
||||
@ -23,8 +23,6 @@
|
||||
***************************************************************************/
|
||||
#include "tool_setup.h"
|
||||
|
||||
#define ENABLE_CURLX_PRINTF
|
||||
/* use our own printf() functions */
|
||||
#include "curlx.h"
|
||||
|
||||
#include "tool_cfgable.h"
|
||||
|
||||
@ -26,8 +26,6 @@
|
||||
#include "tool_progress.h"
|
||||
#include "tool_util.h"
|
||||
|
||||
#define ENABLE_CURLX_PRINTF
|
||||
/* use our own printf() functions */
|
||||
#include "curlx.h"
|
||||
|
||||
/* The point of this function would be to return a string of the input data,
|
||||
|
||||
@ -25,8 +25,6 @@
|
||||
|
||||
#ifndef CURL_DISABLE_LIBCURL_OPTION
|
||||
|
||||
#define ENABLE_CURLX_PRINTF
|
||||
/* use our own printf() functions */
|
||||
#include "curlx.h"
|
||||
|
||||
#include "tool_cfgable.h"
|
||||
|
||||
@ -23,8 +23,6 @@
|
||||
***************************************************************************/
|
||||
#include "tool_setup.h"
|
||||
|
||||
#define ENABLE_CURLX_PRINTF
|
||||
/* use our own printf() functions */
|
||||
#include "curlx.h"
|
||||
#include "tool_cfgable.h"
|
||||
#include "tool_doswin.h"
|
||||
|
||||
@ -30,7 +30,6 @@
|
||||
#include <unixlib.h>
|
||||
#endif
|
||||
|
||||
#define ENABLE_CURLX_PRINTF
|
||||
#include "curlx.h"
|
||||
|
||||
#include "curlmsg_vms.h"
|
||||
|
||||
@ -22,8 +22,7 @@
|
||||
*
|
||||
***************************************************************************/
|
||||
#include "tool_setup.h"
|
||||
#define ENABLE_CURLX_PRINTF
|
||||
/* use our own printf() functions */
|
||||
|
||||
#include "curlx.h"
|
||||
#include "tool_cfgable.h"
|
||||
#include "tool_writeout.h"
|
||||
|
||||
@ -23,9 +23,6 @@
|
||||
***************************************************************************/
|
||||
#include "tool_setup.h"
|
||||
|
||||
#define ENABLE_CURLX_PRINTF
|
||||
|
||||
/* use our own printf() functions */
|
||||
#include "curlx.h"
|
||||
#include "tool_cfgable.h"
|
||||
#include "tool_writeout_json.h"
|
||||
|
||||
@ -23,8 +23,6 @@
|
||||
***************************************************************************/
|
||||
#include "tool_setup.h"
|
||||
|
||||
#define ENABLE_CURLX_PRINTF
|
||||
/* use our own printf() functions */
|
||||
#include "curlx.h"
|
||||
|
||||
#include "tool_cfgable.h"
|
||||
|
||||
@ -31,7 +31,6 @@
|
||||
* responses with a pre-written string saved in test case test2005.
|
||||
*/
|
||||
|
||||
#define ENABLE_CURLX_PRINTF
|
||||
#include "curlx.h" /* from the private lib dir */
|
||||
#include "getpart.h"
|
||||
#include "util.h"
|
||||
|
||||
@ -25,9 +25,6 @@
|
||||
|
||||
#include "getpart.h"
|
||||
|
||||
#define ENABLE_CURLX_PRINTF
|
||||
/* make the curlx header define all printf() functions to use the curlx_*
|
||||
versions instead */
|
||||
#include "curlx.h" /* from the private lib dir */
|
||||
|
||||
/* just to please curl_base64.h we create a fake struct */
|
||||
|
||||
@ -54,9 +54,6 @@
|
||||
#include <netdb.h>
|
||||
#endif
|
||||
|
||||
#define ENABLE_CURLX_PRINTF
|
||||
/* make the curlx header define all printf() functions to use the curlx_*
|
||||
versions instead */
|
||||
#include "curlx.h" /* from the private lib dir */
|
||||
#include "getpart.h"
|
||||
#include "inet_pton.h"
|
||||
|
||||
@ -45,9 +45,6 @@
|
||||
#include <netdb.h>
|
||||
#endif
|
||||
|
||||
#define ENABLE_CURLX_PRINTF
|
||||
/* make the curlx header define all printf() functions to use the curlx_*
|
||||
versions instead */
|
||||
#include "curlx.h" /* from the private lib dir */
|
||||
#include "util.h"
|
||||
|
||||
|
||||
@ -46,9 +46,6 @@
|
||||
#include <netinet/tcp.h> /* for TCP_NODELAY */
|
||||
#endif
|
||||
|
||||
#define ENABLE_CURLX_PRINTF
|
||||
/* make the curlx header define all printf() functions to use the curlx_*
|
||||
versions instead */
|
||||
#include "curlx.h" /* from the private lib dir */
|
||||
#include "getpart.h"
|
||||
#include "util.h"
|
||||
|
||||
@ -99,9 +99,6 @@
|
||||
#include <netdb.h>
|
||||
#endif
|
||||
|
||||
#define ENABLE_CURLX_PRINTF
|
||||
/* make the curlx header define all printf() functions to use the curlx_*
|
||||
versions instead */
|
||||
#include "curlx.h" /* from the private lib dir */
|
||||
#include "getpart.h"
|
||||
#include "inet_pton.h"
|
||||
|
||||
@ -71,9 +71,6 @@
|
||||
#include <netdb.h>
|
||||
#endif
|
||||
|
||||
#define ENABLE_CURLX_PRINTF
|
||||
/* make the curlx header define all printf() functions to use the curlx_*
|
||||
versions instead */
|
||||
#include "curlx.h" /* from the private lib dir */
|
||||
#include "getpart.h"
|
||||
#include "inet_pton.h"
|
||||
|
||||
@ -47,9 +47,6 @@
|
||||
#include <netinet/tcp.h> /* for TCP_NODELAY */
|
||||
#endif
|
||||
|
||||
#define ENABLE_CURLX_PRINTF
|
||||
/* make the curlx header define all printf() functions to use the curlx_*
|
||||
versions instead */
|
||||
#include "curlx.h" /* from the private lib dir */
|
||||
#include "getpart.h"
|
||||
#include "inet_pton.h"
|
||||
|
||||
@ -81,9 +81,6 @@
|
||||
|
||||
#include <ctype.h>
|
||||
|
||||
#define ENABLE_CURLX_PRINTF
|
||||
/* make the curlx header define all printf() functions to use the curlx_*
|
||||
versions instead */
|
||||
#include "curlx.h" /* from the private lib dir */
|
||||
#include "getpart.h"
|
||||
#include "util.h"
|
||||
|
||||
@ -40,9 +40,6 @@
|
||||
#include <sys/poll.h>
|
||||
#endif
|
||||
|
||||
#define ENABLE_CURLX_PRINTF
|
||||
/* make the curlx header define all printf() functions to use the curlx_*
|
||||
versions instead */
|
||||
#include "curlx.h" /* from the private lib dir */
|
||||
#include "getpart.h"
|
||||
#include "util.h"
|
||||
|
||||
@ -33,7 +33,6 @@
|
||||
# include <arpa/inet.h>
|
||||
#endif
|
||||
|
||||
#define ENABLE_CURLX_PRINTF
|
||||
#include "curlx.h"
|
||||
|
||||
#include "hash.h"
|
||||
|
||||
@ -23,7 +23,6 @@
|
||||
***************************************************************************/
|
||||
#include "curlcheck.h"
|
||||
|
||||
#define ENABLE_CURLX_PRINTF
|
||||
#include "curlx.h"
|
||||
|
||||
#include "hash.h"
|
||||
|
||||
@ -23,7 +23,6 @@
|
||||
***************************************************************************/
|
||||
#include "curlcheck.h"
|
||||
|
||||
#define ENABLE_CURLX_PRINTF
|
||||
#include "curlx.h"
|
||||
|
||||
#include "hash.h"
|
||||
|
||||
@ -23,7 +23,6 @@
|
||||
***************************************************************************/
|
||||
#include "curlcheck.h"
|
||||
|
||||
#define ENABLE_CURLX_PRINTF
|
||||
#include "curlx.h"
|
||||
|
||||
#include "hash.h"
|
||||
|
||||
Loading…
Reference in New Issue
Block a user