[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[lmi-commits] [lmi] master f7f9c1e7 4/6: Enable '-Wfloat-conversion' for
From: |
Greg Chicares |
Subject: |
[lmi-commits] [lmi] master f7f9c1e7 4/6: Enable '-Wfloat-conversion' for clang: C only |
Date: |
Sat, 9 Jul 2022 18:28:39 -0400 (EDT) |
branch: master
commit f7f9c1e77a1947134a7f17cdfb1df78d6d1a0a63
Author: Gregory W. Chicares <gchicares@sbcglobal.net>
Commit: Gregory W. Chicares <gchicares@sbcglobal.net>
Enable '-Wfloat-conversion' for clang: C only
* compiler_clang_warnings.make: Enable this warning for C. Incidentally
enable '-Wno-reserved-macro-identifier': the code it complained about
now uses a workaround.
* fdlibm_expm1.c: Fix the only such conversion in '*.c'.
---
compiler_clang_warnings.make | 4 ++--
fdlibm_expm1.c | 2 +-
2 files changed, 3 insertions(+), 3 deletions(-)
diff --git a/compiler_clang_warnings.make b/compiler_clang_warnings.make
index 4e84270f..badd3fca 100644
--- a/compiler_clang_warnings.make
+++ b/compiler_clang_warnings.make
@@ -38,12 +38,12 @@ clang_common_warnings := \
-Weverything \
# Write '-Wno' options at the end, with a rationale here.
+# -Wfloat-equal: too many false positives, e.g., 0.0 == X
+### -Wsign-conversion
clang_c_warnings := \
$(clang_common_warnings) \
- -Wno-float-conversion \
-Wno-float-equal \
- -Wno-reserved-macro-identifier \
-Wno-sign-conversion \
# Write '-Wno' options at the end, with a rationale here.
diff --git a/fdlibm_expm1.c b/fdlibm_expm1.c
index e037b6c9..b0dac0f5 100644
--- a/fdlibm_expm1.c
+++ b/fdlibm_expm1.c
@@ -203,7 +203,7 @@ double fdlibm_expm1(double x)
else
{hi = x + ln2_hi; lo = -ln2_lo; k = -1;}
} else {
- k = invln2*x+((xsb==0)?0.5:-0.5);
+ k = (int32_t)(invln2*x+((xsb==0)?0.5:-0.5));
t = k;
hi = x - t*ln2_hi; // t*ln2_hi is exact here
lo = t*ln2_lo;
- [lmi-commits] [lmi] master updated (68095897 -> 931cce6f), Greg Chicares, 2022/07/09
- [lmi-commits] [lmi] master 8b387bdc 1/6: Add "[[noreturn]]" in a few places, Greg Chicares, 2022/07/09
- [lmi-commits] [lmi] master 9b175313 2/6: Enable '-Wconditional-uninitialized' for clang, Greg Chicares, 2022/07/09
- [lmi-commits] [lmi] master 931cce6f 6/6: Explain why several clang warnings are disabled, Greg Chicares, 2022/07/09
- [lmi-commits] [lmi] master d8bb7cb4 5/6: Repeat less, Greg Chicares, 2022/07/09
- [lmi-commits] [lmi] master 6f740381 3/6: Explain why '-Wfloat-conversion' is disabled for clang, Greg Chicares, 2022/07/09
- [lmi-commits] [lmi] master f7f9c1e7 4/6: Enable '-Wfloat-conversion' for clang: C only,
Greg Chicares <=