diff mbox

C PATCH to add C11 references

Message ID 20170317163002.GC3172@redhat.com
State New
Headers show

Commit Message

Marek Polacek March 17, 2017, 4:30 p.m. UTC
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  <polacek@redhat.com>

	* c-parser.c: Add C11 references.


	Marek

Comments

Joseph Myers March 17, 2017, 9:42 p.m. UTC | #1
On Fri, 17 Mar 2017, Marek Polacek wrote:

> 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?

OK.
diff mbox

Patch

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<c_token>);
 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<tree> *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