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?
You can use something like:
short longvariables will now belong, at least in mainstream compilers likegccandclang.Any
shortvariables will now beint, the side effect is thatshort intdeclarations will now causeinvalid combinationerror.The solution found by the OP was to use
#define shortwhich will effectively removeshortfrom the type declaration making itlong.The side effect is that variables declared
shortwill have no type or storage class, and as such, will default toint.In compilers like
clangorgccthe typeint longwill default tolongeffectively making both solutions possible, minding the different side effects.