When the input source is stdin, the FLT_EVAL_METHOD macro is not set.
This patch defines it.
Details
- Reviewers
aaron.ballman andrew.w.kaylor
Diff Detail
Event Timeline
clang/lib/Frontend/FrontendAction.cpp | ||
---|---|---|
845–855 | I'm confused as to why we want to predefine this macro *only* when the input source is stdin? So I'm not certain I understand why this change is desired. e.g., https://godbolt.org/z/E8Y67381r (note how there's no __FLT_EVAL_METHOD__ defined there) |
clang/lib/Frontend/FrontendAction.cpp | ||
---|---|---|
845–855 | I was offering a solution to the issue raised by @glandium in https://reviews.llvm.org/D109239. I thought that the issue was only when the source is stdin, but obviously not. The default setting should happen under no condition. |
clang/lib/Frontend/FrontendAction.cpp | ||
---|---|---|
845–855 | There have been a lot of reviews over this stuff, so I may be remembering incorrectly... but I thought it was a conscious decision to *not* predefine __FLT_EVAL_METHOD__ because that value changes depending on pragmas in the TU. I thought the way that macro worked was that we registered it as a macro and we figure out its value at expansion time. (The original report confused me into thinking that __FLT_EVAL_METHOD__ was behaving as though it was never defined, so expansion would never result in a correct value except when the eval method is 0.) |
clang/lib/Frontend/FrontendAction.cpp | ||
---|---|---|
845–855 | Yes, you are remembering correctly. I looked at older comments and it's something that was intended. We didn't want to pre-define it, until it is set at expansion. |
clang/lib/Frontend/FrontendAction.cpp | ||
---|---|---|
845–855 | Thank you for double-checking! I would recommend that you abandon this change, and instead make an NFC change to https://clang.llvm.org/docs/UsersManual.html#a-note-about-flt-eval-method to make it clear that this macro does not appear when dumping preprocessor macro definitions but is instead resolved when expanding it as a macro definition. |
clang/lib/Frontend/FrontendAction.cpp | ||
---|---|---|
845–855 | Good idea! I seem to be regularly falling into forgetting this. |
I'm confused as to why we want to predefine this macro *only* when the input source is stdin? So I'm not certain I understand why this change is desired.
e.g., https://godbolt.org/z/E8Y67381r (note how there's no __FLT_EVAL_METHOD__ defined there)