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

Aaron Ballman via cfe-commits cfe-commits at lists.llvm.org
Mon Feb 5 07:33:46 PST 2024


================
@@ -87,3 +87,10 @@ program by treating all string literals as having type ``const char *``
 instead of ``char *``. This can cause unexpected behaviors with type-sensitive
 constructs like ``_Generic``.
 }];
+
+defvar NanInfDisabledDocs = [{
+This warning is enabled when source code using the macros INFINITY and/or NAN
+is compiled with floating-point options preventing these two values. This can
+lead to undefined behavior. Some command line combinations order and pragmas
+may have an impact and a warning can be generated when not expected.
----------------
AaronBallman wrote:

```suggestion
This warning is enabled when source code using the macros ``INFINITY`` or ``NAN``
is compiled with floating-point options preventing these two values. This can
lead to undefined behavior. Check the order of command line arguments that modify
this behavior, such as ``-ffast-math``, ``-fhonor-infinities``, and ``-fhonor-nans`` (etc), as
well as ``#pragma`` directives if this diagnostic is generated unexpectedly.
```

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


More information about the cfe-commits mailing list