[clang] [clang] Expose -f(no-)math-errno as a clang-cl option (PR #195455)
Nico Weber via cfe-commits
cfe-commits at lists.llvm.org
Sat May 2 08:18:35 PDT 2026
https://github.com/nico updated https://github.com/llvm/llvm-project/pull/195455
>From b6200e8576afd6f1740b560f14f02036c59e6634 Mon Sep 17 00:00:00 2001
From: Nico Weber <thakis at chromium.org>
Date: Sat, 2 May 2026 10:45:59 -0400
Subject: [PATCH 1/2] [clang] Expose -f(no-)math-errno as a clang-cl option
---
clang/include/clang/Options/Options.td | 2 +-
clang/test/Driver/cl-options.c | 2 ++
2 files changed, 3 insertions(+), 1 deletion(-)
diff --git a/clang/include/clang/Options/Options.td b/clang/include/clang/Options/Options.td
index c64ebba6f3dbf..6102236388df9 100644
--- a/clang/include/clang/Options/Options.td
+++ b/clang/include/clang/Options/Options.td
@@ -2413,7 +2413,7 @@ defm fast_math : BoolFOption<"fast-math",
NegFlag<SetFalse, [], [ClangOption, CC1Option, FC1Option, FlangOption]>>;
defm math_errno : BoolFOption<"math-errno",
LangOpts<"MathErrno">, DefaultFalse,
- PosFlag<SetTrue, [], [ClangOption, CC1Option],
+ PosFlag<SetTrue, [], [ClangOption, CLOption, CC1Option],
"Require math functions to indicate errors by setting errno">,
NegFlag<SetFalse>>,
ShouldParseIf<!strconcat("!", open_cl.KeyPath)>;
diff --git a/clang/test/Driver/cl-options.c b/clang/test/Driver/cl-options.c
index 37f8081e6be4f..c0f57ae768252 100644
--- a/clang/test/Driver/cl-options.c
+++ b/clang/test/Driver/cl-options.c
@@ -755,6 +755,8 @@
// RUN: -fcs-profile-generate=dir \
// RUN: -fpseudo-probe-for-profiling \
// RUN: -ftime-trace \
+// RUN: -fmath-errno \
+// RUN: -fno-math-errno \
// RUN: -fmodules \
// RUN: -fno-modules \
// RUN: -fimplicit-module-maps \
>From 0b9fb13a0e544296e0d2bbe38ae88fbf740ee0b7 Mon Sep 17 00:00:00 2001
From: Nico Weber <thakis at chromium.org>
Date: Sat, 2 May 2026 11:18:22 -0400
Subject: [PATCH 2/2] neg flag
---
clang/include/clang/Options/Options.td | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/clang/include/clang/Options/Options.td b/clang/include/clang/Options/Options.td
index 6102236388df9..407f48aabc58b 100644
--- a/clang/include/clang/Options/Options.td
+++ b/clang/include/clang/Options/Options.td
@@ -2415,7 +2415,7 @@ defm math_errno : BoolFOption<"math-errno",
LangOpts<"MathErrno">, DefaultFalse,
PosFlag<SetTrue, [], [ClangOption, CLOption, CC1Option],
"Require math functions to indicate errors by setting errno">,
- NegFlag<SetFalse>>,
+ NegFlag<SetFalse, [], [CLOption]>>,
ShouldParseIf<!strconcat("!", open_cl.KeyPath)>;
def fextend_args_EQ : Joined<["-"], "fextend-arguments=">, Group<f_Group>,
Flags<[NoArgumentUnused]>, Visibility<[ClangOption, CC1Option]>,
More information about the cfe-commits
mailing list