[libvirt] [PATCH] tests: fix build on old 32-bit platforms

Eric Blake eblake at redhat.com
Wed Apr 15 18:52:31 UTC 2015


gcc 4.1.2 (hello RHEL 5) on 32-bit platforms complains:

vircgrouptest.c: In function 'testCgroupGetPercpuStats':
vircgrouptest.c:627: warning: integer constant is too large for 'long' type
vircgrouptest.c:628: warning: this decimal constant is unsigned only in ISO C90
vircgrouptest.c:634: warning: integer constant is too large for 'long' type
vircgrouptest.c:635: warning: this decimal constant is unsigned only in ISO C90
vircgrouptest.c:636: warning: this decimal constant is unsigned only in ISO C90
vircgrouptest.c:644: warning: integer constant is too large for 'long' type

* tests/vircgrouptest.c (testCgroupGetPercpuStats): Use ULL suffix.

Signed-off-by: Eric Blake <eblake at redhat.com>
---

Pushing under the build-breaker rule

 tests/vircgrouptest.c | 34 +++++++++++++++++-----------------
 1 file changed, 17 insertions(+), 17 deletions(-)

diff --git a/tests/vircgrouptest.c b/tests/vircgrouptest.c
index 2b30258..ad49425 100644
--- a/tests/vircgrouptest.c
+++ b/tests/vircgrouptest.c
@@ -1,5 +1,5 @@
 /*
- * Copyright (C) 2013-2014 Red Hat, Inc.
+ * Copyright (C) 2013-2015 Red Hat, Inc.
  *
  * This library is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
@@ -624,25 +624,25 @@ static int testCgroupGetPercpuStats(const void *args ATTRIBUTE_UNUSED)

     unsigned long long expected[EXPECTED_NCPUS] = {
         0, 0, 0, 0, 0, 0, 0, 0,
-        7059492996, 0, 0, 0, 0, 0, 0, 0,
-        4180532496, 0, 0, 0, 0, 0, 0, 0,
+        7059492996ULL, 0, 0, 0, 0, 0, 0, 0,
+        4180532496ULL, 0, 0, 0, 0, 0, 0, 0,
         0, 0, 0, 0, 0, 0, 0, 0,
         0, 0, 0, 0, 0, 0, 0, 0,
         0, 0, 0, 0, 0, 0, 0, 0,
-        1957541268, 0, 0, 0, 0, 0, 0, 0,
-        2065932204, 0, 0, 0, 0, 0, 0, 0,
-        18228689414, 0, 0, 0, 0, 0, 0, 0,
-        4245525148, 0, 0, 0, 0, 0, 0, 0,
-        2911161568, 0, 0, 0, 0, 0, 0, 0,
-        1407758136, 0, 0, 0, 0, 0, 0, 0,
-        1836807700, 0, 0, 0, 0, 0, 0, 0,
-        1065296618, 0, 0, 0, 0, 0, 0, 0,
-        2046213266, 0, 0, 0, 0, 0, 0, 0,
-        747889778, 0, 0, 0, 0, 0, 0, 0,
-        709566900, 0, 0, 0, 0, 0, 0, 0,
-        444777342, 0, 0, 0, 0, 0, 0, 0,
-        5683512916, 0, 0, 0, 0, 0, 0, 0,
-        635751356, 0, 0, 0, 0, 0, 0, 0,
+        1957541268ULL, 0, 0, 0, 0, 0, 0, 0,
+        2065932204ULL, 0, 0, 0, 0, 0, 0, 0,
+        18228689414ULL, 0, 0, 0, 0, 0, 0, 0,
+        4245525148ULL, 0, 0, 0, 0, 0, 0, 0,
+        2911161568ULL, 0, 0, 0, 0, 0, 0, 0,
+        1407758136ULL, 0, 0, 0, 0, 0, 0, 0,
+        1836807700ULL, 0, 0, 0, 0, 0, 0, 0,
+        1065296618ULL, 0, 0, 0, 0, 0, 0, 0,
+        2046213266ULL, 0, 0, 0, 0, 0, 0, 0,
+        747889778ULL, 0, 0, 0, 0, 0, 0, 0,
+        709566900ULL, 0, 0, 0, 0, 0, 0, 0,
+        444777342ULL, 0, 0, 0, 0, 0, 0, 0,
+        5683512916ULL, 0, 0, 0, 0, 0, 0, 0,
+        635751356ULL, 0, 0, 0, 0, 0, 0, 0,
     };

     if (VIR_ALLOC_N(params, EXPECTED_NCPUS) < 0)
-- 
2.1.0




More information about the libvir-list mailing list