Skip to content

Commit

Permalink
Tests: Silence -Wsign-conversion warning on GCC version < 10.
Browse files Browse the repository at this point in the history
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+.
  • Loading branch information
JiaT75 committed Dec 7, 2023
1 parent 4a972a8 commit d0b24ef
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion tests/test_block_header.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down

0 comments on commit d0b24ef

Please sign in to comment.