4.4.15 Manifest Macros
The CCI defines the general form for macros that manifest the compiler and target device characteristics. These macros can be used to conditionally compile alternate source code based on the compiler or the target device.
The macros and macro families are details in the following table.
Name | Meaning if defined | Example |
---|---|---|
__XC__ | Compiled with an MPLAB XC compiler | __XC__ |
__CCI__ | Compiler is CCI compliant and CCI enforcement is enabled | __CCI__ |
__XC##__ | The specific XC compiler used
(## can be 8 ,
16 or 32 ) | __XC16__ |
__DEVICEFAMILY__ | The family of the selected target device | __dsPIC30F__ |
__DEVICENAME__ | The selected target device name | __18F452_ _ |
Example
The following example shows code that is conditionally compiled dependent on the device having EEPROM memory.
#ifdef __XC16__
void __interrupt(__auto_psv__) myIsr(void)
#else
void __interrupt(low_priority) myIsr(void
#endif
Differences
Some of these CCI macros are new (for example, __CCI__
),
and others have different names to previous symbols with identical meaning (for example,
__18F452
is now __18F452__
).
Migration to the CCI
Any code that uses compiler-defined macros needs review. Old macros will continue to work as expected, but they are not compliant with the CCI.
Caveats
None.