Skip to content

Add G_GNUC_FALLTHROUGH for __attribute__(fallthrough))

Benjamin Otte requested to merge wip/otte/fallthrough into master

The first patch adds G_GNUC_FALLTHROUGH for attribute(fallthrough)) which can be used with gcc >= 7 to mark switch cases as fallthrough.
The 2nd commit marks all those cases in the glib code.
And then the final commit turns on -Wimplicit-fallthrough which can be used with gcc >= 7 to warn about cases where there is neither a break or G_GNUC_FALLTHROUGH at the end of a case statement.

I got inspired for this by Kees Cook's talk at https://www.youtube.com/watch?v=XfNt6MsLj0E

Merge request reports