Fix gcc compiler warnings about switch fallthroughs.

This commit is contained in:
Sebastian Rasmussen
2018-09-03 23:26:46 +08:00
committed by Tor Andersson
parent d4655ae888
commit 7448a82448
3 changed files with 6 additions and 4 deletions

View File

@@ -538,7 +538,7 @@ static void ccall(JF, js_Ast *fun, js_Ast *args)
ceval(J, F, fun, args); ceval(J, F, fun, args);
return; return;
} }
/* fall through */ /* fallthrough */
default: default:
cexp(J, F, fun); cexp(J, F, fun);
emit(J, F, OP_UNDEF); emit(J, F, OP_UNDEF);

View File

@@ -426,7 +426,8 @@ loop:
while (*r) { while (*r) {
if (*r == '$') { if (*r == '$') {
switch (*(++r)) { switch (*(++r)) {
case 0: --r; /* end of string; back up and fall through */ case 0: --r; /* end of string; back up */
/* fallthrough */
case '$': js_putc(J, &sb, '$'); break; case '$': js_putc(J, &sb, '$'); break;
case '`': js_putm(J, &sb, source, s); break; case '`': js_putm(J, &sb, source, s); break;
case '\'': js_puts(J, &sb, s + n); break; case '\'': js_puts(J, &sb, s + n); break;
@@ -522,7 +523,8 @@ static void Sp_replace_string(js_State *J)
while (*r) { while (*r) {
if (*r == '$') { if (*r == '$') {
switch (*(++r)) { switch (*(++r)) {
case 0: --r; /* end of string; back up and fall through */ case 0: --r; /* end of string; back up */
/* fallthrough */
case '$': js_putc(J, &sb, '$'); break; case '$': js_putc(J, &sb, '$'); break;
case '&': js_putm(J, &sb, s, s + n); break; case '&': js_putm(J, &sb, s, s + n); break;
case '`': js_putm(J, &sb, source, s); break; case '`': js_putm(J, &sb, source, s); break;

View File

@@ -110,7 +110,7 @@ static int nextrune(struct cstate *g)
if (g->yychar == '\\') { if (g->yychar == '\\') {
g->source += chartorune(&g->yychar, g->source); g->source += chartorune(&g->yychar, g->source);
switch (g->yychar) { switch (g->yychar) {
case 0: die(g, "unterminated escape sequence"); case 0: die(g, "unterminated escape sequence"); break;
case 'f': g->yychar = '\f'; return 0; case 'f': g->yychar = '\f'; return 0;
case 'n': g->yychar = '\n'; return 0; case 'n': g->yychar = '\n'; return 0;
case 'r': g->yychar = '\r'; return 0; case 'r': g->yychar = '\r'; return 0;