-
Notifications
You must be signed in to change notification settings - Fork 15.3k
Fixes: Can not use C99 function names as variable names in C89 #129979
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
base: main
Are you sure you want to change the base?
Conversation
You seemed to misread the page. |
My bad, I should have better clarified my previous comment. While GCC's behavior seems to be that even if builtins are "re-defined" it is allowed, when there is no explicit include for Reference:I've made a godbolt link https://godbolt.org/z/zY76dWa84 with all the symbols on https://en.cppreference.com/w/c/numeric/math All panels have
|
However, declaration it as an object with external linkage is UB (or ill-formed, no diagnostic required in the C++ standard wording). Per N3220 7.1.3/1
In C89 that was in 4.1.2
It seem to me that the following program was well-defined in C89 but became undefined (IFNDR) since C99. int logf = 0; /* N.B. static not used */
int main(void) { return logf; }But if |
|
✅ With the latest revision this PR passed the C/C++ code formatter. |
|
I'm a bit confused about the whole what is not UB/IFNDR in C89, but is in C99. Based on my current understanding the simplest way to resolve the issue seems to what I've done as of: Is not define builtins for symbols available in C89? let me know if that looks good. |
d79f127 to
6b05ad8
Compare
This reverts commit 6b05ad8.
fda5122 to
951bff3
Compare
709b617 to
9a6d3a8
Compare
math.h functions|
Any suggestions on how to go about making further progress on this one? Sort of stuck right now. |
@frederick-vs-ja bump |
| if (NameStr == "log" || NameStr == "va_start" || NameStr == "va_arg" || | ||
| NameStr == "va_end") { | ||
| return true; | ||
| } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The list would be very long, see https://port70.net/~nsz/c/c89/c89-draft.html. Perhaps we should add a .def file for this.
Fixes #15522
Essentially all of math.h doesn't exist untilC99: https://en.cppreference.com/w/c/numeric/math/logTodo: need more granular filtering based on poring the reference