tests: fix 64-bit int literals for 32-bit hosts
PATCH 1/1 tests: fix 64-bit int literals for 32-bit hosts
On 32-bit hosts:
CC tests/test-opts-visitor.otests/test-opts-visitor.c: In function 'test_value':tests/test-opts-visitor.c:128: warning: integer constant is too large for 'long' type
CC tests/test-bitops.otests/test-bitops.c:34: warning: integer constant is too large for 'long' type tests/test-bitops.c:35: warning: integer constant is too large for 'long' type tests/test-bitops.c:35: warning: integer constant is too large for 'long' type
CC tests/endianness-test.otests/endianness-test.c:47: warning: integer constant is too large for 'long' type
--- tests/endianness-test.c | 3 ++- tests/test-bitops.c | 4 ++-- tests/test-opts-visitor.c | 2 +- 3 files changed, 5 insertions(+), 4 deletions(-)
tests/endianness-test.c +2 -1
@@ -44,7 +44,8 @@ static const TestCase test_cases[] = { { "ppc", "prep", 0x80000000, .bswap = true }, { "ppc", "bamboo", 0xe8000000, .bswap = true, .superio = "i82378" }, { "ppc64", "mac99", 0xf2000000, .bswap = true, .superio = "i82378" }, - { "ppc64", "pseries", 0x10080000000, .bswap = true, .superio = "i82378" }, + { "ppc64", "pseries", 0x10080000000ULL, + .bswap = true, .superio = "i82378" }, { "sh4", "r2d", 0xfe240000, .superio = "i82378" }, { "sh4eb", "r2d", 0xfe240000, .bswap = true, .superio = "i82378" }, { "sparc64", "sun4u", 0x1fe02000000LL, .bswap = true },
tests/test-bitops.c +2 -2
@@ -31,8 +31,8 @@ static const S32Test test_s32_data[] = { };static const S64Test test_s64_data[] = { - {0x8459826734967223 ,60 ,4 ,-8 }, - {0x8459826734967223 ,0 ,64 ,0x8459826734967223 }, + {0x8459826734967223ULL ,60 ,4 ,-8 }, + {0x8459826734967223ULL ,0 ,64 ,0x8459826734967223LL }, };static void test_sextract32 (void )
tests/test-opts-visitor.c +1 -1
@@ -125,7 +125,7 @@ test_value(OptsVisitorFixture *f, gconstpointer test_data)g_assert ((magic & bitval) ==0 ); magic |= bitval; } -g_assert (magic ==0xBADC0FFEE0DDF00D ); +g_assert (magic ==0xBADC0FFEE0DDF00DULL ); magic =0 ;for (u16 = f->userdef->u16; u16 !=NULL ; u16 = u16->next) {
Signature · 1 line
1.8.3.1
Quoted 12 lines · Stefan Hajnoczi
On 32-bit hosts:
CC
tests/test-opts-visitor.otests/test-opts-visitor.c: In function 'test_value':tests/test-opts-visitor.c:128: warning: integer constant is too large for 'long' type
CCtests/test-bitops.otests/test-bitops.c:34: warning: integer constant is too large for 'long' typetests/test-bitops.c:35: warning: integer constant is too large for 'long' typetests/test-bitops.c:35: warning: integer constant is too large for 'long' type
CCtests/endianness-test.otests/endianness-test.c:47: warning: integer constant is too large for 'long' type
Quoted 6 lines
Signed-off-by Stefan Hajnoczi <[email protected]>--- tests/endianness-test.c | 3 ++- tests/test-bitops.c | 4 ++-- tests/test-opts-visitor.c | 2 +- 3 files changed, 5 insertions(+), 4 deletions(-)
Signature · 2 lines
Eric Blake eblake redhat com +1-919-301-3266 Libvirt virtualization library http://libvirt.org
Quoted 12 lines · Stefan Hajnoczi
On 32-bit hosts:
CC
tests/test-opts-visitor.otests/test-opts-visitor.c: In function 'test_value':tests/test-opts-visitor.c:128: warning: integer constant is too large for 'long' type
CCtests/test-bitops.otests/test-bitops.c:34: warning: integer constant is too large for 'long' typetests/test-bitops.c:35: warning: integer constant is too large for 'long' typetests/test-bitops.c:35: warning: integer constant is too large for 'long' type
CCtests/endianness-test.otests/endianness-test.c:47: warning: integer constant is too large for 'long' type
Quoted 6 lines
Signed-off-by Stefan Hajnoczi <[email protected]>--- tests/endianness-test.c | 3 ++- tests/test-bitops.c | 4 ++-- tests/test-opts-visitor.c | 2 +- 3 files changed, 5 insertions(+), 4 deletions(-)
Blame it on still using gnu89 instead of c99 (or gnu99 if must be).
Laszlo