]> git.ipfire.org Git - thirdparty/xz.git/commitdiff
Tests: Silence -Wsign-conversion warning on GCC version < 10.
authorJia Tan <jiat0218@gmail.com>
Thu, 7 Dec 2023 13:48:07 +0000 (21:48 +0800)
committerJia Tan <jiat0218@gmail.com>
Thu, 7 Dec 2023 13:48:07 +0000 (21:48 +0800)
Since GCC version 10, GCC no longer complains about simple implicit
integer conversions with Arithmetic operators.

For instance:

    uint8_t a = 5;
    uint32_t b = a + 5;

Give a warning on GCC 9 and earlier but this:

    uint8_t a = 5;
    uint32_t b = (a + 5) * 2;

Gives a warning with GCC 10+.

tests/test_block_header.c

index b3101355bf8e180d6f0345b3d0ecb2eb54298344..10f4af33dcab2e32d32d6395388aa6b0ceee9f73 100644 (file)
@@ -320,7 +320,7 @@ test_lzma_block_header_encode(void)
        uint8_t flags = out[1];
 
        // Should have number of filters = 1
-       assert_uint_eq((flags & 0x3) + 1, 1);
+       assert_uint_eq((flags & 0x3) + 1U, 1);
 
        // Bits 2-7 must be empty not set
        assert_uint_eq(flags & (0xFF - 0x3), 0);