[PATCH] D72841: [RFC] Add support for pragma float_control, to control precision and exception behavior at the source level
Melanie Blower via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Fri Jan 17 08:25:15 PST 2020
mibintc marked 3 inline comments as done.
mibintc added a comment.
@sepavloff Thanks a lot for your comments. I added a few replies and I have one question, added inline.
================
Comment at: clang/lib/Parse/ParsePragma.cpp:2522
+ IdentifierInfo *II = Tok.getIdentifierInfo();
+ PragmaFloatControlDecl::FloatControlKind Kind =
+ llvm::StringSwitch<PragmaFloatControlDecl::FloatControlKind>(
----------------
sepavloff wrote:
> Does such treatment allow a pragma like:
>
> #pragma #pragma float_control(except, on), push
>
> The comment to `PragmaFloatControlHandler::HandlePragma` says it is valid.
Yes, #pragma float_control(except, on, push) is allowed. That's inherited from the Microsoft pragma of the same name. I need to change the .rst documentation about this. #pragma float_control(push) or #pragma float_control(pop) is also supported. Here's a link to the Microsoft doc, https://docs.microsoft.com/en-us/cpp/preprocessor/float-control?view=vs-2019
================
Comment at: clang/lib/Sema/SemaAttr.cpp:430
+ break;
+ case PragmaFloatControlDecl::FC_Push:
+ case PragmaFloatControlDecl::FC_Pop:
----------------
sepavloff wrote:
> `push` cannot be combined with `precise`?
Yes it can be combined: #pragma float_control(precise, push); the "push" is coded into the Action, the action can be either "set" or "push". I'm using pre-existing code in clang which provides support for microsoft-style pragma push/pop/set. For example, clang supports the Microsoft pragma code_seg which supports a stack of code segment names.
================
Comment at: clang/lib/Sema/SemaExpr.cpp:13129
if (FunctionDecl *F = dyn_cast<FunctionDecl>(CurContext)) {
+ // If the expression occurs inside an internal global_var_init_function
+ // then the FunctionDecl is not availble
----------------
sepavloff wrote:
> The standard says that static initializers execute in default FP mode.
> The standard says ...
Are you sure about this one? Can you please provide the standards reference so I can study it?
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D72841/new/
https://reviews.llvm.org/D72841
More information about the llvm-commits
mailing list