mirror of
https://github.com/curl/curl.git
synced 2026-04-14 22:11:45 +03:00
include: avoid recursive macros
To fix potential `-Wdisabled-macro-expansion` warnings when using these
macros within other macros. Fixing for example:
```
lib/doh.c:328:3: error: disabled expansion of recursive macro [clang-diagnostic-disabled-macro-expansion,-warnings-as-errors]
328 | ERROR_CHECK_SETOPT(CURLOPT_URL, url);
| ^
lib/doh.c:271:14: note: expanded from macro 'ERROR_CHECK_SETOPT'
271 | result = curl_easy_setopt((CURL *)doh, x, y); \
| ^
include/curl/curl.h:3332:44: note: expanded from macro 'curl_easy_setopt'
3332 | #define curl_easy_setopt(handle,opt,param) curl_easy_setopt(handle,opt,param)
| ^
[...]
```
Also update comments on why curl continues to disable
`-Wdisabled-macro-expansion` and `-Wused-but-marked-unused` warnings.
Follow-up to 92f215fea1 #18477
Closes #20597
This commit is contained in:
parent
1eec8b8d03
commit
daa6b27b4d
4 changed files with 17 additions and 12 deletions
|
|
@ -3329,10 +3329,14 @@ CURL_EXTERN CURLcode curl_easy_ssls_export(CURL *handle,
|
|||
/* This preprocessor magic that replaces a call with the exact same call is
|
||||
only done to make sure application authors pass exactly three arguments
|
||||
to these functions. */
|
||||
#define curl_easy_setopt(handle,opt,param) curl_easy_setopt(handle,opt,param)
|
||||
#define curl_easy_getinfo(handle,info,arg) curl_easy_getinfo(handle,info,arg)
|
||||
#define curl_share_setopt(share,opt,param) curl_share_setopt(share,opt,param)
|
||||
#define curl_multi_setopt(handle,opt,param) curl_multi_setopt(handle,opt,param)
|
||||
#define curl_easy_setopt(handle, opt, param) \
|
||||
(curl_easy_setopt)(handle, opt, param)
|
||||
#define curl_easy_getinfo(handle, info, arg) \
|
||||
(curl_easy_getinfo)(handle, info, arg)
|
||||
#define curl_share_setopt(share, opt, param) \
|
||||
(curl_share_setopt)(share, opt, param)
|
||||
#define curl_multi_setopt(handle,opt,param) \
|
||||
(curl_multi_setopt)(handle, opt, param)
|
||||
#endif /* __STDC__ >= 1 */
|
||||
#endif /* gcc >= 4.3 && !__cplusplus && !CURL_DISABLE_TYPECHECK */
|
||||
|
||||
|
|
|
|||
|
|
@ -156,7 +156,7 @@
|
|||
Wcurl_easy_setopt_err_CURLSH(); \
|
||||
) \
|
||||
} \
|
||||
curl_easy_setopt(handle, option, value); \
|
||||
(curl_easy_setopt)(handle, option, value); \
|
||||
})
|
||||
|
||||
/* wraps curl_easy_getinfo() with type checking */
|
||||
|
|
@ -190,7 +190,7 @@
|
|||
Wcurl_easy_getinfo_err_curl_off_t(); \
|
||||
) \
|
||||
} \
|
||||
curl_easy_getinfo(handle, info, arg); \
|
||||
(curl_easy_getinfo)(handle, info, arg); \
|
||||
})
|
||||
|
||||
#define curl_multi_setopt(handle, option, value) \
|
||||
|
|
@ -221,7 +221,7 @@
|
|||
if(!curlcheck_multitimer_cb(value)) \
|
||||
Wcurl_multi_setopt_err_timercb(); \
|
||||
} \
|
||||
curl_multi_setopt(handle, option, value); \
|
||||
(curl_multi_setopt)(handle, option, value); \
|
||||
})
|
||||
|
||||
/* evaluates to true if the option takes a data argument to pass to a
|
||||
|
|
@ -262,7 +262,8 @@
|
|||
/*
|
||||
* For now, just make sure that the functions are called with three arguments
|
||||
*/
|
||||
#define curl_share_setopt(share,opt,param) curl_share_setopt(share,opt,param)
|
||||
#define curl_share_setopt(share, opt, param) \
|
||||
(curl_share_setopt)(share, opt, param)
|
||||
|
||||
/* the actual warnings, triggered by calling the Wcurl_easy_setopt_err*
|
||||
* functions */
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue