tests: memset-test: Parenthesize zero size argument for clang

When running coreboot unit tests on a recent clang version, it helpfully
throws an error on memset(..., 0xAA, 0) because it thinks you probably
made a typo and meant to write memset(..., 0, 0xAA) instead. I mean, who
would ever memset() a buffer of zero bytes, right? Unfortunately, unit
tests for memset() want to do exactly that. Wrapping the argument in
parenthesis silences the warning.

Signed-off-by: Julius Werner <jwerner@chromium.org>
Change-Id: I21aeb5ec4d6ce74d5df2d21e2f9084b17b3ac6e3
Reviewed-on: https://review.coreboot.org/c/coreboot/+/51617
Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
Reviewed-by: Jakub Czapiga <jacz@semihalf.com>
Reviewed-by: Paul Menzel <paulepanter@users.sourceforge.net>
Reviewed-by: Angel Pons <th3fanbus@gmail.com>
Reviewed-by: Paul Fagerburg <pfagerburg@chromium.org>
This commit is contained in:
Julius Werner 2021-03-17 17:49:56 -07:00 committed by Paul Fagerburg
parent a699240612
commit d4863a5ca0
1 changed files with 1 additions and 1 deletions

View File

@ -85,7 +85,7 @@ static void test_memset_zero_size(void **state)
} }
/* Expect no change in buffer after calling memset with zero size */ /* Expect no change in buffer after calling memset with zero size */
memset(s->base_buffer, 0xAA, 0); memset(s->base_buffer, 0xAA, (0));
assert_memory_equal(s->base_buffer, s->helper_buffer, MEMSET_BUFFER_SZ); assert_memory_equal(s->base_buffer, s->helper_buffer, MEMSET_BUFFER_SZ);
} }