mirror of
https://github.com/curl/curl.git
synced 2026-08-25 13:53:37 +03:00
build: untangle CURLDEBUG and DEBUGBUILD macros
`CURLDEBUG` is meant to enable memory tracking, but in a bunch of cases, it was protecting debug features that were supposed to be guarded with `DEBUGBUILD`. Replace these uses with `DEBUGBUILD`. This leaves `CURLDEBUG` uses solely for its intended purpose: to enable the memory tracking debug feature. Also: - autotools: rely on `DEBUGBUILD` to enable `checksrc`. Instead of `CURLDEBUG`, which worked in most cases because debug builds enable `CURLDEBUG` by default, but it's not accurate. - include `lib/easyif.h` instead of keeping a copy of a declaration. - add CI test jobs for the build issues discovered. Ref: https://github.com/curl/curl/pull/13694#issuecomment-2120311894 Closes #13718
This commit is contained in:
parent
53b4dfe405
commit
59dc9f7e69
24 changed files with 53 additions and 43 deletions
|
|
@ -126,7 +126,7 @@ checksrc:
|
|||
-W$(srcdir)/curl_config.h $(srcdir)/*.[ch] $(srcdir)/vauth/*.[ch] \
|
||||
$(srcdir)/vtls/*.[ch] $(srcdir)/vquic/*.[ch] $(srcdir)/vssh/*.[ch])
|
||||
|
||||
if CURLDEBUG
|
||||
if DEBUGBUILD
|
||||
# for debug builds, we scan the sources on all regular make invokes
|
||||
all-local: checksrc
|
||||
endif
|
||||
|
|
|
|||
|
|
@ -718,7 +718,7 @@ CURLcode Curl_conn_send(struct Curl_easy *data, int sockindex,
|
|||
DEBUGASSERT(data);
|
||||
DEBUGASSERT(data->conn);
|
||||
conn = data->conn;
|
||||
#ifdef CURLDEBUG
|
||||
#ifdef DEBUGBUILD
|
||||
{
|
||||
/* Allow debug builds to override this logic to force short sends
|
||||
*/
|
||||
|
|
|
|||
|
|
@ -50,7 +50,7 @@ struct conncache {
|
|||
#define BUNDLE_UNKNOWN 0 /* initial value */
|
||||
#define BUNDLE_MULTIPLEX 2
|
||||
|
||||
#ifdef CURLDEBUG
|
||||
#ifdef DEBUGBUILD
|
||||
/* the debug versions of these macros make extra certain that the lock is
|
||||
never doubly locked or unlocked */
|
||||
#define CONNCACHE_LOCK(x) \
|
||||
|
|
|
|||
14
lib/doh.c
14
lib/doh.c
|
|
@ -191,7 +191,7 @@ doh_write_cb(const void *contents, size_t size, size_t nmemb, void *userp)
|
|||
return realsize;
|
||||
}
|
||||
|
||||
#if defined(USE_HTTPSRR) && defined(CURLDEBUG)
|
||||
#if defined(USE_HTTPSRR) && defined(DEBUGBUILD)
|
||||
static void local_print_buf(struct Curl_easy *data,
|
||||
const char *prefix,
|
||||
unsigned char *buf, size_t len)
|
||||
|
|
@ -285,7 +285,7 @@ static CURLcode dohprobe(struct Curl_easy *data,
|
|||
ERROR_CHECK_SETOPT(CURLOPT_HTTP_VERSION, CURL_HTTP_VERSION_2TLS);
|
||||
ERROR_CHECK_SETOPT(CURLOPT_PIPEWAIT, 1L);
|
||||
#endif
|
||||
#ifndef CURLDEBUG
|
||||
#ifndef DEBUGBUILD
|
||||
/* enforce HTTPS if not debug */
|
||||
ERROR_CHECK_SETOPT(CURLOPT_PROTOCOLS, CURLPROTO_HTTPS);
|
||||
#else
|
||||
|
|
@ -870,7 +870,7 @@ static void showdoh(struct Curl_easy *data,
|
|||
}
|
||||
#ifdef USE_HTTPSRR
|
||||
for(i = 0; i < d->numhttps_rrs; i++) {
|
||||
# ifdef CURLDEBUG
|
||||
# ifdef DEBUGBUILD
|
||||
local_print_buf(data, "DoH HTTPS",
|
||||
d->https_rrs[i].val, d->https_rrs[i].len);
|
||||
# else
|
||||
|
|
@ -1143,7 +1143,7 @@ err:
|
|||
return CURLE_BAD_CONTENT_ENCODING;
|
||||
}
|
||||
|
||||
#ifdef CURLDEBUG
|
||||
#ifdef DEBUGBUILD
|
||||
static CURLcode test_alpn_escapes(void)
|
||||
{
|
||||
/* we'll use an example from draft-ietf-dnsop-svcb, figure 10 */
|
||||
|
|
@ -1176,7 +1176,7 @@ static CURLcode Curl_doh_decode_httpsrr(unsigned char *rrval, size_t len,
|
|||
struct Curl_https_rrinfo *lhrr = NULL;
|
||||
char *dnsname = NULL;
|
||||
|
||||
#ifdef CURLDEBUG
|
||||
#ifdef DEBUGBUILD
|
||||
/* a few tests of escaping, shouldn't be here but ok for now */
|
||||
if(test_alpn_escapes() != CURLE_OK)
|
||||
return CURLE_OUT_OF_MEMORY;
|
||||
|
|
@ -1244,7 +1244,7 @@ err:
|
|||
return CURLE_OUT_OF_MEMORY;
|
||||
}
|
||||
|
||||
# ifdef CURLDEBUG
|
||||
# ifdef DEBUGBUILD
|
||||
static void local_print_httpsrr(struct Curl_easy *data,
|
||||
struct Curl_https_rrinfo *hrr)
|
||||
{
|
||||
|
|
@ -1382,7 +1382,7 @@ CURLcode Curl_doh_is_resolved(struct Curl_easy *data,
|
|||
return result;
|
||||
}
|
||||
infof(data, "Some HTTPS RR to process");
|
||||
# ifdef CURLDEBUG
|
||||
# ifdef DEBUGBUILD
|
||||
local_print_httpsrr(data, hrr);
|
||||
# endif
|
||||
(*dnsp)->hinfo = hrr;
|
||||
|
|
|
|||
|
|
@ -374,7 +374,7 @@ struct Curl_easy *curl_easy_init(void)
|
|||
return data;
|
||||
}
|
||||
|
||||
#ifdef CURLDEBUG
|
||||
#ifdef DEBUGBUILD
|
||||
|
||||
struct socketmonitor {
|
||||
struct socketmonitor *next; /* the next node in the list or NULL */
|
||||
|
|
@ -655,7 +655,7 @@ static CURLcode easy_events(struct Curl_multi *multi)
|
|||
|
||||
return wait_or_timeout(multi, &evs);
|
||||
}
|
||||
#else /* CURLDEBUG */
|
||||
#else /* DEBUGBUILD */
|
||||
/* when not built with debug, this function doesn't exist */
|
||||
#define easy_events(x) CURLE_NOT_BUILT_IN
|
||||
#endif
|
||||
|
|
@ -788,7 +788,7 @@ CURLcode curl_easy_perform(struct Curl_easy *data)
|
|||
return easy_perform(data, FALSE);
|
||||
}
|
||||
|
||||
#ifdef CURLDEBUG
|
||||
#ifdef DEBUGBUILD
|
||||
/*
|
||||
* curl_easy_perform_ev() is the external interface that performs a blocking
|
||||
* transfer using the event-based API internally.
|
||||
|
|
|
|||
|
|
@ -34,7 +34,7 @@ CURLcode Curl_senddata(struct Curl_easy *data, const void *buffer,
|
|||
CURLcode Curl_connect_only_attach(struct Curl_easy *data);
|
||||
#endif
|
||||
|
||||
#ifdef CURLDEBUG
|
||||
#ifdef DEBUGBUILD
|
||||
CURL_EXTERN CURLcode curl_easy_perform_ev(struct Curl_easy *easy);
|
||||
#endif
|
||||
|
||||
|
|
|
|||
|
|
@ -2849,7 +2849,7 @@ CURLcode Curl_http_header(struct Curl_easy *data,
|
|||
#ifndef CURL_DISABLE_ALTSVC
|
||||
v = (data->asi &&
|
||||
((data->conn->handler->flags & PROTOPT_SSL) ||
|
||||
#ifdef CURLDEBUG
|
||||
#ifdef DEBUGBUILD
|
||||
/* allow debug builds to circumvent the HTTPS restriction */
|
||||
getenv("CURL_ALTSVC_HTTP")
|
||||
#else
|
||||
|
|
@ -3116,7 +3116,7 @@ CURLcode Curl_http_header(struct Curl_easy *data,
|
|||
/* If enabled, the header is incoming and this is over HTTPS */
|
||||
v = (data->hsts &&
|
||||
((conn->handler->flags & PROTOPT_SSL) ||
|
||||
#ifdef CURLDEBUG
|
||||
#ifdef DEBUGBUILD
|
||||
/* allow debug builds to circumvent the HTTPS restriction */
|
||||
getenv("CURL_HSTS_HTTP")
|
||||
#else
|
||||
|
|
|
|||
|
|
@ -585,7 +585,7 @@ static size_t mqtt_decode_len(unsigned char *buf,
|
|||
return len;
|
||||
}
|
||||
|
||||
#ifdef CURLDEBUG
|
||||
#ifdef DEBUGBUILD
|
||||
static const char *statenames[]={
|
||||
"MQTT_FIRST",
|
||||
"MQTT_REMAINING_LENGTH",
|
||||
|
|
@ -606,7 +606,7 @@ static void mqstate(struct Curl_easy *data,
|
|||
{
|
||||
struct connectdata *conn = data->conn;
|
||||
struct mqtt_conn *mqtt = &conn->proto.mqtt;
|
||||
#ifdef CURLDEBUG
|
||||
#ifdef DEBUGBUILD
|
||||
infof(data, "%s (from %s) (next is %s)",
|
||||
statenames[state],
|
||||
statenames[mqtt->state],
|
||||
|
|
|
|||
|
|
@ -105,7 +105,7 @@ static CURLcode randit(struct Curl_easy *data, unsigned int *rnd)
|
|||
static unsigned int randseed;
|
||||
static bool seeded = FALSE;
|
||||
|
||||
#ifdef CURLDEBUG
|
||||
#ifdef DEBUGBUILD
|
||||
char *force_entropy = getenv("CURL_ENTROPY");
|
||||
if(force_entropy) {
|
||||
if(!seeded) {
|
||||
|
|
|
|||
|
|
@ -187,7 +187,7 @@ static CURLcode xfer_send(struct Curl_easy *data,
|
|||
CURLcode result = CURLE_OK;
|
||||
|
||||
*pnwritten = 0;
|
||||
#ifdef CURLDEBUG
|
||||
#ifdef DEBUGBUILD
|
||||
{
|
||||
/* Allow debug builds to override this logic to force short initial
|
||||
sends
|
||||
|
|
|
|||
|
|
@ -3028,7 +3028,7 @@ static CURLcode parse_connect_to_slist(struct Curl_easy *data,
|
|||
#ifndef CURL_DISABLE_ALTSVC
|
||||
if(data->asi && !host && (port == -1) &&
|
||||
((conn->handler->protocol == CURLPROTO_HTTPS) ||
|
||||
#ifdef CURLDEBUG
|
||||
#ifdef DEBUGBUILD
|
||||
/* allow debug builds to circumvent the HTTPS restriction */
|
||||
getenv("CURL_ALTSVC_HTTP")
|
||||
#else
|
||||
|
|
|
|||
|
|
@ -1375,7 +1375,7 @@ struct UrlState {
|
|||
unsigned char select_bits; /* != 0 -> bitmask of socket events for this
|
||||
transfer overriding anything the socket may
|
||||
report */
|
||||
#ifdef CURLDEBUG
|
||||
#ifdef DEBUGBUILD
|
||||
BIT(conncache_lock);
|
||||
#endif
|
||||
/* when curl_easy_perform() is called, the multi handle is "owned" by
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue