[libc-commits] [PATCH] D144208: [libc] use vars in string to num fuzz targets
Siva Chandra via Phabricator via libc-commits
libc-commits at lists.llvm.org
Mon Feb 27 12:27:01 PST 2023
sivachandra added inline comments.
================
Comment at: libc/fuzzing/stdlib/strtofloat_fuzz.cpp:20
+template <typename T> LIBC_INLINE bool is_nan(T x) { return x != x; }
+
----------------
`LIBC_INLINE` is to be used only in the `src` directory. Else, we are creating an unnecessary dependency.
================
Comment at: libc/fuzzing/stdlib/strtofloat_fuzz.cpp:55
+ // Then all the outputs should be NaN.
+ // This is a trivial check meant to silence the "unused variable" warnings.
+ if (!is_nan(atof_output) || !is_nan(strtof_output) ||
----------------
If all of this is present to only silence a compiler warning, and if you really want to check `isnan`, you are better off using the `isnan` predicate from `math.h`.
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D144208/new/
https://reviews.llvm.org/D144208
More information about the libc-commits
mailing list