From 908429eb3331303e65898be08637078869873495 Mon Sep 17 00:00:00 2001 From: Kaspar Schleiser Date: Fri, 10 Mar 2017 17:06:04 +0100 Subject: [PATCH] tests: fix misc cppcheck warnings --- tests/driver_hdc1000/main.c | 2 +- tests/driver_pn532/main.c | 2 ++ tests/leds/main.c | 2 ++ tests/periph_hwrng/main.c | 2 +- tests/pthread_cleanup/main.c | 2 +- tests/unittests/tests-crypto/tests-crypto.h | 2 +- 6 files changed, 8 insertions(+), 4 deletions(-) diff --git a/tests/driver_hdc1000/main.c b/tests/driver_hdc1000/main.c index b84a5e2c80..864024c484 100644 --- a/tests/driver_hdc1000/main.c +++ b/tests/driver_hdc1000/main.c @@ -33,7 +33,6 @@ int main(void) { hdc1000_t dev; int16_t temp, hum; - size_t len; char tstr[8]; char hstr[8]; @@ -49,6 +48,7 @@ int main(void) } while (1) { + size_t len; hdc1000_read(&dev, &temp, &hum); len = fmt_s16_dfp(tstr, temp, 2); diff --git a/tests/driver_pn532/main.c b/tests/driver_pn532/main.c index 3b501dd815..b74b84f2b3 100644 --- a/tests/driver_pn532/main.c +++ b/tests/driver_pn532/main.c @@ -50,6 +50,8 @@ int main(void) ret = pn532_init_i2c(&pn532, &pn532_conf[0]); #elif defined(PN532_SUPPORT_SPI) ret = pn532_init_spi(&pn532, &pn532_conf[0]); +#else +#error None of PN532_SUPPORT_I2C and PN532_SUPPORT_SPI set! #endif if (ret != 0) { diff --git a/tests/leds/main.c b/tests/leds/main.c index 1405e12b10..fc329a8146 100644 --- a/tests/leds/main.c +++ b/tests/leds/main.c @@ -77,6 +77,8 @@ int main(void) #endif puts("On-board LED test\n"); + /* cppcheck-suppress knownConditionTrueFalse + * rationale: board-dependent ifdefs */ if (numof == 0) { puts("NO LEDs AVAILABLE"); } diff --git a/tests/periph_hwrng/main.c b/tests/periph_hwrng/main.c index c81b60be50..3b67b4e148 100644 --- a/tests/periph_hwrng/main.c +++ b/tests/periph_hwrng/main.c @@ -31,7 +31,7 @@ int main(void) uint8_t buf[LIMIT]; puts("\nHWRNG peripheral driver test\n"); - printf("This test will print from 1 to %i random bytes about every " + printf("This test will print from 1 to %u random bytes about every " "second\n\n", LIMIT); puts("Initializing the HWRNG driver.\n"); diff --git a/tests/pthread_cleanup/main.c b/tests/pthread_cleanup/main.c index fc1e92c620..a6ec193896 100644 --- a/tests/pthread_cleanup/main.c +++ b/tests/pthread_cleanup/main.c @@ -68,7 +68,7 @@ int main(void) { void *res; pthread_join(th_id, (void **) &res); - printf("Result: %u\n", (int) (intptr_t) res); + printf("Result: %i\n", (int) (intptr_t) res); puts("Done."); return 0; } diff --git a/tests/unittests/tests-crypto/tests-crypto.h b/tests/unittests/tests-crypto/tests-crypto.h index 30d557e702..95a85fadc0 100644 --- a/tests/unittests/tests-crypto/tests-crypto.h +++ b/tests/unittests/tests-crypto/tests-crypto.h @@ -40,7 +40,7 @@ void tests_crypto(void); */ Test *tests_crypto_chacha_tests(void); -static inline int compare(uint8_t a[16], uint8_t b[16], uint8_t len) +static inline int compare(uint8_t *a, uint8_t *b, uint8_t len) { int result = 1;