From 46f599c1a99c6d4b563702066fdf82b429141fc1 Mon Sep 17 00:00:00 2001 From: Erik Ekman Date: Thu, 25 Nov 2021 11:03:58 +0100 Subject: [PATCH] tests/fault_handler: Suppress cppcheck errors This code is supposed to hit the null pointer. tests/fault_handler/main.c:43: error (nullPointer): Null pointer dereference: (volatile unsigned int*)(0x00000000u) tests/fault_handler/main.c:44: error (nullPointer): Null pointer dereference: (volatile unsigned int*)(0x00000000u) --- tests/fault_handler/main.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/tests/fault_handler/main.c b/tests/fault_handler/main.c index 7c5995149f..14b2624fbc 100644 --- a/tests/fault_handler/main.c +++ b/tests/fault_handler/main.c @@ -36,11 +36,14 @@ int main(void) { puts("Fault handler test application"); - printf("This application will crash by attempting to write to address 0x%08x\n", FORBIDDEN_ADDRESS); + printf("This application will crash by attempting to write to address 0x%08x\n", + FORBIDDEN_ADDRESS); puts("Waiting 1 second before crashing..."); xtimer_usleep(1000000lu); puts("Write to forbidden address " PRINT_MACRO(FORBIDDEN_ADDRESS)); + /* cppcheck-suppress nullPointer */ *((volatile unsigned int *) FORBIDDEN_ADDRESS) = 12345u; + /* cppcheck-suppress nullPointer */ unsigned int readback = *((volatile unsigned int *) FORBIDDEN_ADDRESS); printf("readback: 0x%08x\n", readback); puts("We did not expect the application to survive the previous write."); @@ -48,6 +51,6 @@ int main(void) puts(PRINT_MACRO(INVALID_INSTRUCTION)); INVALID_INSTRUCTION; puts("Failed to crash the program, hanging..."); - while(1) {} + while (1) {} return 0; }