]> git.ipfire.org Git - thirdparty/glibc.git/commitdiff
Replace copysign (0,-1) with -0.0 in initializer
authorH.J. Lu <hjl.tools@gmail.com>
Sat, 14 Dec 2024 11:21:15 +0000 (19:21 +0800)
committerH.J. Lu <hjl.tools@gmail.com>
Tue, 17 Dec 2024 18:19:58 +0000 (02:19 +0800)
GCC 4.9 issues an error for copysign in initializer:

In file included from tst-printf-format-p-double.c:20:0:
tst-printf-format-skeleton-double.c:29:3: error: initializer element is not a constant expression [-Werror]
   { -HUGE_VAL, -DBL_MAX, -DBL_MIN, copysign (0, -1), -NAN, NAN, 0, DBL_MIN,
   ^

since it can't fold "copysign (0, -1)".  Replace copysign (0,-1) with -0.0.

Signed-off-by: H.J. Lu <hjl.tools@gmail.com>
stdio-common/tst-printf-format-skeleton-double.c
stdio-common/tst-printf-format-skeleton-ldouble.c

index 03ac594736fd352fe75d7730869d2b524cd8168e..19d75bbcbf51d5138b862962551c39d1d53645ce 100644 (file)
@@ -26,7 +26,7 @@
 #define PREC DBL_MANT_DIG
 typedef double type_t;
 static const type_t vals[] =
-  { -HUGE_VAL, -DBL_MAX, -DBL_MIN, copysign (0, -1), -NAN, NAN, 0, DBL_MIN,
+  { -HUGE_VAL, -DBL_MAX, -DBL_MIN, -0.0, -NAN, NAN, 0, DBL_MIN,
     DBL_MAX, HUGE_VAL };
 static const char length[] = "";
 
index ed47e7796390ecaff69f279a8bf9f969ec35348d..cb58f1ab15b2a7e1bc5c4a606979edff0722ac51 100644 (file)
@@ -27,7 +27,7 @@
 #define PREC LDBL_MANT_DIG
 typedef long double type_t;
 static const type_t vals[] =
-  { -HUGE_VAL, -LDBL_MAX, -LDBL_MIN, copysign (0, -1), -NAN, NAN, 0, LDBL_MIN,
+  { -HUGE_VAL, -LDBL_MAX, -LDBL_MIN, -0.0, -NAN, NAN, 0, LDBL_MIN,
     LDBL_MAX, HUGE_VAL };
 static const char length[] = "L";