Conditional mis-compilation

Tip / Sign in to post questions, reply, level up, and achieve exciting badges. Know more

cross mob
Not applicable
Hi,

Can anyone help with the ETH_LWIP 'Enable statistics collection' option ?
I'm chasing a deadline, and battled with for 2 hours so far, which I think is about enough.
Is it even *supposed* to work ?

The basic issue is, checking that option, results in the following two, within lwipopts.h - so far, so good:

#define LWIP_STATS 1
#define LWIP_STATS_DISPLAY 1

Also present in the file, is eg, the following:

#define LWIP_TCP 1

lwipopts.h is included within opt.h, which has eg the following. It's ungreyed, so DAVE is telling me it has included.

#ifndef TCP_STATS
#define TCP_STATS (LWIP_TCP)
#endif

Opt.h is included within stats.h, but all the TCP_STATS conditionals, are greyed. Where, did the link 'break', between TCP_STATS being 1 in opt.h, but not within stats.h. Does anyone have tips about how to go about troubleshooting conditional compilation puzzles like this? What is a reliable way of finding out the *real* state of TCP_STATS, at each point it is referenced. I'm really not sure I should be having to troubleshoot this..

..the upshot of TCP_STATS changing from 1 to 0, is that there is no statistics collection.

Best regards,

David King
0 Likes
2 Replies
jferreira
Employee
Employee
10 sign-ins 5 sign-ins First like received
Hi David,

Maybe you can try with compiler option -save-temps.

Regards,
Jesus
0 Likes
Not applicable
Hi Jesus,

Thanks, interesting. I googled -save-temps, and found https://gcc.gnu.org/onlinedocs/gcc/Developer-Options.html#Developer-Options.
I can see it's to do with retaining compiler temporary files that the compiler would normally automatically delete.
I'll add to my todo list to look into, to see what light they might shed.

Meanwhile, I found a solution:

It took a fair bit of labour, but basically I tried referencing in my code, each of the ETH_LWIP statistics, one-by-one, to find which *actually* existed,
rather than what the conditional-compilation greying would suggest.

And indeed, the statistics that *actually* existed, differed from what the greying would suggest..

I think there might be a bit of an issue, with the greying. From a quick google, I think the greying is an Eclipse and/or GCC thing, rather than a DAVE thing, per se..

And perhaps, there's something about ETH_LWIP, or heavily nested conditional compilation in general, that gets Eclipse confused. It's just a cosmetic thing, mind..

But it has rather broken my confidence, in relying on the greying, for an understanding of what's included, and what's not..

I've not seen any greying confusion with my own sections of code. But they're just single or dual tier conditionally compiled. No 3-tier nesting or deeper.

Best regards,

David
0 Likes