[PATCH] build: avoid compiler warning on 32-bit platform

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

 



On a 32-bit platform:

virstringtest.c: In function 'mymain':
virstringtest.c:673: warning: this decimal constant is unsigned only in ISO C90

I already had a comment in the file about the 64-bit counterpart;
the easiest fix was to make both sites use the standardized macro
that is guaranteed to work.

* tests/virstringtest.c (mymain): Minimum signed integers are a pain.

Signed-off-by: Eric Blake <eblake@xxxxxxxxxx>
---

Pushing under the build-breaker rule.

 tests/virstringtest.c | 6 ++----
 1 file changed, 2 insertions(+), 4 deletions(-)

diff --git a/tests/virstringtest.c b/tests/virstringtest.c
index 1e330f9..96c3784 100644
--- a/tests/virstringtest.c
+++ b/tests/virstringtest.c
@@ -670,7 +670,7 @@ mymain(void)
                 -1LL, 0, 18446744073709551615ULL, 0);
     TEST_STRTOL("-2147483647", NULL, -2147483647, 0, 2147483649U, 0,
                 -2147483647LL, 0, 18446744071562067969ULL, 0);
-    TEST_STRTOL("-2147483648", NULL, -2147483648, 0, 2147483648U, 0,
+    TEST_STRTOL("-2147483648", NULL, INT32_MIN, 0, 2147483648U, 0,
                 -2147483648LL, 0, 18446744071562067968ULL, 0);
     TEST_STRTOL("-2147483649", NULL, 0, -1, 2147483647U, 0,
                 -2147483649LL, 0, 18446744071562067967ULL, 0);
@@ -680,10 +680,8 @@ mymain(void)
                 -4294967296LL, 0, 18446744069414584320ULL, 0);
     TEST_STRTOL("-9223372036854775807", NULL, 0, -1, 0U, -1,
                 -9223372036854775807LL, 0, 9223372036854775809ULL, 0);
-    /* Bah, stupid gcc warning about -9223372036854775808LL being an
-     * unrepresentable integer constant */
     TEST_STRTOL("-9223372036854775808", NULL, 0, -1, 0U, -1,
-                0x8000000000000000LL, 0, 9223372036854775808ULL, 0);
+                INT64_MIN, 0, 9223372036854775808ULL, 0);
     TEST_STRTOL("-9223372036854775809", NULL, 0, -1, 0U, -1,
                 0LL, -1, 9223372036854775807ULL, 0);
     TEST_STRTOL("-18446744073709551615", NULL, 0, -1, 0U, -1,
-- 
1.9.3

--
libvir-list mailing list
libvir-list@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/libvir-list




[Index of Archives]     [Virt Tools]     [Libvirt Users]     [Lib OS Info]     [Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]     [Fedora Tools]