Cygwin: Add 'fallthrough' pseudo keyword for switch/case use
This patch has been inspired by the Linux kernel patch 294f69e662d1 compiler_attributes.h: Add 'fallthrough' pseudo keyword for switch/case use written by Joe Perches <joe AT perches DOT com> based on an idea from Dan Carpenter <dan DOT carpenter AT oracle DOT com>. The following text is from the original log message: Reserve the pseudo keyword 'fallthrough' for the ability to convert the various case block /* fallthrough */ style comments to appear to be an actual reserved word with the same gcc case block missing fallthrough warning capability. All switch/case blocks now should end in one of: break; fallthrough; goto <label>; return [expression]; continue; In C mode, GCC supports the __fallthrough__ attribute since 7.1, the same time the warning and the comment parsing were introduced. Cygwin-only: add an explicit -Wimplicit-fallthrough=5 to the build flags.
This commit is contained in:
@ -445,7 +445,7 @@ p_ere_exp(struct parse *p)
|
||||
break;
|
||||
case '{': /* okay as ordinary except if digit follows */
|
||||
(void)REQUIRE(!MORE() || !isdigit((uch)PEEK()), REG_BADRPT);
|
||||
/* FALLTHROUGH */
|
||||
fallthrough;
|
||||
default:
|
||||
p->next--;
|
||||
wc = WGETNEXT();
|
||||
@ -656,7 +656,7 @@ p_simp_re(struct parse *p,
|
||||
break;
|
||||
case '*':
|
||||
(void)REQUIRE(starordinary, REG_BADRPT);
|
||||
/* FALLTHROUGH */
|
||||
fallthrough;
|
||||
default:
|
||||
p->next--;
|
||||
wc = WGETNEXT();
|
||||
@ -1545,7 +1545,7 @@ findmust(struct parse *p, struct re_guts *g)
|
||||
return;
|
||||
}
|
||||
} while (OP(s) != O_QUEST && OP(s) != O_CH);
|
||||
/* FALLTHROUGH */
|
||||
fallthrough;
|
||||
case OBOW: /* things that break a sequence */
|
||||
case OEOW:
|
||||
case OBOL:
|
||||
|
Reference in New Issue
Block a user