[clang] [clang] Expose -f(no-)math-errno as a clang-cl option (PR #195455)

via cfe-commits cfe-commits at lists.llvm.org
Sat May 2 07:47:32 PDT 2026


llvmorg-github-actions[bot] wrote:


<!--LLVM PR SUMMARY COMMENT-->
@llvm/pr-subscribers-clang-driver

@llvm/pr-subscribers-clang

Author: Nico Weber (nico)

<details>
<summary>Changes</summary>

Vaguely related: https://developercommunity.visualstudio.com/t/Add-a-flag-similar-to--fno-math-errno-th/10710444

---
Full diff: https://github.com/llvm/llvm-project/pull/195455.diff


2 Files Affected:

- (modified) clang/include/clang/Options/Options.td (+1-1) 
- (modified) clang/test/Driver/cl-options.c (+2) 


``````````diff
diff --git a/clang/include/clang/Options/Options.td b/clang/include/clang/Options/Options.td
index c16c41ad4057d..09e969cbbc2c0 100644
--- a/clang/include/clang/Options/Options.td
+++ b/clang/include/clang/Options/Options.td
@@ -2417,7 +2417,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 \

``````````

</details>


https://github.com/llvm/llvm-project/pull/195455


More information about the cfe-commits mailing list