Commit b7484fbe by Mike Stump

58th Cygnus<->FSF merge

From-SVN: r9186
parent a0dabda5
......@@ -194,14 +194,15 @@ parse.o : $(PARSE_C) $(CONFIG_H) $(CXX_TREE_H) $(srcdir)/../flags.h lex.h
$(CC) -c $(ALL_CFLAGS) $(ALL_CPPFLAGS) $(INCLUDES) $(BIG_SWITCHFLAG) \
`echo $(PARSE_C) | sed 's,^\./,,'`
CONFLICTS = expect 5 shift/reduce confict and 38 reduce/reduce conflicts.
$(PARSE_H) : $(PARSE_C)
$(PARSE_C) : $(srcdir)/parse.y
@echo expect 5 shift/reduce confict and 39 reduce/reduce conflicts.
@echo $(CONFLICTS)
cd $(srcdir); $(BISON) $(BISONFLAGS) -d -o parse.c parse.y
cd $(srcdir); grep '^#define[ ]*YYEMPTY' parse.c >>parse.h
#$(PARSE_C) $(PARSE_H) : stamp-parse ; @true
#stamp-parse: $(srcdir)/parse.y
# @echo expect 1 shift/reduce confict and 39 reduce/reduce conflicts.
# @echo $(CONFLICTS)
# $(BISON) $(BISONFLAGS) -d $(srcdir)/parse.y
# grep '^#define[ ]*YYEMPTY' y.tab.c >>y.tab.h
# $(srcdir)/../move-if-change y.tab.c $(PARSE_C)
......
......@@ -593,6 +593,15 @@ can_convert (to, from)
return h.code < USER_CODE;
}
int
can_convert_arg (to, from, arg)
tree to, from, arg;
{
struct harshness_code h;
h = convert_harshness (to, from, arg);
return h.code < USER_CODE;
}
#ifdef DEBUG_MATCHING
static char *
print_harshness (h)
......@@ -2371,9 +2380,12 @@ build_method_call (instance, name, parms, basetype_path, flags)
assemble_external (function);
#if 0
/* Is it a synthesized method that needs to be synthesized? */
if (DECL_ARTIFICIAL (function) && ! flag_no_inline
&& DECL_SAVED_INSNS (function) == 0
&& ! TREE_ASM_WRITTEN (function))
&& ! TREE_ASM_WRITTEN (function)
/* Kludge: don't synthesize for default args. */
&& current_function_decl)
synthesize_method (function);
#endif
......
......@@ -240,7 +240,7 @@ build_vbase_path (code, type, expr, path, alias_this)
{
null_expr = build1 (NOP_EXPR, TYPE_POINTER_TO (last_virtual), integer_zero_node);
expr = build (COND_EXPR, TYPE_POINTER_TO (last_virtual),
build (EQ_EXPR, integer_type_node, expr,
build (EQ_EXPR, boolean_type_node, expr,
integer_zero_node),
null_expr, nonnull_expr);
}
......@@ -323,7 +323,7 @@ build_vbase_path (code, type, expr, path, alias_this)
expr = save_expr (expr);
return build (COND_EXPR, type,
build (EQ_EXPR, integer_type_node, expr, integer_zero_node),
build (EQ_EXPR, boolean_type_node, expr, integer_zero_node),
null_expr,
build (code, type, expr, offset));
}
......@@ -490,11 +490,12 @@ build_vfn_ref (ptr_to_instptr, instance, idx)
return aref;
else
{
*ptr_to_instptr
= build (PLUS_EXPR, TREE_TYPE (*ptr_to_instptr),
*ptr_to_instptr,
convert (ptrdiff_type_node,
build_component_ref (aref, delta_identifier, 0, 0)));
if (ptr_to_instptr)
*ptr_to_instptr
= build (PLUS_EXPR, TREE_TYPE (*ptr_to_instptr),
*ptr_to_instptr,
convert (ptrdiff_type_node,
build_component_ref (aref, delta_identifier, 0, 0)));
return build_component_ref (aref, pfn_identifier, 0, 0);
}
}
......@@ -2020,6 +2021,7 @@ duplicate_tag_error (t)
tree t;
{
cp_error ("redefinition of `%#T'", t);
cp_error_at ("previous definition here", t);
/* Pretend we haven't defined this type. */
......
......@@ -1836,6 +1836,17 @@ extern tree current_class_type; /* _TYPE: the type of the current class */
#define CONV_C_CAST (CONV_IMPLICIT | CONV_STATIC | CONV_CONST \
| CONV_REINTERPRET | CONV_PRIVATE | CONV_FORCE_TEMP)
/* Used by build_expr_type_conversion to indicate which types are
acceptable as arguments to the expression under consideration. */
#define WANT_INT 1 /* integer types, including bool */
#define WANT_FLOAT 2 /* floating point types */
#define WANT_ENUM 4 /* enumerated types */
#define WANT_POINTER 8 /* pointer types */
#define WANT_NULL 16 /* null pointer constant */
#define WANT_ARITH (WANT_INT | WANT_FLOAT)
/* Anatomy of a DECL_FRIENDLIST (which is a TREE_LIST):
purpose = friend name (IDENTIFIER_NODE);
value = TREE_LIST of FUNCTION_DECLS;
......@@ -1913,8 +1924,8 @@ extern tree convert PROTO((tree, tree));
extern tree cp_convert PROTO((tree, tree, int, int));
extern tree convert_force PROTO((tree, tree, int));
extern tree build_type_conversion PROTO((enum tree_code, tree, tree, int));
extern tree build_expr_type_conversion PROTO((int, tree, int));
extern int build_default_binary_type_conversion PROTO((enum tree_code, tree *, tree *));
extern int build_default_unary_type_conversion PROTO((enum tree_code, tree *));
extern tree type_promotes_to PROTO((tree));
/* decl.c */
......@@ -2042,9 +2053,10 @@ extern tree get_namespace_id PROTO((void));
/* in edsel.c */
/* in except.c */
extern tree protect_list;
extern void start_protect PROTO((void));
extern void end_protect PROTO((tree));
extern void end_protect_partials ();
extern void expand_exception_blocks PROTO((void));
extern void expand_start_try_stmts PROTO((void));
extern void expand_end_try_stmts PROTO((void));
......@@ -2053,7 +2065,8 @@ extern void expand_end_all_catch PROTO((void));
extern void start_catch_block PROTO((tree, tree));
extern void end_catch_block PROTO((void));
extern void expand_throw PROTO((tree));
extern int build_exception_table PROTO((void));
extern int might_have_exceptions_p PROTO((void));
extern void emit_exception_table PROTO((void));
extern tree build_throw PROTO((tree));
extern void init_exception_processing PROTO((void));
......@@ -2093,7 +2106,7 @@ extern tree get_type_value PROTO((tree));
extern tree build_member_call PROTO((tree, tree, tree));
extern tree build_offset_ref PROTO((tree, tree));
extern tree get_member_function PROTO((tree *, tree, tree));
extern tree get_member_function_from_ptrfunc PROTO((tree *, tree, tree));
extern tree get_member_function_from_ptrfunc PROTO((tree *, tree));
extern tree resolve_offset_ref PROTO((tree));
extern tree decl_constant_value PROTO((tree));
extern int is_friend_type PROTO((tree, tree));
......
......@@ -1027,6 +1027,7 @@ grok_array_decl (array_expr, index_exp)
tree array_expr, index_exp;
{
tree type = TREE_TYPE (array_expr);
tree p1, p2, i1, i2;
if (type == error_mark_node || index_exp == error_mark_node)
return error_mark_node;
......@@ -1049,28 +1050,38 @@ grok_array_decl (array_expr, index_exp)
array_expr, index_exp, NULL_TREE);
/* Otherwise, create an ARRAY_REF for a pointer or array type. */
if (TREE_CODE (type) == POINTER_TYPE
|| TREE_CODE (type) == ARRAY_TYPE)
return build_array_ref (array_expr, index_exp);
/* Woops, looks like they did something like `5[a]' instead of `a[5]'.
We don't emit a warning or error for this, since it's allowed
by ARM $8.2.4. */
if (TREE_CODE (type) == ARRAY_TYPE)
p1 = array_expr;
else
p1 = build_expr_type_conversion (WANT_POINTER, array_expr, 0);
type = TREE_TYPE (index_exp);
if (TREE_CODE (TREE_TYPE (index_exp)) == ARRAY_TYPE)
p2 = index_exp;
else
p2 = build_expr_type_conversion (WANT_POINTER, index_exp, 0);
if (TREE_CODE (type) == OFFSET_TYPE
|| TREE_CODE (type) == REFERENCE_TYPE)
type = TREE_TYPE (type);
i1 = build_expr_type_conversion (WANT_INT | WANT_ENUM, array_expr, 0);
i2 = build_expr_type_conversion (WANT_INT | WANT_ENUM, index_exp, 0);
if (TREE_CODE (type) == POINTER_TYPE
|| TREE_CODE (type) == ARRAY_TYPE)
return build_array_ref (index_exp, array_expr);
if ((p1 && i2) && (i1 && p2))
error ("ambiguous conversion for array subscript");
/* The expression E1[E2] is identical (by definition) to *((E1)+(E2)). */
return build_indirect_ref (build_binary_op (PLUS_EXPR, array_expr,
index_exp, 1),
"array indexing");
if (p1 && i2)
array_expr = p1, index_exp = i2;
else if (i1 && p2)
array_expr = p2, index_exp = i1;
else
{
cp_error ("invalid types `%T[%T]' for array subscript",
type, TREE_TYPE (index_exp));
return error_mark_node;
}
if (array_expr == error_mark_node || index_exp == error_mark_node)
error ("ambiguous conversion for array subscript");
return build_array_ref (array_expr, index_exp);
}
/* Given the cast expression EXP, checking out its validity. Either return
......@@ -2487,8 +2498,8 @@ import_export_vtable (decl, type, final)
}
else
{
/* We can only do this optimization if we have real non-inline
virtual functions in our class, or if we come from a template. */
/* We can only wait to decide if we have real non-inline virtual
functions in our class, or if we come from a template. */
int found = CLASSTYPE_TEMPLATE_INSTANTIATION (type);
......@@ -2543,7 +2554,8 @@ finish_prevtable_vardecl (prev, vars)
tree ctype = DECL_CONTEXT (vars);
import_export_template (ctype);
if (CLASSTYPE_INTERFACE_UNKNOWN (ctype) && TYPE_VIRTUAL_P (ctype))
if (CLASSTYPE_INTERFACE_UNKNOWN (ctype) && TYPE_VIRTUAL_P (ctype)
&& ! CLASSTYPE_TEMPLATE_INSTANTIATION (ctype))
{
tree method;
for (method = CLASSTYPE_METHODS (ctype); method != NULL_TREE;
......@@ -2562,19 +2574,11 @@ finish_prevtable_vardecl (prev, vars)
import_export_vtable (vars, ctype, 1);
if (write_virtuals >= 0
if (flag_rtti && write_virtuals >= 0
&& ! DECL_EXTERNAL (vars) && (TREE_PUBLIC (vars) || TREE_USED (vars)))
{
extern tree the_null_vtable_entry;
/* Kick out the type descriptor before writing out the vtable. */
if (flag_rtti)
{
build_t_desc (ctype, 1);
}
/* Write it out. */
mark_vtable_entries (vars);
build_t_desc (ctype, 1);
}
}
......@@ -2582,39 +2586,13 @@ static void
finish_vtable_vardecl (prev, vars)
tree prev, vars;
{
tree ctype = DECL_CONTEXT (vars);
import_export_template (ctype);
if (CLASSTYPE_INTERFACE_UNKNOWN (ctype) && TYPE_VIRTUAL_P (ctype))
{
tree method;
for (method = CLASSTYPE_METHODS (ctype); method != NULL_TREE;
method = DECL_NEXT_METHOD (method))
{
if (DECL_VINDEX (method) != NULL_TREE && !DECL_SAVED_INSNS (method)
&& !DECL_ABSTRACT_VIRTUAL_P (method))
{
SET_CLASSTYPE_INTERFACE_KNOWN (ctype);
CLASSTYPE_VTABLE_NEEDS_WRITING (ctype) = ! DECL_EXTERNAL (method);
CLASSTYPE_INTERFACE_ONLY (ctype) = DECL_EXTERNAL (method);
if (flag_rtti)
cp_warning ("compiler error: rtti entry for `%T' decided too late", ctype);
break;
}
}
}
import_export_vtable (vars, ctype, 1);
if (write_virtuals >= 0
&& ! DECL_EXTERNAL (vars) && (TREE_PUBLIC (vars) || TREE_USED (vars)))
{
extern tree the_null_vtable_entry;
/* Write it out. */
mark_vtable_entries (vars);
if (TREE_TYPE (DECL_INITIAL (vars)) == 0)
store_init_value (vars, DECL_INITIAL (vars));
store_init_value (vars, DECL_INITIAL (vars));
#ifdef DWARF_DEBUGGING_INFO
if (write_symbols == DWARF_DEBUG)
......@@ -2646,8 +2624,18 @@ finish_vtable_vardecl (prev, vars)
rest_of_decl_compilation (vars, NULL_PTR, 1, 1);
}
else if (TREE_USED (vars))
assemble_external (vars);
else if (! TREE_USED (vars))
/* We don't know what to do with this one yet. */
return;
/* We know that PREV must be non-zero here. */
TREE_CHAIN (prev) = TREE_CHAIN (vars);
}
static void
prune_vtable_vardecl (prev, vars)
tree prev, vars;
{
/* We know that PREV must be non-zero here. */
TREE_CHAIN (prev) = TREE_CHAIN (vars);
}
......@@ -2731,6 +2719,8 @@ import_export_inline (decl)
if (DECL_INTERFACE_KNOWN (decl))
return;
DECL_EXTERNAL (decl) = 0;
if (DECL_TEMPLATE_INSTANTIATION (decl))
{
if (DECL_IMPLICIT_INSTANTIATION (decl) && flag_implicit_templates)
......@@ -2773,7 +2763,6 @@ finish_file ()
tree fnname;
tree vars = static_aggregates;
int needs_cleaning = 0, needs_messing_up = 0;
int have_exception_handlers = build_exception_table ();
if (flag_detailed_statistics)
dump_tree_statistics ();
......@@ -2788,7 +2777,7 @@ finish_file ()
we'll need here. */
push_lang_context (lang_name_c);
if (static_ctors || vars || have_exception_handlers)
if (static_ctors || vars || might_have_exceptions_p ())
needs_messing_up = 1;
if (static_dtors)
needs_cleaning = 1;
......@@ -2900,7 +2889,7 @@ finish_file ()
push_momentary ();
expand_start_bindings (0);
if (have_exception_handlers)
if (might_have_exceptions_p ())
register_exception_table ();
while (vars)
......@@ -2931,6 +2920,7 @@ finish_file ()
/* 9.5p5: The initializer of a static member of a class has
the same acess rights as a member function. */
DECL_CLASS_CONTEXT (current_function_decl) = DECL_CONTEXT (decl);
DECL_STATIC_FUNCTION_P (current_function_decl) = 1;
#if 0
if (init)
......@@ -3061,30 +3051,9 @@ finish_file ()
pushdecl (vars);
#endif
walk_vtables ((void (*)())0, finish_vtable_vardecl);
if (flag_handle_signatures)
walk_sigtables ((void (*)())0, finish_sigtable_vardecl);
for (vars = saved_inlines; vars; vars = TREE_CHAIN (vars))
{
tree decl = TREE_VALUE (vars);
if (DECL_ARTIFICIAL (decl)
&& ! DECL_INITIAL (decl)
&& TREE_USED (decl))
synthesize_method (decl);
}
for (vars = getdecls (); vars; vars = TREE_CHAIN (vars))
{
if (TREE_CODE (vars) == THUNK_DECL)
emit_thunk (vars);
else if (TREE_CODE (vars) == FUNCTION_DECL
&& ! DECL_INTERFACE_KNOWN (vars)
&& DECL_DECLARED_STATIC (vars))
TREE_PUBLIC (vars) = 0;
}
/* Now write out inline functions which had their addresses taken and
which were not declared virtual and which were not declared `extern
inline'. */
......@@ -3098,10 +3067,23 @@ finish_file ()
tree place = TREE_CHAIN (saved_inlines);
reconsider = 0;
walk_vtables ((void (*)())0, finish_vtable_vardecl);
for (; place; place = TREE_CHAIN (place))
{
tree decl = TREE_VALUE (place);
if (DECL_ARTIFICIAL (decl) && ! DECL_INITIAL (decl))
{
if (TREE_USED (decl))
synthesize_method (decl);
else
{
last = place;
continue;
}
}
if (TREE_ASM_WRITTEN (decl) || DECL_SAVED_INSNS (decl) == 0)
{
TREE_CHAIN (last) = TREE_CHAIN (place);
......@@ -3114,9 +3096,7 @@ finish_file ()
{
TREE_CHAIN (last) = TREE_CHAIN (place);
if (DECL_EXTERNAL (decl))
assemble_external (decl);
else
if (! DECL_EXTERNAL (decl))
{
reconsider = 1;
temporary_allocation ();
......@@ -3132,6 +3112,21 @@ finish_file ()
}
}
walk_vtables ((void (*)())0, prune_vtable_vardecl);
for (vars = getdecls (); vars; vars = TREE_CHAIN (vars))
{
if (TREE_CODE (vars) == THUNK_DECL)
emit_thunk (vars);
else if (TREE_CODE (vars) == FUNCTION_DECL
&& ! DECL_INTERFACE_KNOWN (vars)
&& DECL_DECLARED_STATIC (vars))
TREE_PUBLIC (vars) = 0;
}
if (might_have_exceptions_p ())
emit_exception_table ();
if (write_virtuals == 2)
{
/* Now complain about an virtual function tables promised
......
......@@ -585,7 +585,7 @@ dump_decl (t, v)
break;
case VAR_DECL:
if (VTABLE_NAME_P (DECL_NAME (t)))
if (DECL_NAME (t) && VTABLE_NAME_P (DECL_NAME (t)))
{
OB_PUTS ("vtable for ");
dump_type (DECL_CONTEXT (t), v);
......@@ -933,9 +933,16 @@ dump_expr (t, nop)
char *p = enum_name_string (t, type);
OB_PUTCP (p);
}
else if (type == char_type_node
|| type == signed_char_type_node
|| type == unsigned_char_type_node)
else if (type == boolean_type_node)
{
if (t == boolean_false_node)
OB_PUTS ("false");
else if (t == boolean_true_node)
OB_PUTS ("true");
else
my_friendly_abort (366);
}
else if (type == char_type_node)
{
OB_PUTC ('\'');
dump_char (TREE_INT_CST_LOW (t));
......
......@@ -31,6 +31,8 @@ the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. */
#include "obstack.h"
#include "expr.h"
tree protect_list;
extern void (*interim_eh_hook) PROTO((tree));
/* holds the fndecl for __builtin_return_address () */
......@@ -53,6 +55,11 @@ tree builtin_return_address_fndecl;
#define __mips
#endif
#endif
#ifdef __i386__
#ifndef __i386
#define __i386
#endif
#endif
#if defined(__i386) || defined(__rs6000) || defined(__hppa) || defined(__mc68000) || defined (__mips) || defined (__arm) || defined (__alpha)
#define TRY_NEW_EH
#endif
......@@ -872,11 +879,13 @@ void
end_protect (finalization)
tree finalization;
{
struct ehEntry *entry = pop_eh_entry (&ehstack);
struct ehEntry *entry;
if (! doing_eh (0))
return;
entry = pop_eh_entry (&ehstack);
emit_label (entry->end_label);
entry->finalization = finalization;
......@@ -1574,11 +1583,29 @@ expand_throw (exp)
/* end of: my-cp-except.c */
#endif
void
end_protect_partials () {
while (protect_list)
{
end_protect (TREE_VALUE (protect_list));
protect_list = TREE_CHAIN (protect_list);
}
}
int
might_have_exceptions_p ()
{
#ifdef TRY_NEW_EH
if (eh_table_output_queue.head)
return 1;
#endif
return 0;
}
/* Output the exception table.
Return the number of handlers. */
int
build_exception_table ()
void
emit_exception_table ()
{
int count = 0;
#ifdef TRY_NEW_EH
......@@ -1587,7 +1614,15 @@ build_exception_table ()
tree eh_node_decl;
if (! doing_eh (0))
return 0;
return;
exception_section ();
/* Beginning marker for table. */
ASM_OUTPUT_ALIGN (asm_out_file, 2);
ASM_OUTPUT_LABEL (asm_out_file, "__EXCEPTION_TABLE__");
output_exception_table_entry (asm_out_file,
const0_rtx, const0_rtx, const0_rtx);
while (entry = dequeue_eh_entry (&eh_table_output_queue))
{
......@@ -1596,32 +1631,18 @@ build_exception_table ()
if (context && ! TREE_ASM_WRITTEN (context))
continue;
if (count == 0)
{
exception_section ();
/* Beginning marker for table. */
ASM_OUTPUT_ALIGN (asm_out_file, 2);
ASM_OUTPUT_LABEL (asm_out_file, "__EXCEPTION_TABLE__");
output_exception_table_entry (asm_out_file,
const0_rtx, const0_rtx, const0_rtx);
}
count++;
output_exception_table_entry (asm_out_file,
entry->start_label, entry->end_label,
entry->exception_handler_label);
}
if (count)
{
/* Ending marker for table. */
ASM_OUTPUT_LABEL (asm_out_file, "__EXCEPTION_END__");
output_exception_table_entry (asm_out_file,
constm1_rtx, constm1_rtx, constm1_rtx);
}
/* Ending marker for table. */
ASM_OUTPUT_LABEL (asm_out_file, "__EXCEPTION_END__");
output_exception_table_entry (asm_out_file,
constm1_rtx, constm1_rtx, constm1_rtx);
#endif /* TRY_NEW_EH */
return count;
}
void
......
......@@ -4541,8 +4541,6 @@ real_yylex ()
{ value = '}'; goto done; }
else if (c == '%' && c1 == ':')
{ value = '#'; goto done; }
else if (c == ':' && c1 == '>')
{ value = ']'; goto done; }
nextchar = c1;
token_buffer[1] = 0;
......@@ -4560,6 +4558,11 @@ real_yylex ()
value = SCOPE;
yylval.itype = 1;
}
else if (c == '>')
{
value = ']';
goto done;
}
else
{
nextchar = c;
......
......@@ -2211,12 +2211,14 @@ synthesize_method (fndecl)
int nested = (current_function_decl != NULL_TREE);
int toplev = (decl_function_context (fndecl) == NULL_TREE);
char *f = input_filename;
tree base = DECL_CLASS_CONTEXT (fndecl);
if (nested)
push_cp_function_context (toplev);
input_filename = DECL_SOURCE_FILE (fndecl);
extract_interface_info ();
interface_unknown = CLASSTYPE_INTERFACE_UNKNOWN (base);
interface_only = CLASSTYPE_INTERFACE_ONLY (base);
start_function (NULL_TREE, fndecl, NULL_TREE, 1);
store_parm_decls ();
......
......@@ -1074,8 +1074,10 @@ unary_expr:
{
tree t = TREE_VALUE ($2);
if (t != NULL_TREE
&& TREE_CODE (TREE_TYPE (t)) == FUNCTION_TYPE)
pedwarn ("ANSI C++ forbids using sizeof() on a function");
&& ((TREE_TYPE (t)
&& TREE_CODE (TREE_TYPE (t)) == FUNCTION_TYPE)
|| is_overloaded_fn (t)))
pedwarn ("ANSI C++ forbids taking the sizeof a function type");
}
$$ = c_sizeof (TREE_TYPE ($2)); }
| SIZEOF '(' type_id ')' %prec HYPERUNARY
......@@ -1142,7 +1144,7 @@ new_initializer:
syntactically valid but semantically invalid. */
| '=' init
{
if (flag_ansi)
if (pedantic)
pedwarn ("ANSI C++ forbids initialization of new expression with `='");
$$ = $2;
}
......@@ -1169,7 +1171,7 @@ cast_expr:
{
tree init = build_nt (CONSTRUCTOR, NULL_TREE,
nreverse ($3));
if (flag_ansi)
if (pedantic)
pedwarn ("ANSI C++ forbids constructor-expressions");
/* Indicate that this was a GNU C constructor expression. */
TREE_HAS_CONSTRUCTOR (init) = 1;
......@@ -1289,7 +1291,6 @@ unqualified_id:
expr_or_declarator:
notype_unqualified_id
| notype_qualified_id
| '*' expr_or_declarator %prec UNARY
{ $$ = build_parse_node (INDIRECT_REF, $2); }
| '&' expr_or_declarator %prec UNARY
......@@ -1301,9 +1302,6 @@ expr_or_declarator:
direct_notype_declarator:
complex_direct_notype_declarator
| notype_unqualified_id
| notype_qualified_id
{ push_nested_class (TREE_TYPE (OP0 ($$)), 3);
TREE_COMPLEXITY ($$) = current_class_depth; }
| '(' expr_or_declarator ')'
{ $$ = finish_decl_parsing ($2); }
;
......@@ -1360,7 +1358,7 @@ primary:
$<ttype>$ = expand_start_stmt_expr (); }
compstmt ')'
{ tree rtl_exp;
if (flag_ansi)
if (pedantic)
pedwarn ("ANSI C++ forbids braced-groups within expressions");
rtl_exp = expand_end_stmt_expr ($<ttype>2);
/* The statements have side effects, so the group does. */
......@@ -1554,7 +1552,7 @@ primary:
| object unqualified_id %prec UNARY
{ got_object = NULL_TREE;
$$ = build_component_ref ($$, $2, NULL_TREE, 1); }
| object qualified_id %prec UNARY
| object overqualified_id %prec UNARY
{ got_object = NULL_TREE;
$$ = build_object_ref ($$, OP0 ($2), OP1 ($2)); }
| object unqualified_id '(' nonnull_exprlist ')'
......@@ -1589,7 +1587,7 @@ primary:
(LOOKUP_NORMAL|LOOKUP_AGGR));
#endif
}
| object qualified_id '(' nonnull_exprlist ')'
| object overqualified_id '(' nonnull_exprlist ')'
{
got_object = NULL_TREE;
if (IS_SIGNATURE (IDENTIFIER_TYPE_VALUE (OP0 ($2))))
......@@ -1601,7 +1599,7 @@ primary:
else
$$ = build_scoped_method_call ($$, OP0 ($2), OP1 ($2), $4);
}
| object qualified_id LEFT_RIGHT
| object overqualified_id LEFT_RIGHT
{
got_object = NULL_TREE;
if (IS_SIGNATURE (IDENTIFIER_TYPE_VALUE (OP0 ($2))))
......@@ -1617,8 +1615,9 @@ primary:
| object '~' TYPESPEC LEFT_RIGHT
{
got_object = NULL_TREE;
if (TREE_CODE (TREE_TYPE ($1))
!= TREE_CODE (TREE_TYPE (IDENTIFIER_GLOBAL_VALUE ($3))))
if (IDENTIFIER_GLOBAL_VALUE ($3)
&& (TREE_CODE (TREE_TYPE ($1))
!= TREE_CODE (TREE_TYPE (IDENTIFIER_GLOBAL_VALUE ($3)))))
cp_error ("`%E' is not of type `%T'", $1, $3);
$$ = convert (void_type_node, $1);
}
......@@ -1654,7 +1653,7 @@ primary_no_id:
}
$<ttype>$ = expand_start_stmt_expr (); }
compstmt ')'
{ if (flag_ansi)
{ if (pedantic)
pedwarn ("ANSI C++ forbids braced-groups within expressions");
$$ = expand_end_stmt_expr ($<ttype>2); }
| primary_no_id '(' nonnull_exprlist ')'
......@@ -1816,6 +1815,8 @@ typed_declspecs1:
{ $$ = decl_tree_cons (NULL_TREE, $2, $$); }
| typespec reserved_declspecs %prec HYPERUNARY
{ $$ = decl_tree_cons (NULL_TREE, $$, $2); }
| typespec reserved_typespecquals reserved_declspecs
{ $$ = decl_tree_cons (NULL_TREE, $$, chainon ($2, $3)); }
| declmods typespec reserved_declspecs
{ $$ = decl_tree_cons (NULL_TREE, $2, chainon ($3, $$)); }
| declmods typespec reserved_typespecquals
......@@ -1902,11 +1903,11 @@ typespec: structsp
| complete_type_name
| TYPEOF '(' expr ')'
{ $$ = TREE_TYPE ($3);
if (flag_ansi)
if (pedantic)
pedwarn ("ANSI C++ forbids `typeof'"); }
| TYPEOF '(' type_id ')'
{ $$ = groktypename ($3);
if (flag_ansi)
if (pedantic)
pedwarn ("ANSI C++ forbids `typeof'"); }
| SIGOF '(' expr ')'
{ tree type = TREE_TYPE ($3);
......@@ -2763,7 +2764,7 @@ new_type_id:
non-constant dimension. */
| '(' type_id ')' '[' expr ']'
{
if (flag_ansi)
if (pedantic)
pedwarn ("ANSI C++ forbids array dimensions with parenthesized type in new");
$$ = build_parse_node (ARRAY_REF, TREE_VALUE ($2), $5);
$$ = build_decl_list (TREE_PURPOSE ($2), $$);
......@@ -2905,6 +2906,9 @@ complex_direct_notype_declarator:
{ $$ = build_parse_node (ARRAY_REF, $$, $3); }
| direct_notype_declarator '[' ']'
{ $$ = build_parse_node (ARRAY_REF, $$, NULL_TREE); }
| notype_qualified_id
{ push_nested_class (TREE_TYPE (OP0 ($$)), 3);
TREE_COMPLEXITY ($$) = current_class_depth; }
;
qualified_id:
......@@ -3107,7 +3111,7 @@ errstmt: error ';'
maybe_label_decls:
/* empty */
| label_decls
{ if (flag_ansi)
{ if (pedantic)
pedwarn ("ANSI C++ forbids label declarations"); }
;
......@@ -3323,7 +3327,7 @@ simple_stmt:
register tree label
= build_decl (LABEL_DECL, NULL_TREE, NULL_TREE);
if (flag_ansi)
if (pedantic)
pedwarn ("ANSI C++ forbids range expressions in switch statement");
if (value1 != error_mark_node
&& value2 != error_mark_node)
......
......@@ -755,6 +755,8 @@ uses_template_parms (t)
case REFERENCE_TYPE:
return uses_template_parms (TREE_TYPE (t));
case RECORD_TYPE:
if (TYPE_PTRMEMFUNC_FLAG (t))
return uses_template_parms (TYPE_PTRMEMFUNC_FN_TYPE (t));
case UNION_TYPE:
if (!TYPE_NAME (t))
return 0;
......@@ -1153,9 +1155,8 @@ tsubst (t, args, nargs, in_decl)
&& type != integer_type_node
&& type != void_type_node
&& type != char_type_node)
type = cp_build_type_variant (tsubst (type, args, nargs, in_decl),
TYPE_READONLY (type),
TYPE_VOLATILE (type));
type = tsubst (type, args, nargs, in_decl);
switch (TREE_CODE (t))
{
case RECORD_TYPE:
......@@ -1679,12 +1680,16 @@ instantiate_template (tmpl, targ_ptr)
my_friendly_assert (TREE_CODE (tmpl) == TEMPLATE_DECL, 283);
len = TREE_VEC_LENGTH (DECL_TEMPLATE_PARMS (tmpl));
i = len;
while (i--)
targ_ptr[i] = copy_to_permanent (targ_ptr[i]);
for (fndecl = DECL_TEMPLATE_INSTANTIATIONS (tmpl);
fndecl; fndecl = TREE_CHAIN (fndecl))
{
tree *t1 = &TREE_VEC_ELT (TREE_PURPOSE (fndecl), 0);
for (i = len - 1; i >= 0; i--)
if (t1[i] != targ_ptr[i])
if (simple_cst_equal (t1[i], targ_ptr[i]) <= 0)
goto no_match;
/* Here, we have a match. */
......@@ -2036,6 +2041,15 @@ type_unification (tparms, targs, parms, args, nsubsts, subr)
return 1;
if (arg == unknown_type_node)
return 1;
if (! uses_template_parms (parm)
&& TREE_CODE_CLASS (TREE_CODE (arg)) != 't')
{
if (can_convert_arg (parm, TREE_TYPE (arg), arg))
continue;
return 1;
}
#if 0
if (TREE_CODE (arg) == VAR_DECL)
arg = TREE_TYPE (arg);
......
......@@ -1740,6 +1740,9 @@ make_deep_copy (t)
case ARRAY_TYPE:
return build_array_type (make_deep_copy (TREE_TYPE (t)),
make_deep_copy (TYPE_DOMAIN (t)));
case INTEGER_TYPE:
return build_index_type (make_deep_copy (TYPE_MAX_VALUE (t)));
case OFFSET_TYPE:
return build_offset_type (make_deep_copy (TYPE_OFFSET_BASETYPE (t)),
make_deep_copy (TREE_TYPE (t)));
......@@ -1749,6 +1752,7 @@ make_deep_copy (t)
build_function_type
(make_deep_copy (TREE_TYPE (t)),
make_deep_copy (TREE_CHAIN (TYPE_ARG_TYPES (t)))));
case RECORD_TYPE:
if (TYPE_PTRMEMFUNC_P (t))
return build_ptrmemfunc_type
......
......@@ -329,7 +329,7 @@ ack (s, v, v2)
silly. So instead, we just do the equivalent of a call to fatal in the
same situation (call exit). */
/* First used: 0 (reserved), Last used: 364. Free: */
/* First used: 0 (reserved), Last used: 366. Free: */
static int abortcount = 0;
......@@ -855,6 +855,14 @@ digest_init (type, init, tail)
}
init = element;
}
while (TREE_CODE (init) == CONSTRUCTOR)
{
cp_pedwarn ("braces around scalar initializer for `%T'", type);
init = CONSTRUCTOR_ELTS (init);
if (TREE_CHAIN (init))
cp_pedwarn ("ignoring extra initializers for `%T'", type);
init = TREE_VALUE (init);
}
return convert_for_initialization (0, type, init, LOOKUP_NORMAL,
"initialization", NULL_TREE, 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