Predefined compiler macros

If you have a simple question and just want an answer.
ct3
New User
Posts: 2
Joined: Thu Nov 12, 2015 11:40 am

Predefined compiler macros

Post by ct3 »

Hi,

Does anyone know where to find a list of all the macros predefined by the XCC compiler?

Right now I am looking for one to distinguish the XCC compiler from other compilers.

Thanks

User avatar
larry
Respected Member
Posts: 275
Joined: Fri Mar 12, 2010 6:03 pm

Post by larry »

You can dump predefined macros by doing preprocess-only on an empty file with -dM, e.g. xcc -dM -E empty.xc. Normally, you can specify a null file, such as:

 

gcc -dM -E - </dev/null

 

but XCC doesn't support that.

ct3
New User
Posts: 2
Joined: Thu Nov 12, 2015 11:40 am

Post by ct3 »

Here is the best solution I've found so far:

In xTIMEcomposer, go to the project settings, C/C++ General > Paths and Symbols > tab: Symbols

From there you will get a list of all preprocessor macros which are currently defined for C, C++ and XC.

 

Now the question for the XMOS dev team is: where does this list come from? Most likely it is from xcc, so it would be great to know the command line arguments to get this list directly from xcc.