bschwand / STM8-SPL-SDCC

STM8S SPL for SDCC
45 stars 12 forks source link

Minor Change to Avoid Compiler Warnings with SDCC #9

Closed sbmarcom closed 8 months ago

sbmarcom commented 8 months ago

I use this library with the stm8s_it.c and stm8s_it.h files to create ISRs.

The syntax used in these files to define the interrupts is defined in stm8s.h on lines 2793-2803, as well as 2811. However, because the function declaration in stm8s_it.h includes void as an argument to the ISRs, the compiler does not recognize the definitions in stm8s_it.c as valid for the declarations in stm8s_it.h.

I added (void) to the defines in stm8s.h so that the declaration matches the definition.

Example declaration in stm8s_it.h:

    void EXTI_PORTD_IRQHandler(void) INTERRUPT(6); 

Example definition in stm8s_it.c

    INTERRUPT_HANDLER(EXTI_PORTD_IRQHandler, 6){}

Pre-processor output before my changes:

    void EXTI_PORTD_IRQHandler() __interrupt(6){}

Pre-processor output after my changes

    void EXTI_PORTD_IRQHandler(void) __interrupt(6){}

This correctly matches the declaration, and the compiler error is gone.