core: debug: rely on optimizer to kick out unused debug code#5166
core: debug: rely on optimizer to kick out unused debug code#5166smlng merged 21 commits intoRIOT-OS:masterfrom
Conversation
|
@OlegHahm I remember you were against this as you regularly compile with |
|
Launching murdock to see if this would expose trouble... |
|
We may need to take care of |
Would that evaluate to true with ENABLE_DEBUG==0? |
|
For example, gnrc_ipv6.c declares temporary buffer to format IP address: So we have to change it to: or enable zero size arrays and change it to: or change it to allocate the buffer on the stack. |
core/include/debug.h
Outdated
| * @brief Extra stacksize needed when ENABLE_DEBUG==1 | ||
| */ | ||
| #if ENABLE_DEBUG | ||
| #if ENABLE_DEBUG==1 |
Oops, should have read this before. Well, yes, I guess everybody who's debugging is using |
|
How about this? [edit] Clang and GCC seems to eliminate |
|
@kaspar030 can you retake this? Since WIP label is set I think it's better to put it in the next release. |
bfeef9a to
1969dd4
Compare
|
Actally, yes. But I propose going in steps. This PR makes all |
|
@cladmi are we good here, or do you have any doubts/comments? Otherwise, we should merge this. |
|
Well then, ACK & GO! |
This PR changes
DEBUGto be enclosed inif (ENABLE_DEBUG)instead of being wiped by the preprocessor if unused. That way, all debug code is always compile-checked. With any optimization enabled, the code will still be eliminated if dead.