From 23e3684d7069fd1f5769146cf9828ce6aa043cb7 Mon Sep 17 00:00:00 2001 From: rbiasini Date: Mon, 8 Jul 2019 15:13:52 -0700 Subject: [PATCH] Cppcheck unused functions (#247) * Skip cppcheck on unused functions that are consumed in large headers we can't pass to cppcheck --- board/main.c | 3 +++ board/pedal/main.c | 5 +++++ 2 files changed, 8 insertions(+) diff --git a/board/main.c b/board/main.c index b8bcb1debc1d98..3d41ec65679237 100644 --- a/board/main.c +++ b/board/main.c @@ -69,6 +69,7 @@ bool is_gpio_started(void) { return (GPIOA->IDR & (1U << 1)) == 0; } +// cppcheck-suppress unusedFunction ; used in headers not included in cppcheck void EXTI1_IRQHandler(void) { volatile unsigned int pr = EXTI->PR & (1U << 1); if ((pr & (1U << 1)) != 0U) { @@ -524,6 +525,7 @@ int spi_cb_rx(uint8_t *data, int len, uint8_t *data_out) { // ***************************** main code ***************************** +// cppcheck-suppress unusedFunction ; used in headers not included in cppcheck void __initialize_hardware_early(void) { early(); } @@ -537,6 +539,7 @@ uint64_t tcnt = 0; uint64_t marker = 0; // called once per second +// cppcheck-suppress unusedFunction ; used in headers not included in cppcheck void TIM3_IRQHandler(void) { #define CURRENT_THRESHOLD 0xF00U #define CLICKS 5U // 5 seconds to switch modes diff --git a/board/pedal/main.c b/board/pedal/main.c index 744058ecdf0733..522acfd1db42fb 100644 --- a/board/pedal/main.c +++ b/board/pedal/main.c @@ -30,6 +30,7 @@ #define ENTER_BOOTLOADER_MAGIC 0xdeadbeef uint32_t enter_bootloader_mode; +// cppcheck-suppress unusedFunction ; used in headers not included in cppcheck void __initialize_hardware_early(void) { early(); } @@ -122,6 +123,7 @@ uint8_t pedal_checksum(uint8_t *dat, int len) { #define CAN_GAS_SIZE 6 #define COUNTER_CYCLE 0xFU +// cppcheck-suppress unusedFunction ; used in headers not included in cppcheck void CAN1_TX_IRQHandler(void) { // clear interrupt CAN->TSR |= CAN_TSR_RQCP0; @@ -144,6 +146,7 @@ uint32_t current_index = 0; #define FAULT_INVALID 6U uint8_t state = FAULT_STARTUP; +// cppcheck-suppress unusedFunction ; used in headers not included in cppcheck void CAN1_RX0_IRQHandler(void) { while ((CAN->RF0R & CAN_RF0R_FMP0) != 0) { #ifdef DEBUG @@ -210,6 +213,7 @@ void CAN1_RX0_IRQHandler(void) { } } +// cppcheck-suppress unusedFunction ; used in headers not included in cppcheck void CAN1_SCE_IRQHandler(void) { state = FAULT_SCE; llcan_clear_send(CAN); @@ -221,6 +225,7 @@ unsigned int pkt_idx = 0; int led_value = 0; +// cppcheck-suppress unusedFunction ; used in headers not included in cppcheck void TIM3_IRQHandler(void) { #ifdef DEBUG puth(TIM3->CNT);