Fix warnings reported by -Wpedantic
Previously CI hasn't been running with -Wpedantic (using autoconf), so
these haven't been reported previously.
- replace BUILD_ASSERT with static_assert()
- don't use %m GNU extension for printf
- don't use arithmetic on void*
- remove unused variables
Change-Id: I97d1acc908f06773b8b1ee95bfee80760fdc7a63
Signed-off-by: Matt Johnston <matt@codeconstruct.com.au>
diff --git a/tests/test_core.c b/tests/test_core.c
index 435e5e4..ead3990 100644
--- a/tests/test_core.c
+++ b/tests/test_core.c
@@ -623,20 +623,13 @@
};
/* clang-format on */
-#ifndef BUILD_ASSERT
-#define BUILD_ASSERT(x) \
- do { \
- (void)sizeof(char[0 - (!(x))]); \
- } while (0)
-#endif
-
int main(void)
{
uint8_t i;
mctp_set_log_stdio(MCTP_LOG_DEBUG);
- BUILD_ASSERT(ARRAY_SIZE(mctp_core_tests) < SIZE_MAX);
+ static_assert(ARRAY_SIZE(mctp_core_tests) < SIZE_MAX, "size");
for (i = 0; i < ARRAY_SIZE(mctp_core_tests); i++) {
mctp_prlog(MCTP_LOG_DEBUG, "begin: %s",
mctp_core_tests[i].name);