-
-
Notifications
You must be signed in to change notification settings - Fork 6.6k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
curl_printf.h macros can conflict with external headers #743
Comments
Thanks @davidben, it all makes sense. I like keeping the defines simply because it makes a lot of code use the traditional and commonly known function names. If we'd use the full Moving the include seems like the least annoying change. I think we can improve the
|
I merged that patch just now: 7218b52 to get it out of the way =) |
I bit the bullet and made it happen. Thanks for the report! |
curl_printf.h
definesprintf
tocurl_mprintf
, etc. This can cause problems with external headers which may use__attribute__((format(printf, ...)))
markers. This can be worked around by spelling it__format__
and__printf__
(which I have done for BoringSSL), but this still seems something curl should avoid. Defining macros in libc's namespace right before including external headers is a little screwy.The simplest fix would be to require
curl_printf.h
be one of the last includes, just beforecurl_memory.h
. Though this too is a little screwy sincecurl_memory.h
includescurl.h
which includesstdio.h
. I think the only reason that one doesn't break is becausecurl_printf.h
pulls inmprintf.h
which, in turn, pulls instdio.h
first.I don't know if you'd rather that get resolved first. (One possibility is to separate the headers which define the symbols of interest from the headers which define the convenience macros. Another is maybe not to use the macros at all and call
curl_mprintf
and friends directly in cURL code) If not, I'm happy to send a patch which just moves all thecurl_printf.h
includes to the end.The text was updated successfully, but these errors were encountered: