I'm newish to raw C, and a newb to macros. I've got code from a library with the following macros defined, that does not work.
However, replacing it with the expected output (below) does work.
Why does the macro not work?
Is there a way to view the preprocessor output?
How can I fix the macro?
FWIW, I'm using the TI compiler for MSP430.
Code:
#define _ISR(a,b) EMIT_PRAGMA(vector=##a)\
__interrupt void b (void)
#define ISR(x,...) _ISR(x,isr_##x)
/*The below doesn't set the interupt handler, and throws a compiler warning =
"concatenation with "(" in macro "_ISR" does not create a valid token"
*/
ISR(I2C_ISR_VECTOR)
{
<Interrupt handler code>
}
Code:
#pragma vector=I2C_ISR_VECTOR
__interrupt void I2C_ISR(void)
{
<Interrupt handler code>
}
Is there a way to view the preprocessor output?
How can I fix the macro?
FWIW, I'm using the TI compiler for MSP430.