Skip to content

Commit

Permalink
Cppcheck unused functions (commaai#247)
Browse files Browse the repository at this point in the history
* Skip cppcheck on unused functions that are consumed in large headers we can't pass to cppcheck
  • Loading branch information
rbiasini authored Jul 8, 2019
1 parent c97d60b commit 23e3684
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 0 deletions.
3 changes: 3 additions & 0 deletions board/main.c
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down Expand Up @@ -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();
}
Expand All @@ -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
Expand Down
5 changes: 5 additions & 0 deletions board/pedal/main.c
Original file line number Diff line number Diff line change
Expand Up @@ -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();
}
Expand Down Expand Up @@ -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;
Expand All @@ -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
Expand Down Expand Up @@ -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);
Expand All @@ -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);
Expand Down

0 comments on commit 23e3684

Please sign in to comment.