bug-gnulib
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

ieee754-h tests: Fix some gcc -Wmissing-field-initializers warnings


From: Bruno Haible
Subject: ieee754-h tests: Fix some gcc -Wmissing-field-initializers warnings
Date: Mon, 04 Sep 2023 16:28:29 +0200

These two warnings

test-ieee754-h.c:39:4: warning: missing initializer for field 'frac_lo' of 
'const struct <anonymous>' [-Wmissing-field-initializers]
test-ieee754-h.c:40:4: warning: missing initializer for field 'frac_lo' of 
'const struct <anonymous>' [-Wmissing-field-initializers]

are probably consequences of copy&paste, thus unintended. This patch fixes them.


2023-09-04  Bruno Haible  <bruno@clisp.org>

        ieee754-h tests: Fix some gcc -Wmissing-field-initializers warnings.
        * tests/test-ieee754-h.c (float_tests): Use float literals.
        (double_tests): Use double literals. Initialize frac_lo.

diff --git a/tests/test-ieee754-h.c b/tests/test-ieee754-h.c
index 02e2db0531..559fa06715 100644
--- a/tests/test-ieee754-h.c
+++ b/tests/test-ieee754-h.c
@@ -26,9 +26,9 @@ static struct {
   unsigned sign; unsigned exponent; unsigned frac;
 } const float_tests[] =
   {
-   {0, 0, 0, 0},
-   {-0.0, 1, 0, 0},
-   {0.1, 0, 0x7b, 0x4ccccd}
+   {0.0f, 0, 0, 0},
+   {-0.0f, 1, 0, 0},
+   {0.1f, 0, 0x7b, 0x4ccccd}
   };
 
 static struct {
@@ -36,8 +36,8 @@ static struct {
   unsigned sign; unsigned exponent; unsigned frac_hi; unsigned frac_lo;
 } const double_tests[] =
   {
-   {0, 0, 0, 0},
-   {-0.0, 1, 0, 0 },
+   {0.0, 0, 0, 0, 0},
+   {-0.0, 1, 0, 0, 0},
    {0.1, 0, 0x3fb, 0x99999, 0x9999999a}
   };
 






reply via email to

[Prev in Thread] Current Thread [Next in Thread]