aboutsummaryrefslogtreecommitdiff
path: root/gcc/java
diff options
context:
space:
mode:
authorAlexandre Petit-Bianco <apbianco@gcc.gnu.org>2001-01-25 14:25:22 -0800
committerAlexandre Petit-Bianco <apbianco@gcc.gnu.org>2001-01-25 14:25:22 -0800
commitc4faeb92870c2e757702e491d4d22c00e5080905 (patch)
tree0784ed59de14fb0bb1d22a8534203fe2bd586799 /gcc/java
parenta8d1550a43a5d5ad6fbc6a07b36c654001b0ad84 (diff)
downloadgcc-c4faeb92870c2e757702e491d4d22c00e5080905.zip
gcc-c4faeb92870c2e757702e491d4d22c00e5080905.tar.gz
gcc-c4faeb92870c2e757702e491d4d22c00e5080905.tar.bz2
ChangeLog (2001-01-21): Fixed typo.
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. (http://gcc.gnu.org/ml/gcc-patches/2001-01/msg01954.html) From-SVN: r39274
Diffstat (limited to 'gcc/java')
-rw-r--r--gcc/java/ChangeLog30
-rw-r--r--gcc/java/class.c8
-rw-r--r--gcc/java/constants.c2
-rw-r--r--gcc/java/decl.c1
-rw-r--r--gcc/java/java-tree.h4
-rw-r--r--gcc/java/mangle.c5
-rw-r--r--gcc/java/parse.h4
-rw-r--r--gcc/java/parse.y112
-rw-r--r--gcc/java/typeck.c9
9 files changed, 52 insertions, 123 deletions
diff --git a/gcc/java/ChangeLog b/gcc/java/ChangeLog
index cbe6322..0f279e6 100644
--- a/gcc/java/ChangeLog
+++ b/gcc/java/ChangeLog
@@ -1,3 +1,31 @@
+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.
@@ -101,7 +129,7 @@
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>
diff --git a/gcc/java/class.c b/gcc/java/class.c
index 3d88143..b0b4719 100644
--- a/gcc/java/class.c
+++ b/gcc/java/class.c
@@ -1773,10 +1773,6 @@ layout_class_method (this_class, super_class, method_decl, dtable_count)
tree this_class, super_class, method_decl, dtable_count;
{
tree method_name = DECL_NAME (method_decl);
- int method_name_is_wfl =
- (TREE_CODE (method_name) == EXPR_WITH_FILE_LOCATION);
- if (method_name_is_wfl)
- method_name = java_get_real_method_name (method_decl);
TREE_PUBLIC (method_decl) = 1;
@@ -1799,10 +1795,6 @@ layout_class_method (this_class, super_class, method_decl, dtable_count)
if (*ptr++ == '.')
p = ptr;
}
- if (method_name_is_wfl)
- EXPR_WFL_NODE (DECL_NAME (method_decl)) = get_identifier (p);
- else
- DECL_NAME (method_decl) = get_identifier (p);
DECL_CONSTRUCTOR_P (method_decl) = 1;
build_java_argument_signature (TREE_TYPE (method_decl));
}
diff --git a/gcc/java/constants.c b/gcc/java/constants.c
index aff5bed..ee7be0b 100644
--- a/gcc/java/constants.c
+++ b/gcc/java/constants.c
@@ -202,8 +202,6 @@ find_methodref_index (cpool, decl)
tree name = DECL_CONSTRUCTOR_P (decl) ? init_identifier_node
: DECL_NAME (decl);
int name_type_index;
- if (TREE_CODE (name) == EXPR_WITH_FILE_LOCATION)
- name = EXPR_WFL_NODE (name);
name_type_index =
find_name_and_type_constant (cpool, name, TREE_TYPE (decl));
return find_constant1 (cpool,
diff --git a/gcc/java/decl.c b/gcc/java/decl.c
index 0175b32..ae5339c 100644
--- a/gcc/java/decl.c
+++ b/gcc/java/decl.c
@@ -1920,6 +1920,7 @@ lang_mark_tree (t)
if (ld)
{
ggc_mark (ld);
+ ggc_mark_tree (ld->wfl);
ggc_mark_tree (ld->throws_list);
ggc_mark_tree (ld->function_decl_body);
ggc_mark_tree (ld->called_constructor);
diff --git a/gcc/java/java-tree.h b/gcc/java/java-tree.h
index ed6ee9a..46e8f8a 100644
--- a/gcc/java/java-tree.h
+++ b/gcc/java/java-tree.h
@@ -669,6 +669,8 @@ struct lang_identifier
#define DECL_MAX_STACK(DECL) (DECL_LANG_SPECIFIC(DECL)->max_stack)
/* Number of local variable slots needed for the arguments of this function. */
#define DECL_ARG_SLOT_COUNT(DECL) (DECL_LANG_SPECIFIC(DECL)->arg_slot_count)
+/* Information on declaration location */
+#define DECL_FUNCTION_WFL(DECL) (DECL_LANG_SPECIFIC(DECL)->wfl)
/* List of checked thrown exceptions, as specified with the `throws'
keyword */
#define DECL_FUNCTION_THROWS(DECL) (DECL_LANG_SPECIFIC(DECL)->throws_list)
@@ -835,6 +837,7 @@ struct lang_decl
long localvariables_offset;
int arg_slots;
int max_locals, max_stack, arg_slot_count;
+ tree wfl; /* Information on the original location */
tree throws_list; /* Exception specified by `throws' */
tree function_decl_body; /* Hold all function's statements */
tree called_constructor; /* When decl is a constructor, the
@@ -1037,7 +1040,6 @@ extern char *print_int_node PARAMS ((tree));
extern void parse_error_context PARAMS ((tree cl, const char *, ...))
ATTRIBUTE_PRINTF_2;
extern tree build_primtype_type_ref PARAMS ((const char *));
-extern tree java_get_real_method_name PARAMS ((tree));
extern void finish_class PARAMS ((void));
extern void java_layout_seen_class_methods PARAMS ((void));
extern void check_for_initialization PARAMS ((tree));
diff --git a/gcc/java/mangle.c b/gcc/java/mangle.c
index 080d455..e6ead9b5 100644
--- a/gcc/java/mangle.c
+++ b/gcc/java/mangle.c
@@ -152,11 +152,6 @@ mangle_method_decl (mdecl)
/* Mangle the name of the type that contains mdecl */
mangle_record_type (DECL_CONTEXT (mdecl), /* from_pointer = */ 0);
- /* Before working on the method name, get to it. It might be burried
- in a WFL. */
- if (TREE_CODE (method_name) == EXPR_WITH_FILE_LOCATION)
- method_name = java_get_real_method_name (mdecl);
-
/* Mangle the function name. There three cases
- mdecl is java.lang.Object.Object(), use `C2' for its name
(denotes a base object constructor.)
diff --git a/gcc/java/parse.h b/gcc/java/parse.h
index 3db2580..15e9852 100644
--- a/gcc/java/parse.h
+++ b/gcc/java/parse.h
@@ -125,10 +125,6 @@ extern tree stabilize_reference PARAMS ((tree));
#define GET_REAL_TYPE(TYPE) \
(TREE_CODE (TYPE) == TREE_LIST ? TREE_PURPOSE (TYPE) : TYPE)
-#define GET_METHOD_NAME(METHOD) \
- (TREE_CODE (DECL_NAME (METHOD)) == EXPR_WITH_FILE_LOCATION ? \
- EXPR_WFL_NODE (DECL_NAME (METHOD)) : DECL_NAME (METHOD))
-
/* Get TYPE name string, regardless whether TYPE is a class or an
array. */
#define GET_TYPE_NAME(TYPE) \
diff --git a/gcc/java/parse.y b/gcc/java/parse.y
index 187c5e97..491dfb4 100644
--- a/gcc/java/parse.y
+++ b/gcc/java/parse.y
@@ -249,7 +249,6 @@ static tree create_artificial_method PARAMS ((tree, int, tree, tree, tree));
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));
@@ -4513,6 +4512,9 @@ method_header (flags, type, mdecl, throws)
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)
{
@@ -4715,15 +4717,13 @@ check_abstract_method_header (meth)
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);
@@ -5809,50 +5809,6 @@ get_printable_method_name (decl)
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.) */
@@ -5861,28 +5817,23 @@ static int
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;
@@ -6078,7 +6029,7 @@ java_check_regular_methods (class_decl)
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 */
@@ -6092,17 +6043,9 @@ java_check_regular_methods (class_decl)
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;
@@ -6150,11 +6093,6 @@ java_check_regular_methods (class_decl)
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)))
@@ -6245,13 +6183,6 @@ java_check_regular_methods (class_decl)
/* 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));
@@ -6311,8 +6242,6 @@ java_check_abstract_methods (interface_decl)
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;
@@ -6323,17 +6252,14 @@ java_check_abstract_methods (interface_decl)
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;
}
}
@@ -6357,8 +6283,6 @@ java_check_abstract_methods (interface_decl)
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'",
@@ -6369,7 +6293,6 @@ java_check_abstract_methods (interface_decl)
(DECL_CONTEXT (sub_interface_method)))),
IDENTIFIER_POINTER
(DECL_NAME (TYPE_NAME (DECL_CONTEXT (found)))));
- DECL_NAME (found) = saved_found_wfl;
}
}
}
@@ -8681,7 +8604,6 @@ java_expand_classes ()
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 */
@@ -10605,7 +10527,7 @@ search_applicable_methods_list (lc, method, name, arglist, list, all_list)
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))
diff --git a/gcc/java/typeck.c b/gcc/java/typeck.c
index ad78ffb..5ed5d53 100644
--- a/gcc/java/typeck.c
+++ b/gcc/java/typeck.c
@@ -812,11 +812,8 @@ lookup_do (searched_class, searched_interface, method_name, signature, signature
method != NULL_TREE; method = TREE_CHAIN (method))
{
tree method_sig = (*signature_builder) (TREE_TYPE (method));
- tree name = DECL_NAME (method);
- if ((TREE_CODE (name) == EXPR_WITH_FILE_LOCATION ?
- EXPR_WFL_NODE (name) : name) == method_name
- && method_sig == signature)
+ if (DECL_NAME (method) == method_name && method_sig == signature)
return method;
}
@@ -839,9 +836,7 @@ lookup_do (searched_class, searched_interface, method_name, signature, signature
tree method_sig = (*signature_builder) (TREE_TYPE (method));
tree name = DECL_NAME (method);
- if ((TREE_CODE (name) == EXPR_WITH_FILE_LOCATION ?
- EXPR_WFL_NODE (name) : name) == method_name
- && method_sig == signature)
+ if (DECL_NAME (method) == method_name && method_sig == signature)
return method;
}
searched_class = CLASSTYPE_SUPER (searched_class);