From patchwork Fri Mar 17 16:30:02 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Marek Polacek X-Patchwork-Id: 740380 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from sourceware.org (server1.sourceware.org [209.132.180.131]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 3vl9nj4nxcz9s2s for ; Sat, 18 Mar 2017 03:31:04 +1100 (AEDT) Authentication-Results: ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=gcc.gnu.org header.i=@gcc.gnu.org header.b="PomNnB34"; dkim-atps=neutral DomainKey-Signature: a=rsa-sha1; c=nofws; d=gcc.gnu.org; h=list-id :list-unsubscribe:list-archive:list-post:list-help:sender:date :from:to:subject:message-id:mime-version:content-type; q=dns; s= default; b=IrBf58KBktyjjBMY3874SjOyWq+2WlzP5yCxdM13gJMR+T3KOZ7kT tcf0r2gJr9OT+O+xtpMDBtou6OCDaqgo/pZG/xhs09rF7tUsplfrsOS7yu+UTX2y lwqt7fLnGBvZMQtAjjY4nW6bKXtcaqNzmA0UguSztPl0x+YMjG5BW4= DKIM-Signature: v=1; a=rsa-sha1; c=relaxed; d=gcc.gnu.org; h=list-id :list-unsubscribe:list-archive:list-post:list-help:sender:date :from:to:subject:message-id:mime-version:content-type; s= default; bh=Sn1xluWHQGo/94UG8n4CedgXi3c=; b=PomNnB34idPK9/diBI1j ivlUtNs3c3s8/h+CValslScqQ9EBHGUo2oSCtiMYOTLUflWAYaJkXSYX6+UbYYio y2Wcg8XHHZkqtPHYv9/4Hj+hjQbrjgmXMMqsG8ZkGjsPtU+XIrSVyhv5YTwZaYqy F/V869MtSsXExsn72b+6IH8= Received: (qmail 33558 invoked by alias); 17 Mar 2017 16:30:54 -0000 Mailing-List: contact gcc-patches-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Unsubscribe: List-Archive: List-Post: List-Help: Sender: gcc-patches-owner@gcc.gnu.org Delivered-To: mailing list gcc-patches@gcc.gnu.org Received: (qmail 33200 invoked by uid 89); 17 Mar 2017 16:30:24 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-26.9 required=5.0 tests=BAYES_00, GIT_PATCH_0, GIT_PATCH_1, GIT_PATCH_2, GIT_PATCH_3, RP_MATCHES_RCVD, SPF_HELO_PASS autolearn=ham version=3.3.2 spammy=AFTER, compound, 13597 X-HELO: mx1.redhat.com Received: from mx1.redhat.com (HELO mx1.redhat.com) (209.132.183.28) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Fri, 17 Mar 2017 16:30:07 +0000 Received: from smtp.corp.redhat.com (int-mx16.intmail.prod.int.phx2.redhat.com [10.5.11.28]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 139568F22E; Fri, 17 Mar 2017 16:30:07 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mx1.redhat.com 139568F22E Authentication-Results: ext-mx02.extmail.prod.ext.phx2.redhat.com; dmarc=none (p=none dis=none) header.from=redhat.com Authentication-Results: ext-mx02.extmail.prod.ext.phx2.redhat.com; spf=pass smtp.mailfrom=polacek@redhat.com DKIM-Filter: OpenDKIM Filter v2.11.0 mx1.redhat.com 139568F22E Received: from redhat.com (ovpn-204-27.brq.redhat.com [10.40.204.27]) by smtp.corp.redhat.com (Postfix) with ESMTPS id D0A1E2D5C1; Fri, 17 Mar 2017 16:30:05 +0000 (UTC) Date: Fri, 17 Mar 2017 17:30:02 +0100 From: Marek Polacek To: GCC Patches , Joseph Myers Subject: C PATCH to add C11 references Message-ID: <20170317163002.GC3172@redhat.com> MIME-Version: 1.0 Content-Disposition: inline User-Agent: Mutt/1.7.1 (2016-10-04) This means precisely zilch, but hey, it's Friday. The references are mostly the same as C99, but they differ for e.g. declarators. I wish C had what C++ has, i.e. references like [stmt.switch]. Ok for trunk? 2017-03-17 Marek Polacek * c-parser.c: Add C11 references. Marek diff --git gcc/c/c-parser.c gcc/c/c-parser.c index 5bc238b..988369e 100644 --- gcc/c/c-parser.c +++ gcc/c/c-parser.c @@ -1316,7 +1316,7 @@ static void c_parser_cilk_grainsize (c_parser *, bool *); static void c_parser_parse_rtl_body (c_parser *parser, char *start_with_pass); -/* Parse a translation unit (C90 6.7, C99 6.9). +/* Parse a translation unit (C90 6.7, C99 6.9, C11 6.9). translation-unit: external-declarations @@ -1359,7 +1359,7 @@ c_parser_translation_unit (c_parser *parser) error ("storage size of %q+D isn%'t known", decl); } -/* Parse an external declaration (C90 6.7, C99 6.9). +/* Parse an external declaration (C90 6.7, C99 6.9, C11 6.9). external-declaration: function-definition @@ -1475,8 +1475,8 @@ static void c_finish_omp_declare_simd (c_parser *, tree, tree, vec); static void c_finish_oacc_routine (struct oacc_routine_data *, tree, bool); /* Parse a declaration or function definition (C90 6.5, 6.7.1, C99 - 6.7, 6.9.1). If FNDEF_OK is true, a function definition is - accepted; otherwise (old-style parameter declarations) only other + 6.7, 6.9.1, C11 6.7, 6.9.1). If FNDEF_OK is true, a function definition + is accepted; otherwise (old-style parameter declarations) only other declarations are accepted. If STATIC_ASSERT_OK is true, a static assertion is accepted; otherwise (old-style parameter declarations) it is not. If NESTED is true, we are inside a function or parsing @@ -2262,7 +2262,7 @@ c_parser_static_assert_declaration_no_semi (c_parser *parser) } /* Parse some declaration specifiers (possibly none) (C90 6.5, C99 - 6.7), adding them to SPECS (which may already include some). + 6.7, C11 6.7), adding them to SPECS (which may already include some). Storage class specifiers are accepted iff SCSPEC_OK; type specifiers are accepted iff TYPESPEC_OK; alignment specifiers are accepted iff ALIGNSPEC_OK; attributes are accepted at the start @@ -2279,7 +2279,7 @@ c_parser_static_assert_declaration_no_semi (c_parser *parser) handled as storage class specifiers, as is __thread. Alignment specifiers are from C11. - C90 6.5.1, C99 6.7.1: + C90 6.5.1, C99 6.7.1, C11 6.7.1: storage-class-specifier: typedef extern @@ -2290,14 +2290,14 @@ c_parser_static_assert_declaration_no_semi (c_parser *parser) (_Thread_local is new in C11.) - C99 6.7.4: + C99 6.7.4, C11 6.7.4: function-specifier: inline _Noreturn (_Noreturn is new in C11.) - C90 6.5.2, C99 6.7.2: + C90 6.5.2, C99 6.7.2, C11 6.7.2: type-specifier: void char @@ -2319,7 +2319,7 @@ c_parser_static_assert_declaration_no_semi (c_parser *parser) (_Bool and _Complex are new in C99.) (atomic-type-specifier is new in C11.) - C90 6.5.3, C99 6.7.3: + C90 6.5.3, C99 6.7.3, C11 6.7.3: type-qualifier: const @@ -2656,7 +2656,7 @@ c_parser_declspecs (c_parser *parser, struct c_declspecs *specs, out: ; } -/* Parse an enum specifier (C90 6.5.2.2, C99 6.7.2.2). +/* Parse an enum specifier (C90 6.5.2.2, C99 6.7.2.2, C11 6.7.2.2). enum-specifier: enum attributes[opt] identifier[opt] { enumerator-list } attributes[opt] @@ -2819,7 +2819,7 @@ c_parser_enum_specifier (c_parser *parser) return ret; } -/* Parse a struct or union specifier (C90 6.5.2.1, C99 6.7.2.1). +/* Parse a struct or union specifier (C90 6.5.2.1, C99 6.7.2.1, C11 6.7.2.1). struct-or-union-specifier: struct-or-union attributes[opt] identifier[opt] @@ -3014,8 +3014,8 @@ c_parser_struct_or_union_specifier (c_parser *parser) return ret; } -/* Parse a struct-declaration (C90 6.5.2.1, C99 6.7.2.1), *without* - the trailing semicolon. +/* Parse a struct-declaration (C90 6.5.2.1, C99 6.7.2.1, C11 6.7.2.1), + *without* the trailing semicolon. struct-declaration: specifier-qualifier-list struct-declarator-list @@ -3300,13 +3300,13 @@ c_parser_alignas_specifier (c_parser * parser) } /* Parse a declarator, possibly an abstract declarator (C90 6.5.4, - 6.5.5, C99 6.7.5, 6.7.6). If TYPE_SEEN_P then a typedef name may - be redeclared; otherwise it may not. KIND indicates which kind of - declarator is wanted. Returns a valid declarator except in the - case of a syntax error in which case NULL is returned. *SEEN_ID is - set to true if an identifier being declared is seen; this is used - to diagnose bad forms of abstract array declarators and to - determine whether an identifier list is syntactically permitted. + 6.5.5, C99 6.7.5, 6.7.6, C11 6.7.6, 6.7.7). If TYPE_SEEN_P then + a typedef name may be redeclared; otherwise it may not. KIND + indicates which kind of declarator is wanted. Returns a valid + declarator except in the case of a syntax error in which case NULL is + returned. *SEEN_ID is set to true if an identifier being declared is + seen; this is used to diagnose bad forms of abstract array declarators + and to determine whether an identifier list is syntactically permitted. declarator: pointer[opt] direct-declarator @@ -4272,7 +4272,7 @@ c_parser_attributes (c_parser *parser) return attrs; } -/* Parse a type name (C90 6.5.5, C99 6.7.6). +/* Parse a type name (C90 6.5.5, C99 6.7.6, C11 6.7.7). type-name: specifier-qualifier-list abstract-declarator[opt] @@ -4308,7 +4308,7 @@ c_parser_type_name (c_parser *parser) return ret; } -/* Parse an initializer (C90 6.5.7, C99 6.7.8). +/* Parse an initializer (C90 6.5.7, C99 6.7.8, C11 6.7.9). initializer: assignment-expression @@ -4670,7 +4670,7 @@ c_parser_initval (c_parser *parser, struct c_expr *after, } /* Parse a compound statement (possibly a function body) (C90 6.6.2, - C99 6.8.2). + C99 6.8.2, C11 6.8.2). compound-statement: { block-item-list[opt] } @@ -4940,7 +4940,7 @@ c_parser_all_labels (c_parser *parser) c_parser_label (parser); } -/* Parse a label (C90 6.6.1, C99 6.8.1). +/* Parse a label (C90 6.6.1, C99 6.8.1, C11 6.8.1). label: identifier : attributes[opt] @@ -5053,7 +5053,7 @@ c_parser_label (c_parser *parser) } } -/* Parse a statement (C90 6.6, C99 6.8). +/* Parse a statement (C90 6.6, C99 6.8, C11 6.8). statement: labeled-statement @@ -5583,7 +5583,7 @@ c_parser_maybe_reclassify_token (c_parser *parser) } } -/* Parse an if statement (C90 6.6.4, C99 6.8.4). +/* Parse an if statement (C90 6.6.4, C99 6.8.4, C11 6.8.4). if-statement: if ( expression ) statement @@ -5684,7 +5684,7 @@ c_parser_if_statement (c_parser *parser, bool *if_p, vec *chain) c_parser_maybe_reclassify_token (parser); } -/* Parse a switch statement (C90 6.6.4, C99 6.8.4). +/* Parse a switch statement (C90 6.6.4, C99 6.8.4, C11 6.8.4). switch-statement: switch (expression) statement @@ -5741,7 +5741,7 @@ c_parser_switch_statement (c_parser *parser, bool *if_p) c_parser_maybe_reclassify_token (parser); } -/* Parse a while statement (C90 6.6.5, C99 6.8.5). +/* Parse a while statement (C90 6.6.5, C99 6.8.5, C11 6.8.5). while-statement: while (expression) statement @@ -5791,7 +5791,7 @@ c_parser_while_statement (c_parser *parser, bool ivdep, bool *if_p) c_cont_label = save_cont; } -/* Parse a do statement (C90 6.6.5, C99 6.8.5). +/* Parse a do statement (C90 6.6.5, C99 6.8.5, C11 6.8.5). do-statement: do statement while ( expression ) ; @@ -5835,7 +5835,7 @@ c_parser_do_statement (c_parser *parser, bool ivdep) add_stmt (c_end_compound_stmt (loc, block, flag_isoc99)); } -/* Parse a for statement (C90 6.6.5, C99 6.8.5). +/* Parse a for statement (C90 6.6.5, C99 6.8.5, C11 6.8.5). for-statement: for ( expression[opt] ; expression[opt] ; expression[opt] ) statement @@ -6361,9 +6361,9 @@ c_parser_asm_goto_operands (c_parser *parser) } /* Parse an expression other than a compound expression; that is, an - assignment expression (C90 6.3.16, C99 6.5.16). If AFTER is not - NULL then it is an Objective-C message expression which is the - primary-expression starting the expression as an initializer. + assignment expression (C90 6.3.16, C99 6.5.16, C11 6.5.16). If + AFTER is not NULL then it is an Objective-C message expression which + is the primary-expression starting the expression as an initializer. assignment-expression: conditional-expression @@ -6444,8 +6444,8 @@ c_parser_expr_no_commas (c_parser *parser, struct c_expr *after, return ret; } -/* Parse a conditional expression (C90 6.3.15, C99 6.5.15). If AFTER - is not NULL then it is an Objective-C message expression which is +/* Parse a conditional expression (C90 6.3.15, C99 6.5.15, C11 6.5.15). If + AFTER is not NULL then it is an Objective-C message expression which is the primary-expression starting the expression as an initializer. conditional-expression: @@ -6558,9 +6558,9 @@ c_parser_conditional_expression (c_parser *parser, struct c_expr *after, } /* Parse a binary expression; that is, a logical-OR-expression (C90 - 6.3.5-6.3.14, C99 6.5.5-6.5.14). If AFTER is not NULL then it is - an Objective-C message expression which is the primary-expression - starting the expression as an initializer. + 6.3.5-6.3.14, C99 6.5.5-6.5.14, C11 6.5.5-6.5.14). If AFTER is not + NULL then it is an Objective-C message expression which is the + primary-expression starting the expression as an initializer. OMP_ATOMIC_LHS is NULL, unless parsing OpenMP #pragma omp atomic, when it should be the unfolded lhs. In a valid OpenMP source, @@ -6832,8 +6832,8 @@ c_parser_binary_expression (c_parser *parser, struct c_expr *after, #undef POP } -/* Parse a cast expression (C90 6.3.4, C99 6.5.4). If AFTER is not - NULL then it is an Objective-C message expression which is the +/* Parse a cast expression (C90 6.3.4, C99 6.5.4, C11 6.5.4). If AFTER + is not NULL then it is an Objective-C message expression which is the primary-expression starting the expression as an initializer. cast-expression: @@ -6893,7 +6893,7 @@ c_parser_cast_expression (c_parser *parser, struct c_expr *after) return c_parser_unary_expression (parser); } -/* Parse an unary expression (C90 6.3.3, C99 6.5.3). +/* Parse an unary expression (C90 6.3.3, C99 6.5.3, C11 6.5.3). unary-expression: postfix-expression @@ -7493,7 +7493,8 @@ c_parser_generic_selection (c_parser *parser) return matched_assoc.expression; } -/* Parse a postfix expression (C90 6.3.1-6.3.2, C99 6.5.1-6.5.2). +/* Parse a postfix expression (C90 6.3.1-6.3.2, C99 6.5.1-6.5.2, + C11 6.5.1-6.5.2). postfix-expression: primary-expression @@ -8572,7 +8573,7 @@ c_parser_postfix_expression_after_primary (c_parser *parser, } } -/* Parse an expression (C90 6.3.17, C99 6.5.17). +/* Parse an expression (C90 6.3.17, C99 6.5.17, C11 6.5.17). expression: assignment-expression