X-Git-Url: http://git.sourceforge.jp/view?a=blobdiff_plain;f=gcc%2Fc-parser.c;h=56134c24e50a27d3ad47ade5c919d24b0fe25d3e;hb=3cb4b8e201bbdc2105b79eb5995ddd5e6c88c56b;hp=b88b11fc4302b0cafea5285cb19a30daf6e0db08;hpb=bdd07b44ffe70f2d6f3c76b1563e7cb4f2c42336;p=pf3gnuchains%2Fgcc-fork.git diff --git a/gcc/c-parser.c b/gcc/c-parser.c index b88b11fc430..56134c24e50 100644 --- a/gcc/c-parser.c +++ b/gcc/c-parser.c @@ -1,7 +1,7 @@ /* Parser for C and Objective-C. Copyright (C) 1987, 1988, 1989, 1992, 1993, 1994, 1995, 1996, 1997, 1998, - 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2007, 2008, 2009, 2010, 2011 - Free Software Foundation, Inc. + 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2007, 2008, 2009, 2010, 2011, + 2012 Free Software Foundation, Inc. Parser actions based on the old Bison parser; structure somewhat influenced by and fragments based on the C++ parser. @@ -1796,7 +1796,7 @@ c_parser_asm_definition (c_parser *parser) c_parser_skip_until_found (parser, CPP_SEMICOLON, "expected %<;%>"); } -/* Parse a static assertion (C1X N1425 6.7.10). +/* Parse a static assertion (C11 6.7.10). static_assert-declaration: static_assert-declaration-no-semi ; @@ -1811,7 +1811,7 @@ c_parser_static_assert_declaration (c_parser *parser) c_parser_skip_to_end_of_block_or_statement (parser); } -/* Parse a static assertion (C1X N1425 6.7.10), without the trailing +/* Parse a static assertion (C11 6.7.10), without the trailing semicolon. static_assert-declaration-no-semi: @@ -1827,7 +1827,7 @@ c_parser_static_assert_declaration_no_semi (c_parser *parser) gcc_assert (c_parser_next_token_is_keyword (parser, RID_STATIC_ASSERT)); assert_loc = c_parser_peek_token (parser)->location; - if (!flag_isoc1x) + if (!flag_isoc11) { if (flag_isoc99) pedwarn (assert_loc, OPT_pedantic, @@ -1902,7 +1902,7 @@ c_parser_static_assert_declaration_no_semi (c_parser *parser) Function specifiers (inline) are from C99, and are currently handled as storage class specifiers, as is __thread. Alignment - specifiers are from C1X. + specifiers are from C11. C90 6.5.1, C99 6.7.1: storage-class-specifier: @@ -1917,7 +1917,7 @@ c_parser_static_assert_declaration_no_semi (c_parser *parser) inline _Noreturn - (_Noreturn is new in C1X.) + (_Noreturn is new in C11.) C90 6.5.2, C99 6.7.2: type-specifier: @@ -2768,7 +2768,7 @@ c_parser_typeof_specifier (c_parser *parser) /* Parse an alignment-specifier. - C1X 6.7.5: + C11 6.7.5: alignment-specifier: _Alignas ( type-name ) @@ -2782,7 +2782,7 @@ c_parser_alignas_specifier (c_parser * parser) location_t loc = c_parser_peek_token (parser)->location; gcc_assert (c_parser_next_token_is_keyword (parser, RID_ALIGNAS)); c_parser_consume_token (parser); - if (!flag_isoc1x) + if (!flag_isoc11) { if (flag_isoc99) pedwarn (loc, OPT_pedantic, @@ -5841,7 +5841,7 @@ c_parser_cast_expression (c_parser *parser, struct c_expr *after) __alignof__ ( type-name ) && identifier - (C1X permits _Alignof with type names only.) + (C11 permits _Alignof with type names only.) unary-operator: one of __extension__ __real__ __imag__ @@ -6038,9 +6038,9 @@ c_parser_alignof_expression (c_parser *parser) tree alignof_spelling = c_parser_peek_token (parser)->value; gcc_assert (c_parser_next_token_is_keyword (parser, RID_ALIGNOF)); /* A diagnostic is not required for the use of this identifier in - the implementation namespace; only diagnose it for the C1X + the implementation namespace; only diagnose it for the C11 spelling because of existing code using the other spellings. */ - if (!flag_isoc1x + if (!flag_isoc11 && strcmp (IDENTIFIER_POINTER (alignof_spelling), "_Alignof") == 0) { if (flag_isoc99) @@ -6568,9 +6568,16 @@ c_parser_postfix_expression (c_parser *parser) "expected %<)%>"); { tree e1, e2; + e1 = groktypename (t1, NULL, NULL); + e2 = groktypename (t2, NULL, NULL); + if (e1 == error_mark_node || e2 == error_mark_node) + { + expr.value = error_mark_node; + break; + } - e1 = TYPE_MAIN_VARIANT (groktypename (t1, NULL, NULL)); - e2 = TYPE_MAIN_VARIANT (groktypename (t2, NULL, NULL)); + e1 = TYPE_MAIN_VARIANT (e1); + e2 = TYPE_MAIN_VARIANT (e2); expr.value = comptypes (e1, e2) ? integer_one_node : integer_zero_node; @@ -6640,6 +6647,8 @@ c_parser_postfix_expression (c_parser *parser) case RID_BUILTIN_SHUFFLE: { VEC(c_expr_t,gc) *cexpr_list; + unsigned int i; + c_expr_t *p; c_parser_consume_token (parser); if (!c_parser_get_builtin_args (parser, @@ -6650,6 +6659,9 @@ c_parser_postfix_expression (c_parser *parser) break; } + FOR_EACH_VEC_ELT (c_expr_t, cexpr_list, i, p) + mark_exp_read (p->value); + if (VEC_length (c_expr_t, cexpr_list) == 2) expr.value = c_build_vec_perm_expr @@ -9004,6 +9016,7 @@ c_parser_omp_clause_num_threads (c_parser *parser, tree list) { location_t expr_loc = c_parser_peek_token (parser)->location; tree c, t = c_parser_expression (parser).value; + mark_exp_read (t); t = c_fully_fold (t, false, NULL); c_parser_skip_until_found (parser, CPP_CLOSE_PAREN, "expected %<)%>"); @@ -9211,6 +9224,7 @@ c_parser_omp_clause_schedule (c_parser *parser, tree list) here = c_parser_peek_token (parser)->location; t = c_parser_expr_no_commas (parser, NULL).value; + mark_exp_read (t); t = c_fully_fold (t, false, NULL); if (OMP_CLAUSE_SCHEDULE_KIND (c) == OMP_CLAUSE_SCHEDULE_RUNTIME)