Skip to content

Commit b6b1b8d

Browse files
committed
fix misra errors for safety.c
1 parent cfe5dc1 commit b6b1b8d

File tree

5 files changed

+8
-10
lines changed

5 files changed

+8
-10
lines changed

board/drivers/registers.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
#include "registers_declarations.h"
2+
#include "safety/board/faults_declarations.h"
23

34
static reg register_map[REGISTER_MAP_SIZE];
45

board/faults.h

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -36,9 +36,3 @@
3636

3737
// Permanent faults
3838
#define PERMANENT_FAULTS 0U
39-
40-
extern uint8_t fault_status;
41-
extern uint32_t faults;
42-
43-
extern void fault_occurred(uint32_t fault);
44-
extern void fault_recovered(uint32_t fault);

board/safety.c

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,12 @@ extern void print(const char *a);
88
extern void puth(unsigned int i);
99
extern uint32_t microsecond_timer_get(void);
1010

11+
// Suppress funky header inclusion ordering. We need the forward declarations
12+
// above. This will all eventually be deleted when opendbc is fixed.
13+
// cppcheck-suppress-begin misra-c2012-20.1 -
1114
#include "safety/board/utils.h"
1215
#include "safety/board/faults.h"
1316
#include "safety/board/can.h"
1417
#include "safety/board/drivers/can_common.h"
1518
#include "safety/safety.h"
19+
// cppcheck-suppress-end misra-c2012-20.1

tests/misra/checkers.txt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ Cppcheck checkers list from test_misra.sh:
55

66

77
TEST variant options:
8-
--enable=all --disable=unusedFunction -DPANDA --addon=misra -DSTM32F4 -DSTM32F413xx /board/ --enable=all --file-filter=*.c -i /board/safety.c -i /board/jungle/main.c -i /board/bootstub.c
8+
--enable=all --disable=unusedFunction -DPANDA --addon=misra -DSTM32F4 -DSTM32F413xx /board/ --enable=all --file-filter=*.c -i /board/jungle/main.c -i /board/bootstub.c
99

1010

1111
Critical errors
@@ -460,7 +460,7 @@ Not available, Cppcheck Premium is not used
460460

461461

462462
TEST variant options:
463-
--enable=all --disable=unusedFunction -DPANDA --addon=misra -DSTM32H7 -DSTM32H725xx /board/ --enable=all --file-filter=*.c -i /board/safety.c -i /board/jungle/main.c -i /board/bootstub.c
463+
--enable=all --disable=unusedFunction -DPANDA --addon=misra -DSTM32H7 -DSTM32H725xx /board/ --enable=all --file-filter=*.c -i /board/jungle/main.c -i /board/bootstub.c
464464

465465

466466
Critical errors

tests/misra/test_misra.sh

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -73,9 +73,8 @@ cppcheck() {
7373

7474
PANDA_OPTS="--enable=all --disable=unusedFunction -DPANDA --addon=misra"
7575
PANDA_SOURCES="$PANDA_DIR/board/ --enable=all --file-filter=*.c \
76-
-i $PANDA_DIR/board/safety.c \
7776
-i $PANDA_DIR/board/jungle/main.c \
78-
-i $PANDA_DIR/board/bootstub.c"
77+
-i $PANskA_DIR/board/bootstub.c"
7978

8079
printf "\n${GREEN}** PANDA F4 CODE **${NC}\n"
8180
cppcheck $PANDA_OPTS -DSTM32F4 -DSTM32F413xx $PANDA_SOURCES

0 commit comments

Comments
 (0)