I am working with a primitive C Parser that does not handle the Preprocessor directive.
I can preprocess most of the header with the -E switch without problem.
Lately I found cases when attribute and align are present.
I tried to get rid of them with this tweak:
gcc -D "aligned(ARGS)" \
-D "__align__(ARGS)" \
-D "__attribute__(ARGS)" \
-E /usr/local/include/fancyheader.h
Update:
But without success, example:
struct __attribute__((aligned(16))) long4
{
long int x, y, z, w;
};
The above statements is transformed to, with that "1" pending around
struct 1 long4
{
long int x, y, z, w;
};
Who knowzs the correct way to get rid of the __align__ and __attribute__ extensions ?
What happens when you use -D "aligned(ARGS)="
?
The preprocessor assigns the value 1
to all macros defined on the command line without specifying a replacement list. For instance, if you compile with -DFOO:
std::cout << FOO << std::endl;
will print 1
. If you want to explicitly set the macro replacement list to be empty use -DFOO=
(or in your case -D__align__(x)=
.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With