Tests: Silence -Wsign-conversion warning on GCC version < 10.

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+.
This commit is contained in:
Jia Tan 2023-12-07 21:48:07 +08:00
parent 932f02990c
commit 3f51a4415a
1 changed files with 1 additions and 1 deletions

View File

@ -320,7 +320,7 @@ test_lzma_block_header_encode(void)
uint8_t flags = out[1]; uint8_t flags = out[1];
// Should have number of filters = 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 // Bits 2-7 must be empty not set
assert_uint_eq(flags & (0xFF - 0x3), 0); assert_uint_eq(flags & (0xFF - 0x3), 0);