mirror of
https://github.com/curl/curl.git
synced 2026-08-26 10:43:32 +03:00
build: delete/replace clang warning pragmas
- delete redundant warning suppressions for `-Wformat-nonliteral`. This now relies on `CURL_PRINTF()` and it's theoratically possible that this macro isn't active but the warning is. We're ignoring this as a corner-case here. - replace two pragmas with code changes to avoid the warnings. Follow-up toaee4ebe591#12803 Follow-up to0923012758#12540 Follow-up to3829759bd0#12489 Reviewed-by: Daniel Stenberg Closes #12812
This commit is contained in:
parent
ecb5d6bee9
commit
5b286c2508
9 changed files with 5 additions and 87 deletions
|
|
@ -92,14 +92,7 @@ void Curl_failf(struct Curl_easy *data, const char *fmt, ...)
|
|||
int len;
|
||||
char error[CURL_ERROR_SIZE + 2];
|
||||
va_start(ap, fmt);
|
||||
#ifdef __clang__
|
||||
#pragma clang diagnostic push
|
||||
#pragma clang diagnostic ignored "-Wformat-nonliteral"
|
||||
#endif
|
||||
len = mvsnprintf(error, CURL_ERROR_SIZE, fmt, ap);
|
||||
#ifdef __clang__
|
||||
#pragma clang diagnostic pop
|
||||
#endif
|
||||
|
||||
if(data->set.errorbuffer && !data->state.errorbuf) {
|
||||
strcpy(data->set.errorbuffer, error);
|
||||
|
|
@ -125,14 +118,7 @@ void Curl_infof(struct Curl_easy *data, const char *fmt, ...)
|
|||
int len;
|
||||
char buffer[MAXINFO + 2];
|
||||
va_start(ap, fmt);
|
||||
#ifdef __clang__
|
||||
#pragma clang diagnostic push
|
||||
#pragma clang diagnostic ignored "-Wformat-nonliteral"
|
||||
#endif
|
||||
len = mvsnprintf(buffer, MAXINFO, fmt, ap);
|
||||
#ifdef __clang__
|
||||
#pragma clang diagnostic pop
|
||||
#endif
|
||||
va_end(ap);
|
||||
buffer[len++] = '\n';
|
||||
buffer[len] = '\0';
|
||||
|
|
@ -150,14 +136,7 @@ void Curl_trc_cf_infof(struct Curl_easy *data, struct Curl_cfilter *cf,
|
|||
char buffer[MAXINFO + 2];
|
||||
len = msnprintf(buffer, MAXINFO, "[%s] ", cf->cft->name);
|
||||
va_start(ap, fmt);
|
||||
#ifdef __clang__
|
||||
#pragma clang diagnostic push
|
||||
#pragma clang diagnostic ignored "-Wformat-nonliteral"
|
||||
#endif
|
||||
len += mvsnprintf(buffer + len, MAXINFO - len, fmt, ap);
|
||||
#ifdef __clang__
|
||||
#pragma clang diagnostic pop
|
||||
#endif
|
||||
va_end(ap);
|
||||
buffer[len++] = '\n';
|
||||
buffer[len] = '\0';
|
||||
|
|
|
|||
|
|
@ -135,14 +135,7 @@ static CURLcode sendf(curl_socket_t sockfd, struct Curl_easy *data,
|
|||
char *sptr;
|
||||
va_list ap;
|
||||
va_start(ap, fmt);
|
||||
#ifdef __clang__
|
||||
#pragma clang diagnostic push
|
||||
#pragma clang diagnostic ignored "-Wformat-nonliteral"
|
||||
#endif
|
||||
s = vaprintf(fmt, ap); /* returns an allocated string */
|
||||
#ifdef __clang__
|
||||
#pragma clang diagnostic pop
|
||||
#endif
|
||||
va_end(ap);
|
||||
if(!s)
|
||||
return CURLE_OUT_OF_MEMORY; /* failure */
|
||||
|
|
|
|||
|
|
@ -204,14 +204,7 @@ CURLcode Curl_dyn_vaddf(struct dynbuf *s, const char *fmt, va_list ap)
|
|||
return CURLE_OUT_OF_MEMORY;
|
||||
#else
|
||||
char *str;
|
||||
#ifdef __clang__
|
||||
#pragma clang diagnostic push
|
||||
#pragma clang diagnostic ignored "-Wformat-nonliteral"
|
||||
#endif
|
||||
str = vaprintf(fmt, ap); /* this allocs a new string to append */
|
||||
#ifdef __clang__
|
||||
#pragma clang diagnostic pop
|
||||
#endif
|
||||
|
||||
if(str) {
|
||||
CURLcode result = dyn_nappend(s, (unsigned char *)str, strlen(str));
|
||||
|
|
|
|||
|
|
@ -448,14 +448,7 @@ void curl_dbg_log(const char *format, ...)
|
|||
return;
|
||||
|
||||
va_start(ap, format);
|
||||
#ifdef __clang__
|
||||
#pragma clang diagnostic push
|
||||
#pragma clang diagnostic ignored "-Wformat-nonliteral"
|
||||
#endif
|
||||
nchars = mvsnprintf(buf, LOGLINE_BUFSIZE, format, ap);
|
||||
#ifdef __clang__
|
||||
#pragma clang diagnostic pop
|
||||
#endif
|
||||
va_end(ap);
|
||||
|
||||
if(nchars > LOGLINE_BUFSIZE - 1)
|
||||
|
|
|
|||
|
|
@ -1677,14 +1677,7 @@ CURLcode Curl_mime_add_header(struct curl_slist **slp, const char *fmt, ...)
|
|||
va_list ap;
|
||||
|
||||
va_start(ap, fmt);
|
||||
#ifdef __clang__
|
||||
#pragma clang diagnostic push
|
||||
#pragma clang diagnostic ignored "-Wformat-nonliteral"
|
||||
#endif
|
||||
s = curl_mvaprintf(fmt, ap);
|
||||
#ifdef __clang__
|
||||
#pragma clang diagnostic pop
|
||||
#endif
|
||||
va_end(ap);
|
||||
|
||||
if(s) {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue