[clang] Fix INF/NAN warning. (PR #80290)

Aaron Ballman via cfe-commits cfe-commits at lists.llvm.org
Thu Feb 1 08:07:19 PST 2024


================
@@ -72,7 +72,9 @@ def warn_pragma_debug_unexpected_argument : Warning<
 
 def warn_fp_nan_inf_when_disabled : Warning<
   "use of %select{infinity|NaN}0%select{| via a macro}1 is undefined behavior "
-  "due to the currently enabled floating-point options">,
+  "due to the currently enabled floating-point options%select{|; mix of safe "
+  "and unsafe math options are used. Check the order of you command line "
+  "arguments}2">,
----------------
AaronBallman wrote:

```suggestion
  "due to the currently enabled floating-point options">,
```
I think we want to drop the advice to check command line arguments because it could also be the result of using pragmas as well. I think we can lean on calling it out as undefined behavior to tell the user that something is wrong somewhere.

I think we could instead add some documentation to `DiagnosticDocs.td` about the command line and pragmas potentially impacting things, and then link those docs with the `nan-infinity-disabled` warning group.

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


More information about the cfe-commits mailing list