Skip to content

Prevent switch/case statement "fall through" warnings [trivial]#1163

Merged
whitwham merged 1 commit intosamtools:developfrom
jmarshall:fallthru
Nov 9, 2020
Merged

Prevent switch/case statement "fall through" warnings [trivial]#1163
whitwham merged 1 commit intosamtools:developfrom
jmarshall:fallthru

Conversation

@jmarshall
Copy link
Copy Markdown
Member

@jmarshall jmarshall commented Oct 23, 2020

[A trivial one that's been in a holding pattern since before the 1.11 release…]

Add comments indicating intentional fall-throughs, so that gcc -Wextra builds don't need -Wno-implicit-fallthrough as well.

(Clang understands only not-yet-standard attributes and annotations, not comment text, so there's little point in catering to its -Wimplicit-fallthrough warning, which isn't included in ‑Wall/ ‑Wextra in Clang.)

Add comments indicating intentional fall-throughs. Adjust comment in
textutils_internal.h to match GCC's -Wimplicit-fallthrough[=3] pattern.
Annotate several functions that call exit() as HTS_NORETURN so the
compiler knows they won't actually fall through in any switch
statements they appear in.

(Clang understands only not-yet-standard attributes and annotations,
not comment text, so there's little point in catering to its -Wimplicit-
fallthrough warning, which isn't included in -Wall/-Wextra in Clang.)
@whitwham whitwham self-requested a review October 27, 2020 14:04
@whitwham whitwham self-assigned this Nov 9, 2020
@whitwham whitwham removed their request for review November 9, 2020 09:31
@whitwham whitwham merged commit 7f8211c into samtools:develop Nov 9, 2020
@jmarshall jmarshall deleted the fallthru branch November 9, 2020 09:59
@jmarshall
Copy link
Copy Markdown
Member Author

Thanks Andrew.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants