curl/curl.h: revert to recursive macros to keep supporting C++ use-case

To avoid breaking 3rd-party code reusing these symbols as C++ methods,
e.g. in CMake sources:
```
cmake/src/v4.0.0-b30653ae0c.clean/Source/cmCurl.cxx:119:24: error: expected unqualified-id
  119 |     ::CURLcode res = ::curl_easy_setopt(curl, CURLOPT_CAINFO, cafile.c_str());
      |                        ^
```

Also expand comment to highlight the case.

Reported-by: Kai Pastor
Bug: daa6b27b4d (r177869049)
Reported-by: Marcel Raad
Bug: https://curl.se/mail/lib-2026-02/0020.html
Fixes #20682
Follow-up to daa6b27b4d #20597

Closes #20686
This commit is contained in:
Viktor Szakats 2026-02-23 12:00:18 +01:00
parent d6d8a1a15a
commit ee9b000438
No known key found for this signature in database
3 changed files with 9 additions and 8 deletions

View file

@ -3329,15 +3329,16 @@ CURL_EXTERN CURLcode curl_easy_ssls_export(CURL *handle,
#if defined(__STDC__) && (__STDC__ >= 1)
/* 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. */
to these functions. Use recursive macros to allow reusing these symbols
as C++ method names. */
#define curl_easy_setopt(handle, opt, param) \
(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)
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)
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 */