Skip to content

make: ignore fallthroughs errors with GCC 7.x#8430

Merged
jnohlgard merged 5 commits intoRIOT-OS:masterfrom
smlng:gcc7/ignore_fallthroughs
Feb 19, 2018
Merged

make: ignore fallthroughs errors with GCC 7.x#8430
jnohlgard merged 5 commits intoRIOT-OS:masterfrom
smlng:gcc7/ignore_fallthroughs

Conversation

@smlng
Copy link
Copy Markdown
Member

@smlng smlng commented Jan 24, 2018

Contribution description

This PR fixes several implicit-fallthrough errors when using GCC 7.x. That is, for libcoap and oonf_api package the errors are ignored, and this PR also relaxes -Werror=implicit-fallthrough=2 to allow more descriptive comments. See also here

Issues/PRs references

#8265

@smlng smlng added Type: enhancement The issue suggests enhanceable parts / The PR enhances parts of the codebase / documentation Area: build system Area: Build system Area: pkg Area: External package ports CI: ready for build If set, CI server will compile all applications for all available boards for the labeled PR Process: needs backport Integration Process: The PR is required to be backported to a release or feature branch labels Jan 24, 2018
@smlng smlng added this to the Release 2018.01 milestone Jan 24, 2018
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.

Looks good for the pkgs, but why do we need to change the default implicit fall through regex choice?


MODULE:=$(PKG_NAME)

CFLAGS += -Wno-implicit-fallthrough
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.

Add a comment above this line why it is necessary.

PKG_VERSION=ef41ce5d02d64cec0751882ae8fd95f6c32bc018
PKG_LICENSE=BSD-2-Clause

CFLAGS += -Wno-implicit-fallthrough
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.

Add a comment above this line describing why this is necessary

Makefile.include Outdated
export WERROR
ifeq ($(WERROR),1)
CFLAGS += -Wall -Werror -Wextra
CFLAGS += -Wall -Werror -Wextra -Werror=implicit-fallthrough=2
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.

Why do we need this? Are some comments wrongly formatted to match the gcc default regex?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

Not wrongly formatted, but default is -Werror=implicit-fallthrough=3, which only allows (or matches) on one-line comments with very limited (and case sensitive) wording, e.g., /* falls through */, but some like to add an explanation like /* falls through intentionally because of XYZ */, see here for instance, which does not match and hence causes an error.

However, considering 17000++ errors this gives us for older compilers that do not recognise this option - we better fix/adapt the comments - I guess.

@kaspar030
Copy link
Copy Markdown
Contributor

(17007 more failed jobs)

new record! ;)

@smlng
Copy link
Copy Markdown
Member Author

smlng commented Jan 24, 2018

new record! ;)

I always aim for that, where is my medal 😉 🏅

@smlng smlng force-pushed the gcc7/ignore_fallthroughs branch from bbce413 to b3fde34 Compare January 24, 2018 21:07
@smlng
Copy link
Copy Markdown
Member Author

smlng commented Jan 24, 2018

reworked and added some more fixes for GCC 7

@smlng smlng removed the Process: needs backport Integration Process: The PR is required to be backported to a release or feature branch label Jan 30, 2018
Copy link
Copy Markdown
Member

@miri64 miri64 left a comment

Choose a reason for hiding this comment

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

Please also add a fallthrough ignore to pkg/emb6/Makefile.include

PKG_LICENSE=BSD-2-Clause

# GCC 7.x fails on (intentional) fallthrough, thus disable implicit-fallthrough.
CFLAGS += -Wno-implicit-fallthrough
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.

Shouldn't this rather go in pkg/libcoap/Makefile.include?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

mhm, @gebart was suggesting to use Makefile not Makefile.include so the option is only effective when compiling the package. IIRC putting it into Makefile.include exposes this to RIOT completely.

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.

Ah, you are right... But with emb6 this doesn't work somehow.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

I'll look into it

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.

Ah, because emb6 has submodules and libcoap and oonf_api do not... So at least for those submodules we somehow also need to activate -Wno-implicit-fallthrough... I think it is easier just to take the patch from smlng#3
for the moment, since porting to newest emb6 isn't that simple ;-).

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.

MODULE:=$(PKG_NAME)

# GCC 7.x fails on (intentional) fallthrough, thus disable implicit-fallthrough.
CFLAGS += -Wno-implicit-fallthrough
Copy link
Copy Markdown
Member

@miri64 miri64 Feb 15, 2018

Choose a reason for hiding this comment

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

Dito for pkg/oonf_api/Makefile.include?

@smlng smlng 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 Feb 15, 2018
@smlng smlng 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 Feb 15, 2018
@jnohlgard jnohlgard mentioned this pull request Feb 19, 2018
13 tasks
@jnohlgard
Copy link
Copy Markdown
Member

@miri64 @smlng What is the status here? Regarding the emb6 part of the PR

@jnohlgard
Copy link
Copy Markdown
Member

@miri64 @smlng Sorry, mixed up the PRs. This has nothing to do with emb6

@smlng
Copy link
Copy Markdown
Member Author

smlng commented Feb 19, 2018

emb6 is separately fixed in #8571, the Murdock error is unrelated I'll retriever

@smlng smlng removed the CI: ready for build If set, CI server will compile all applications for all available boards for the labeled PR label Feb 19, 2018
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.

ACK, looks fine now

@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 Feb 19, 2018
@jnohlgard
Copy link
Copy Markdown
Member

Murdock is happy now -> go

@jnohlgard jnohlgard merged commit 73c11a3 into RIOT-OS:master Feb 19, 2018
@smlng smlng deleted the gcc7/ignore_fallthroughs branch February 19, 2018 12:38
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: pkg Area: External package ports 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