Commit 863adfc0 by Mike Stump

69th Cygnus<->FSF merge

From-SVN: r9606
parent f8e48ed4
Tue May 9 19:10:33 1995 Mike Stump <mrs@cygnus.com>
* decl2.c: Add flag_new_for_scope for new -ffor-scope flag.
* parse.y (FOR): Conditionalize the pushing and poping of scope for
the for-init-statement upon the new flag_new_for_scope.
* parse.y (try_block): Simplify and use compstmt.
Mon May 8 12:41:52 1995 Jason Merrill <jason@phydeaux.cygnus.com>
* decl.c (define_function): Mark function decl artificial.
Sun May 7 00:51:28 1995 Jason Merrill <jason@phydeaux.cygnus.com>
* parse.y (simple_stmt, FOR): Put back push/pop for condition scope.
* decl2.c (grokclassfn): DECLs don't have cv-qualified types.
* tree.c (build_cplus_method_type): Ditto.
* cp-tree.h (SET_DECL_ARTIFICIAL): Just set DECL_ARTIFICIAL to 1.
* typeck.c (build_function_call_real): If convert_arguments failed,
just bail.
(convert_arguments): If one of the arguments is error_mark_node,
just bail.
Sat May 6 02:39:41 1995 Jason Merrill <jason@phydeaux.cygnus.com>
* decl.c (duplicate_decls): Don't check DECL_NOT_REALLY_EXTERN for
decls that don't include it.
Fri May 5 14:23:30 1995 Jason Merrill <jason@phydeaux.cygnus.com>
* decl.c (duplicate_decls): Decls that have DECL_INTERFACE_KNOWN or
DECL_NOT_REALLY_EXTERN set aren't extern decls.
* typeck.c (build_indirect_ref): Don't call default_conversion for a
parameter of reference_type.
* cvt.c (convert_from_reference): Just use build_indirect_ref.
* pt.c (do_type_instantiation): Only instantiate member functions
that actually come from templates.
Fri May 5 09:46:05 1995 Mike Stump <mrs@cygnus.com>
* parse.y: Generalized cleanup of poplevels, and compound statements
and compound statements in try blocks. Rewritten `for' rule so that
the scope of variables declared in the for clause is shortened to
span just to the end of the statement, instead of the whole
containing block.
Fri May 5 00:37:14 1995 Jason Merrill <jason@phydeaux.cygnus.com>
* call.c (convert_harshness): Handle pointers to members better.
Thu May 4 16:00:26 1995 Jason Merrill <jason@phydeaux.cygnus.com>
* decl2.c (delete_sanity): Do access control here.
* init.c (build_delete): Instead of here.
* Make-lang.in: Build c++filt.
Wed May 3 02:59:53 1995 Jason Merrill <jason@phydeaux.cygnus.com>
* decl2.c (cplus_decl_attributes): If we just modified a TYPE_DECL,
update our IDENTIFIER_TYPE_VALUE.
Fri Apr 28 07:58:41 1995 Jason Merrill <jason@phydeaux.cygnus.com> Fri Apr 28 07:58:41 1995 Jason Merrill <jason@phydeaux.cygnus.com>
* lex.c (cons_up_default_function): Fix linkage of #pragma * lex.c (cons_up_default_function): Fix linkage of #pragma
......
...@@ -49,6 +49,8 @@ GXX_INSTALL_NAME = `t='$(program_transform_name)'; echo g++ | sed $$t` ...@@ -49,6 +49,8 @@ GXX_INSTALL_NAME = `t='$(program_transform_name)'; echo g++ | sed $$t`
CXX_CROSS_NAME = `t='$(program_transform_cross_name)'; echo c++ | sed $$t` CXX_CROSS_NAME = `t='$(program_transform_cross_name)'; echo c++ | sed $$t`
GXX_CROSS_NAME = `t='$(program_transform_cross_name)'; echo g++ | sed $$t` GXX_CROSS_NAME = `t='$(program_transform_cross_name)'; echo g++ | sed $$t`
# The name to use for the demangler program.
DEMANGLER_PROG = c++filt
# Define the names for selecting c++ in LANGUAGES. # Define the names for selecting c++ in LANGUAGES.
# Note that it would be nice to move the dependency on g++ # Note that it would be nice to move the dependency on g++
...@@ -68,6 +70,17 @@ g++-cross: $(srcdir)/cp/g++.c version.o $(LIBDEPS) ...@@ -68,6 +70,17 @@ g++-cross: $(srcdir)/cp/g++.c version.o $(LIBDEPS)
$(CC) $(ALL_CFLAGS) $(INCLUDES) $(LDFLAGS) -o g++-cross \ $(CC) $(ALL_CFLAGS) $(INCLUDES) $(LDFLAGS) -o g++-cross \
-DGCC_NAME=\"$(GCC_CROSS_NAME)\" $(srcdir)/cp/g++.c version.o $(LIBS) -DGCC_NAME=\"$(GCC_CROSS_NAME)\" $(srcdir)/cp/g++.c version.o $(LIBS)
cxxmain.o: cplus-dem.c demangle.h
rm -f cxxmain.c
ln -s $(srcdir)/cplus-dem.c cxxmain.c
$(CC) -c -DMAIN $(ALL_CFLAGS) $(ALL_CPPFLAGS) $(INCLUDES) \
-DVERSION='"$(version)"' cxxmain.c
rm -f cxxmain.c
$(DEMANGLER_PROG): cxxmain.o underscore.o getopt.o getopt1.o
$(CC) $(ALL_CFLAGS) $(LDFLAGS) -o $(DEMANGLER_PROG) \
cxxmain.o underscore.o getopt.o getopt1.o
CXX_SRCS = $(srcdir)/cp/call.c $(srcdir)/cp/decl2.c \ CXX_SRCS = $(srcdir)/cp/call.c $(srcdir)/cp/decl2.c \
$(srcdir)/cp/except.c $(srcdir)/cp/input.c $(srcdir)/cp/pt.c \ $(srcdir)/cp/except.c $(srcdir)/cp/input.c $(srcdir)/cp/pt.c \
$(srcdir)/cp/spew.c $(srcdir)/cp/xref.c $(srcdir)/cp/class.c \ $(srcdir)/cp/spew.c $(srcdir)/cp/xref.c $(srcdir)/cp/class.c \
...@@ -83,10 +96,10 @@ cc1plus: $(P) $(CXX_SRCS) $(LIBDEPS) stamp-objlist c-common.o c-pragma.o ...@@ -83,10 +96,10 @@ cc1plus: $(P) $(CXX_SRCS) $(LIBDEPS) stamp-objlist c-common.o c-pragma.o
# Build hooks: # Build hooks:
c++.all.build: g++ c++.all.build: g++ $(DEMANGLER_PROG)
c++.all.cross: g++-cross c++.all.cross: g++-cross $(DEMANGLER_PROG)
c++.start.encap: g++ c++.start.encap: g++
c++.rest.encap: c++.rest.encap: $(DEMANGLER_PROG)
c++.info: c++.info:
c++.dvi: c++.dvi:
......
...@@ -172,10 +172,33 @@ convert_harshness (type, parmtype, parm) ...@@ -172,10 +172,33 @@ convert_harshness (type, parmtype, parm)
if (coder != TREE_CODE (type)) if (coder != TREE_CODE (type))
return EVIL_RETURN (h); return EVIL_RETURN (h);
if (type != parmtype && coder == METHOD_TYPE)
{
tree ttl = TYPE_METHOD_BASETYPE (type);
tree ttr = TYPE_METHOD_BASETYPE (parmtype);
int b_or_d = get_base_distance (ttr, ttl, 0, 0);
if (b_or_d < 0)
{
b_or_d = get_base_distance (ttl, ttr, 0, 0);
if (b_or_d < 0)
return EVIL_RETURN (h);
h.distance = -b_or_d;
}
else
h.distance = b_or_d;
h.code = STD_CODE;
type = build_function_type
(TREE_TYPE (type), TREE_CHAIN (TYPE_ARG_TYPES (type)));
parmtype = build_function_type
(TREE_TYPE (parmtype), TREE_CHAIN (TYPE_ARG_TYPES (parmtype)));
}
/* We allow the default conversion between function type /* We allow the default conversion between function type
and pointer-to-function type for free. */ and pointer-to-function type for free. */
if (type == parmtype) if (type == parmtype)
return ZERO_RETURN (h); return h;
if (pedantic) if (pedantic)
return EVIL_RETURN (h); return EVIL_RETURN (h);
...@@ -272,28 +295,34 @@ convert_harshness (type, parmtype, parm) ...@@ -272,28 +295,34 @@ convert_harshness (type, parmtype, parm)
} }
else if (codel == POINTER_TYPE && coder == OFFSET_TYPE) else if (codel == POINTER_TYPE && coder == OFFSET_TYPE)
{ {
tree ttl, ttr;
/* Get to the OFFSET_TYPE that this might be. */ /* Get to the OFFSET_TYPE that this might be. */
type = TREE_TYPE (type); type = TREE_TYPE (type);
if (coder != TREE_CODE (type)) if (coder != TREE_CODE (type))
return EVIL_RETURN (h); return EVIL_RETURN (h);
if (TYPE_OFFSET_BASETYPE (type) == TYPE_OFFSET_BASETYPE (parmtype)) ttl = TYPE_OFFSET_BASETYPE (type);
ttr = TYPE_OFFSET_BASETYPE (parmtype);
if (ttl == ttr)
h.code = 0; h.code = 0;
else if (UNIQUELY_DERIVED_FROM_P (TYPE_OFFSET_BASETYPE (type), else
TYPE_OFFSET_BASETYPE (parmtype)))
{
h.code = STD_CODE;
h.distance = 1;
}
else if (UNIQUELY_DERIVED_FROM_P (TYPE_OFFSET_BASETYPE (parmtype),
TYPE_OFFSET_BASETYPE (type)))
{ {
int b_or_d = get_base_distance (ttr, ttl, 0, 0);
if (b_or_d < 0)
{
b_or_d = get_base_distance (ttl, ttr, 0, 0);
if (b_or_d < 0)
return EVIL_RETURN (h);
h.distance = -b_or_d;
}
else
h.distance = b_or_d;
h.code = STD_CODE; h.code = STD_CODE;
h.distance = -1;
} }
else
return EVIL_RETURN (h);
/* Now test the OFFSET_TYPE's target compatibility. */ /* Now test the OFFSET_TYPE's target compatibility. */
type = TREE_TYPE (type); type = TREE_TYPE (type);
parmtype = TREE_TYPE (parmtype); parmtype = TREE_TYPE (parmtype);
......
...@@ -1141,8 +1141,7 @@ struct lang_decl ...@@ -1141,8 +1141,7 @@ struct lang_decl
#endif #endif
/* This _DECL represents a compiler-generated entity. */ /* This _DECL represents a compiler-generated entity. */
#define DECL_ARTIFICIAL(NODE) (DECL_SOURCE_LINE (NODE) == 0) #define SET_DECL_ARTIFICIAL(NODE) (DECL_ARTIFICIAL (NODE) = 1)
#define SET_DECL_ARTIFICIAL(NODE) (DECL_SOURCE_LINE (NODE) = 0)
/* Record whether a typedef for type `int' was actually `signed int'. */ /* Record whether a typedef for type `int' was actually `signed int'. */
#define C_TYPEDEF_EXPLICITLY_SIGNED(exp) DECL_LANG_FLAG_1 ((exp)) #define C_TYPEDEF_EXPLICITLY_SIGNED(exp) DECL_LANG_FLAG_1 ((exp))
......
...@@ -855,30 +855,8 @@ convert_from_reference (val) ...@@ -855,30 +855,8 @@ convert_from_reference (val)
if (TREE_CODE (type) == OFFSET_TYPE) if (TREE_CODE (type) == OFFSET_TYPE)
type = TREE_TYPE (type); type = TREE_TYPE (type);
if (TREE_CODE (type) == REFERENCE_TYPE) if (TREE_CODE (type) == REFERENCE_TYPE)
{ return build_indirect_ref (val, NULL_PTR);
tree target_type = TREE_TYPE (type);
tree nval;
/* This can happen if we cast to a reference type. */
if (TREE_CODE (val) == ADDR_EXPR)
{
nval = build1 (NOP_EXPR, build_pointer_type (target_type), val);
nval = build_indirect_ref (nval, NULL_PTR);
/* The below was missing, are other important flags missing too? */
TREE_SIDE_EFFECTS (nval) = TREE_SIDE_EFFECTS (val);
return nval;
}
nval = build1 (INDIRECT_REF, target_type, val);
TREE_THIS_VOLATILE (nval) = TYPE_VOLATILE (target_type);
TREE_SIDE_EFFECTS (nval) = TYPE_VOLATILE (target_type);
TREE_READONLY (nval) = TYPE_READONLY (target_type);
/* The below was missing, are other important flags missing too? */
TREE_SIDE_EFFECTS (nval) |= TREE_SIDE_EFFECTS (val);
return nval;
}
return val; return val;
} }
......
...@@ -2507,7 +2507,8 @@ duplicate_decls (newdecl, olddecl) ...@@ -2507,7 +2507,8 @@ duplicate_decls (newdecl, olddecl)
} }
/* Merge the storage class information. */ /* Merge the storage class information. */
if (DECL_EXTERNAL (newdecl)) if (DECL_EXTERNAL (newdecl) && ! DECL_INTERFACE_KNOWN (newdecl)
&& ! (DECL_LANG_SPECIFIC (newdecl) && DECL_NOT_REALLY_EXTERN (newdecl)))
{ {
TREE_STATIC (newdecl) = TREE_STATIC (olddecl); TREE_STATIC (newdecl) = TREE_STATIC (olddecl);
DECL_EXTERNAL (newdecl) = DECL_EXTERNAL (olddecl); DECL_EXTERNAL (newdecl) = DECL_EXTERNAL (olddecl);
...@@ -5261,6 +5262,7 @@ define_function (name, type, function_code, pfn, library_name) ...@@ -5261,6 +5262,7 @@ define_function (name, type, function_code, pfn, library_name)
DECL_EXTERNAL (decl) = 1; DECL_EXTERNAL (decl) = 1;
TREE_PUBLIC (decl) = 1; TREE_PUBLIC (decl) = 1;
DECL_INTERFACE_KNOWN (decl) = 1; DECL_INTERFACE_KNOWN (decl) = 1;
DECL_ARTIFICIAL (decl) = 1;
/* Since `pushdecl' relies on DECL_ASSEMBLER_NAME instead of DECL_NAME, /* Since `pushdecl' relies on DECL_ASSEMBLER_NAME instead of DECL_NAME,
we cannot change DECL_ASSEMBLER_NAME until we have installed this we cannot change DECL_ASSEMBLER_NAME until we have installed this
......
...@@ -359,6 +359,11 @@ int flag_operator_names; ...@@ -359,6 +359,11 @@ int flag_operator_names;
int flag_check_new; int flag_check_new;
/* Nonzero if we want the new ANSI rules for pushing a new scope for `for'
initialization variables. Default to on. */
int flag_new_for_scope = 1;
/* Table of language-dependent -f options. /* Table of language-dependent -f options.
STRING is the option name. VARIABLE is the address of the variable. STRING is the option name. VARIABLE is the address of the variable.
ON_VALUE is the value to store in VARIABLE ON_VALUE is the value to store in VARIABLE
...@@ -405,7 +410,8 @@ static struct { char *string; int *variable; int on_value;} lang_f_options[] = ...@@ -405,7 +410,8 @@ static struct { char *string; int *variable; int on_value;} lang_f_options[] =
{"gnu-keywords", &flag_no_gnu_keywords, 0}, {"gnu-keywords", &flag_no_gnu_keywords, 0},
{"operator-names", &flag_operator_names, 1}, {"operator-names", &flag_operator_names, 1},
{"check-new", &flag_check_new, 1}, {"check-new", &flag_check_new, 1},
{"repo", &flag_use_repository, 1} {"repo", &flag_use_repository, 1},
{"for-scope", &flag_new_for_scope, 1}
}; };
/* Decode the string P as a language-specific option. /* Decode the string P as a language-specific option.
...@@ -418,7 +424,7 @@ lang_decode_option (p) ...@@ -418,7 +424,7 @@ lang_decode_option (p)
{ {
if (!strcmp (p, "-ftraditional") || !strcmp (p, "-traditional")) if (!strcmp (p, "-ftraditional") || !strcmp (p, "-traditional"))
flag_traditional = 1, dollars_in_ident = 1, flag_writable_strings = 1, flag_traditional = 1, dollars_in_ident = 1, flag_writable_strings = 1,
flag_this_is_variable = 1; flag_this_is_variable = 1, flag_new_for_scope = 0;
/* The +e options are for cfront compatibility. They come in as /* The +e options are for cfront compatibility. They come in as
`-+eN', to kludge around gcc.c's argument handling. */ `-+eN', to kludge around gcc.c's argument handling. */
else if (p[0] == '-' && p[1] == '+' && p[2] == 'e') else if (p[0] == '-' && p[1] == '+' && p[2] == 'e')
...@@ -872,10 +878,11 @@ grokclassfn (ctype, cname, function, flags, quals) ...@@ -872,10 +878,11 @@ grokclassfn (ctype, cname, function, flags, quals)
/* Right now we just make this a pointer. But later /* Right now we just make this a pointer. But later
we may wish to make it special. */ we may wish to make it special. */
tree type = TREE_VALUE (arg_types); tree type = TREE_VALUE (arg_types);
int constp = 1;
if ((flag_this_is_variable > 0) if ((flag_this_is_variable > 0)
&& (flags == DTOR_FLAG || DECL_CONSTRUCTOR_P (function))) && (flags == DTOR_FLAG || DECL_CONSTRUCTOR_P (function)))
type = TYPE_MAIN_VARIANT (type); constp = 0;
if (DECL_CONSTRUCTOR_P (function)) if (DECL_CONSTRUCTOR_P (function))
{ {
...@@ -902,7 +909,7 @@ grokclassfn (ctype, cname, function, flags, quals) ...@@ -902,7 +909,7 @@ grokclassfn (ctype, cname, function, flags, quals)
/* We can make this a register, so long as we don't /* We can make this a register, so long as we don't
accidentally complain if someone tries to take its address. */ accidentally complain if someone tries to take its address. */
DECL_REGISTER (parm) = 1; DECL_REGISTER (parm) = 1;
if (TYPE_READONLY (type)) if (constp)
TREE_READONLY (parm) = 1; TREE_READONLY (parm) = 1;
TREE_CHAIN (parm) = last_function_parms; TREE_CHAIN (parm) = last_function_parms;
last_function_parms = parm; last_function_parms = parm;
...@@ -1178,9 +1185,22 @@ delete_sanity (exp, size, doing_vec, use_global_delete) ...@@ -1178,9 +1185,22 @@ delete_sanity (exp, size, doing_vec, use_global_delete)
return build_vec_delete (t, maxindex, elt_size, integer_one_node, return build_vec_delete (t, maxindex, elt_size, integer_one_node,
integer_two_node, use_global_delete); integer_two_node, use_global_delete);
else else
return build_delete (type, t, integer_three_node, {
LOOKUP_NORMAL|LOOKUP_HAS_IN_CHARGE, if (IS_AGGR_TYPE (TREE_TYPE (type))
use_global_delete); && TYPE_GETS_REG_DELETE (TREE_TYPE (type)))
{
/* Only do access checking here; we'll be calling op delete
from the destructor. */
tree tmp = build_opfncall (DELETE_EXPR, LOOKUP_NORMAL, t,
size_zero_node, NULL_TREE);
if (tmp == error_mark_node)
return error_mark_node;
}
return build_delete (type, t, integer_three_node,
LOOKUP_NORMAL|LOOKUP_HAS_IN_CHARGE,
use_global_delete);
}
} }
/* Sanity check: report error if this function FUNCTION is not /* Sanity check: report error if this function FUNCTION is not
...@@ -1956,6 +1976,9 @@ cplus_decl_attributes (decl, attributes, prefix_attributes) ...@@ -1956,6 +1976,9 @@ cplus_decl_attributes (decl, attributes, prefix_attributes)
decl = DECL_TEMPLATE_RESULT (decl); decl = DECL_TEMPLATE_RESULT (decl);
decl_attributes (decl, attributes, prefix_attributes); decl_attributes (decl, attributes, prefix_attributes);
if (TREE_CODE (decl) == TYPE_DECL)
SET_IDENTIFIER_TYPE_VALUE (DECL_NAME (decl), TREE_TYPE (decl));
} }
/* CONSTRUCTOR_NAME: /* CONSTRUCTOR_NAME:
......
...@@ -3626,18 +3626,7 @@ build_delete (type, addr, auto_delete, flags, use_global_delete) ...@@ -3626,18 +3626,7 @@ build_delete (type, addr, auto_delete, flags, use_global_delete)
auto_delete, integer_two_node)); auto_delete, integer_two_node));
} }
else else
{ passed_auto_delete = auto_delete;
if (TYPE_GETS_REG_DELETE (type))
{
/* Only do access checking here; we'll be calling op delete
from the destructor. */
tree t = build_opfncall (DELETE_EXPR, LOOKUP_NORMAL, addr,
size_zero_node, NULL_TREE);
if (t == error_mark_node)
return error_mark_node;
}
passed_auto_delete = auto_delete;
}
if (flags & LOOKUP_PROTECT) if (flags & LOOKUP_PROTECT)
{ {
......
...@@ -233,12 +233,12 @@ empty_parms () ...@@ -233,12 +233,12 @@ empty_parms ()
%type <ttype> base_class maybe_base_class_list base_class.1 %type <ttype> base_class maybe_base_class_list base_class.1
%type <ttype> exception_specification_opt ansi_raise_identifier ansi_raise_identifiers %type <ttype> exception_specification_opt ansi_raise_identifier ansi_raise_identifiers
%type <ttype> component_declarator0 %type <ttype> component_declarator0
%type <ttype> forhead.1 operator_name %type <ttype> operator_name
%type <ttype> object aggr %type <ttype> object aggr
%type <itype> new delete %type <itype> new delete
/* %type <ttype> primary_no_id */ /* %type <ttype> primary_no_id */
%type <ttype> nonmomentary_expr maybe_parmlist %type <ttype> nonmomentary_expr maybe_parmlist
%type <itype> forhead.2 initdcl0 notype_initdcl0 member_init_list %type <itype> initdcl0 notype_initdcl0 member_init_list
%type <ttype> template_header template_parm_list template_parm %type <ttype> template_header template_parm_list template_parm
%type <ttype> template_type_parm %type <ttype> template_type_parm
%type <ttype> template_type template_arg_list template_arg %type <ttype> template_type template_arg_list template_arg
...@@ -252,7 +252,7 @@ empty_parms () ...@@ -252,7 +252,7 @@ empty_parms ()
%type <ttype> complex_type_name nested_name_specifier_1 %type <ttype> complex_type_name nested_name_specifier_1
%type <itype> nomods_initdecls nomods_initdcl0 %type <itype> nomods_initdecls nomods_initdcl0
%type <ttype> new_initializer new_placement specialization type_specifier_seq %type <ttype> new_initializer new_placement specialization type_specifier_seq
%type <ttype> using_decl %type <ttype> using_decl .poplevel
/* in order to recognize aggr tags as defining and thus shadowing. */ /* in order to recognize aggr tags as defining and thus shadowing. */
%token TYPENAME_DEFN IDENTIFIER_DEFN PTYPENAME_DEFN %token TYPENAME_DEFN IDENTIFIER_DEFN PTYPENAME_DEFN
...@@ -262,8 +262,6 @@ empty_parms () ...@@ -262,8 +262,6 @@ empty_parms ()
%token NSNAME %token NSNAME
%type <ttype> NSNAME %type <ttype> NSNAME
%type <strtype> .pushlevel
/* Used in lex.c for parsing pragmas. */ /* Used in lex.c for parsing pragmas. */
%token END_OF_LINE %token END_OF_LINE
...@@ -983,12 +981,15 @@ condition: ...@@ -983,12 +981,15 @@ condition:
| expr | expr
; ;
compstmtend:
'}'
| maybe_label_decls stmts '}'
| maybe_label_decls stmts error '}'
| maybe_label_decls error '}'
;
already_scoped_stmt: already_scoped_stmt:
'{' '}' '{' compstmtend
{ finish_stmt (); }
| '{' maybe_label_decls stmts '}'
{ finish_stmt (); }
| '{' maybe_label_decls error '}'
{ finish_stmt (); } { finish_stmt (); }
| simple_stmt | simple_stmt
; ;
...@@ -3105,6 +3106,12 @@ errstmt: error ';' ...@@ -3105,6 +3106,12 @@ errstmt: error ';'
expand_start_bindings (0); } expand_start_bindings (0); }
; ;
.poplevel: /* empty */
{ expand_end_bindings (getdecls (), kept_level_p (), 1);
$$ = poplevel (kept_level_p (), 1, 0);
pop_momentary (); }
;
/* Read zero or more forward-declarations for labels /* Read zero or more forward-declarations for labels
that nested functions can jump to. */ that nested functions can jump to. */
maybe_label_decls: maybe_label_decls:
...@@ -3139,22 +3146,8 @@ compstmt_or_error: ...@@ -3139,22 +3146,8 @@ compstmt_or_error:
| error compstmt | error compstmt
; ;
compstmt: '{' .pushlevel '}' compstmt: '{' .pushlevel compstmtend .poplevel
{ expand_end_bindings (getdecls (), kept_level_p(), 1); { $$ = $4; }
$$ = poplevel (kept_level_p (), 1, 0);
pop_momentary (); }
| '{' .pushlevel maybe_label_decls stmts '}'
{ expand_end_bindings (getdecls (), kept_level_p(), 1);
$$ = poplevel (kept_level_p (), 1, 0);
pop_momentary (); }
| '{' .pushlevel maybe_label_decls stmts error '}'
{ expand_end_bindings (getdecls (), kept_level_p(), 1);
$$ = poplevel (kept_level_p (), 0, 0);
pop_momentary (); }
| '{' .pushlevel maybe_label_decls error '}'
{ expand_end_bindings (getdecls (), kept_level_p(), 1);
$$ = poplevel (kept_level_p (), 0, 0);
pop_momentary (); }
; ;
simple_if: simple_if:
...@@ -3169,10 +3162,8 @@ simple_if: ...@@ -3169,10 +3162,8 @@ simple_if:
implicitly_scoped_stmt: implicitly_scoped_stmt:
compstmt compstmt
{ finish_stmt (); } { finish_stmt (); }
| .pushlevel simple_stmt | .pushlevel simple_stmt .poplevel
{ expand_end_bindings (getdecls (), kept_level_p (), 1); { $$ = $3; }
$$ = poplevel (kept_level_p (), 1, 0);
pop_momentary (); }
; ;
stmt: stmt:
...@@ -3201,11 +3192,9 @@ simple_stmt: ...@@ -3201,11 +3192,9 @@ simple_stmt:
| simple_if ELSE | simple_if ELSE
{ expand_start_else (); } { expand_start_else (); }
implicitly_scoped_stmt implicitly_scoped_stmt
{ expand_end_cond (); { expand_end_cond (); }
expand_end_bindings (getdecls (), kept_level_p (), 1); .poplevel
poplevel (kept_level_p (), 1, 0); { finish_stmt (); }
pop_momentary ();
finish_stmt (); }
| simple_if %prec IF | simple_if %prec IF
{ expand_end_cond (); { expand_end_cond ();
expand_end_bindings (getdecls (), kept_level_p (), 1); expand_end_bindings (getdecls (), kept_level_p (), 1);
...@@ -3219,11 +3208,8 @@ simple_stmt: ...@@ -3219,11 +3208,8 @@ simple_stmt:
cond_stmt_keyword = "while"; } cond_stmt_keyword = "while"; }
.pushlevel paren_cond_or_null .pushlevel paren_cond_or_null
{ expand_exit_loop_if_false (0, $4); } { expand_exit_loop_if_false (0, $4); }
already_scoped_stmt already_scoped_stmt .poplevel
{ expand_end_bindings (getdecls (), kept_level_p (), 1); { expand_end_loop ();
poplevel (kept_level_p (), 1, 0);
pop_momentary ();
expand_end_loop ();
finish_stmt (); } finish_stmt (); }
| DO | DO
{ emit_nop (); { emit_nop ();
...@@ -3238,51 +3224,42 @@ simple_stmt: ...@@ -3238,51 +3224,42 @@ simple_stmt:
expand_end_loop (); expand_end_loop ();
clear_momentary (); clear_momentary ();
finish_stmt (); } finish_stmt (); }
| forhead.1 | FOR
{ extern int flag_new_for_scope;
emit_line_note (input_filename, lineno);
if (flag_new_for_scope)
{
/* Conditionalize .pushlevel */
pushlevel (0);
clear_last_expr ();
push_momentary ();
expand_start_bindings (0);
}
}
'(' for.init.statement
{ emit_nop (); { emit_nop ();
emit_line_note (input_filename, lineno); emit_line_note (input_filename, lineno);
if ($1) cplus_expand_expr_stmt ($1);
expand_start_loop_continue_elsewhere (1); } expand_start_loop_continue_elsewhere (1); }
.pushlevel xcond ';' .pushlevel xcond ';'
{ emit_line_note (input_filename, lineno); { emit_line_note (input_filename, lineno);
if ($4) expand_exit_loop_if_false (0, $4); } if ($7) expand_exit_loop_if_false (0, $7); }
xexpr ')' xexpr ')'
/* Don't let the tree nodes for $7 be discarded /* Don't let the tree nodes for $10 be discarded
by clear_momentary during the parsing of the next stmt. */ by clear_momentary during the parsing of the next stmt. */
{ push_momentary (); } { push_momentary (); }
already_scoped_stmt already_scoped_stmt .poplevel
{ emit_line_note (input_filename, lineno); { emit_line_note (input_filename, lineno);
expand_end_bindings (getdecls (), kept_level_p (), 1);
poplevel (kept_level_p (), 1, 0);
pop_momentary ();
expand_loop_continue_here (); expand_loop_continue_here ();
if ($7) cplus_expand_expr_stmt ($7); if ($10) cplus_expand_expr_stmt ($10);
pop_momentary (); pop_momentary ();
expand_end_loop (); expand_end_loop ();
if (flag_new_for_scope)
{
expand_end_bindings (getdecls (), kept_level_p (), 1);
poplevel (kept_level_p (), 1, 0);
pop_momentary ();
}
finish_stmt (); } finish_stmt (); }
| forhead.2
{ emit_nop ();
emit_line_note (input_filename, lineno);
expand_start_loop_continue_elsewhere (1); }
.pushlevel xcond ';'
{ emit_line_note (input_filename, lineno);
if ($4) expand_exit_loop_if_false (0, $4); }
xexpr ')'
/* Don't let the tree nodes for $7 be discarded
by clear_momentary during the parsing of the next stmt. */
{ push_momentary ();
$<itype>8 = lineno; }
already_scoped_stmt
{ emit_line_note (input_filename, (int) $<itype>8);
expand_end_bindings (getdecls (), kept_level_p (), 1);
poplevel (kept_level_p (), 1, 0);
pop_momentary ();
expand_loop_continue_here ();
if ($7) cplus_expand_expr_stmt ($7);
pop_momentary ();
expand_end_loop ();
finish_stmt ();
}
| SWITCH .pushlevel '(' condition ')' | SWITCH .pushlevel '(' condition ')'
{ emit_line_note (input_filename, lineno); { emit_line_note (input_filename, lineno);
c_expand_start_case ($4); c_expand_start_case ($4);
...@@ -3293,11 +3270,9 @@ simple_stmt: ...@@ -3293,11 +3270,9 @@ simple_stmt:
implicitly_scoped_stmt implicitly_scoped_stmt
{ expand_end_case ($4); { expand_end_case ($4);
pop_momentary (); pop_momentary ();
pop_switch (); pop_switch (); }
expand_end_bindings (getdecls (), kept_level_p (), 1); .poplevel
poplevel (kept_level_p (), 1, 0); { finish_stmt (); }
pop_momentary ();
finish_stmt (); }
| CASE expr_no_commas ':' | CASE expr_no_commas ':'
{ register tree value = check_cp_case_value ($2); { register tree value = check_cp_case_value ($2);
register tree label register tree label
...@@ -3442,43 +3417,20 @@ simple_stmt: ...@@ -3442,43 +3417,20 @@ simple_stmt:
; ;
try_block: try_block:
TRY '{' .pushlevel TRY
{ expand_start_try_stmts (); } { expand_start_try_stmts (); }
ansi_try_stmts compstmt
{ expand_end_try_stmts (); { expand_end_try_stmts ();
expand_start_all_catch (); } expand_start_all_catch (); }
handler_seq handler_seq
{ expand_end_all_catch (); } { expand_end_all_catch (); }
; ;
ansi_try_stmts:
'}'
/* An empty try block is degenerate, but it's better to
do extra work here than to do all the special-case work
everywhere else. */
{ expand_end_bindings (0,1,1);
poplevel (2,0,0);
}
| stmts '}'
{ expand_end_bindings (0,1,1);
poplevel (2,0,0);
}
| error '}'
{ expand_end_bindings (0,1,1);
poplevel (2,0,0);
}
;
handler_seq: handler_seq:
/* empty */ /* empty */
| handler_seq CATCH | handler_seq CATCH .pushlevel handler_args compstmt
{ emit_line_note (input_filename, lineno); } { expand_end_catch_block (); }
.pushlevel handler_args compstmt .poplevel
{ expand_end_catch_block ();
expand_end_bindings (getdecls (), kept_level_p (), 1);
poplevel (kept_level_p (), 1, 0);
pop_momentary ();
}
; ;
type_specifier_seq: type_specifier_seq:
...@@ -3518,24 +3470,11 @@ label_colon: ...@@ -3518,24 +3470,11 @@ label_colon:
{ goto do_label; } { goto do_label; }
; ;
forhead.1: for.init.statement:
FOR '(' ';' xexpr ';'
{ $$ = NULL_TREE; } { if ($1) cplus_expand_expr_stmt ($1); }
| FOR '(' expr ';' | decl
{ $$ = $3; } | '{' compstmtend
| FOR '(' '{' '}'
{ $$ = NULL_TREE; }
;
forhead.2:
FOR '(' decl
{ $$ = 0; }
| FOR '(' error ';'
{ $$ = 0; }
| FOR '(' '{' .pushlevel stmts '}'
{ $$ = 1; }
| FOR '(' '{' .pushlevel error '}'
{ $$ = -1; }
; ;
/* Either a type-qualifier or nothing. First thing in an `asm' statement. */ /* Either a type-qualifier or nothing. First thing in an `asm' statement. */
......
...@@ -2648,10 +2648,11 @@ do_type_instantiation (name, storage) ...@@ -2648,10 +2648,11 @@ do_type_instantiation (name, storage)
/* this should really be done by instantiate_member_templates */ /* this should really be done by instantiate_member_templates */
tmp = TREE_VEC_ELT (CLASSTYPE_METHOD_VEC (t), 0); tmp = TREE_VEC_ELT (CLASSTYPE_METHOD_VEC (t), 0);
for (; tmp; tmp = TREE_CHAIN (tmp)) for (; tmp; tmp = TREE_CHAIN (tmp))
{ if (DECL_TEMPLATE_INSTANTIATION (tmp))
mark_function_instantiated (tmp, extern_p); {
repo_template_instantiated (tmp, extern_p); mark_function_instantiated (tmp, extern_p);
} repo_template_instantiated (tmp, extern_p);
}
#if 0 #if 0
for (tmp = TYPE_FIELDS (t); tmp; tmp = TREE_CHAIN (tmp)) for (tmp = TYPE_FIELDS (t); tmp; tmp = TREE_CHAIN (tmp))
......
...@@ -397,10 +397,8 @@ build_cplus_method_type (basetype, rettype, argtypes) ...@@ -397,10 +397,8 @@ build_cplus_method_type (basetype, rettype, argtypes)
TYPE_READONLY (basetype), TYPE_READONLY (basetype),
TYPE_VOLATILE (basetype)); TYPE_VOLATILE (basetype));
else else
{ ptype = build_pointer_type (basetype);
ptype = build_pointer_type (basetype);
ptype = build_type_variant (ptype, 1, 0);
}
/* The actual arglist for this function includes a "hidden" argument /* The actual arglist for this function includes a "hidden" argument
which is "this". Put it into the list of argument types. */ which is "this". Put it into the list of argument types. */
......
...@@ -1823,7 +1823,8 @@ build_indirect_ref (ptr, errorstring) ...@@ -1823,7 +1823,8 @@ build_indirect_ref (ptr, errorstring)
tree ptr; tree ptr;
char *errorstring; char *errorstring;
{ {
register tree pointer = default_conversion (ptr); register tree pointer = (TREE_CODE (TREE_TYPE (ptr)) == REFERENCE_TYPE ?
ptr : default_conversion (ptr));
register tree type = TREE_TYPE (pointer); register tree type = TREE_TYPE (pointer);
if (ptr == current_class_decl) if (ptr == current_class_decl)
...@@ -2427,6 +2428,9 @@ build_function_call_real (function, params, require_complete, flags) ...@@ -2427,6 +2428,9 @@ build_function_call_real (function, params, require_complete, flags)
coerced_params = convert_arguments (NULL_TREE, TYPE_ARG_TYPES (fntype), coerced_params = convert_arguments (NULL_TREE, TYPE_ARG_TYPES (fntype),
params, fndecl, 0); params, fndecl, 0);
if (coerced_params == error_mark_node)
return error_mark_node;
/* Check for errors in format strings. */ /* Check for errors in format strings. */
if (warn_format && (name || assembler_name)) if (warn_format && (name || assembler_name))
...@@ -2541,7 +2545,7 @@ convert_arguments (return_loc, typelist, values, fndecl, flags) ...@@ -2541,7 +2545,7 @@ convert_arguments (return_loc, typelist, values, fndecl, flags)
register tree val = TREE_VALUE (valtail); register tree val = TREE_VALUE (valtail);
if (val == error_mark_node) if (val == error_mark_node)
continue; return error_mark_node;
if (type == void_type_node) if (type == void_type_node)
{ {
...@@ -2628,7 +2632,7 @@ convert_arguments (return_loc, typelist, values, fndecl, flags) ...@@ -2628,7 +2632,7 @@ convert_arguments (return_loc, typelist, values, fndecl, flags)
} }
if (val == error_mark_node) if (val == error_mark_node)
continue; return error_mark_node;
if (type != 0) if (type != 0)
{ {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment