mirror of
git://gcc.gnu.org/git/gcc.git
synced 2025-04-19 06:20:27 +08:00
c-parse.in (initelt: identifier ':' initval): Add an empty action to fix a type clash.
2002-06-19 Akim Demaille <akim@epita.fr> * c-parse.in (initelt: identifier ':' initval): Add an empty action to fix a type clash. (aliasdecl, classdef): Add the missing closing `;'. Whitespace changes. * gengtype-yacc.y (typedef_struct): Add an empty action to preevnt $$ = $1 type clashes. cp: * parse.y (TYPENAME): Rename as tTYPENAME to avoid the clash with decl.h's TYPENAME. * spew.c, lex.c: Adjust. * parse.y (explicit_instantiation): Add empty action to override the default $$ = $1 where it introduces a type clash. From-SVN: r54811
This commit is contained in:
parent
ef40bc6512
commit
84d901be21
@ -1,3 +1,12 @@
|
||||
2002-06-19 Akim Demaille <akim@epita.fr>
|
||||
|
||||
* c-parse.in (initelt: identifier ':' initval): Add an empty
|
||||
action to fix a type clash.
|
||||
(aliasdecl, classdef): Add the missing closing `;'.
|
||||
Whitespace changes.
|
||||
* gengtype-yacc.y (typedef_struct): Add an empty action to preevnt
|
||||
$$ = $1 type clashes.
|
||||
|
||||
2002-06-19 Eric Christopher <echristo@redhat.com>
|
||||
|
||||
* config/mips/mips.c (symbol_operand): New function.
|
||||
@ -70,7 +79,7 @@
|
||||
|
||||
2002-06-19 Andrew Pinski <pinskia@physics.uc.edu>
|
||||
|
||||
* cpptrad.c (_cpp_replacement_text_len): initialize len.
|
||||
* cpptrad.c (_cpp_replacement_text_len): initialize len.
|
||||
|
||||
2002-06-19 Jason Merrill <jason@redhat.com>
|
||||
|
||||
|
@ -49,7 +49,7 @@ end ifc
|
||||
#include "output.h"
|
||||
#include "toplev.h"
|
||||
#include "ggc.h"
|
||||
|
||||
|
||||
#ifdef MULTIBYTE_CHARS
|
||||
#include <locale.h>
|
||||
#endif
|
||||
@ -255,11 +255,11 @@ ifobjc
|
||||
end ifobjc
|
||||
|
||||
%{
|
||||
/* Number of statements (loosely speaking) and compound statements
|
||||
/* Number of statements (loosely speaking) and compound statements
|
||||
seen so far. */
|
||||
static int stmt_count;
|
||||
static int compstmt_count;
|
||||
|
||||
|
||||
/* Input file and line number of the end of the body of last simple_if;
|
||||
used by the stmt-rule immediately after simple_if returns. */
|
||||
static const char *if_stmt_file;
|
||||
@ -320,8 +320,8 @@ static enum tree_code objc_inherit_code;
|
||||
static int objc_pq_context = 0, objc_public_flag = 0;
|
||||
|
||||
/* The following flag is needed to contextualize ObjC lexical analysis.
|
||||
In some cases (e.g., 'int NSObject;'), it is undesirable to bind
|
||||
an identifier to an ObjC class, even if a class with that name
|
||||
In some cases (e.g., 'int NSObject;'), it is undesirable to bind
|
||||
an identifier to an ObjC class, even if a class with that name
|
||||
exists. */
|
||||
static int objc_need_raw_identifier;
|
||||
#define OBJC_NEED_RAW_IDENTIFIER(VAL) objc_need_raw_identifier = VAL
|
||||
@ -404,7 +404,7 @@ datadef:
|
||||
{ if (pedantic)
|
||||
error ("ISO C forbids data definition with no type or storage class");
|
||||
else
|
||||
warning ("data definition has no type or storage class");
|
||||
warning ("data definition has no type or storage class");
|
||||
|
||||
POP_DECLSPEC_STACK; }
|
||||
| declspecs_nots setspecs notype_initdecls ';'
|
||||
@ -431,7 +431,7 @@ fndef:
|
||||
save_filename save_lineno compstmt_or_error
|
||||
{ DECL_SOURCE_FILE (current_function_decl) = $7;
|
||||
DECL_SOURCE_LINE (current_function_decl) = $8;
|
||||
finish_function (0, 1);
|
||||
finish_function (0, 1);
|
||||
POP_DECLSPEC_STACK; }
|
||||
| declspecs_ts setspecs declarator error
|
||||
{ POP_DECLSPEC_STACK; }
|
||||
@ -445,7 +445,7 @@ fndef:
|
||||
save_filename save_lineno compstmt_or_error
|
||||
{ DECL_SOURCE_FILE (current_function_decl) = $7;
|
||||
DECL_SOURCE_LINE (current_function_decl) = $8;
|
||||
finish_function (0, 1);
|
||||
finish_function (0, 1);
|
||||
POP_DECLSPEC_STACK; }
|
||||
| declspecs_nots setspecs notype_declarator error
|
||||
{ POP_DECLSPEC_STACK; }
|
||||
@ -459,7 +459,7 @@ fndef:
|
||||
save_filename save_lineno compstmt_or_error
|
||||
{ DECL_SOURCE_FILE (current_function_decl) = $6;
|
||||
DECL_SOURCE_LINE (current_function_decl) = $7;
|
||||
finish_function (0, 1);
|
||||
finish_function (0, 1);
|
||||
POP_DECLSPEC_STACK; }
|
||||
| setspecs notype_declarator error
|
||||
{ POP_DECLSPEC_STACK; }
|
||||
@ -667,7 +667,7 @@ primary:
|
||||
{ $$ = fix_string_type ($$); }
|
||||
| VAR_FUNC_NAME
|
||||
{ $$ = fname_decl (C_RID_CODE ($$), $$); }
|
||||
| '(' typename ')' '{'
|
||||
| '(' typename ')' '{'
|
||||
{ start_init (NULL_TREE, NULL, 0);
|
||||
$2 = groktypename ($2);
|
||||
really_start_incremental_init ($2); }
|
||||
@ -1431,7 +1431,7 @@ initdcl:
|
||||
| declarator maybeasm maybe_attribute
|
||||
{ tree d = start_decl ($1, current_declspecs, 0,
|
||||
chainon ($3, all_prefix_attributes));
|
||||
finish_decl (d, NULL_TREE, $2);
|
||||
finish_decl (d, NULL_TREE, $2);
|
||||
}
|
||||
;
|
||||
|
||||
@ -1457,7 +1457,7 @@ maybe_attribute:
|
||||
| attributes
|
||||
{ $$ = $1; }
|
||||
;
|
||||
|
||||
|
||||
attributes:
|
||||
attribute
|
||||
{ $$ = $1; }
|
||||
@ -1476,7 +1476,7 @@ attribute_list:
|
||||
| attribute_list ',' attrib
|
||||
{ $$ = chainon ($1, $3); }
|
||||
;
|
||||
|
||||
|
||||
attrib:
|
||||
/* empty */
|
||||
{ $$ = NULL_TREE; }
|
||||
@ -1544,6 +1544,7 @@ initelt:
|
||||
if (pedantic)
|
||||
pedwarn ("obsolete use of designated initializer with `:'"); }
|
||||
initval
|
||||
{}
|
||||
| initval
|
||||
;
|
||||
|
||||
@ -1604,7 +1605,7 @@ nested_function:
|
||||
DECL_SOURCE_FILE (decl) = $5;
|
||||
DECL_SOURCE_LINE (decl) = $6;
|
||||
finish_function (1, 1);
|
||||
pop_function_context ();
|
||||
pop_function_context ();
|
||||
add_decl_stmt (decl); }
|
||||
;
|
||||
|
||||
@ -1634,7 +1635,7 @@ notype_nested_function:
|
||||
DECL_SOURCE_FILE (decl) = $5;
|
||||
DECL_SOURCE_LINE (decl) = $6;
|
||||
finish_function (1, 1);
|
||||
pop_function_context ();
|
||||
pop_function_context ();
|
||||
add_decl_stmt (decl); }
|
||||
;
|
||||
|
||||
@ -1755,7 +1756,7 @@ structsp_attr:
|
||||
{ $$ = start_struct (RECORD_TYPE, $2);
|
||||
/* Start scope of tag before parsing components. */
|
||||
}
|
||||
component_decl_list '}' maybe_attribute
|
||||
component_decl_list '}' maybe_attribute
|
||||
{ $$ = finish_struct ($<ttype>4, $5, chainon ($1, $7)); }
|
||||
| struct_head '{' component_decl_list '}' maybe_attribute
|
||||
{ $$ = finish_struct (start_struct (RECORD_TYPE, NULL_TREE),
|
||||
@ -1845,8 +1846,8 @@ component_decl:
|
||||
POP_DECLSPEC_STACK; }
|
||||
| declspecs_nosc_ts setspecs save_filename save_lineno
|
||||
{
|
||||
/* Support for unnamed structs or unions as members of
|
||||
structs or unions (which is [a] useful and [b] supports
|
||||
/* Support for unnamed structs or unions as members of
|
||||
structs or unions (which is [a] useful and [b] supports
|
||||
MS P-SDK). */
|
||||
if (pedantic)
|
||||
pedwarn ("ISO C doesn't support unnamed structs/unions");
|
||||
@ -2102,8 +2103,8 @@ c99_block_end: /* empty */
|
||||
{ if (flag_isoc99)
|
||||
{
|
||||
tree scope_stmt = add_scope_stmt (/*begin_p=*/0, /*partial_p=*/0);
|
||||
$$ = poplevel (kept_level_p (), 0, 0);
|
||||
SCOPE_STMT_BLOCK (TREE_PURPOSE (scope_stmt))
|
||||
$$ = poplevel (kept_level_p (), 0, 0);
|
||||
SCOPE_STMT_BLOCK (TREE_PURPOSE (scope_stmt))
|
||||
= SCOPE_STMT_BLOCK (TREE_VALUE (scope_stmt))
|
||||
= $$;
|
||||
}
|
||||
@ -2152,8 +2153,8 @@ compstmt_start: '{' { compstmt_count++;
|
||||
compstmt_nostart: '}'
|
||||
{ $$ = convert (void_type_node, integer_zero_node); }
|
||||
| pushlevel maybe_label_decls compstmt_contents_nonempty '}' poplevel
|
||||
{ $$ = poplevel (kept_level_p (), 1, 0);
|
||||
SCOPE_STMT_BLOCK (TREE_PURPOSE ($5))
|
||||
{ $$ = poplevel (kept_level_p (), 1, 0);
|
||||
SCOPE_STMT_BLOCK (TREE_PURPOSE ($5))
|
||||
= SCOPE_STMT_BLOCK (TREE_VALUE ($5))
|
||||
= $$; }
|
||||
;
|
||||
@ -2182,7 +2183,7 @@ compstmt_primary_start:
|
||||
;
|
||||
|
||||
compstmt: compstmt_start compstmt_nostart
|
||||
{ RECHAIN_STMTS ($1, COMPOUND_BODY ($1));
|
||||
{ RECHAIN_STMTS ($1, COMPOUND_BODY ($1));
|
||||
last_expr_type = NULL_TREE;
|
||||
$$ = $1; }
|
||||
;
|
||||
@ -2209,7 +2210,7 @@ if_prefix:
|
||||
IF
|
||||
{ $<ttype>$ = c_begin_if_stmt (); }
|
||||
'(' expr ')'
|
||||
{ c_expand_start_cond (c_common_truthvalue_conversion ($4),
|
||||
{ c_expand_start_cond (c_common_truthvalue_conversion ($4),
|
||||
compstmt_count,$<ttype>2);
|
||||
$<itype>$ = stmt_count;
|
||||
if_stmt_file = $<filename>-2;
|
||||
@ -2223,7 +2224,7 @@ do_stmt_start:
|
||||
DO
|
||||
{ stmt_count++;
|
||||
compstmt_count++;
|
||||
$<ttype>$
|
||||
$<ttype>$
|
||||
= add_stmt (build_stmt (DO_STMT, NULL_TREE,
|
||||
NULL_TREE));
|
||||
/* In the event that a parse error prevents
|
||||
@ -2318,7 +2319,7 @@ select_or_iter_stmt:
|
||||
we later pass to c_finish_while_stmt_cond to fill
|
||||
in the condition and other tidbits. */
|
||||
| WHILE
|
||||
{ stmt_count++;
|
||||
{ stmt_count++;
|
||||
$<ttype>$ = c_begin_while_stmt (); }
|
||||
'(' expr ')'
|
||||
{ $4 = c_common_truthvalue_conversion ($4);
|
||||
@ -2335,12 +2336,12 @@ select_or_iter_stmt:
|
||||
| FOR
|
||||
{ $<ttype>$ = build_stmt (FOR_STMT, NULL_TREE, NULL_TREE,
|
||||
NULL_TREE, NULL_TREE);
|
||||
add_stmt ($<ttype>$); }
|
||||
add_stmt ($<ttype>$); }
|
||||
'(' for_init_stmt
|
||||
{ stmt_count++;
|
||||
RECHAIN_STMTS ($<ttype>2, FOR_INIT_STMT ($<ttype>2)); }
|
||||
xexpr ';'
|
||||
{ if ($6)
|
||||
{ if ($6)
|
||||
FOR_COND ($<ttype>2)
|
||||
= c_common_truthvalue_conversion ($6); }
|
||||
xexpr ')'
|
||||
@ -2356,7 +2357,7 @@ select_or_iter_stmt:
|
||||
|
||||
for_init_stmt:
|
||||
xexpr ';'
|
||||
{ add_stmt (build_stmt (EXPR_STMT, $1)); }
|
||||
{ add_stmt (build_stmt (EXPR_STMT, $1)); }
|
||||
| decl
|
||||
{ check_for_loop_decls (); }
|
||||
;
|
||||
@ -2567,7 +2568,7 @@ parm:
|
||||
| declspecs_ts setspecs notype_declarator maybe_attribute
|
||||
{ $$ = build_tree_list (build_tree_list (current_declspecs,
|
||||
$3),
|
||||
chainon ($4, all_prefix_attributes));
|
||||
chainon ($4, all_prefix_attributes));
|
||||
POP_DECLSPEC_STACK; }
|
||||
| declspecs_ts setspecs absdcl_maybe_attribute
|
||||
{ $$ = $3;
|
||||
@ -2594,7 +2595,7 @@ firstparm:
|
||||
| declspecs_ts_nosa setspecs_fp notype_declarator maybe_attribute
|
||||
{ $$ = build_tree_list (build_tree_list (current_declspecs,
|
||||
$3),
|
||||
chainon ($4, all_prefix_attributes));
|
||||
chainon ($4, all_prefix_attributes));
|
||||
POP_DECLSPEC_STACK; }
|
||||
| declspecs_ts_nosa setspecs_fp absdcl_maybe_attribute
|
||||
{ $$ = $3;
|
||||
@ -2708,12 +2709,14 @@ classdecl:
|
||||
{
|
||||
objc_declare_class ($2);
|
||||
}
|
||||
;
|
||||
|
||||
aliasdecl:
|
||||
ALIAS identifier identifier ';'
|
||||
{
|
||||
objc_declare_alias ($2, $3);
|
||||
}
|
||||
;
|
||||
|
||||
classdef:
|
||||
INTERFACE identifier protocolrefs '{'
|
||||
@ -3452,7 +3455,7 @@ static const short rid_to_yy[RID_MAX] =
|
||||
/* RID_BYCOPY */ TYPE_QUAL,
|
||||
/* RID_BYREF */ TYPE_QUAL,
|
||||
/* RID_ONEWAY */ TYPE_QUAL,
|
||||
|
||||
|
||||
/* C */
|
||||
/* RID_INT */ TYPESPEC,
|
||||
/* RID_CHAR */ TYPESPEC,
|
||||
@ -3538,7 +3541,7 @@ static const short rid_to_yy[RID_MAX] =
|
||||
/* RID_BITAND */ 0,
|
||||
/* RID_BITOR */ 0,
|
||||
/* RID_COMPL */ 0,
|
||||
|
||||
|
||||
/* Objective C */
|
||||
/* RID_ID */ OBJECTNAME,
|
||||
/* RID_AT_ENCODE */ ENCODE,
|
||||
@ -3618,12 +3621,12 @@ static int
|
||||
yylexname ()
|
||||
{
|
||||
tree decl;
|
||||
|
||||
|
||||
ifobjc
|
||||
int objc_force_identifier = objc_need_raw_identifier;
|
||||
OBJC_NEED_RAW_IDENTIFIER (0);
|
||||
end ifobjc
|
||||
|
||||
|
||||
if (C_IS_RESERVED_WORD (yylval.ttype))
|
||||
{
|
||||
enum rid rid_code = C_RID_CODE (yylval.ttype);
|
||||
@ -3648,13 +3651,13 @@ end ifobjc
|
||||
/* __FUNCTION__ and __PRETTY_FUNCTION__ get converted
|
||||
to string constants. */
|
||||
const char *name = fname_string (rid_code);
|
||||
|
||||
|
||||
yylval.ttype = build_string (strlen (name) + 1, name);
|
||||
C_ARTIFICIAL_STRING_P (yylval.ttype) = 1;
|
||||
last_token = CPP_STRING; /* so yyerror won't choke */
|
||||
return STRING;
|
||||
}
|
||||
|
||||
|
||||
/* Return the canonical spelling for this keyword. */
|
||||
yylval.ttype = ridpointers[(int) rid_code];
|
||||
return yycode;
|
||||
@ -3673,8 +3676,8 @@ ifobjc
|
||||
tree objc_interface_decl = is_class_name (yylval.ttype);
|
||||
/* ObjC class names are in the same namespace as variables and
|
||||
typedefs, and hence are shadowed by local declarations. */
|
||||
if (objc_interface_decl
|
||||
&& (global_bindings_p ()
|
||||
if (objc_interface_decl
|
||||
&& (global_bindings_p ()
|
||||
|| (!objc_force_identifier && !decl)))
|
||||
{
|
||||
yylval.ttype = objc_interface_decl;
|
||||
@ -3819,7 +3822,7 @@ _yylex ()
|
||||
case CPP_STRING:
|
||||
case CPP_WSTRING:
|
||||
return yylexstring ();
|
||||
|
||||
|
||||
/* This token is Objective-C specific. It gives the next token
|
||||
special significance. */
|
||||
case CPP_ATSIGN:
|
||||
@ -3885,7 +3888,7 @@ yyprint (file, yychar, yyl)
|
||||
tree t = yyl.ttype;
|
||||
|
||||
fprintf (file, " [%s]", NAME(last_token));
|
||||
|
||||
|
||||
switch (yychar)
|
||||
{
|
||||
case IDENTIFIER:
|
||||
|
@ -1,3 +1,11 @@
|
||||
2002-06-19 Akim Demaille <akim@epita.fr>
|
||||
|
||||
* parse.y (TYPENAME): Rename as tTYPENAME to avoid the clash with
|
||||
decl.h's TYPENAME.
|
||||
* spew.c, lex.c: Adjust.
|
||||
* parse.y (explicit_instantiation): Add empty action to override
|
||||
the default $$ = $1 where it introduces a type clash.
|
||||
|
||||
2002-06-14 Jason Merrill <jason@redhat.com>
|
||||
|
||||
* semantics.c (begin_for_stmt): Push the 'for' scope before
|
||||
@ -75,8 +83,8 @@
|
||||
* mangle.c (start_mangling): Allocate G.substitutions here...
|
||||
(init_mangle): ... rather than here.
|
||||
(finish_mangling): Clear the varray pointer when done with it.
|
||||
* spew.c (yylexstring): Don't use VARRAY_FREE.
|
||||
* search.c (bfs_walk): Don't use VARRAY_FREE.
|
||||
* spew.c (yylexstring): Don't use VARRAY_FREE.
|
||||
* search.c (bfs_walk): Don't use VARRAY_FREE.
|
||||
* decl2.c (pending_statics): Use gengtype to mark.
|
||||
(deferred_fns): Likewise.
|
||||
(ssdf_decls): Likewise.
|
||||
@ -988,7 +996,7 @@
|
||||
|
||||
2002-03-21 Aldy Hernandez <aldyh@redhat.com>
|
||||
|
||||
* tree.c (cp_cannot_inline_tree_fn): Same.
|
||||
* tree.c (cp_cannot_inline_tree_fn): Same.
|
||||
|
||||
2002-03-21 Neil Booth <neil@daikokuya.demon.co.uk>
|
||||
|
||||
@ -1306,10 +1314,10 @@
|
||||
|
||||
2002-02-21 Aldy Hernandez <aldyh@redhat.com>
|
||||
|
||||
* cp/decl.c (duplicate_decls): Merge always_inline attribute.
|
||||
* cp/decl.c (duplicate_decls): Merge always_inline attribute.
|
||||
|
||||
* cp/tree.c (cp_cannot_inline_tree_fn): Do not inline at -O0
|
||||
unless DECL_ALWAYS_INLINE.
|
||||
* cp/tree.c (cp_cannot_inline_tree_fn): Do not inline at -O0
|
||||
unless DECL_ALWAYS_INLINE.
|
||||
|
||||
2002-02-20 Jakub Jelinek <jakub@redhat.com>
|
||||
|
||||
|
13
gcc/cp/lex.c
13
gcc/cp/lex.c
@ -86,10 +86,11 @@ extern YYSTYPE yylval; /* the semantic value of the */
|
||||
int warn_traditional = 0;
|
||||
int flag_digraphs = 1;
|
||||
|
||||
/* the declaration found for the last IDENTIFIER token read in.
|
||||
yylex must look this up to detect typedefs, which get token type TYPENAME,
|
||||
so it is left around in case the identifier is not a typedef but is
|
||||
used in a context which makes it a reference to a variable. */
|
||||
/* the declaration found for the last IDENTIFIER token read in. yylex
|
||||
must look this up to detect typedefs, which get token type
|
||||
tTYPENAME, so it is left around in case the identifier is not a
|
||||
typedef but is used in a context which makes it a reference to a
|
||||
variable. */
|
||||
tree lastiddecl;
|
||||
|
||||
/* Array for holding counts of the numbers of tokens seen. */
|
||||
@ -692,7 +693,7 @@ yyprint (file, yychar, yylval)
|
||||
switch (yychar)
|
||||
{
|
||||
case IDENTIFIER:
|
||||
case TYPENAME:
|
||||
case tTYPENAME:
|
||||
case TYPESPEC:
|
||||
case PTYPENAME:
|
||||
case PFUNCNAME:
|
||||
@ -914,7 +915,7 @@ check_for_missing_semicolon (type)
|
||||
if ((yychar > 255
|
||||
&& yychar != SCSPEC
|
||||
&& yychar != IDENTIFIER
|
||||
&& yychar != TYPENAME
|
||||
&& yychar != tTYPENAME
|
||||
&& yychar != CV_QUALIFIER
|
||||
&& yychar != SELFNAME)
|
||||
|| yychar == 0 /* EOF */)
|
||||
|
324
gcc/cp/parse.y
324
gcc/cp/parse.y
@ -138,7 +138,7 @@ empty_parms ()
|
||||
tree parms;
|
||||
|
||||
#ifndef NO_IMPLICIT_EXTERN_C
|
||||
if (in_system_header && current_class_type == NULL
|
||||
if (in_system_header && current_class_type == NULL
|
||||
&& current_lang_name == lang_name_c)
|
||||
parms = NULL_TREE;
|
||||
else
|
||||
@ -163,12 +163,12 @@ frob_specs (specs_attrs, lookups)
|
||||
{
|
||||
/* We have to indicate that there is an "extern", but that it
|
||||
was part of a language specifier. For instance,
|
||||
|
||||
|
||||
extern "C" typedef int (*Ptr) ();
|
||||
|
||||
is well formed. */
|
||||
current_declspecs = tree_cons (error_mark_node,
|
||||
get_identifier ("extern"),
|
||||
get_identifier ("extern"),
|
||||
current_declspecs);
|
||||
used_extern_spec = 1;
|
||||
}
|
||||
@ -268,10 +268,10 @@ check_class_key (key, aggr)
|
||||
%start program
|
||||
|
||||
%union { GTY(())
|
||||
long itype;
|
||||
tree ttype;
|
||||
char *strtype;
|
||||
enum tree_code code;
|
||||
long itype;
|
||||
tree ttype;
|
||||
char *strtype;
|
||||
enum tree_code code;
|
||||
flagged_type_tree ftype;
|
||||
struct unparsed_text *pi;
|
||||
}
|
||||
@ -283,7 +283,7 @@ check_class_key (key, aggr)
|
||||
/* All identifiers that are declared typedefs in the current block.
|
||||
In some contexts, they are treated just like IDENTIFIER,
|
||||
but they can also serve as typespecs in declarations. */
|
||||
%token TYPENAME
|
||||
%token tTYPENAME
|
||||
%token SELFNAME
|
||||
|
||||
/* A template function. */
|
||||
@ -345,7 +345,7 @@ check_class_key (key, aggr)
|
||||
%nonassoc IF
|
||||
%nonassoc ELSE
|
||||
|
||||
%left IDENTIFIER PFUNCNAME TYPENAME SELFNAME PTYPENAME SCSPEC TYPESPEC CV_QUALIFIER ENUM AGGR ELLIPSIS TYPEOF SIGOF OPERATOR NSNAME TYPENAME_KEYWORD ATTRIBUTE
|
||||
%left IDENTIFIER PFUNCNAME tTYPENAME SELFNAME PTYPENAME SCSPEC TYPESPEC CV_QUALIFIER ENUM AGGR ELLIPSIS TYPEOF SIGOF OPERATOR NSNAME TYPENAME_KEYWORD ATTRIBUTE
|
||||
|
||||
%left '{' ',' ';'
|
||||
|
||||
@ -375,7 +375,7 @@ check_class_key (key, aggr)
|
||||
|
||||
%type <code> unop
|
||||
|
||||
%type <ttype> identifier IDENTIFIER TYPENAME CONSTANT expr nonnull_exprlist
|
||||
%type <ttype> identifier IDENTIFIER tTYPENAME CONSTANT expr nonnull_exprlist
|
||||
%type <ttype> PFUNCNAME maybe_identifier
|
||||
%type <ttype> paren_expr_or_null nontrivial_exprlist SELFNAME
|
||||
%type <ttype> expr_no_commas expr_no_comma_rangle
|
||||
@ -396,14 +396,14 @@ check_class_key (key, aggr)
|
||||
%type <ttype> after_type_declarator_intern
|
||||
%type <ttype> direct_notype_declarator direct_after_type_declarator
|
||||
%type <itype> components notype_components
|
||||
%type <ttype> component_decl component_decl_1
|
||||
%type <ttype> component_decl component_decl_1
|
||||
%type <ttype> component_declarator component_declarator0
|
||||
%type <ttype> notype_component_declarator notype_component_declarator0
|
||||
%type <ttype> after_type_component_declarator after_type_component_declarator0
|
||||
%type <ttype> absdcl cv_qualifiers
|
||||
%type <ttype> direct_abstract_declarator conversion_declarator
|
||||
%type <ttype> new_declarator direct_new_declarator
|
||||
%type <ttype> xexpr parmlist parms bad_parm
|
||||
%type <ttype> xexpr parmlist parms bad_parm
|
||||
%type <ttype> identifiers_or_typenames
|
||||
%type <ttype> fcast_or_absdcl regcast_or_absdcl
|
||||
%type <ttype> expr_or_declarator expr_or_declarator_intern
|
||||
@ -412,7 +412,7 @@ check_class_key (key, aggr)
|
||||
%type <ttype> template_id do_id object_template_id notype_template_declarator
|
||||
%type <ttype> overqualified_id notype_qualified_id any_id
|
||||
%type <ttype> complex_direct_notype_declarator functional_cast
|
||||
%type <ttype> complex_parmlist parms_comma
|
||||
%type <ttype> complex_parmlist parms_comma
|
||||
%type <ttype> namespace_qualifier namespace_using_decl
|
||||
|
||||
%type <ftype> type_id new_type_id typed_typespecs typespec typed_declspecs
|
||||
@ -426,7 +426,7 @@ check_class_key (key, aggr)
|
||||
%token <ttype> PTYPENAME
|
||||
%token <ttype> EXTERN_LANG_STRING ALL
|
||||
%token <ttype> PRE_PARSED_CLASS_DECL DEFARG DEFARG_MARKER
|
||||
%token <pi> PRE_PARSED_FUNCTION_DECL
|
||||
%token <pi> PRE_PARSED_FUNCTION_DECL
|
||||
%type <ttype> component_constructor_declarator
|
||||
%type <ttype> fn_def2 return_id constructor_declarator
|
||||
%type <ttype> begin_function_body_
|
||||
@ -569,7 +569,7 @@ extdef:
|
||||
;
|
||||
|
||||
namespace_alias:
|
||||
NAMESPACE identifier '='
|
||||
NAMESPACE identifier '='
|
||||
{ begin_only_namespace_names (); }
|
||||
any_id ';'
|
||||
{
|
||||
@ -656,7 +656,7 @@ template_parm_header:
|
||||
|
||||
template_spec_header:
|
||||
TEMPLATE '<' '>'
|
||||
{ begin_specialization();
|
||||
{ begin_specialization();
|
||||
$$ = NULL_TREE; }
|
||||
;
|
||||
|
||||
@ -809,7 +809,7 @@ eat_saved_input:
|
||||
function_body:
|
||||
begin_function_body_ ctor_initializer_opt save_lineno '{'
|
||||
{ $<ttype>$ = begin_compound_stmt (/*has_no_scope=*/1); }
|
||||
compstmtend
|
||||
compstmtend
|
||||
{
|
||||
STMT_LINENO ($<ttype>5) = $3;
|
||||
finish_compound_stmt (/*has_no_scope=*/1, $<ttype>5);
|
||||
@ -827,15 +827,15 @@ fndef:
|
||||
;
|
||||
|
||||
constructor_declarator:
|
||||
nested_name_specifier SELFNAME '('
|
||||
nested_name_specifier SELFNAME '('
|
||||
{ $$ = begin_constructor_declarator ($1, $2); }
|
||||
parmlist ')' cv_qualifiers exception_specification_opt
|
||||
{ $$ = make_call_declarator ($<ttype>4, $5, $7, $8); }
|
||||
| nested_name_specifier SELFNAME LEFT_RIGHT cv_qualifiers exception_specification_opt
|
||||
{ $$ = begin_constructor_declarator ($1, $2);
|
||||
{ $$ = begin_constructor_declarator ($1, $2);
|
||||
$$ = make_call_declarator ($$, empty_parms (), $4, $5);
|
||||
}
|
||||
| global_scope nested_name_specifier SELFNAME '('
|
||||
| global_scope nested_name_specifier SELFNAME '('
|
||||
{ $$ = begin_constructor_declarator ($2, $3); }
|
||||
parmlist ')' cv_qualifiers exception_specification_opt
|
||||
{ $$ = make_call_declarator ($<ttype>5, $6, $8, $9); }
|
||||
@ -843,7 +843,7 @@ constructor_declarator:
|
||||
{ $$ = begin_constructor_declarator ($2, $3);
|
||||
$$ = make_call_declarator ($$, empty_parms (), $5, $6);
|
||||
}
|
||||
| nested_name_specifier self_template_type '('
|
||||
| nested_name_specifier self_template_type '('
|
||||
{ $$ = begin_constructor_declarator ($1, $2); }
|
||||
parmlist ')' cv_qualifiers exception_specification_opt
|
||||
{ $$ = make_call_declarator ($<ttype>4, $5, $7, $8); }
|
||||
@ -851,12 +851,12 @@ constructor_declarator:
|
||||
{ $$ = begin_constructor_declarator ($1, $2);
|
||||
$$ = make_call_declarator ($$, empty_parms (), $4, $5);
|
||||
}
|
||||
| global_scope nested_name_specifier self_template_type '('
|
||||
| global_scope nested_name_specifier self_template_type '('
|
||||
{ $$ = begin_constructor_declarator ($2, $3); }
|
||||
parmlist ')' cv_qualifiers exception_specification_opt
|
||||
{ $$ = make_call_declarator ($<ttype>5, $6, $8, $9); }
|
||||
| global_scope nested_name_specifier self_template_type LEFT_RIGHT cv_qualifiers exception_specification_opt
|
||||
{ $$ = begin_constructor_declarator ($2, $3);
|
||||
{ $$ = begin_constructor_declarator ($2, $3);
|
||||
$$ = make_call_declarator ($$, empty_parms (), $5, $6);
|
||||
}
|
||||
;
|
||||
@ -911,19 +911,19 @@ fn_def2:
|
||||
yychar = YYLEX;
|
||||
snarf_method ($$); }
|
||||
| component_constructor_declarator
|
||||
{ $$ = parse_method ($1, NULL_TREE, NULL_TREE);
|
||||
{ $$ = parse_method ($1, NULL_TREE, NULL_TREE);
|
||||
goto rest_of_mdef; }
|
||||
| typed_declspecs declarator
|
||||
{ $$ = parse_method ($2, $1.t, $1.lookups); goto rest_of_mdef;}
|
||||
| declmods notype_declarator
|
||||
{ $$ = parse_method ($2, $1.t, $1.lookups); goto rest_of_mdef;}
|
||||
| notype_declarator
|
||||
{ $$ = parse_method ($1, NULL_TREE, NULL_TREE);
|
||||
{ $$ = parse_method ($1, NULL_TREE, NULL_TREE);
|
||||
goto rest_of_mdef; }
|
||||
| declmods constructor_declarator
|
||||
{ $$ = parse_method ($2, $1.t, $1.lookups); goto rest_of_mdef;}
|
||||
| constructor_declarator
|
||||
{ $$ = parse_method ($1, NULL_TREE, NULL_TREE);
|
||||
{ $$ = parse_method ($1, NULL_TREE, NULL_TREE);
|
||||
goto rest_of_mdef; }
|
||||
;
|
||||
|
||||
@ -964,20 +964,20 @@ begin_function_body_:
|
||||
|
||||
member_init_list:
|
||||
/* empty */
|
||||
{
|
||||
$$.new_type_flag = 0;
|
||||
$$.t = NULL_TREE;
|
||||
{
|
||||
$$.new_type_flag = 0;
|
||||
$$.t = NULL_TREE;
|
||||
}
|
||||
| member_init
|
||||
{
|
||||
$$.new_type_flag = 1;
|
||||
$$.t = $1;
|
||||
{
|
||||
$$.new_type_flag = 1;
|
||||
$$.t = $1;
|
||||
}
|
||||
| member_init_list ',' member_init
|
||||
{
|
||||
if ($3)
|
||||
{
|
||||
if ($3)
|
||||
{
|
||||
$$.new_type_flag = 1;
|
||||
$$.new_type_flag = 1;
|
||||
TREE_CHAIN ($3) = $1.t;
|
||||
$$.t = $3;
|
||||
}
|
||||
@ -999,7 +999,7 @@ member_init:
|
||||
if (current_class_name)
|
||||
pedwarn ("anachronistic old style base class initializer");
|
||||
$$ = expand_member_init (current_class_ref,
|
||||
NULL_TREE,
|
||||
NULL_TREE,
|
||||
void_type_node);
|
||||
}
|
||||
| notype_identifier '(' nonnull_exprlist ')'
|
||||
@ -1023,7 +1023,7 @@ member_init:
|
||||
|
||||
identifier:
|
||||
IDENTIFIER
|
||||
| TYPENAME
|
||||
| tTYPENAME
|
||||
| SELFNAME
|
||||
| PTYPENAME
|
||||
| NSNAME
|
||||
@ -1031,7 +1031,7 @@ identifier:
|
||||
|
||||
notype_identifier:
|
||||
IDENTIFIER
|
||||
| PTYPENAME
|
||||
| PTYPENAME
|
||||
| NSNAME %prec EMPTY
|
||||
;
|
||||
|
||||
@ -1060,24 +1060,28 @@ explicit_instantiation:
|
||||
{ do_type_instantiation ($4.t, $1, 1);
|
||||
yyungetc (';', 1); }
|
||||
end_explicit_instantiation
|
||||
| SCSPEC TEMPLATE begin_explicit_instantiation typed_declspecs
|
||||
{}
|
||||
| SCSPEC TEMPLATE begin_explicit_instantiation typed_declspecs
|
||||
declarator
|
||||
{ tree specs = strip_attrs ($4.t);
|
||||
do_decl_instantiation (specs, $5, $1); }
|
||||
end_explicit_instantiation
|
||||
{}
|
||||
| SCSPEC TEMPLATE begin_explicit_instantiation notype_declarator
|
||||
{ do_decl_instantiation (NULL_TREE, $4, $1); }
|
||||
end_explicit_instantiation
|
||||
{}
|
||||
| SCSPEC TEMPLATE begin_explicit_instantiation constructor_declarator
|
||||
{ do_decl_instantiation (NULL_TREE, $4, $1); }
|
||||
end_explicit_instantiation
|
||||
{}
|
||||
;
|
||||
|
||||
begin_explicit_instantiation:
|
||||
begin_explicit_instantiation:
|
||||
{ begin_explicit_instantiation(); }
|
||||
;
|
||||
|
||||
end_explicit_instantiation:
|
||||
end_explicit_instantiation:
|
||||
{ end_explicit_instantiation(); }
|
||||
;
|
||||
|
||||
@ -1089,7 +1093,7 @@ template_type:
|
||||
PTYPENAME '<' template_arg_list_opt template_close_bracket
|
||||
finish_template_type_
|
||||
{ $$ = $5; }
|
||||
| TYPENAME '<' template_arg_list_opt template_close_bracket
|
||||
| tTYPENAME '<' template_arg_list_opt template_close_bracket
|
||||
finish_template_type_
|
||||
{ $$ = $5; }
|
||||
| self_template_type
|
||||
@ -1109,18 +1113,18 @@ self_template_type:
|
||||
;
|
||||
|
||||
finish_template_type_:
|
||||
{
|
||||
{
|
||||
if (yychar == YYEMPTY)
|
||||
yychar = YYLEX;
|
||||
|
||||
$$ = finish_template_type ($<ttype>-3, $<ttype>-1,
|
||||
$$ = finish_template_type ($<ttype>-3, $<ttype>-1,
|
||||
yychar == SCOPE);
|
||||
}
|
||||
;
|
||||
|
||||
template_close_bracket:
|
||||
'>'
|
||||
| RSHIFT
|
||||
| RSHIFT
|
||||
{
|
||||
/* Handle `Class<Class<Type>>' without space in the `>>' */
|
||||
pedwarn ("`>>' should be `> >' in template class name");
|
||||
@ -1231,11 +1235,11 @@ condition:
|
||||
$<ttype>$ = parse_decl ($<ttype>2, $4, 1);
|
||||
}
|
||||
init
|
||||
{
|
||||
{
|
||||
parse_end_decl ($<ttype>6, $7, $4);
|
||||
$$ = convert_from_reference ($<ttype>6);
|
||||
$$ = convert_from_reference ($<ttype>6);
|
||||
if (TREE_CODE (TREE_TYPE ($$)) == ARRAY_TYPE)
|
||||
error ("definition of array `%#D' in condition", $$);
|
||||
error ("definition of array `%#D' in condition", $$);
|
||||
}
|
||||
| expr
|
||||
;
|
||||
@ -1249,10 +1253,10 @@ compstmtend:
|
||||
|
||||
nontrivial_exprlist:
|
||||
expr_no_commas ',' expr_no_commas
|
||||
{ $$ = tree_cons (NULL_TREE, $$,
|
||||
{ $$ = tree_cons (NULL_TREE, $$,
|
||||
build_tree_list (NULL_TREE, $3)); }
|
||||
| expr_no_commas ',' error
|
||||
{ $$ = tree_cons (NULL_TREE, $$,
|
||||
{ $$ = tree_cons (NULL_TREE, $$,
|
||||
build_tree_list (NULL_TREE, error_mark_node)); }
|
||||
| nontrivial_exprlist ',' expr_no_commas
|
||||
{ chainon ($$, build_tree_list (NULL_TREE, $3)); }
|
||||
@ -1292,36 +1296,36 @@ unary_expr:
|
||||
| ALIGNOF unary_expr %prec UNARY
|
||||
{ $$ = finish_alignof ($2); }
|
||||
| ALIGNOF '(' type_id ')' %prec HYPERUNARY
|
||||
{ $$ = finish_alignof (groktypename ($3.t));
|
||||
{ $$ = finish_alignof (groktypename ($3.t));
|
||||
check_for_new_type ("alignof", $3); }
|
||||
|
||||
/* The %prec EMPTY's here are required by the = init initializer
|
||||
syntax extension; see below. */
|
||||
| new new_type_id %prec EMPTY
|
||||
{ $$ = build_new (NULL_TREE, $2.t, NULL_TREE, $1);
|
||||
{ $$ = build_new (NULL_TREE, $2.t, NULL_TREE, $1);
|
||||
check_for_new_type ("new", $2); }
|
||||
| new new_type_id new_initializer
|
||||
{ $$ = build_new (NULL_TREE, $2.t, $3, $1);
|
||||
{ $$ = build_new (NULL_TREE, $2.t, $3, $1);
|
||||
check_for_new_type ("new", $2); }
|
||||
| new new_placement new_type_id %prec EMPTY
|
||||
{ $$ = build_new ($2, $3.t, NULL_TREE, $1);
|
||||
{ $$ = build_new ($2, $3.t, NULL_TREE, $1);
|
||||
check_for_new_type ("new", $3); }
|
||||
| new new_placement new_type_id new_initializer
|
||||
{ $$ = build_new ($2, $3.t, $4, $1);
|
||||
{ $$ = build_new ($2, $3.t, $4, $1);
|
||||
check_for_new_type ("new", $3); }
|
||||
| new '(' type_id ')'
|
||||
%prec EMPTY
|
||||
{ $$ = build_new (NULL_TREE, groktypename($3.t),
|
||||
NULL_TREE, $1);
|
||||
NULL_TREE, $1);
|
||||
check_for_new_type ("new", $3); }
|
||||
| new '(' type_id ')' new_initializer
|
||||
{ $$ = build_new (NULL_TREE, groktypename($3.t), $5, $1);
|
||||
{ $$ = build_new (NULL_TREE, groktypename($3.t), $5, $1);
|
||||
check_for_new_type ("new", $3); }
|
||||
| new new_placement '(' type_id ')' %prec EMPTY
|
||||
{ $$ = build_new ($2, groktypename($4.t), NULL_TREE, $1);
|
||||
{ $$ = build_new ($2, groktypename($4.t), NULL_TREE, $1);
|
||||
check_for_new_type ("new", $4); }
|
||||
| new new_placement '(' type_id ')' new_initializer
|
||||
{ $$ = build_new ($2, groktypename($4.t), $6, $1);
|
||||
{ $$ = build_new ($2, groktypename($4.t), $6, $1);
|
||||
check_for_new_type ("new", $4); }
|
||||
|
||||
| delete cast_expr %prec UNARY
|
||||
@ -1360,7 +1364,7 @@ new_initializer:
|
||||
}
|
||||
/* GNU extension so people can use initializer lists. Note that
|
||||
this alters the meaning of `new int = 1', which was previously
|
||||
syntactically valid but semantically invalid.
|
||||
syntactically valid but semantically invalid.
|
||||
This feature is now deprecated and will be removed in a future
|
||||
release. */
|
||||
| '=' init
|
||||
@ -1383,7 +1387,7 @@ regcast_or_absdcl:
|
||||
$$ = make_call_declarator (NULL_TREE, $2.t, NULL_TREE, NULL_TREE);
|
||||
check_for_new_type ("cast", $2); }
|
||||
| regcast_or_absdcl '(' type_id ')' %prec EMPTY
|
||||
{ $3.t = finish_parmlist (build_tree_list (NULL_TREE, $3.t), 0);
|
||||
{ $3.t = finish_parmlist (build_tree_list (NULL_TREE, $3.t), 0);
|
||||
$$ = make_call_declarator ($$, $3.t, NULL_TREE, NULL_TREE);
|
||||
check_for_new_type ("cast", $3); }
|
||||
;
|
||||
@ -1393,9 +1397,9 @@ cast_expr:
|
||||
| regcast_or_absdcl unary_expr %prec UNARY
|
||||
{ $$ = reparse_absdcl_as_casts ($$, $2); }
|
||||
| regcast_or_absdcl '{' initlist maybecomma '}' %prec UNARY
|
||||
{
|
||||
{
|
||||
tree init = build_nt (CONSTRUCTOR, NULL_TREE,
|
||||
nreverse ($3));
|
||||
nreverse ($3));
|
||||
if (pedantic)
|
||||
pedwarn ("ISO C++ forbids compound literals");
|
||||
/* Indicate that this was a C99 compound literal. */
|
||||
@ -1539,7 +1543,7 @@ do_id:
|
||||
;
|
||||
|
||||
template_id:
|
||||
PFUNCNAME '<' do_id template_arg_list_opt template_close_bracket
|
||||
PFUNCNAME '<' do_id template_arg_list_opt template_close_bracket
|
||||
{ $$ = lookup_template_function ($3, $4); }
|
||||
| operator_name '<' do_id template_arg_list_opt template_close_bracket
|
||||
{ $$ = lookup_template_function ($3, $4); }
|
||||
@ -1550,14 +1554,14 @@ object_template_id:
|
||||
{ $$ = lookup_template_function ($2, $4); }
|
||||
| TEMPLATE PFUNCNAME '<' template_arg_list_opt template_close_bracket
|
||||
{ $$ = lookup_template_function ($2, $4); }
|
||||
| TEMPLATE operator_name '<' template_arg_list_opt
|
||||
| TEMPLATE operator_name '<' template_arg_list_opt
|
||||
template_close_bracket
|
||||
{ $$ = lookup_template_function ($2, $4); }
|
||||
;
|
||||
|
||||
unqualified_id:
|
||||
notype_unqualified_id
|
||||
| TYPENAME
|
||||
| tTYPENAME
|
||||
| SELFNAME
|
||||
;
|
||||
|
||||
@ -1587,7 +1591,7 @@ notype_template_declarator:
|
||||
| NSNAME '<' template_arg_list template_close_bracket
|
||||
{ $$ = lookup_template_function ($1, $3); }
|
||||
;
|
||||
|
||||
|
||||
direct_notype_declarator:
|
||||
complex_direct_notype_declarator
|
||||
/* This precedence declaration is to prefer this reduce
|
||||
@ -1603,9 +1607,9 @@ primary:
|
||||
{
|
||||
if (TREE_CODE ($1) == BIT_NOT_EXPR)
|
||||
$$ = build_x_unary_op (BIT_NOT_EXPR, TREE_OPERAND ($1, 0));
|
||||
else
|
||||
else
|
||||
$$ = finish_id_expr ($1);
|
||||
}
|
||||
}
|
||||
| CONSTANT
|
||||
| boolean_literal
|
||||
| STRING
|
||||
@ -1639,8 +1643,8 @@ primary:
|
||||
YYERROR;
|
||||
}
|
||||
if (pedantic)
|
||||
pedwarn ("ISO C++ forbids braced-groups within expressions");
|
||||
$<ttype>$ = begin_stmt_expr ();
|
||||
pedwarn ("ISO C++ forbids braced-groups within expressions");
|
||||
$<ttype>$ = begin_stmt_expr ();
|
||||
}
|
||||
compstmt_or_stmtexpr ')'
|
||||
{ $$ = finish_stmt_expr ($<ttype>2); }
|
||||
@ -1720,8 +1724,8 @@ primary:
|
||||
| overqualified_id LEFT_RIGHT
|
||||
{ $$ = finish_qualified_call_expr ($1, NULL_TREE); }
|
||||
| object object_template_id %prec UNARY
|
||||
{
|
||||
$$ = build_x_component_ref ($$, $2, NULL_TREE, 1);
|
||||
{
|
||||
$$ = build_x_component_ref ($$, $2, NULL_TREE, 1);
|
||||
}
|
||||
| object object_template_id '(' nonnull_exprlist ')'
|
||||
{ $$ = finish_object_call_expr ($2, $1, $4); }
|
||||
@ -1825,7 +1829,7 @@ object:
|
||||
{ got_object = TREE_TYPE ($$); }
|
||||
| primary POINTSAT
|
||||
{
|
||||
$$ = build_x_arrow ($$);
|
||||
$$ = build_x_arrow ($$);
|
||||
got_object = TREE_TYPE ($$);
|
||||
}
|
||||
;
|
||||
@ -1874,20 +1878,20 @@ fcast_or_absdcl:
|
||||
/* ISO type-id (8.1) */
|
||||
type_id:
|
||||
typed_typespecs absdcl
|
||||
{ $$.t = build_tree_list ($1.t, $2);
|
||||
{ $$.t = build_tree_list ($1.t, $2);
|
||||
$$.new_type_flag = $1.new_type_flag; }
|
||||
| nonempty_cv_qualifiers absdcl
|
||||
{ $$.t = build_tree_list ($1.t, $2);
|
||||
{ $$.t = build_tree_list ($1.t, $2);
|
||||
$$.new_type_flag = $1.new_type_flag; }
|
||||
| typespec absdcl
|
||||
{ $$.t = build_tree_list (build_tree_list (NULL_TREE, $1.t),
|
||||
$2);
|
||||
$2);
|
||||
$$.new_type_flag = $1.new_type_flag; }
|
||||
| typed_typespecs %prec EMPTY
|
||||
{ $$.t = build_tree_list ($1.t, NULL_TREE);
|
||||
$$.new_type_flag = $1.new_type_flag; }
|
||||
| nonempty_cv_qualifiers %prec EMPTY
|
||||
{ $$.t = build_tree_list ($1.t, NULL_TREE);
|
||||
{ $$.t = build_tree_list ($1.t, NULL_TREE);
|
||||
$$.new_type_flag = $1.new_type_flag; }
|
||||
;
|
||||
|
||||
@ -1905,23 +1909,23 @@ typed_declspecs:
|
||||
|
||||
typed_declspecs1:
|
||||
declmods typespec
|
||||
{ $$.t = tree_cons (NULL_TREE, $2.t, $1.t);
|
||||
{ $$.t = tree_cons (NULL_TREE, $2.t, $1.t);
|
||||
$$.new_type_flag = $2.new_type_flag; }
|
||||
| typespec reserved_declspecs %prec HYPERUNARY
|
||||
{ $$.t = tree_cons (NULL_TREE, $1.t, $2);
|
||||
{ $$.t = tree_cons (NULL_TREE, $1.t, $2);
|
||||
$$.new_type_flag = $1.new_type_flag; }
|
||||
| typespec reserved_typespecquals reserved_declspecs
|
||||
{ $$.t = tree_cons (NULL_TREE, $1.t, chainon ($2, $3));
|
||||
{ $$.t = tree_cons (NULL_TREE, $1.t, chainon ($2, $3));
|
||||
$$.new_type_flag = $1.new_type_flag; }
|
||||
| declmods typespec reserved_declspecs
|
||||
{ $$.t = tree_cons (NULL_TREE, $2.t, chainon ($3, $1.t));
|
||||
{ $$.t = tree_cons (NULL_TREE, $2.t, chainon ($3, $1.t));
|
||||
$$.new_type_flag = $2.new_type_flag; }
|
||||
| declmods typespec reserved_typespecquals
|
||||
{ $$.t = tree_cons (NULL_TREE, $2.t, chainon ($3, $1.t));
|
||||
{ $$.t = tree_cons (NULL_TREE, $2.t, chainon ($3, $1.t));
|
||||
$$.new_type_flag = $2.new_type_flag; }
|
||||
| declmods typespec reserved_typespecquals reserved_declspecs
|
||||
{ $$.t = tree_cons (NULL_TREE, $2.t,
|
||||
chainon ($3, chainon ($4, $1.t)));
|
||||
chainon ($3, chainon ($4, $1.t)));
|
||||
$$.new_type_flag = $2.new_type_flag; }
|
||||
;
|
||||
|
||||
@ -1987,16 +1991,16 @@ declmods:
|
||||
|
||||
typed_typespecs:
|
||||
typespec %prec EMPTY
|
||||
{ $$.t = build_tree_list (NULL_TREE, $1.t);
|
||||
{ $$.t = build_tree_list (NULL_TREE, $1.t);
|
||||
$$.new_type_flag = $1.new_type_flag; }
|
||||
| nonempty_cv_qualifiers typespec
|
||||
{ $$.t = tree_cons (NULL_TREE, $2.t, $1.t);
|
||||
{ $$.t = tree_cons (NULL_TREE, $2.t, $1.t);
|
||||
$$.new_type_flag = $2.new_type_flag; }
|
||||
| typespec reserved_typespecquals
|
||||
{ $$.t = tree_cons (NULL_TREE, $1.t, $2);
|
||||
{ $$.t = tree_cons (NULL_TREE, $1.t, $2);
|
||||
$$.new_type_flag = $1.new_type_flag; }
|
||||
| nonempty_cv_qualifiers typespec reserved_typespecquals
|
||||
{ $$.t = tree_cons (NULL_TREE, $2.t, chainon ($3, $1.t));
|
||||
{ $$.t = tree_cons (NULL_TREE, $2.t, chainon ($3, $1.t));
|
||||
$$.new_type_flag = $2.new_type_flag; }
|
||||
;
|
||||
|
||||
@ -2119,7 +2123,7 @@ initdcl0_innards:
|
||||
{ $<ttype>$ = parse_decl0 ($<ttype>-1, $<ftype>-2.t,
|
||||
$<ftype>-2.lookups, $1, 1); }
|
||||
/* Note how the declaration of the variable is in effect
|
||||
while its init is parsed! */
|
||||
while its init is parsed! */
|
||||
init
|
||||
{ parse_end_decl ($<ttype>3, $4, $<ttype>0); }
|
||||
| maybe_attribute
|
||||
@ -2127,7 +2131,7 @@ initdcl0_innards:
|
||||
$<ftype>-2.lookups, $1, 0);
|
||||
parse_end_decl (d, NULL_TREE, $<ttype>0); }
|
||||
;
|
||||
|
||||
|
||||
initdcl0:
|
||||
declarator maybeasm initdcl0_innards
|
||||
{}
|
||||
@ -2137,15 +2141,15 @@ notype_initdcl0:
|
||||
notype_declarator maybeasm initdcl0_innards
|
||||
{}
|
||||
;
|
||||
|
||||
|
||||
nomods_initdcl0:
|
||||
notype_declarator maybeasm
|
||||
{ /* Set things up as initdcl0_innards expects. */
|
||||
$<ttype>$ = $2;
|
||||
$2 = $1;
|
||||
$2 = $1;
|
||||
$<ftype>1.t = NULL_TREE;
|
||||
$<ftype>1.lookups = NULL_TREE; }
|
||||
initdcl0_innards
|
||||
initdcl0_innards
|
||||
{}
|
||||
| constructor_declarator maybeasm maybe_attribute
|
||||
{ tree d = parse_decl0 ($1, NULL_TREE, NULL_TREE, $3, 0);
|
||||
@ -2160,7 +2164,7 @@ maybe_attribute:
|
||||
| attributes
|
||||
{ $$ = $1; }
|
||||
;
|
||||
|
||||
|
||||
attributes:
|
||||
attribute
|
||||
{ $$ = $1; }
|
||||
@ -2179,7 +2183,7 @@ attribute_list:
|
||||
| attribute_list ',' attrib
|
||||
{ $$ = chainon ($1, $3); }
|
||||
;
|
||||
|
||||
|
||||
attrib:
|
||||
/* empty */
|
||||
{ $$ = NULL_TREE; }
|
||||
@ -2259,13 +2263,13 @@ pending_inline:
|
||||
process_next_inline ($1);
|
||||
}
|
||||
| PRE_PARSED_FUNCTION_DECL maybe_return_init function_try_block
|
||||
{
|
||||
expand_body (finish_function (2));
|
||||
{
|
||||
expand_body (finish_function (2));
|
||||
process_next_inline ($1);
|
||||
}
|
||||
| PRE_PARSED_FUNCTION_DECL maybe_return_init error
|
||||
{
|
||||
finish_function (2);
|
||||
{
|
||||
finish_function (2);
|
||||
process_next_inline ($1); }
|
||||
;
|
||||
|
||||
@ -2311,14 +2315,14 @@ structsp:
|
||||
current_enum_type = $<ttype>3;
|
||||
check_for_missing_semicolon ($$.t); }
|
||||
| ENUM identifier
|
||||
{ $$.t = xref_tag (enum_type_node, $2, 1);
|
||||
{ $$.t = xref_tag (enum_type_node, $2, 1);
|
||||
$$.new_type_flag = 0; }
|
||||
| ENUM complex_type_name
|
||||
{ $$.t = xref_tag (enum_type_node, $2, 1);
|
||||
{ $$.t = xref_tag (enum_type_node, $2, 1);
|
||||
$$.new_type_flag = 0; }
|
||||
| TYPENAME_KEYWORD typename_sub
|
||||
{ $$.t = $2;
|
||||
$$.new_type_flag = 0;
|
||||
$$.new_type_flag = 0;
|
||||
if (!processing_template_decl)
|
||||
pedwarn ("using `typename' outside of template"); }
|
||||
/* C++ extensions, merged with C to avoid shift/reduce conflicts */
|
||||
@ -2327,7 +2331,7 @@ structsp:
|
||||
if ($2 && $1.t != error_mark_node)
|
||||
{
|
||||
tree type = TREE_TYPE ($1.t);
|
||||
|
||||
|
||||
if (TREE_CODE (type) == TYPENAME_TYPE)
|
||||
/* In a definition of a member class template,
|
||||
we will get here with an implicit typename,
|
||||
@ -2336,11 +2340,11 @@ structsp:
|
||||
maybe_process_partial_specialization (type);
|
||||
xref_basetypes (current_aggr, $1.t, type, $2);
|
||||
}
|
||||
$1.t = begin_class_definition (TREE_TYPE ($1.t));
|
||||
$1.t = begin_class_definition (TREE_TYPE ($1.t));
|
||||
check_class_key (current_aggr, $1.t);
|
||||
current_aggr = NULL_TREE; }
|
||||
opt.component_decl_list '}' maybe_attribute
|
||||
{
|
||||
{
|
||||
int semi;
|
||||
tree t;
|
||||
|
||||
@ -2365,7 +2369,7 @@ structsp:
|
||||
pending_inlines
|
||||
{
|
||||
$$.t = $<ttype>8;
|
||||
$$.new_type_flag = 1;
|
||||
$$.new_type_flag = 1;
|
||||
}
|
||||
| class_head_decl
|
||||
{
|
||||
@ -2426,18 +2430,18 @@ class_head:
|
||||
|
||||
class_head_apparent_template:
|
||||
aggr apparent_template_type
|
||||
{
|
||||
current_aggr = $1;
|
||||
{
|
||||
current_aggr = $1;
|
||||
$$ = $2;
|
||||
}
|
||||
| aggr nested_name_specifier apparent_template_type
|
||||
{
|
||||
current_aggr = $1;
|
||||
{
|
||||
current_aggr = $1;
|
||||
$$ = $3;
|
||||
}
|
||||
| aggr global_scope nested_name_specifier apparent_template_type
|
||||
{
|
||||
current_aggr = $1;
|
||||
{
|
||||
current_aggr = $1;
|
||||
$$ = $4;
|
||||
}
|
||||
;
|
||||
@ -2589,7 +2593,7 @@ base_class_access_list:
|
||||
opt.component_decl_list:
|
||||
| component_decl_list
|
||||
| opt.component_decl_list access_specifier component_decl_list
|
||||
| opt.component_decl_list access_specifier
|
||||
| opt.component_decl_list access_specifier
|
||||
;
|
||||
|
||||
access_specifier:
|
||||
@ -2603,13 +2607,13 @@ access_specifier:
|
||||
ARM $9.2 says that the semicolon is optional, and therefore allowed. */
|
||||
component_decl_list:
|
||||
component_decl
|
||||
{
|
||||
{
|
||||
finish_member_declaration ($1);
|
||||
current_aggr = NULL_TREE;
|
||||
reset_type_access_control ();
|
||||
}
|
||||
| component_decl_list component_decl
|
||||
{
|
||||
{
|
||||
finish_member_declaration ($2);
|
||||
current_aggr = NULL_TREE;
|
||||
reset_type_access_control ();
|
||||
@ -2637,7 +2641,7 @@ component_decl:
|
||||
{ $$ = $2;
|
||||
pedantic = $1; }
|
||||
| template_header component_decl
|
||||
{
|
||||
{
|
||||
if ($2)
|
||||
$$ = finish_member_template_decl ($2);
|
||||
else
|
||||
@ -2647,8 +2651,8 @@ component_decl:
|
||||
finish_template_decl ($1);
|
||||
}
|
||||
| template_header typed_declspecs ';'
|
||||
{
|
||||
$$ = finish_member_class_template ($2.t);
|
||||
{
|
||||
$$ = finish_member_class_template ($2.t);
|
||||
finish_template_decl ($1);
|
||||
}
|
||||
| bad_decl
|
||||
@ -2681,10 +2685,10 @@ component_decl_1:
|
||||
$$ = NULL_TREE;
|
||||
}
|
||||
| declmods notype_components
|
||||
{
|
||||
{
|
||||
if (!$2)
|
||||
grok_x_components ($1.t);
|
||||
$$ = NULL_TREE;
|
||||
$$ = NULL_TREE;
|
||||
}
|
||||
| notype_declarator maybeasm maybe_attribute maybe_init
|
||||
{ $$ = grokfield ($$, NULL_TREE, $4, $2, $3); }
|
||||
@ -2720,14 +2724,14 @@ components:
|
||||
/* empty: possibly anonymous */
|
||||
{ $$ = 0; }
|
||||
| component_declarator0
|
||||
{
|
||||
{
|
||||
if (PROCESSING_REAL_TEMPLATE_DECL_P ())
|
||||
$1 = finish_member_template_decl ($1);
|
||||
finish_member_declaration ($1);
|
||||
finish_member_declaration ($1);
|
||||
$$ = 1;
|
||||
}
|
||||
| components ',' component_declarator
|
||||
{
|
||||
{
|
||||
check_multiple_declarators ();
|
||||
if (PROCESSING_REAL_TEMPLATE_DECL_P ())
|
||||
$3 = finish_member_template_decl ($3);
|
||||
@ -2740,18 +2744,18 @@ notype_components:
|
||||
/* empty: possibly anonymous */
|
||||
{ $$ = 0; }
|
||||
| notype_component_declarator0
|
||||
{
|
||||
{
|
||||
if (PROCESSING_REAL_TEMPLATE_DECL_P ())
|
||||
$1 = finish_member_template_decl ($1);
|
||||
finish_member_declaration ($1);
|
||||
$$ = 1;
|
||||
}
|
||||
| notype_components ',' notype_component_declarator
|
||||
{
|
||||
{
|
||||
check_multiple_declarators ();
|
||||
if (PROCESSING_REAL_TEMPLATE_DECL_P ())
|
||||
$3 = finish_member_template_decl ($3);
|
||||
finish_member_declaration ($3);
|
||||
finish_member_declaration ($3);
|
||||
$$ = 2;
|
||||
}
|
||||
;
|
||||
@ -2770,7 +2774,7 @@ after_type_component_declarator0:
|
||||
after_type_declarator maybeasm maybe_attribute maybe_init
|
||||
{ $$ = parse_field0 ($1, $<ftype>0.t, $<ftype>0.lookups,
|
||||
$3, $2, $4); }
|
||||
| TYPENAME ':' expr_no_commas maybe_attribute
|
||||
| tTYPENAME ':' expr_no_commas maybe_attribute
|
||||
{ $$ = parse_bitfield0 ($1, $<ftype>0.t, $<ftype>0.lookups,
|
||||
$4, $3); }
|
||||
;
|
||||
@ -2793,7 +2797,7 @@ notype_component_declarator0:
|
||||
after_type_component_declarator:
|
||||
after_type_declarator maybeasm maybe_attribute maybe_init
|
||||
{ $$ = parse_field ($1, $3, $2, $4); }
|
||||
| TYPENAME ':' expr_no_commas maybe_attribute
|
||||
| tTYPENAME ':' expr_no_commas maybe_attribute
|
||||
{ $$ = parse_bitfield ($1, $4, $3); }
|
||||
;
|
||||
|
||||
@ -2830,10 +2834,10 @@ enumerator:
|
||||
/* ISO new-type-id (5.3.4) */
|
||||
new_type_id:
|
||||
type_specifier_seq new_declarator
|
||||
{ $$.t = build_tree_list ($1.t, $2);
|
||||
{ $$.t = build_tree_list ($1.t, $2);
|
||||
$$.new_type_flag = $1.new_type_flag; }
|
||||
| type_specifier_seq %prec EMPTY
|
||||
{ $$.t = build_tree_list ($1.t, NULL_TREE);
|
||||
{ $$.t = build_tree_list ($1.t, NULL_TREE);
|
||||
$$.new_type_flag = $1.new_type_flag; }
|
||||
/* GNU extension to allow arrays of arbitrary types with
|
||||
non-constant dimension. */
|
||||
@ -2859,13 +2863,13 @@ nonempty_cv_qualifiers:
|
||||
{ $$.t = hash_tree_cons (NULL_TREE, $1, NULL_TREE);
|
||||
$$.new_type_flag = 0; }
|
||||
| nonempty_cv_qualifiers CV_QUALIFIER
|
||||
{ $$.t = hash_tree_cons (NULL_TREE, $2, $1.t);
|
||||
{ $$.t = hash_tree_cons (NULL_TREE, $2, $1.t);
|
||||
$$.new_type_flag = $1.new_type_flag; }
|
||||
| attributes %prec EMPTY
|
||||
{ $$.t = hash_tree_cons ($1, NULL_TREE, NULL_TREE);
|
||||
{ $$.t = hash_tree_cons ($1, NULL_TREE, NULL_TREE);
|
||||
$$.new_type_flag = 0; }
|
||||
| nonempty_cv_qualifiers attributes %prec EMPTY
|
||||
{ $$.t = hash_tree_cons ($2, NULL_TREE, $1.t);
|
||||
{ $$.t = hash_tree_cons ($2, NULL_TREE, $1.t);
|
||||
$$.new_type_flag = $1.new_type_flag; }
|
||||
;
|
||||
|
||||
@ -2974,7 +2978,7 @@ notype_declarator_intern:
|
||||
$$ = tree_cons ($1, $2, NULL_TREE);
|
||||
}
|
||||
;
|
||||
|
||||
|
||||
notype_declarator:
|
||||
'*' nonempty_cv_qualifiers notype_declarator_intern %prec UNARY
|
||||
{ $$ = make_pointer_declarator ($2.t, $3); }
|
||||
@ -3022,7 +3026,7 @@ complex_direct_notype_declarator:
|
||||
{ enter_scope_of ($2); $$ = $2;}
|
||||
| global_scope notype_unqualified_id
|
||||
{ $$ = build_nt (SCOPE_REF, global_namespace, $2);
|
||||
enter_scope_of ($$);
|
||||
enter_scope_of ($$);
|
||||
}
|
||||
| nested_name_specifier notype_template_declarator
|
||||
{ got_scope = NULL_TREE;
|
||||
@ -3065,7 +3069,7 @@ functional_cast:
|
||||
;
|
||||
|
||||
type_name:
|
||||
TYPENAME
|
||||
tTYPENAME
|
||||
| SELFNAME
|
||||
| template_type %prec EMPTY
|
||||
;
|
||||
@ -3075,21 +3079,21 @@ nested_name_specifier:
|
||||
| nested_name_specifier nested_name_specifier_1
|
||||
{ $$ = $2; }
|
||||
| nested_name_specifier TEMPLATE explicit_template_type SCOPE
|
||||
{ got_scope = $$
|
||||
{ got_scope = $$
|
||||
= make_typename_type ($1, $3, tf_error); }
|
||||
/* Error handling per Core 125. */
|
||||
| nested_name_specifier IDENTIFIER SCOPE
|
||||
{ got_scope = $$
|
||||
{ got_scope = $$
|
||||
= make_typename_type ($1, $2, tf_error); }
|
||||
| nested_name_specifier PTYPENAME SCOPE
|
||||
{ got_scope = $$
|
||||
{ got_scope = $$
|
||||
= make_typename_type ($1, $2, tf_error); }
|
||||
;
|
||||
|
||||
/* Why the @#$%^& do type_name and notype_identifier need to be expanded
|
||||
inline here?!? (jason) */
|
||||
nested_name_specifier_1:
|
||||
TYPENAME SCOPE
|
||||
tTYPENAME SCOPE
|
||||
{
|
||||
if (TREE_CODE ($1) == IDENTIFIER_NODE)
|
||||
{
|
||||
@ -3165,17 +3169,17 @@ typename_sub1:
|
||||
}
|
||||
}
|
||||
| typename_sub1 explicit_template_type SCOPE
|
||||
{ got_scope = $$
|
||||
{ got_scope = $$
|
||||
= make_typename_type ($1, $2, tf_error); }
|
||||
| typename_sub1 TEMPLATE explicit_template_type SCOPE
|
||||
{ got_scope = $$
|
||||
{ got_scope = $$
|
||||
= make_typename_type ($1, $3, tf_error); }
|
||||
;
|
||||
|
||||
/* This needs to return a TYPE_DECL for simple names so that we don't
|
||||
forget what name was used. */
|
||||
typename_sub2:
|
||||
TYPENAME SCOPE
|
||||
tTYPENAME SCOPE
|
||||
{
|
||||
if (TREE_CODE ($1) != TYPE_DECL)
|
||||
$$ = lastiddecl;
|
||||
@ -3276,7 +3280,7 @@ absdcl_intern:
|
||||
$$ = tree_cons ($1, $2, NULL_TREE);
|
||||
}
|
||||
;
|
||||
|
||||
|
||||
/* ISO abstract-declarator (8.1) */
|
||||
absdcl:
|
||||
'*' nonempty_cv_qualifiers absdcl_intern
|
||||
@ -3362,7 +3366,7 @@ label_decls:
|
||||
|
||||
label_decl:
|
||||
LABEL identifiers_or_typenames ';'
|
||||
{
|
||||
{
|
||||
while ($2)
|
||||
{
|
||||
finish_label_decl (TREE_VALUE ($2));
|
||||
@ -3374,7 +3378,7 @@ label_decl:
|
||||
compstmt_or_stmtexpr:
|
||||
save_lineno '{'
|
||||
{ $<ttype>$ = begin_compound_stmt (0); }
|
||||
compstmtend
|
||||
compstmtend
|
||||
{ STMT_LINENO ($<ttype>3) = $1;
|
||||
finish_compound_stmt (0, $<ttype>3); }
|
||||
;
|
||||
@ -3397,9 +3401,9 @@ simple_if:
|
||||
|
||||
implicitly_scoped_stmt:
|
||||
compstmt
|
||||
|
|
||||
|
|
||||
{ $<ttype>$ = begin_compound_stmt (0); }
|
||||
save_lineno simple_stmt
|
||||
save_lineno simple_stmt
|
||||
{ STMT_LINENO ($<ttype>1) = $2;
|
||||
if ($3) STMT_LINENO ($3) = $2;
|
||||
finish_compound_stmt (0, $<ttype>1); }
|
||||
@ -3420,9 +3424,9 @@ simple_stmt:
|
||||
| simple_if ELSE
|
||||
{ begin_else_clause (); }
|
||||
implicitly_scoped_stmt
|
||||
{
|
||||
{
|
||||
$$ = $1;
|
||||
finish_else_clause ($1);
|
||||
finish_else_clause ($1);
|
||||
finish_if_stmt ();
|
||||
}
|
||||
| simple_if %prec IF
|
||||
@ -3459,7 +3463,7 @@ simple_stmt:
|
||||
implicitly_scoped_stmt
|
||||
{ $$ = $<ttype>2;
|
||||
finish_for_stmt ($<ttype>2); }
|
||||
| SWITCH
|
||||
| SWITCH
|
||||
{ $<ttype>$ = begin_switch_stmt (); }
|
||||
'(' condition ')'
|
||||
{ finish_switch_cond ($4, $<ttype>2); }
|
||||
@ -3510,7 +3514,7 @@ simple_stmt:
|
||||
asm_clobbers ')' ';'
|
||||
{ $$ = finish_asm_stmt ($2, $4, $6, NULL_TREE, $8); }
|
||||
| GOTO '*' expr ';'
|
||||
{
|
||||
{
|
||||
if (pedantic)
|
||||
pedwarn ("ISO C++ forbids computed gotos");
|
||||
$$ = finish_goto_stmt ($3);
|
||||
@ -3601,7 +3605,7 @@ handler_args:
|
||||
expand_start_catch_block ($2.t, $3); }
|
||||
This allows reference parameters... */
|
||||
| '(' parm ')'
|
||||
{
|
||||
{
|
||||
check_for_new_type ("inside exception declarations", $2);
|
||||
$$ = start_handler_parms (TREE_PURPOSE ($2.t),
|
||||
TREE_VALUE ($2.t));
|
||||
@ -3613,7 +3617,7 @@ label_colon:
|
||||
{ finish_label_stmt ($1); }
|
||||
| PTYPENAME ':'
|
||||
{ finish_label_stmt ($1); }
|
||||
| TYPENAME ':'
|
||||
| tTYPENAME ':'
|
||||
{ finish_label_stmt ($1); }
|
||||
| SELFNAME ':'
|
||||
{ finish_label_stmt ($1); }
|
||||
@ -3704,7 +3708,7 @@ complex_parmlist:
|
||||
{ $$ = finish_parmlist ($1, 1); }
|
||||
| type_id ELLIPSIS
|
||||
{ $$ = finish_parmlist (build_tree_list (NULL_TREE,
|
||||
$1.t), 1); }
|
||||
$1.t), 1); }
|
||||
| ELLIPSIS
|
||||
{ $$ = finish_parmlist (NULL_TREE, 1); }
|
||||
| parms ':'
|
||||
@ -3724,7 +3728,7 @@ complex_parmlist:
|
||||
parenthesis. */
|
||||
yyerror ("possibly missing ')'");
|
||||
$$ = finish_parmlist (build_tree_list (NULL_TREE,
|
||||
$1.t), 0);
|
||||
$1.t), 0);
|
||||
yyungetc (':', 0);
|
||||
yychar = ')';
|
||||
}
|
||||
@ -3776,20 +3780,20 @@ named_parm:
|
||||
{ $$.new_type_flag = $1.new_type_flag;
|
||||
$$.t = build_tree_list ($1.t, $2); }
|
||||
| typed_typespecs declarator
|
||||
{ $$.t = build_tree_list ($1.t, $2);
|
||||
{ $$.t = build_tree_list ($1.t, $2);
|
||||
$$.new_type_flag = $1.new_type_flag; }
|
||||
| typespec declarator
|
||||
{ $$.t = build_tree_list (build_tree_list (NULL_TREE, $1.t),
|
||||
$2);
|
||||
$2);
|
||||
$$.new_type_flag = $1.new_type_flag; }
|
||||
| typed_declspecs1 absdcl
|
||||
{ $$.t = build_tree_list ($1.t, $2);
|
||||
$$.new_type_flag = $1.new_type_flag; }
|
||||
| typed_declspecs1 %prec EMPTY
|
||||
{ $$.t = build_tree_list ($1.t, NULL_TREE);
|
||||
{ $$.t = build_tree_list ($1.t, NULL_TREE);
|
||||
$$.new_type_flag = $1.new_type_flag; }
|
||||
| declmods notype_declarator
|
||||
{ $$.t = build_tree_list ($1.t, $2);
|
||||
{ $$.t = build_tree_list ($1.t, $2);
|
||||
$$.new_type_flag = 0; }
|
||||
;
|
||||
|
||||
|
@ -86,7 +86,7 @@ struct unparsed_text GTY(())
|
||||
struct token_chunk * tokens; /* Start of the token list. */
|
||||
|
||||
struct token_chunk *last_chunk; /* End of the token list. */
|
||||
short last_pos; /* Number of tokens used in the last chunk of
|
||||
short last_pos; /* Number of tokens used in the last chunk of
|
||||
TOKENS. */
|
||||
|
||||
short cur_pos; /* Current token in 'cur_chunk', when rescanning. */
|
||||
@ -126,7 +126,7 @@ static SPEW_INLINE void consume_token PARAMS ((void));
|
||||
static SPEW_INLINE int read_process_identifier PARAMS ((YYSTYPE *));
|
||||
|
||||
static SPEW_INLINE void feed_input PARAMS ((struct unparsed_text *));
|
||||
static SPEW_INLINE struct token * space_for_token
|
||||
static SPEW_INLINE struct token * space_for_token
|
||||
PARAMS ((struct unparsed_text *t));
|
||||
static SPEW_INLINE struct token * remove_last_token
|
||||
PARAMS ((struct unparsed_text *t));
|
||||
@ -161,10 +161,11 @@ static enum cpp_ttype last_token;
|
||||
static tree last_token_id;
|
||||
|
||||
/* From lex.c: */
|
||||
/* the declaration found for the last IDENTIFIER token read in.
|
||||
yylex must look this up to detect typedefs, which get token type TYPENAME,
|
||||
so it is left around in case the identifier is not a typedef but is
|
||||
used in a context which makes it a reference to a variable. */
|
||||
/* the declaration found for the last IDENTIFIER token read in. yylex
|
||||
must look this up to detect typedefs, which get token type
|
||||
tTYPENAME, so it is left around in case the identifier is not a
|
||||
typedef but is used in a context which makes it a reference to a
|
||||
variable. */
|
||||
extern tree lastiddecl; /* let our brains leak out here too */
|
||||
extern int yychar; /* the lookahead symbol */
|
||||
extern YYSTYPE yylval; /* the semantic value of the */
|
||||
@ -178,7 +179,7 @@ static int first_token;
|
||||
through and parse all of them using do_pending_defargs. Since yacc
|
||||
parsers are not reentrant, we retain defargs state in these two
|
||||
variables so that subsequent calls to do_pending_defargs can resume
|
||||
where the previous call left off. DEFARG_FNS is a tree_list where
|
||||
where the previous call left off. DEFARG_FNS is a tree_list where
|
||||
the TREE_TYPE is the current_class_type, TREE_VALUE is the FUNCTION_DECL,
|
||||
and TREE_PURPOSE is the list unprocessed dependent functions. */
|
||||
|
||||
@ -359,7 +360,7 @@ read_token (t)
|
||||
case CPP_EOF:
|
||||
t->yychar = 0;
|
||||
break;
|
||||
|
||||
|
||||
case CPP_NAME:
|
||||
t->yychar = read_process_identifier (&t->yylval);
|
||||
break;
|
||||
@ -486,12 +487,12 @@ next_token (t)
|
||||
feed->input->cur_chunk = feed->input->cur_chunk->next;
|
||||
feed->input->cur_pos = 0;
|
||||
}
|
||||
memcpy (t, feed->input->cur_chunk->toks + feed->input->cur_pos,
|
||||
memcpy (t, feed->input->cur_chunk->toks + feed->input->cur_pos,
|
||||
sizeof (struct token));
|
||||
feed->input->cur_pos++;
|
||||
return t->yychar;
|
||||
}
|
||||
|
||||
|
||||
memcpy (t, &Teosi, sizeof (struct token));
|
||||
return END_OF_SAVED_INPUT;
|
||||
}
|
||||
@ -579,7 +580,7 @@ scan_tokens (n)
|
||||
goto pad_tokens;
|
||||
}
|
||||
return;
|
||||
|
||||
|
||||
pad_tokens:
|
||||
while (num_tokens () <= n)
|
||||
obstack_grow (&token_obstack, &Tpad, sizeof (struct token));
|
||||
@ -605,7 +606,7 @@ identifier_type (decl)
|
||||
{
|
||||
if (TREE_CODE (DECL_TEMPLATE_RESULT (decl)) == TYPE_DECL)
|
||||
return PTYPENAME;
|
||||
else if (looking_for_template)
|
||||
else if (looking_for_template)
|
||||
return PFUNCNAME;
|
||||
}
|
||||
if (looking_for_template && really_overloaded_fn (decl))
|
||||
@ -615,7 +616,7 @@ identifier_type (decl)
|
||||
decl = TREE_VALUE (decl);
|
||||
|
||||
for (t = decl; t != NULL_TREE; t = OVL_CHAIN (t))
|
||||
if (DECL_FUNCTION_TEMPLATE_P (OVL_FUNCTION (t)))
|
||||
if (DECL_FUNCTION_TEMPLATE_P (OVL_FUNCTION (t)))
|
||||
return PFUNCNAME;
|
||||
}
|
||||
if (TREE_CODE (decl) == NAMESPACE_DECL)
|
||||
@ -636,11 +637,11 @@ identifier_type (decl)
|
||||
if (t && t == decl)
|
||||
return SELFNAME;
|
||||
|
||||
return TYPENAME;
|
||||
return tTYPENAME;
|
||||
}
|
||||
|
||||
/* token[0] == AGGR (struct/union/enum)
|
||||
Thus, token[1] is either a TYPENAME or a TYPENAME_DEFN.
|
||||
Thus, token[1] is either a tTYPENAME or a TYPENAME_DEFN.
|
||||
If token[2] == '{' or ':' then it's TYPENAME_DEFN.
|
||||
It's also a definition if it's a forward declaration (as in 'struct Foo;')
|
||||
which we can tell if token[2] == ';' *and* token[-1] != FRIEND or NEW. */
|
||||
@ -649,10 +650,10 @@ static SPEW_INLINE void
|
||||
do_aggr ()
|
||||
{
|
||||
int yc1, yc2;
|
||||
|
||||
|
||||
scan_tokens (2);
|
||||
yc1 = nth_token (1)->yychar;
|
||||
if (yc1 != TYPENAME && yc1 != IDENTIFIER && yc1 != PTYPENAME)
|
||||
if (yc1 != tTYPENAME && yc1 != IDENTIFIER && yc1 != PTYPENAME)
|
||||
return;
|
||||
yc2 = nth_token (2)->yychar;
|
||||
if (yc2 == ';')
|
||||
@ -667,7 +668,7 @@ do_aggr ()
|
||||
|
||||
switch (yc1)
|
||||
{
|
||||
case TYPENAME:
|
||||
case tTYPENAME:
|
||||
nth_token (1)->yychar = TYPENAME_DEFN;
|
||||
break;
|
||||
case PTYPENAME:
|
||||
@ -679,7 +680,7 @@ do_aggr ()
|
||||
default:
|
||||
abort ();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
see_typename ()
|
||||
@ -739,7 +740,7 @@ yylex ()
|
||||
{
|
||||
case EMPTY:
|
||||
/* This is a lexical no-op. */
|
||||
#ifdef SPEW_DEBUG
|
||||
#ifdef SPEW_DEBUG
|
||||
if (spew_debug)
|
||||
debug_yychar (yychr);
|
||||
#endif
|
||||
@ -758,14 +759,14 @@ yylex ()
|
||||
case IDENTIFIER:
|
||||
{
|
||||
int peek;
|
||||
|
||||
|
||||
scan_tokens (1);
|
||||
peek = nth_token (1)->yychar;
|
||||
yychr = frob_id (yychr, peek, &nth_token (0)->yylval.ttype);
|
||||
break;
|
||||
}
|
||||
case IDENTIFIER_DEFN:
|
||||
case TYPENAME:
|
||||
case tTYPENAME:
|
||||
case TYPENAME_DEFN:
|
||||
case PTYPENAME:
|
||||
case PTYPENAME_DEFN:
|
||||
@ -831,13 +832,13 @@ yylex ()
|
||||
yychar = yychr;
|
||||
{
|
||||
struct token *tok = nth_token (0);
|
||||
|
||||
|
||||
yylval = tok->yylval;
|
||||
if (tok->lineno)
|
||||
lineno = tok->lineno;
|
||||
}
|
||||
|
||||
#ifdef SPEW_DEBUG
|
||||
#ifdef SPEW_DEBUG
|
||||
if (spew_debug)
|
||||
debug_yychar (yychr);
|
||||
#endif
|
||||
@ -883,7 +884,7 @@ frob_id (yyc, peek, idp)
|
||||
{
|
||||
tree trrr;
|
||||
int old_looking_for_typename = 0;
|
||||
|
||||
|
||||
if (peek == SCOPE)
|
||||
{
|
||||
/* Don't interfere with the setting from an 'aggr' prefix. */
|
||||
@ -898,7 +899,7 @@ frob_id (yyc, peek, idp)
|
||||
yyc = identifier_type (trrr);
|
||||
switch(yyc)
|
||||
{
|
||||
case TYPENAME:
|
||||
case tTYPENAME:
|
||||
case SELFNAME:
|
||||
case NSNAME:
|
||||
case PTYPENAME:
|
||||
@ -1042,7 +1043,7 @@ space_for_token (t)
|
||||
t->last_chunk->next = ggc_alloc (sizeof (*t->last_chunk->next));
|
||||
t->last_chunk = t->last_chunk->next;
|
||||
t->last_chunk->next = NULL;
|
||||
|
||||
|
||||
t->last_pos = 1;
|
||||
return t->last_chunk->toks;
|
||||
}
|
||||
@ -1134,7 +1135,7 @@ snarf_block (t)
|
||||
{
|
||||
if (!look_for_catch)
|
||||
break;
|
||||
|
||||
|
||||
if (next_token (space_for_token (t)) != CATCH)
|
||||
{
|
||||
push_token (remove_last_token (t));
|
||||
@ -1149,7 +1150,7 @@ snarf_block (t)
|
||||
if (look_for_lbrac)
|
||||
{
|
||||
struct token *fake;
|
||||
|
||||
|
||||
error ("function body for constructor missing");
|
||||
/* fake a { } to avoid further errors */
|
||||
fake = space_for_token (t);
|
||||
@ -1183,7 +1184,7 @@ snarf_method (decl)
|
||||
struct unparsed_text *meth;
|
||||
|
||||
meth = alloc_unparsed_text (starting_filename, starting_lineno, decl,
|
||||
(interface_unknown ? 1
|
||||
(interface_unknown ? 1
|
||||
: (interface_only ? 0 : 2)));
|
||||
|
||||
snarf_block (meth);
|
||||
@ -1284,7 +1285,7 @@ add_defarg_fn (decl)
|
||||
TREE_VALUE (defarg_fns) = decl;
|
||||
else
|
||||
{
|
||||
defarg_fns = tree_cons (NULL_TREE, decl, defarg_fns);
|
||||
defarg_fns = tree_cons (NULL_TREE, decl, defarg_fns);
|
||||
TREE_TYPE (defarg_fns) = current_class_type;
|
||||
}
|
||||
}
|
||||
@ -1313,7 +1314,7 @@ finish_defarg ()
|
||||
error ("parse error at end of saved function text");
|
||||
|
||||
end_input ();
|
||||
}
|
||||
}
|
||||
|
||||
/* Main function for deferred parsing of default arguments. Called from
|
||||
the parser. */
|
||||
@ -1327,7 +1328,7 @@ do_pending_defargs ()
|
||||
for (; defarg_fns;)
|
||||
{
|
||||
tree current = defarg_fns;
|
||||
|
||||
|
||||
tree defarg_fn = TREE_VALUE (defarg_fns);
|
||||
if (defarg_parm == NULL_TREE)
|
||||
{
|
||||
@ -1367,7 +1368,7 @@ do_pending_defargs ()
|
||||
|
||||
poplevel (0, 0, 0);
|
||||
pop_nested_class ();
|
||||
|
||||
|
||||
defarg_fns = TREE_CHAIN (defarg_fns);
|
||||
if (defarg_depfns)
|
||||
{
|
||||
@ -1375,8 +1376,8 @@ do_pending_defargs ()
|
||||
of defarg_fns. We will need to reprocess this function, and
|
||||
check for circular dependencies. */
|
||||
tree a, b;
|
||||
|
||||
for (a = defarg_depfns, b = TREE_PURPOSE (current); a && b;
|
||||
|
||||
for (a = defarg_depfns, b = TREE_PURPOSE (current); a && b;
|
||||
a = TREE_CHAIN (a), b = TREE_CHAIN (b))
|
||||
if (TREE_VALUE (a) != TREE_VALUE (b))
|
||||
goto different;
|
||||
@ -1392,7 +1393,7 @@ do_pending_defargs ()
|
||||
cp_warning_at ("circular dependency in default args of `%#D'", defarg_fn);
|
||||
/* No need to say what else is dependent, as they will be
|
||||
picked up in another pass. */
|
||||
|
||||
|
||||
/* Immediately repeat, but marked so that we break the loop. */
|
||||
defarg_fns = current;
|
||||
TREE_PURPOSE (current) = error_mark_node;
|
||||
@ -1413,7 +1414,7 @@ done_pending_defargs ()
|
||||
{
|
||||
tree fn = TREE_VALUE (defarg_fnsdone);
|
||||
tree parms;
|
||||
|
||||
|
||||
if (TREE_CODE (fn) == FUNCTION_DECL)
|
||||
parms = TYPE_ARG_TYPES (TREE_TYPE (fn));
|
||||
else
|
||||
@ -1460,7 +1461,7 @@ replace_defarg (arg, init)
|
||||
}
|
||||
}
|
||||
|
||||
#ifdef SPEW_DEBUG
|
||||
#ifdef SPEW_DEBUG
|
||||
/* debug_yychar takes a yychar (token number) value and prints its name. */
|
||||
|
||||
static void
|
||||
@ -1469,7 +1470,7 @@ debug_yychar (yy)
|
||||
{
|
||||
if (yy<256)
|
||||
fprintf (stderr, "->%d < %c >\n", lineno, yy);
|
||||
else if (yy == IDENTIFIER || yy == TYPENAME)
|
||||
else if (yy == IDENTIFIER || yy == tTYPENAME)
|
||||
{
|
||||
const char *id;
|
||||
if (TREE_CODE (yylval.ttype) == IDENTIFIER_NODE)
|
||||
|
@ -73,6 +73,7 @@ typedef_struct: ENT_TYPEDEF_STRUCT options '{' struct_fields '}' ID
|
||||
lexer_toplevel_done = 1;
|
||||
}
|
||||
';'
|
||||
{}
|
||||
| ENT_STRUCT options '{' struct_fields '}'
|
||||
{
|
||||
new_structure ($1->u.s.tag, UNION_P ($1), &lexer_line,
|
||||
@ -80,6 +81,7 @@ typedef_struct: ENT_TYPEDEF_STRUCT options '{' struct_fields '}' ID
|
||||
lexer_toplevel_done = 1;
|
||||
}
|
||||
';'
|
||||
{}
|
||||
;
|
||||
|
||||
externstatic: ENT_EXTERNSTATIC options lasttype ID semiequal
|
||||
|
Loading…
x
Reference in New Issue
Block a user