+2001-01-25 Alexandre Petit-Bianco <apbianco@cygnus.com>
+
+ * ChangeLog (2001-01-21): Fixed typo.
+ * class.c (layout_class_method): Code accounting for WFLed
+ method DECL_NAMEs deleted.
+ * constant.c (find_methodref_index): Likewise.
+ * decl.c (lang_mark_tree): Mark `wfl' field in struct lang_decl.
+ * java-tree.h (DECL_FUNCTION_WFL): New macro.
+ (struct lang_decl): New field `wfl'.
+ (java_get_real_method_name): Prototype deleted.
+ * mangle.c (mangle_method_decl): Code accounting for WFLed
+ method DECL_NAMEs deleted.
+ * parse.h (GET_METHOD_NAME): Macro deleted.
+ * parse.y (reset_method_name): Deleted.
+ (method_header): Set DECL_FUNCTION_WFL.
+ (check_abstract_method_header): Code accounting for WFLed method
+ DECL_NAMEs deleted.
+ (java_get_real_method_name): Deleted.
+ (check_method_redefinition): Code accounting for WFLed method
+ DECL_NAMEs deleted. Use DECL_FUNCTION_WFL.
+ (java_check_regular_methods): Likewise.
+ (java_check_abstract_methods): Likewise.
+ (java_expand_classes): Don't call `reset_method_name.'
+ (search_applicable_method_list): Use DECL_NAMEs instead of
+ GET_METHOD_NAME.
+ * typeck.c (lookup_do): Code accounting for WFLed method
+ DECL_NAMEs deleted.
+
2001-01-25 Richard Earnshaw <rearnsha@arm.com>
* lex.c (java_read_char): Check for EOF from getc first.
2001-01-21 Per Bothner <per@bothner.com>
- * verify.c (merge_type_state): Stil may have to merge even if
+ * verify.c (merge_type_state): Still may have to merge even if
LABEL_VERIFIED (label).
2001-01-21 Per Bothner <per@bothner.com>
static void start_artificial_method_body PARAMS ((tree));
static void end_artificial_method_body PARAMS ((tree));
static int check_method_redefinition PARAMS ((tree, tree));
-static int reset_method_name PARAMS ((tree));
static int check_method_types_complete PARAMS ((tree));
static void java_check_regular_methods PARAMS ((tree));
static void java_check_abstract_methods PARAMS ((tree));
DECL_FUNCTION_THROWS (meth) = throws;
}
+ if (TREE_TYPE (GET_CPC ()) != object_type_node)
+ DECL_FUNCTION_WFL (meth) = id;
+
/* Set the flag if we correctly processed a constructor */
if (constructor_ok)
{
tree meth;
{
int flags = get_access_flags_from_decl (meth);
- /* DECL_NAME might still be a WFL node */
- tree name = GET_METHOD_NAME (meth);
OBSOLETE_MODIFIER_WARNING2 (MODIFIER_WFL (ABSTRACT_TK), flags,
ACC_ABSTRACT, "abstract method",
- IDENTIFIER_POINTER (name));
+ IDENTIFIER_POINTER (DECL_NAME (meth)));
OBSOLETE_MODIFIER_WARNING2 (MODIFIER_WFL (PUBLIC_TK), flags,
ACC_PUBLIC, "abstract method",
- IDENTIFIER_POINTER (name));
+ IDENTIFIER_POINTER (DECL_NAME (meth)));
check_modifiers ("Illegal modifier `%s' for interface method",
flags, INTERFACE_METHOD_MODIFIERS);
return to_return;
}
-/* Reinstall the proper DECL_NAME on METHOD. Return 0 if the method
- nevertheless needs to be verfied, 1 otherwise. */
-
-static int
-reset_method_name (method)
- tree method;
-{
- if (!DECL_CLINIT_P (method) && !DECL_FINIT_P (method))
- {
- /* NAME is just the plain name when Object is being defined */
- if (DECL_CONTEXT (method) != object_type_node)
- DECL_NAME (method) = (DECL_CONSTRUCTOR_P (method) ?
- init_identifier_node : GET_METHOD_NAME (method));
- return 0;
- }
- else
- return 1;
-}
-
-/* Return the name of METHOD_DECL, when DECL_NAME is a WFL */
-
-tree
-java_get_real_method_name (method_decl)
- tree method_decl;
-{
- tree method_name = DECL_NAME (method_decl);
- if (DECL_CONSTRUCTOR_P (method_decl))
- return init_identifier_node;
-
- /* Explain here why METHOD_DECL doesn't have the DECL_CONSTRUCTUR_P
- and still can be a constructor. FIXME */
-
- /* Don't confuse method only bearing the name of their class as
- constructors */
- else if (!CLASS_FROM_SOURCE_P (DECL_CONTEXT (method_decl))
- && ctxp
- && GET_CPC_UN () == EXPR_WFL_NODE (method_name)
- && get_access_flags_from_decl (method_decl) <= ACC_PROTECTED
- && TREE_TYPE (TREE_TYPE (method_decl)) == void_type_node)
- return init_identifier_node;
- else
- return EXPR_WFL_NODE (method_name);
-}
-
/* Track method being redefined inside the same class. As a side
effect, set DECL_NAME to an IDENTIFIER (prior entering this
function it's a FWL, so we can track errors more accurately.) */
check_method_redefinition (class, method)
tree class, method;
{
- tree redef, name;
- tree cl = DECL_NAME (method);
- tree sig = TYPE_ARGUMENT_SIGNATURE (TREE_TYPE (method));
- /* decl name of artificial <clinit> and finit$ doesn't need to be
- fixed and checked */
+ tree redef, sig;
- /* Reset the method name before running the check. If it returns 1,
- the method doesn't need to be verified with respect to method
- redeclaration and we return 0 */
- if (reset_method_name (method))
+ /* There's no need to verify <clinit> and finit$ */
+ if (DECL_CLINIT_P (method) || DECL_FINIT_P (method))
return 0;
- name = DECL_NAME (method);
+ sig = TYPE_ARGUMENT_SIGNATURE (TREE_TYPE (method));
for (redef = TYPE_METHODS (class); redef; redef = TREE_CHAIN (redef))
{
if (redef == method)
break;
- if (DECL_NAME (redef) == name
- && sig == TYPE_ARGUMENT_SIGNATURE (TREE_TYPE (redef)))
+ if (DECL_NAME (redef) == DECL_NAME (method)
+ && sig == TYPE_ARGUMENT_SIGNATURE (TREE_TYPE (redef))
+ && !DECL_ARTIFICIAL (method))
{
parse_error_context
- (cl, "Duplicate %s declaration `%s'",
+ (DECL_FUNCTION_WFL (method), "Duplicate %s declaration `%s'",
(DECL_CONSTRUCTOR_P (redef) ? "constructor" : "method"),
get_printable_method_name (redef));
return 1;
int saw_constructor = ANONYMOUS_CLASS_P (TREE_TYPE (class_decl));
tree method;
tree class = CLASS_TO_HANDLE_TYPE (TREE_TYPE (class_decl));
- tree saved_found_wfl = NULL_TREE, found = NULL_TREE;
+ tree found = NULL_TREE;
tree mthrows;
/* It is not necessary to check methods defined in java.lang.Object */
for (method = TYPE_METHODS (class); method; method = TREE_CHAIN (method))
{
tree sig;
- tree method_wfl = DECL_NAME (method);
+ tree method_wfl = DECL_FUNCTION_WFL (method);
int aflags;
- /* If we previously found something and its name was saved,
- reinstall it now */
- if (found && saved_found_wfl)
- {
- DECL_NAME (found) = saved_found_wfl;
- saved_found_wfl = NULL_TREE;
- }
-
/* Check for redefinitions */
if (check_method_redefinition (class, method))
continue;
continue;
}
- /* If found wasn't verified, it's DECL_NAME won't be set properly.
- We set it temporarily for the sake of the error report. */
- saved_found_wfl = DECL_NAME (found);
- reset_method_name (found);
-
/* If `found' is declared in an interface, make sure the
modifier matches. */
if (CLASS_INTERFACE (TYPE_NAME (DECL_CONTEXT (found)))
/* Inheriting multiple methods with the same signature. FIXME */
}
- /* Don't forget eventual pending found and saved_found_wfl. Take
- into account that we might have exited because we saw an
- artificial method as the last entry. */
-
- if (found && !DECL_ARTIFICIAL (found) && saved_found_wfl)
- DECL_NAME (found) = saved_found_wfl;
-
if (!TYPE_NVIRTUALS (class))
TYPE_METHODS (class) = nreverse (TYPE_METHODS (class));
for (method = TYPE_METHODS (interface); method; method = TREE_CHAIN (method))
{
- tree method_wfl = DECL_NAME (method);
-
/* 2- Check for double definition inside the defining interface */
if (check_method_redefinition (interface, method))
continue;
if (found)
{
char *t;
- tree saved_found_wfl = DECL_NAME (found);
- reset_method_name (found);
t = xstrdup (lang_printable_name (TREE_TYPE (TREE_TYPE (found)), 0));
parse_error_context
- (method_wfl,
+ (DECL_FUNCTION_WFL (found),
"Method `%s' was defined with return type `%s' in class `%s'",
lang_printable_name (found, 0), t,
IDENTIFIER_POINTER
(DECL_NAME (TYPE_NAME (DECL_CONTEXT (found)))));
free (t);
- DECL_NAME (found) = saved_found_wfl;
continue;
}
}
sub_interface_method);
if (found && (found != sub_interface_method))
{
- tree saved_found_wfl = DECL_NAME (found);
- reset_method_name (found);
parse_error_context
(lookup_cl (sub_interface_method),
"Interface `%s' inherits method `%s' from interface `%s'. This method is redefined with a different return type in interface `%s'",
(DECL_CONTEXT (sub_interface_method)))),
IDENTIFIER_POINTER
(DECL_NAME (TYPE_NAME (DECL_CONTEXT (found)))));
- DECL_NAME (found) = saved_found_wfl;
}
}
}
if (DECL_CONSTRUCTOR_P (d))
{
restore_line_number_status (1);
- reset_method_name (d);
java_complete_expand_method (d);
restore_line_number_status (0);
break; /* We now there are no other ones */
if (lc && !DECL_CONSTRUCTOR_P (method))
continue;
else if (!lc && (DECL_CONSTRUCTOR_P (method)
- || (GET_METHOD_NAME (method) != name)))
+ || (DECL_NAME (method) != name)))
continue;
if (argument_types_convertible (method, arglist))