#ifdef problem

View: New views
1 Messages — Rating Filter:   Alert me  

#ifdef problem

by Rich Yonts :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Sergey,

Thank you for cflow. I find it very helpful.

I ran into a problem where I was missing whole functions although the debug trace showed that they were being parsed. I finally narrowed it down to the way that #ifdef processing is being handled. When I have a code block that is begun by which branch of an #ifdef...#else...#endif, cflow does not properly handle the input. Here is a sample program that will show different behavior based on whether the duplicated if is in the code or commented out:

int main() {
#ifdef WIN32
/* commenting out the next line changes the output */
if (x > 0) { //
#else
if (x != NULL && x > 0) {
#endif
y = 1;
} else {
y = 0;
}
doit();
fake();
}

int doit() {
prinntf("Hello, world.\n");
}

int fake() {
int j = 3;
}

When cflow is run this is its output:

main() <int main () at test.c:1>:
doit()
fake()
prinntf()

which shows that it does not see the doit() and fake() functions properly. But when one of the two block opening statements is commented out, there is the output

main() <int main () at test.c:1>:
doit() <int doit () at test.c:16>:
prinntf()
fake() <int fake () at test.c:20>

which is what is expected.

Thank you for your hard work and consideration of this problem.


sola gratia, sola fide, solo Christo, sola Scriptura, soli Deo gloria,

Rich Yonts
ryonts@...


Kurie, swson me


_______________________________________________
bug-cflow mailing list
bug-cflow@...
http://lists.gnu.org/mailman/listinfo/bug-cflow

LightInTheBox - Buy quality products at wholesale price!