titapo
titapo

Reputation: 135

C macro: how to hide __at keyword?

I have a .h and .c file for an embedded project, which I want to unit testing in C++. In .c file there are variable declarations:

uint8_t foo __at "NOINIT";

g++ throws error. Has anybody a solution for this problem? (I prefer solutions which leave the .c changed)

I tried to add switch to g++:

-D__at=;//

and the expected result is:

uint8_t foo ;// "NOINIT";

But does not work. What is the correct syntax? (-D__at=";//" and -D__at=;\/\/ are not)

Thank you for your help!

Upvotes: 0

Views: 503

Answers (1)

n. m. could be an AI
n. m. could be an AI

Reputation: 120021

I am a trained professional. Don't try to repeat this at home.

 gcc \
    -D'var1(v,l)=v ## l'     \
    -D'var(v,l)=var1(v,l)'   \
    -D'__at=; const char* var(dummy_x_,__LINE__)='

Upvotes: 4

Related Questions