diff options
author | Prathamesh Kulkarni <bilbotheelffriend@gmail.com> | 2014-04-24 21:29:45 +0000 |
---|---|---|
committer | Jeff Law <law@gcc.gnu.org> | 2014-04-24 15:29:45 -0600 |
commit | 3e4fbd9185ee1e972d8923e02b98b1414611233b (patch) | |
tree | 45e595ff659ff87411855aa108eaf03542fd0dde /gcc | |
parent | 42056eaced812253def2d3be64b755a998c8f830 (diff) | |
download | gcc-3e4fbd9185ee1e972d8923e02b98b1414611233b.zip gcc-3e4fbd9185ee1e972d8923e02b98b1414611233b.tar.gz gcc-3e4fbd9185ee1e972d8923e02b98b1414611233b.tar.bz2 |
c-parser.c (c_parser_sizeof_expression): Reorganize slightly to avoid goto.
* c-parser.c (c_parser_sizeof_expression): Reorganize slightly to
avoid goto.
From-SVN: r209765
Diffstat (limited to 'gcc')
-rw-r--r-- | gcc/c/ChangeLog | 5 | ||||
-rw-r--r-- | gcc/c/c-parser.c | 31 |
2 files changed, 20 insertions, 16 deletions
diff --git a/gcc/c/ChangeLog b/gcc/c/ChangeLog index 3ee2594..14e6169 100644 --- a/gcc/c/ChangeLog +++ b/gcc/c/ChangeLog @@ -1,3 +1,8 @@ +2014-04-24 Prathamesh Kulkarni <bilbotheelffriend@gmail.com> + + * c-parser.c (c_parser_sizeof_expression): Reorganize slightly to + avoid goto. + 2014-04-24 Jakub Jelinek <jakub@redhat.com> * c-parser.c (c_parser_omp_atomic): Allow seq_cst before diff --git a/gcc/c/c-parser.c b/gcc/c/c-parser.c index 6eb235c..c229bdb 100644 --- a/gcc/c/c-parser.c +++ b/gcc/c/c-parser.c @@ -6514,30 +6514,29 @@ c_parser_sizeof_expression (c_parser *parser) return ret; } if (c_parser_next_token_is (parser, CPP_OPEN_BRACE)) + expr = c_parser_postfix_expression_after_paren_type (parser, + type_name, + expr_loc); + else { - expr = c_parser_postfix_expression_after_paren_type (parser, - type_name, - expr_loc); - goto sizeof_expr; + /* sizeof ( type-name ). */ + c_inhibit_evaluation_warnings--; + in_sizeof--; + return c_expr_sizeof_type (expr_loc, type_name); } - /* sizeof ( type-name ). */ - c_inhibit_evaluation_warnings--; - in_sizeof--; - return c_expr_sizeof_type (expr_loc, type_name); } else { expr_loc = c_parser_peek_token (parser)->location; expr = c_parser_unary_expression (parser); - sizeof_expr: - c_inhibit_evaluation_warnings--; - in_sizeof--; - mark_exp_read (expr.value); - if (TREE_CODE (expr.value) == COMPONENT_REF - && DECL_C_BIT_FIELD (TREE_OPERAND (expr.value, 1))) - error_at (expr_loc, "%<sizeof%> applied to a bit-field"); - return c_expr_sizeof_expr (expr_loc, expr); } + c_inhibit_evaluation_warnings--; + in_sizeof--; + mark_exp_read (expr.value); + if (TREE_CODE (expr.value) == COMPONENT_REF + && DECL_C_BIT_FIELD (TREE_OPERAND (expr.value, 1))) + error_at (expr_loc, "%<sizeof%> applied to a bit-field"); + return c_expr_sizeof_expr (expr_loc, expr); } /* Parse an alignof expression. */ |