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
#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
# define mvsnprintf curlx_mvsnprintf
# define aprintf curlx_maprintf
# define vaprintf curlx_mvaprintf
-#endif /* ENABLE_CURLX_PRINTF */
#endif /* HEADER_CURL_CURLX_H */
***************************************************************************/
#include "tool_setup.h"
-#define ENABLE_CURLX_PRINTF
-/* use our own printf() functions */
#include "curlx.h"
#include "tool_cfgable.h"
#include <unistd.h>
#endif
-#define ENABLE_CURLX_PRINTF
-/* use our own printf() functions */
#include "curlx.h"
#include "tool_cfgable.h"
***************************************************************************/
#include "tool_setup.h"
-#define ENABLE_CURLX_PRINTF
-/* use our own printf() functions */
#include "curlx.h"
#include "tool_cfgable.h"
#include <sys/select.h>
#endif
-#define ENABLE_CURLX_PRINTF
-/* use our own printf() functions */
#include "curlx.h"
#include "tool_cfgable.h"
***************************************************************************/
#include "tool_setup.h"
-#define ENABLE_CURLX_PRINTF
-/* use our own printf() functions */
#include "curlx.h"
#include "tool_cfgable.h"
#include <sys/stat.h>
-#define ENABLE_CURLX_PRINTF
-/* use our own printf() functions */
#include "curlx.h"
#include "tool_cfgable.h"
# include <direct.h>
#endif
-#define ENABLE_CURLX_PRINTF
-/* use our own printf() functions */
#include "curlx.h"
#include "tool_dirhie.h"
#ifndef CURL_DISABLE_LIBCURL_OPTION
-#define ENABLE_CURLX_PRINTF
-/* use our own printf() functions */
#include "curlx.h"
#include "tool_cfgable.h"
#include "strcase.h"
-#define ENABLE_CURLX_PRINTF
-/* use our own printf() functions */
#include "curlx.h"
#include "tool_cfgable.h"
#include "strcase.h"
-#define ENABLE_CURLX_PRINTF
-/* use our own printf() functions */
#include "curlx.h"
#include "tool_binmode.h"
*
***************************************************************************/
#include "tool_setup.h"
-#define ENABLE_CURLX_PRINTF
-/* use our own printf() functions */
+
#include "curlx.h"
#include "tool_help.h"
#include "strcase.h"
-#define ENABLE_CURLX_PRINTF
-/* use our own printf() functions */
#include "curlx.h"
#include "tool_cfgable.h"
***************************************************************************/
#include "tool_setup.h"
-#define ENABLE_CURLX_PRINTF
-/* use our own printf() functions */
#include "curlx.h"
#include "dynbuf.h"
#include "strcase.h"
-#define ENABLE_CURLX_PRINTF
-/* use our own printf() functions */
#include "curlx.h"
#include "tool_libinfo.h"
#include <fcntl.h>
#endif
-#define ENABLE_CURLX_PRINTF
-/* use our own printf() functions */
#include "curlx.h"
#include "tool_cfgable.h"
***************************************************************************/
#include "tool_setup.h"
-#define ENABLE_CURLX_PRINTF
-/* use our own printf() functions */
#include "curlx.h"
#include "tool_cfgable.h"
#include <uv.h>
#endif
-#define ENABLE_CURLX_PRINTF
-/* use our own printf() functions */
#include "curlx.h"
#include "tool_binmode.h"
#include "strcase.h"
-#define ENABLE_CURLX_PRINTF
-/* use our own printf() functions */
#include "curlx.h"
#include "tool_cfgable.h"
#include "strcase.h"
-#define ENABLE_CURLX_PRINTF
-/* use our own printf() functions */
#include "curlx.h"
#include "tool_cfgable.h"
***************************************************************************/
#include "tool_setup.h"
-#define ENABLE_CURLX_PRINTF
-/* use our own printf() functions */
#include "curlx.h"
#include "tool_cfgable.h"
#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,
#ifndef CURL_DISABLE_LIBCURL_OPTION
-#define ENABLE_CURLX_PRINTF
-/* use our own printf() functions */
#include "curlx.h"
#include "tool_cfgable.h"
***************************************************************************/
#include "tool_setup.h"
-#define ENABLE_CURLX_PRINTF
-/* use our own printf() functions */
#include "curlx.h"
#include "tool_cfgable.h"
#include "tool_doswin.h"
#include <unixlib.h>
#endif
-#define ENABLE_CURLX_PRINTF
#include "curlx.h"
#include "curlmsg_vms.h"
*
***************************************************************************/
#include "tool_setup.h"
-#define ENABLE_CURLX_PRINTF
-/* use our own printf() functions */
+
#include "curlx.h"
#include "tool_cfgable.h"
#include "tool_writeout.h"
***************************************************************************/
#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"
***************************************************************************/
#include "tool_setup.h"
-#define ENABLE_CURLX_PRINTF
-/* use our own printf() functions */
#include "curlx.h"
#include "tool_cfgable.h"
* 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"
#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 */
#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"
#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"
#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"
#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"
#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"
#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"
#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"
#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"
# include <arpa/inet.h>
#endif
-#define ENABLE_CURLX_PRINTF
#include "curlx.h"
#include "hash.h"
***************************************************************************/
#include "curlcheck.h"
-#define ENABLE_CURLX_PRINTF
#include "curlx.h"
#include "hash.h"
***************************************************************************/
#include "curlcheck.h"
-#define ENABLE_CURLX_PRINTF
#include "curlx.h"
#include "hash.h"
***************************************************************************/
#include "curlcheck.h"
-#define ENABLE_CURLX_PRINTF
#include "curlx.h"
#include "hash.h"