Skip to content

core, log: fix tautology compare error with toolchain llvm#6744

Merged
kaspar030 merged 1 commit intoRIOT-OS:masterfrom
smlng:core/log_fix_tautcmp_error
Mar 17, 2017
Merged

core, log: fix tautology compare error with toolchain llvm#6744
kaspar030 merged 1 commit intoRIOT-OS:masterfrom
smlng:core/log_fix_tautcmp_error

Conversation

@smlng
Copy link
Copy Markdown
Member

@smlng smlng commented Mar 14, 2017

replaces #6612, see comments there

@smlng smlng added Area: core Area: RIOT kernel. Handle PRs marked with this with care! Type: enhancement The issue suggests enhanceable parts / The PR enhances parts of the codebase / documentation Area: build system Area: Build system labels Mar 14, 2017
Copy link
Copy Markdown
Member

@jnohlgard jnohlgard left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Change looks good, did not yet test it.

* @brief Log message if level <= LOG_LEVEL
*/
#ifdef __clang__
#define LOG(level, ...) \
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please add a short comment here why we need to ignore this warning, and in what version of Clang you are seeing this problem. Just for future reference when someone finds this code and wonder why the special handling of Clang.

@smlng
Copy link
Copy Markdown
Member Author

smlng commented Mar 15, 2017

I don't know what happened in between, but currently I cannot reproduce the error. Not with clang 3.8 or 3.9 on Ubuntu Linux nor on macOS 😕 Strange ...

@smlng smlng force-pushed the core/log_fix_tautcmp_error branch from c2a66ee to f2e90c1 Compare March 15, 2017 20:30
@smlng
Copy link
Copy Markdown
Member Author

smlng commented Mar 15, 2017

Jenkins still finds the error, so its with clang version 3.8.0, see here

@smlng
Copy link
Copy Markdown
Member Author

smlng commented Mar 16, 2017

ping! Jenkins is happy, I'll trigger murdock but it should find nothing, because it doesn't check llvm toolchain 😞

@smlng smlng added the CI: ready for build If set, CI server will compile all applications for all available boards for the labeled PR label Mar 16, 2017
#define LOG(level, ...) \
_Pragma("clang diagnostic push") \
_Pragma("clang diagnostic ignored \"-Wtautological-compare\"") \
if (level <= LOG_LEVEL) log_write(level, __VA_ARGS__) \
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There's an error in the original line, but maybe you could fix it while you're at it: level should be parenthesized at all instances, or an invocation like LOG(quite_serious ? LOG_WARN : LOG_INFO, "Something's bad"); would fail.

Also I would surround the whole block in do { } while (0) even if it should not™ be needed.

@smlng smlng force-pushed the core/log_fix_tautcmp_error branch from 1c4e199 to aa88ea0 Compare March 16, 2017 19:36
@smlng
Copy link
Copy Markdown
Member Author

smlng commented Mar 16, 2017

@Kijewski addressed your comments/suggestions, thanks!

@smlng smlng force-pushed the core/log_fix_tautcmp_error branch from aa88ea0 to b74d0db Compare March 16, 2017 19:52
@kaspar030 kaspar030 added CI: ready for build If set, CI server will compile all applications for all available boards for the labeled PR and removed CI: ready for build If set, CI server will compile all applications for all available boards for the labeled PR labels Mar 16, 2017
@kaspar030
Copy link
Copy Markdown
Contributor

please squash!

@smlng smlng force-pushed the core/log_fix_tautcmp_error branch from b74d0db to 1b69f28 Compare March 17, 2017 08:04
@smlng
Copy link
Copy Markdown
Member Author

smlng commented Mar 17, 2017

@kaspar030 or @gebart ready for an ACK and merge this one?

Copy link
Copy Markdown
Contributor

@kaspar030 kaspar030 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ACK.

@kaspar030
Copy link
Copy Markdown
Contributor

&go

@kaspar030 kaspar030 merged commit 355cfe7 into RIOT-OS:master Mar 17, 2017
@smlng smlng deleted the core/log_fix_tautcmp_error branch March 17, 2017 14:41
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Area: build system Area: Build system Area: core Area: RIOT kernel. Handle PRs marked with this with care! CI: ready for build If set, CI server will compile all applications for all available boards for the labeled PR Type: enhancement The issue suggests enhanceable parts / The PR enhances parts of the codebase / documentation

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants