aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMike Stump <mrs@gcc.gnu.org>1994-07-09 07:13:10 +0000
committerMike Stump <mrs@gcc.gnu.org>1994-07-09 07:13:10 +0000
commit5b605f684ecea48279b4c31a263cc8ecc65d9feb (patch)
treed8393eef1445541870011cf311e5e91315809004
parent971ba70d62f95c693c74f15ed355b02f722ee66c (diff)
downloadgcc-5b605f684ecea48279b4c31a263cc8ecc65d9feb.zip
gcc-5b605f684ecea48279b4c31a263cc8ecc65d9feb.tar.gz
gcc-5b605f684ecea48279b4c31a263cc8ecc65d9feb.tar.bz2
44th Cygnus<->FSF merge
From-SVN: r7693
-rw-r--r--gcc/cp/ChangeLog59
-rw-r--r--gcc/cp/call.c11
-rw-r--r--gcc/cp/class.c10
-rw-r--r--gcc/cp/decl.c94
-rw-r--r--gcc/cp/decl2.c33
-rw-r--r--gcc/cp/method.c8
-rw-r--r--gcc/cp/tree.c4
-rw-r--r--gcc/cp/typeck.c34
-rw-r--r--gcc/cp/typeck2.c2
9 files changed, 146 insertions, 109 deletions
diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog
index af52a29..02fa9f7 100644
--- a/gcc/cp/ChangeLog
+++ b/gcc/cp/ChangeLog
@@ -1,3 +1,30 @@
+Fri Jul 8 17:41:46 1994 Mike Stump (mrs@cygnus.com)
+
+ * decl.c (cplus_expand_expr_stmt): Wrap statement expressions inside
+ CLEANUP_POINT_EXPRs so that the stack slots can be reused.
+
+Fri Jul 8 12:59:38 1994 Jason Merrill (jason@deneb.cygnus.com)
+
+ * method.c (hack_identifier): Fix for new overloading.
+
+ * typeck.c (build_binary_op_nodefault): Don't mess with division by
+ zero.
+
+Fri Jul 8 13:20:28 1994 Gerald Baumgartner (gb@cs.purdue.edu)
+
+ * decl2.c (finish_file): Only call walk_sigtables, if
+ flag_handle_signatures is turned on, don't waste time otherwise.
+
+Fri Jul 8 02:27:41 1994 Jason Merrill (jason@deneb.cygnus.com)
+
+ * decl.c (push_overloaded_decl): Don't create overloads of one when
+ shadowing a class type.
+ * typeck.c (build_x_function_call): Complain about overloads of one
+
+ * decl.c (grokdeclarator): Don't try to treat a char* as a tree.
+ (grokdeclarator): Fix setting of TREE_STATIC.
+ (start_decl): Clear DECL_IN_AGGR_P after calling duplicate_decls.
+
Thu Jul 7 22:20:46 1994 Gerald Baumgartner (gb@andros.cygnus.com)
* cp-tree.h (walk_sigtables): Created extern declaration.
@@ -10,6 +37,22 @@ Thu Jul 7 22:20:46 1994 Gerald Baumgartner (gb@andros.cygnus.com)
* sig.c (build_signature_table_constructor): Mark class member
function pointed to from signature table entry as addressable.
+Thu Jul 7 13:39:37 1994 Jason Merrill (jason@deneb.cygnus.com)
+
+ * decl.c (start_decl): Check new decl of static member variable
+ against the declaration in the class here.
+ (grokvardecl): Instead of here.
+
+ * class.c (prepare_fresh_vtable): Call import_export_vtable if not
+ -fvtable-thunks.
+ (build_vtable): Ditto.
+
+ * decl2.c (import_export_vtable): Move logic for deciding the
+ interface of a template class from here.
+ (import_export_template): To here.
+ (finish_vtable_vardecl): Call import_export_template before
+ import_export_vtable.
+
Wed Jul 6 20:25:48 1994 Mike Stump (mrs@cygnus.com)
* except.c (init_exception_processing): Setup interim_eh_hook to
@@ -31,6 +74,22 @@ Wed Jul 6 17:55:32 1994 Per Bothner (bothner@kalessin.cygnus.com)
* decl2.c (mark_vtable_entries): If -ftable-thunks, set the
vtable entry properly to abort.
+Tue Jul 5 14:07:54 1994 Jason Merrill (jason@deneb.cygnus.com)
+
+ * typeck.c (build_binary_op_nodefault): Downgrade division by zero
+ errors to warnings.
+
+ * call.c (build_overload_call_real): Handle fnname being a list of
+ functions.
+ * typeck.c (build_x_function_call): Pass list of functions to
+ build_overload_call, not just the name.
+ * tree.c (count_functions): Complain when called for invalid
+ argument.
+
+ * decl.c (grokdeclarator): Fix settings of TREE_STATIC, TREE_PUBLIC
+ and DECL_EXTERNAL on static members and initialized const members.
+ * decl2.c (grokfield): Reflect this change.
+
Fri Jul 1 09:35:51 1994 Jason Merrill (jason@deneb.cygnus.com)
* parse.y (init): ANSI C++ does not forbid { }.
diff --git a/gcc/cp/call.c b/gcc/cp/call.c
index ec28fa3..3392a7a 100644
--- a/gcc/cp/call.c
+++ b/gcc/cp/call.c
@@ -2680,7 +2680,16 @@ build_overload_call_real (fnname, parms, flags, final_cp, buildxxx)
else
parmtypes = void_list_node;
- functions = lookup_name_nonclass (fnname);
+ if (is_overloaded_fn (fnname))
+ {
+ functions = fnname;
+ if (TREE_CODE (fnname) == TREE_LIST)
+ fnname = TREE_PURPOSE (functions);
+ else if (TREE_CODE (fnname) == FUNCTION_DECL)
+ fnname = DECL_NAME (functions);
+ }
+ else
+ functions = lookup_name_nonclass (fnname);
if (functions == NULL_TREE)
{
diff --git a/gcc/cp/class.c b/gcc/cp/class.c
index e324834..e715c89 100644
--- a/gcc/cp/class.c
+++ b/gcc/cp/class.c
@@ -547,10 +547,9 @@ build_vtable (binfo, type)
n_vtable_elems += list_length (virtuals);
#endif
-#if 0 /* Now done from finish_vtable_vardecl */
/* Set TREE_PUBLIC and TREE_EXTERN as appropriate. */
- import_export_vtable (decl, type);
-#endif
+ if (! flag_vtable_thunks)
+ import_export_vtable (decl, type);
IDENTIFIER_GLOBAL_VALUE (name) = decl = pushdecl_top_level (decl);
/* Initialize the association list for this type, based
@@ -688,10 +687,9 @@ prepare_fresh_vtable (binfo, for_type)
n_vtable_elems += list_length (BINFO_VIRTUALS (binfo));
#endif
-#if 0 /* Now done in finish_vtable_vardecl */
/* Set TREE_PUBLIC and TREE_EXTERN as appropriate. */
- import_export_vtable (new_decl, for_type);
-#endif
+ if (! flag_vtable_thunks)
+ import_export_vtable (new_decl, for_type);
if (TREE_VIA_VIRTUAL (binfo))
my_friendly_assert (binfo == binfo_member (BINFO_TYPE (binfo),
diff --git a/gcc/cp/decl.c b/gcc/cp/decl.c
index 82d852d..f3cc1b9 100644
--- a/gcc/cp/decl.c
+++ b/gcc/cp/decl.c
@@ -3250,6 +3250,7 @@ push_overloaded_decl (decl, forgettable)
tree t = TREE_TYPE (old);
if (IS_AGGR_TYPE (t) && warn_shadow)
cp_warning ("`%#D' hides constructor for `%#T'", decl, t);
+ old = NULL_TREE;
}
else if (is_overloaded_fn (old))
{
@@ -5263,17 +5264,6 @@ start_decl (declarator, declspecs, initialized, raises)
decl = d;
}
- if (context && TYPE_SIZE (context) != NULL_TREE)
- {
- /* If it was not explicitly declared `extern',
- revoke any previous claims of DECL_EXTERNAL. */
- if (DECL_THIS_EXTERN (decl) == 0)
- DECL_EXTERNAL (decl) = 0;
- if (DECL_LANG_SPECIFIC (decl))
- DECL_IN_AGGR_P (decl) = 0;
- pushclass (context, 2);
- }
-
/* If this type of object needs a cleanup, and control may
jump past it, make a new binding level so that it is cleaned
up only when it is initialized first. */
@@ -5365,9 +5355,30 @@ start_decl (declarator, declspecs, initialized, raises)
DECL_INITIAL (decl) = error_mark_node;
}
+ if (context && TYPE_SIZE (context) != NULL_TREE)
+ {
+ if (TREE_CODE (decl) == VAR_DECL)
+ {
+ tree field = lookup_field (context, DECL_NAME (decl), 0, 0);
+ if (field == NULL_TREE || TREE_CODE (field) != VAR_DECL)
+ cp_error ("`%#D' is not a static member of `%#T'", decl, context);
+ else if (duplicate_decls (decl, field))
+ decl = field;
+ }
+
+ /* If it was not explicitly declared `extern',
+ revoke any previous claims of DECL_EXTERNAL. */
+ if (DECL_THIS_EXTERN (decl) == 0)
+ DECL_EXTERNAL (decl) = 0;
+ if (DECL_LANG_SPECIFIC (decl))
+ DECL_IN_AGGR_P (decl) = 0;
+ pushclass (context, 2);
+ }
+
/* Add this decl to the current binding level, but not if it
comes from another scope, e.g. a static member variable.
TEM may equal DECL or it may be a previous decl of the same name. */
+
if ((TREE_CODE (decl) != PARM_DECL && DECL_CONTEXT (decl) != NULL_TREE)
|| (TREE_CODE (decl) == TEMPLATE_DECL && !global_bindings_p ())
|| TREE_CODE (type) == LANG_TYPE)
@@ -6779,47 +6790,11 @@ grokvardecl (type, declarator, specbits, initialized)
{
/* If you declare a static member so that it
can be initialized, the code will reach here. */
- tree field = lookup_field (TYPE_OFFSET_BASETYPE (type),
- declarator, 0, 0);
- if (field == NULL_TREE || TREE_CODE (field) != VAR_DECL)
- {
- tree basetype = TYPE_OFFSET_BASETYPE (type);
- error ("`%s' is not a static member of class `%s'",
- IDENTIFIER_POINTER (declarator),
- TYPE_NAME_STRING (basetype));
- type = TREE_TYPE (type);
- decl = build_lang_field_decl (VAR_DECL, declarator, type);
- DECL_CONTEXT (decl) = basetype;
- DECL_CLASS_CONTEXT (decl) = basetype;
- }
- else
- {
- tree f_type = TREE_TYPE (field);
- tree o_type = TREE_TYPE (type);
-
- if (TYPE_SIZE (f_type) == NULL_TREE)
- {
- if (TREE_CODE (f_type) != TREE_CODE (o_type)
- || (TREE_CODE (f_type) == ARRAY_TYPE
- && TREE_TYPE (f_type) != TREE_TYPE (o_type)))
- error ("redeclaration of type for `%s'",
- IDENTIFIER_POINTER (declarator));
- else if (TYPE_SIZE (o_type) != NULL_TREE)
- TREE_TYPE (field) = type;
- }
- else if (f_type != o_type)
- error ("redeclaration of type for `%s'",
- IDENTIFIER_POINTER (declarator));
- decl = field;
- if (initialized && DECL_INITIAL (decl)
- /* Complain about multiply-initialized
- member variables, but don't be faked
- out if initializer is empty. */
- && ! EMPTY_CONSTRUCTOR_P (DECL_INITIAL (decl)))
- error_with_aggr_type (DECL_CONTEXT (decl),
- "multiple initializations of static member `%s::%s'",
- IDENTIFIER_POINTER (DECL_NAME (decl)));
- }
+ tree basetype = TYPE_OFFSET_BASETYPE (type);
+ type = TREE_TYPE (type);
+ decl = build_lang_field_decl (VAR_DECL, declarator, type);
+ DECL_CONTEXT (decl) = basetype;
+ DECL_CLASS_CONTEXT (decl) = basetype;
}
else
decl = build_decl (VAR_DECL, declarator, type);
@@ -6837,7 +6812,7 @@ grokvardecl (type, declarator, specbits, initialized)
{
TREE_PUBLIC (decl) = 1;
TREE_STATIC (decl) = 1;
- DECL_EXTERNAL (decl) = !initialized;
+ DECL_EXTERNAL (decl) = 0;
}
/* At top level, either `static' or no s.c. makes a definition
(perhaps tentative), and absence of `static' makes it public. */
@@ -8400,7 +8375,7 @@ grokdeclarator (declarator, declspecs, decl_context, initialized, raises)
TREE_TYPE (type), TYPE_ARG_TYPES (type));
else
{
- cp_error ("cannot declare member function `%T::%D' within `%T'",
+ cp_error ("cannot declare member function `%T::%s' within `%T'",
ctype, name, current_class_type);
return void_type_node;
}
@@ -8408,7 +8383,7 @@ grokdeclarator (declarator, declspecs, decl_context, initialized, raises)
else if (TYPE_MAIN_VARIANT (ctype) == current_class_type)
{
if (extra_warnings)
- cp_warning ("redundant qualification `%T' on member `%D' ignored",
+ cp_warning ("redundant qualification `%T' on member `%s' ignored",
ctype, name);
type = build_offset_type (ctype, type);
}
@@ -8920,11 +8895,9 @@ grokdeclarator (declarator, declspecs, decl_context, initialized, raises)
This VAR_DECL is built by build_lang_field_decl.
All other VAR_DECLs are built by build_decl. */
decl = build_lang_field_decl (VAR_DECL, declarator, type);
- if (staticp || TREE_CODE (type) == ARRAY_TYPE)
- TREE_STATIC (decl) = 1;
- /* In class context, static means public access. */
- TREE_PUBLIC (decl) = 1;
- DECL_EXTERNAL (decl) = !!staticp;
+ TREE_STATIC (decl) = 1;
+ /* In class context, 'static' means public access. */
+ TREE_PUBLIC (decl) = DECL_EXTERNAL (decl) = !!staticp;
}
else
{
@@ -11980,6 +11953,7 @@ cplus_expand_expr_stmt (exp)
warning ("at this point in file");
}
+ exp = build1 (CLEANUP_POINT_EXPR, TREE_TYPE (exp), exp);
expand_expr_stmt (break_out_cleanups (exp));
}
diff --git a/gcc/cp/decl2.c b/gcc/cp/decl2.c
index 31a2475..2b9f8a7 100644
--- a/gcc/cp/decl2.c
+++ b/gcc/cp/decl2.c
@@ -1244,7 +1244,7 @@ grokfield (declarator, declspecs, raises, init, asmspec_tree)
grok_function_init (value, init);
init = NULL_TREE;
}
- else if (pedantic && ! TREE_STATIC (value))
+ else if (pedantic && TREE_CODE (value) != VAR_DECL)
/* Already complained in grokdeclarator. */
init = NULL_TREE;
else
@@ -1296,7 +1296,7 @@ grokfield (declarator, declspecs, raises, init, asmspec_tree)
fill in the value of our TREE_CHAIN. Instead, we
modify finish_decl to do the right thing, namely, to
put this decl out straight away. */
- if (TREE_STATIC (value))
+ if (TREE_PUBLIC (value))
{
/* current_class_type can be NULL_TREE in case of error. */
if (asmspec == 0 && current_class_type)
@@ -2335,22 +2335,13 @@ mark_vtable_entries (decl)
Note that anything public is tagged TREE_PUBLIC, whether
it's public in this file or in another one. */
-static void
+void
import_export_vtable (decl, type)
tree decl, type;
{
if (write_virtuals >= 2
|| CLASSTYPE_TEMPLATE_INSTANTIATION (type))
{
- if (CLASSTYPE_IMPLICIT_INSTANTIATION (type)
- && ! flag_implicit_templates
- && CLASSTYPE_INTERFACE_UNKNOWN (type))
- {
- SET_CLASSTYPE_INTERFACE_KNOWN (type);
- CLASSTYPE_INTERFACE_ONLY (type) = 1;
- CLASSTYPE_VTABLE_NEEDS_WRITING (type) = 0;
- }
-
if (CLASSTYPE_INTERFACE_KNOWN (type))
{
TREE_PUBLIC (decl) = 1;
@@ -2366,10 +2357,25 @@ import_export_vtable (decl, type)
}
static void
+import_export_template (type)
+ tree type;
+{
+ if (CLASSTYPE_IMPLICIT_INSTANTIATION (type)
+ && ! flag_implicit_templates
+ && CLASSTYPE_INTERFACE_UNKNOWN (type))
+ {
+ SET_CLASSTYPE_INTERFACE_KNOWN (type);
+ CLASSTYPE_INTERFACE_ONLY (type) = 1;
+ CLASSTYPE_VTABLE_NEEDS_WRITING (type) = 0;
+ }
+}
+
+static void
finish_vtable_vardecl (prev, vars)
tree prev, vars;
{
tree ctype = DECL_CONTEXT (vars);
+ import_export_template (ctype);
import_export_vtable (vars, ctype);
if (flag_vtable_thunks && !CLASSTYPE_INTERFACE_KNOWN (ctype))
@@ -2798,7 +2804,8 @@ finish_file ()
#endif
walk_vtables ((void (*)())0, finish_vtable_vardecl);
- walk_sigtables ((void (*)())0, finish_sigtable_vardecl);
+ if (flag_handle_signatures)
+ walk_sigtables ((void (*)())0, finish_sigtable_vardecl);
for (vars = getdecls (); vars; vars = TREE_CHAIN (vars))
{
diff --git a/gcc/cp/method.c b/gcc/cp/method.c
index bdc040c..e5d72b5 100644
--- a/gcc/cp/method.c
+++ b/gcc/cp/method.c
@@ -1460,12 +1460,12 @@ hack_identifier (value, name, yychar)
if (TREE_CODE (value) == TREE_LIST)
{
- tree t = value;
- while (t && TREE_CODE (t) == TREE_LIST)
+ tree t = get_first_fn (value);
+ while (t)
{
- assemble_external (TREE_VALUE (t));
+ assemble_external (t);
TREE_USED (t) = 1;
- t = TREE_CHAIN (t);
+ t = DECL_CHAIN (t);
}
}
else
diff --git a/gcc/cp/tree.c b/gcc/cp/tree.c
index 0251971..3256744 100644
--- a/gcc/cp/tree.c
+++ b/gcc/cp/tree.c
@@ -1289,8 +1289,10 @@ count_functions (t)
{
if (TREE_CODE (t) == FUNCTION_DECL)
return 1;
+ else if (TREE_CODE (t) == TREE_LIST)
+ return decl_list_length (TREE_VALUE (t));
- return decl_list_length (TREE_VALUE (t));
+ my_friendly_abort (359);
}
/* Like value_member, but for DECL_CHAINs. */
diff --git a/gcc/cp/typeck.c b/gcc/cp/typeck.c
index a133250..fe8e7ba 100644
--- a/gcc/cp/typeck.c
+++ b/gcc/cp/typeck.c
@@ -2076,16 +2076,16 @@ build_x_function_call (function, params, decl)
}
else
{
- tree id = TREE_PURPOSE (function);
- function = TREE_VALUE (function);
+ tree val = TREE_VALUE (function);
- if (TREE_CODE (function) == TEMPLATE_DECL)
+ if (TREE_CODE (val) == TEMPLATE_DECL)
return build_overload_call_maybe
- (id, params, LOOKUP_COMPLAIN, (struct candidate *)0);
- else if (DECL_CHAIN (function) != NULL_TREE)
+ (function, params, LOOKUP_COMPLAIN, (struct candidate *)0);
+ else if (DECL_CHAIN (val) != NULL_TREE)
return build_overload_call
- (id, params, LOOKUP_COMPLAIN, (struct candidate *)0);
- /* else fall out */
+ (function, params, LOOKUP_COMPLAIN, (struct candidate *)0);
+ else
+ my_friendly_abort (360);
}
}
@@ -2893,15 +2893,9 @@ build_binary_op_nodefault (code, orig_op0, orig_op1, error_code)
&& (code1 == INTEGER_TYPE || code1 == REAL_TYPE))
{
if (TREE_CODE (op1) == INTEGER_CST && integer_zerop (op1))
- {
- error ("division by zero");
- op1 = integer_one_node;
- }
+ cp_warning ("division by zero in `%E / 0'", op0);
else if (TREE_CODE (op1) == REAL_CST && real_zerop (op1))
- {
- error ("division by zero");
- op1 = build_real (TREE_TYPE (op1), dconst1);
- }
+ cp_warning ("division by zero in `%E / 0.'", op0);
if (!(code0 == INTEGER_TYPE && code1 == INTEGER_TYPE))
resultcode = RDIV_EXPR;
@@ -2954,15 +2948,9 @@ build_binary_op_nodefault (code, orig_op0, orig_op1, error_code)
case TRUNC_MOD_EXPR:
case FLOOR_MOD_EXPR:
if (code1 == INTEGER_TYPE && integer_zerop (op1))
- {
- error ("division by zero");
- op1 = integer_one_node;
- }
+ cp_warning ("division by zero in `%E % 0'", op0);
else if (code1 == REAL_TYPE && real_zerop (op1))
- {
- error ("division by zero");
- op1 = build_real (TREE_TYPE (op1), dconst1);
- }
+ cp_warning ("division by zero in `%E % 0.'", op0);
if (code0 == INTEGER_TYPE && code1 == INTEGER_TYPE)
{
diff --git a/gcc/cp/typeck2.c b/gcc/cp/typeck2.c
index 5935ee9..871173f 100644
--- a/gcc/cp/typeck2.c
+++ b/gcc/cp/typeck2.c
@@ -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: 358. Free: */
+/* First used: 0 (reserved), Last used: 360. Free: */
static int abortcount = 0;