Reputation: 553
I'm attempting to use SourceTrails (https://www.sourcetrail.com/) to analyze embedded c from the MPLAB CX8 compiler. It's not entirely trouble-free, as the compiler uses a number of custom features, not found in the C standard.
One of these is the use of short long
to indicate 24-bit variables in global includes, such as:
extern volatile unsigned short long TBLPTR;
SourceTrail (using clang) shows this error: cannot combine with previous "short" declaration specifier.
For the analysis only, I'd like to specify something like on the top of the global include:
#define "short long" long
but obviously, this fails!
I might have to perform a search and replace, but it would be great if there were a simpler method?
Upvotes: 2
Views: 151
Reputation: 23832
You can use something like:
#define short int
short long
variables will now be long
, at least in mainstream compilers like gcc
and clang
.
Any short
variables will now be int
, the side effect is that short int
declarations will now cause invalid combination
error.
The solution found by the OP was to use #define short
which will effectively remove short
from the type declaration making it long
.
The side effect is that variables declared short
will have no type or storage class, and as such, will default to int
.
In compilers like clang
or gcc
the type int long
will default to long
effectively making both solutions possible, minding the different side effects.
Upvotes: 2