core: redefine LOG macro to fix tautological compare error#6612
core: redefine LOG macro to fix tautological compare error#6612smlng wants to merge 1 commit intoRIOT-OS:masterfrom
Conversation
|
mhm, okay need to this another way. I'll see to it |
54e2869 to
ff953d8
Compare
ff953d8 to
a58803c
Compare
|
for clarification, the statement: led to a tautological compare error when using toolchain LLVM. I read they also added this to gcc 6.x.y, so this will likely hit more often in the future. [edit] This PR resolves the issue ... |
|
The original idea of these tautological comparisons was to enable the
compiler to do syntax checks during CI build tests, but to let the
optimizer kick out the unreachable log calls. I don't like the thought of
removing that robustness check. We used to have a lot of broken debug
prints in various places in the code but they didn't fail until you tried
to build with ENABLE_DEBUG 1. That was a hassle because when you wanted to
debug some failure in the application you would have to start with fixing
the debug printfs before you could look for the actual problem.
…On Feb 16, 2017 9:04 AM, "Sebastian Meiling" ***@***.***> wrote:
for clarification, the statement:
#define LOG(level, ...) if (level <= LOG_LEVEL) log_write(level, __VA_ARGS__)
led to a *tautological compare* error when using toolchain LLVM. I read
they also added this to gcc 6.x.y, so this will likely hit more often in
the future.
This PR resolves the issue ...
—
You are receiving this because your review was requested.
Reply to this email directly, view it on GitHub
<#6612 (comment)>, or mute
the thread
<https://github.com/notifications/unsubscribe-auth/AATYQkIdi2sBpW9CRhr2xhcpJRKpebV6ks5rdAMAgaJpZM4MBuT0>
.
|
|
@gebart please note that the logging defined here, has nothing to do with logging done be |
If you don't, the log code will be kicked out by the preprocessor, which this log.h previously intentionally tried to not do. Can this be fixed with pragmas? |
|
@kaspar030 please elaborate, I'm unsure what you mean? In any case with whatever |
|
@kaspar030 ping! |
Exactly that is what the log module tries to avoid. Not used debug code will end up as ... which the compile correctly marks as always true. Historically, there were proper changes to code, which did not update the corresponding DEBUG statements. Enabling DEBUG would break the compile, but our CI would not spot those as per default we compile with The next time someone wanted to actually debug, a lot of time was lost repairing broken debug statements elsewhere in the file. That's why this PR's solution is contrary to what the module tries to achieve. It should be possible to disable the warning (which points to expected behavior), using compiler pragmas. Sth like push/tautological-compare//pop should do. |
Just realized that @gebart already explained this... |
|
@smlng Can you try if this patch solves the problem? https://gist.github.com/kaspar030/621c5929cb8256b5e327180b67739efd |
|
closing, superseded by #6744 |
required by #6600