I am using CCS V4, microcontroller edition, and I just spent a day and a half trying to figure out why I was unable to compile a bunch of multi-line macros. It turns out that the preprocessor can't handle whitespace after the " \ " character used to indicate the macro continues onto the next line. Some examples:
This will compile fine:
#define xPortSetupA0(ulWantedBaud) \
{ \
unsigned portLONG ulBaudRateCount; \
\
ulBaudRateCount = configCPU_CLOCK_HZ / ulWantedBaud; \
UCA0BR0 = ulBaudRateCount; \
/* UCA0TXD select */ \
/* | UCA0RXD select */ \
/* | | */ \
P3SEL |= BIT4 | BIT5; \
/* UCSSELx = SMCLK */ \
/* | */ \
}
This will not:
#define xPortSetupA0(ulWantedBaud) \
{ \
unsigned portLONG ulBaudRateCount; \
\
ulBaudRateCount = configCPU_CLOCK_HZ / ulWantedBaud; \
UCA0BR0 = ulBaudRateCount; \
/* UCA0TXD select */ \
/* | UCA0RXD select */ \
/* | | */ \
P3SEL |= BIT4 | BIT5; \
/* UCSSELx = SMCLK */ \
/* | */ \
}
The only difference between the two code snippets is that there is a tab after the 5th line of code in the macro function (highlighted above).
I understand not allowing printed characters after the " \ " but mishandling whitespace seems like a bit of a stretch and something that should be fixed if possible.