You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
a@a:/nt$ clang++ -ffinite-math-only -fsyntax-only toml.hpp
/nt/vendor/toml++/toml.hpp:13012:30: warning: use of infinity is undefined behavior due to the currently enabled floating-point options [-Wnan-infinity-disabled]
13012 | return inf ? (negative ? -std::numeric_limits<double>::infinity() : std::numeric_limits<double>::infinity())
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/nt/vendor/toml++/toml.hpp:13012:72: warning: use of infinity is undefined behavior due to the currently enabled floating-point options [-Wnan-infinity-disabled]
13012 | return inf ? (negative ? -std::numeric_limits<double>::infinity() : std::numeric_limits<double>::infinity())
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
2 warnings generated.
Ideally, the parser should generate a parse error on encountering an Inf/NaN when compiling with -ffinite-math-only.
The text was updated successfully, but these errors were encountered:
I started fixing the issue, but it looks like a lot of unit tests need to be updated to check whether finite-math-only is enabled. Unfortunately I don't have enough time to make these changes, but hopefully my fork is helpful if you decide to address this.
Ideally, the parser should generate a parse error on encountering an Inf/NaN when compiling with -ffinite-math-only.
Hmm, maybe. The problem with doing this is you can no-longer round-trip a config document that contains NaN/Inf if you all you're doing is modifying some other non-float field.
The TOML spec mandates that floating points are IEEE 754 format, and the library is already capable of detecting these regardless of the compilers attitude towards them (ref). All that's missing here is the other side of the round-trip.
You can run the following command on the generated all-in-one toml.hpp file using Clang 19.1:
When compiling, you get the following warnings:
Ideally, the parser should generate a parse error on encountering an Inf/NaN when compiling with -ffinite-math-only.
The text was updated successfully, but these errors were encountered: