From ce8024e8ff76e7be8b9ffa1a39d1dc9310bf74c7 Mon Sep 17 00:00:00 2001 From: Melanie Blower Date: Tue, 20 Jul 2021 16:01:51 -0400 Subject: [CLANG][PATCH][FPEnv] Add support for option -ffp-eval-method and extend #pragma float_control similarly The Intel compiler ICC supports the option "-fp-model=(source|double|extended)" which causes the compiler to use a wider type for intermediate floating point calculations. Also supported is a way to embed this effect in the source program with #pragma float_control(source|double|extended). This patch extends pragma float_control syntax, and also adds support for a new floating point option "-ffp-eval-method=(source|double|extended)". source: intermediate results use source precision double: intermediate results use double precision extended: intermediate results use extended precision Reviewed By: Aaron Ballman Differential Revision: https://reviews.llvm.org/D93769 --- clang/lib/Frontend/CompilerInvocation.cpp | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) (limited to 'clang/lib/Frontend/CompilerInvocation.cpp') diff --git a/clang/lib/Frontend/CompilerInvocation.cpp b/clang/lib/Frontend/CompilerInvocation.cpp index 2c696b5..4c266f5 100644 --- a/clang/lib/Frontend/CompilerInvocation.cpp +++ b/clang/lib/Frontend/CompilerInvocation.cpp @@ -4239,8 +4239,13 @@ static bool ParsePreprocessorArgs(PreprocessorOptions &Opts, ArgList &Args, // Always avoid lexing editor placeholders when we're just running the // preprocessor as we never want to emit the // "editor placeholder in source file" error in PP only mode. - if (isStrictlyPreprocessorAction(Action)) + // Certain predefined macros which depend upon semantic processing, + // for example __FLT_EVAL_METHOD__, are not expanded in PP mode, they + // appear in the preprocessed output as an unexpanded macro name. + if (isStrictlyPreprocessorAction(Action)) { Opts.LexEditorPlaceholders = false; + Opts.LexExpandSpecialBuiltins = false; + } return Diags.getNumErrors() == NumErrorsBefore; } -- cgit v1.1