We are running a survey to help us improve the experience for all of our members. If you see the survey appear, please take the time to tell us about your experience if you can.
Hello All,
I am trying to use the GNU NANA in my project for Invariants and Quantifiers. I am facing some issues with macro expansion (the macros are already written by NANA people).
Whenever I use the MACRO (A, E, and C)in my code and compile it, I get an error as "error: #29: expected an expression". The way I am using it is as in following code snippet:
int main(void) { int q[5] = {1,2,3,4,5}; I(q[4] == 5); N(q[4] == 5); I(A(temp = 0, temp < 5, temp++, q[temp] <= 5)); return 0; }
I got above error for line "I(A(temp = 0, temp < 5, temp++, q[temp] <= 5));"
I have also seen the expanded macro in the preprocessed file and it look like this:
int main(void) { int q[5] = {1,2,3,4,5}; do { if((1)) { if(!(q[4] == 5)) { _I_default_handler("I(" "q[4] == 5" ")","test.c",8); } } } while(0); do { if((1)) { if(!((!(q[4] == 5)))) { _I_default_handler("N(" "q[4] == 5" ")","test.c",9); } } } while(0); do { if((1)) { if(!(({ int _A_result = 1; temp = 0; while(temp < 5) { if(!(q[temp] <= 5)) { _A_result = 0; break; } temp++; } _A_result; }))) { _I_default_handler("I(" "A(temp = 0, temp < 5, temp++, q[temp] <= 5)" ")","test.c",15); } } } while(0); return 0; }
There is some problem while returning _A_result. I tried compliling this with CodeSourcery, and it works fine with that.
Does keil not work well with macros?
Thanks in advance