diff options
author | Christoph Erhardt <erhardt@cs.fau.de> | 2017-09-01 14:00:19 +0200 |
---|---|---|
committer | Andreas Fried <andreas.fried@kit.edu> | 2017-09-01 16:12:43 +0200 |
commit | b9d3a7d6eea3fba94906436107b362ece6d78d27 (patch) | |
tree | 40a6e1f8b97f7d9e2fe0355a54c0f2d1f50a2c6b | |
parent | fd91f7a010a60084b404d0ad71b99860ff105434 (diff) |
Suppress fall-through warnings issued by GCC >= 7
-rw-r--r-- | src/ast/constfold.c | 1 | ||||
-rw-r--r-- | src/driver/diagnostic.c | 2 | ||||
-rw-r--r-- | src/parser/parser.c | 8 | ||||
-rw-r--r-- | src/parser/preprocessor.c | 13 |
4 files changed, 20 insertions, 4 deletions
diff --git a/src/ast/constfold.c b/src/ast/constfold.c index d9f072e..9eea0dd 100644 --- a/src/ast/constfold.c +++ b/src/ast/constfold.c @@ -300,6 +300,7 @@ static ir_tarval *literal_to_tarval_(const literal_expression_t *literal, return get_mode_one(mode); } else { assert(literal->value->begin[0] == 'f'); + /* FALLTHROUGH */ case EXPR_LITERAL_MS_NOOP: return get_mode_null(mode); } diff --git a/src/driver/diagnostic.c b/src/driver/diagnostic.c index a461e27..e64ab98 100644 --- a/src/driver/diagnostic.c +++ b/src/driver/diagnostic.c @@ -301,11 +301,13 @@ bool warningf(warning_t const warn, position_t const* pos, char const *const fmt char const* kind_color; case WARN_STATE_ON: if (is_warn_on(WARN_ERROR)) { + /* FALLTHROUGH */ case WARN_STATE_ON | WARN_STATE_ERROR: ++error_count; kind = "error"; kind_color = colors.error; } else { + /* FALLTHROUGH */ case WARN_STATE_ON | WARN_STATE_NO_ERROR: ++warning_count; kind = "warning"; diff --git a/src/parser/parser.c b/src/parser/parser.c index 23cf594..1f41af6 100644 --- a/src/parser/parser.c +++ b/src/parser/parser.c @@ -3374,6 +3374,7 @@ ptr_operator_end: ; switch (la1->kind) { case T_IDENTIFIER: if (is_typedef_symbol(la1->base.symbol)) { + /* FALLTHROUGH */ case ')': /* ยง6.7.6:2 footnote 126: Empty parentheses in a type name are * interpreted as ``function with no parameter specification'', @@ -3387,6 +3388,7 @@ ptr_operator_end: ; errorf(HERE, "function declarator must have a name"); } } else { + /* FALLTHROUGH */ case '&': case '(': case '*': @@ -5124,7 +5126,7 @@ static void check_unreachable(statement_t* const stmt, void *const env) return; } } - } + } /* FALLTHROUGH */ default: warn_unreachable: @@ -8280,8 +8282,7 @@ static bool maybe_negative(expression_t const *const expr) const type_t *skipped = skip_typeref(member->declaration.type); return is_type_signed(skipped); } - /* FALLTHROUGH */ - } + } /* FALLTHROUGH */ default: return true; @@ -10224,6 +10225,7 @@ static statement_t *intern_parse_statement(void) default: statement = parse_expression_statement(); } else { + /* FALLTHROUGH */ case DECLARATION_START: case T_IDENTIFIER: statement = parse_declaration_statement(); diff --git a/src/parser/preprocessor.c b/src/parser/preprocessor.c index b2f2eb5..b965dc8 100644 --- a/src/parser/preprocessor.c +++ b/src/parser/preprocessor.c @@ -872,6 +872,7 @@ static void parse_character_constant(string_encoding_t const enc) #define SYMBOL_CASES_WITHOUT_E_P \ '$': if (no_dollar_in_symbol) goto dollar_sign; \ + /* FALLTHROUGH */ \ case 'a': \ case 'b': \ case 'c': \ @@ -1567,6 +1568,7 @@ static bool concat_tokens(const position_t *pos, break; case '=': if (kind1 == '=') { set_punctuator(T_EQUALEQUAL); return true; } + /* FALLTHROUGH */ case '>': switch (kind1) { case '=': { set_punctuator(T_GREATEREQUAL); return true; } @@ -2027,6 +2029,15 @@ end_number: #define ELSE(kind) ELSE_CODE(set_punctuator(kind); return;) +#define FALLTHROUGH_ELSE_CODE(code) \ + /* FALLTHROUGH */ \ + default: \ + code \ + } + +#define FALLTHROUGH_ELSE(kind) \ + FALLTHROUGH_ELSE_CODE(set_punctuator(kind); return;) + static void maybe_skip_newline(void) { switch (input.c) { @@ -2203,7 +2214,7 @@ digraph_percentcolon: return; } /* FALLTHROUGH */ - ELSE(':') + FALLTHROUGH_ELSE(':') case '=': MAYBE_PROLOG MAYBE('=', T_EQUALEQUAL) |