This code:
#ifdef LONG
long
#else
int
#endif
calc(
#ifdef LONG
long
#else
int
#endif
a) {
return 2 * a;
}
is incorrectly parsed to this structure:
[1] File
[LONG] #IFDEF LONG
[LONG] Function
[LONG] CodeList
[LONG] long
[LONG && !LONG] #ELSE !LONG
[LONG && !LONG] int
[LONG] calc (
[LONG && LONG] #IFDEF LONG
[LONG && LONG] long
[LONG]
[LONG && !LONG] #ELSE !LONG
[LONG && !LONG] int
[LONG] a )
[LONG] CompoundStatement
[LONG] Statement:
[LONG] return 2 * a ;
Correct would be something like this:
[1] File
[1] Function
[1] CodeList
[LONG] #IFDEF LONG
[LONG] long
[!LONG] #ELSE !LONG
[!LONG] int
[1] calc (
[LONG] #IFDEF LONG
[LONG] long
[!LONG] #ELSE !LONG
[LONG] int
[1] a )
[1] CompoundStatement
[1] Statement:
[1] return 2 * a ;
The problem is, that srcML creates an <cpp:ifdef> tag before the <function> tag:
<cpp:ifdef>#<cpp:directive>ifdef</cpp:directive> <name>LONG</name></cpp:ifdef>
<function><type><name>long</name>
<cpp:else>#<cpp:directive>else</cpp:directive></cpp:else>
<name>int</name></type>
<cpp:endif>#<cpp:directive>endif</cpp:directive></cpp:endif>
Fixing this would require a special rewriting of the XML structure created by srcML. We currently don't plan to do this.
This code:
is incorrectly parsed to this structure:
Correct would be something like this:
The problem is, that srcML creates an
<cpp:ifdef>tag before the<function>tag:Fixing this would require a special rewriting of the XML structure created by srcML. We currently don't plan to do this.