Re: [RFA]: Java Inferior Call Take 2

Andrew Haley
2004-08-03T18:45:17Z

[-- Attachment #1: message body text --]
[-- Type: text/plain, Size: 307 bytes --]

Daniel Jacobowitz writes:
>
> That's what I had in mind. What do field names look like? I thought
> they were already in the shortened form.

Looks like it.

> If you want to send me the patch to try, I'll put it together with the
> Java inferior call support and see if everything lines up right.

[-- Attachment #2: java-brief-name --]
[-- Type: text/plain, Size: 12502 bytes --]

Index: java/java-tree.h
===================================================================
RCS file: /cvs/gcc/gcc/gcc/java/java-tree.h,v
retrieving revision 1.215
diff -c -2 -p -r1.215 java-tree.h
*** java/java-tree.h 1 Aug 2004 18:04:42 -0000 1.215
--- java/java-tree.h 2 Aug 2004 15:00:38 -0000
*************** extern tree java_mangle_class_field (str
*** 1326,1330 ****
extern tree java_mangle_class_field_from_string (struct obstack *, char *);
extern tree java_mangle_vtable (struct obstack *, tree);
- extern const char *lang_printable_name_wls (tree, int);
extern void append_gpp_mangled_name (const char *, int);

--- 1326,1329 ----
Index: java/lang.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/java/lang.c,v
retrieving revision 1.156
diff -c -2 -p -r1.156 lang.c
*** java/lang.c 28 Jul 2004 23:44:55 -0000 1.156
--- java/lang.c 2 Aug 2004 15:00:38 -0000
*************** put_decl_node (tree node)
*** 615,636 ****

const char *
! lang_printable_name (tree decl, int v __attribute__ ((__unused__)))
{
decl_bufpos = 0;
! put_decl_node (decl);
! put_decl_string ("", 1);
! return decl_buf;
! }
!
! /* Does the same thing that lang_printable_name, but add a leading
! space to the DECL name string -- With Leading Space. */
!
! const char *
! lang_printable_name_wls (tree decl, int v __attribute__ ((__unused__)))
! {
! decl_bufpos = 1;
! put_decl_node (decl);
put_decl_string ("", 1);
- decl_buf [0] = ' ';
return decl_buf;
}
--- 615,626 ----

const char *
! lang_printable_name (tree decl, int v)
{
decl_bufpos = 0;
! if (v == 0 && TREE_CODE (decl) == FUNCTION_DECL)
! put_decl_node (DECL_NAME (decl));
! else
! put_decl_node (decl);
put_decl_string ("", 1);
return decl_buf;
}
Index: java/parse.y
===================================================================
RCS file: /cvs/gcc/gcc/gcc/java/parse.y,v
retrieving revision 1.497
diff -c -2 -p -r1.497 parse.y
*** java/parse.y 1 Aug 2004 18:04:42 -0000 1.497
--- java/parse.y 2 Aug 2004 15:00:42 -0000
*************** constructor_circularity_msg (tree from,
*** 4823,4828 ****
{
static char string [4096];
! char *t = xstrdup (lang_printable_name (from, 0));
! sprintf (string, "`%s' invokes `%s'", t, lang_printable_name (to, 0));
free (t);
return string;
--- 4823,4828 ----
{
static char string [4096];
! char *t = xstrdup (lang_printable_name (from, 2));
! sprintf (string, "`%s' invokes `%s'", t, lang_printable_name (to, 2));
free (t);
return string;
*************** verify_constructor_circularity (tree met
*** 4856,4860 ****
}
}
! t = xstrdup (lang_printable_name (meth, 0));
parse_error_context (TREE_PURPOSE (c),
"%s: recursive invocation of constructor `%s'",
--- 4856,4860 ----
}
}
! t = xstrdup (lang_printable_name (meth, 2));
parse_error_context (TREE_PURPOSE (c),
"%s: recursive invocation of constructor `%s'",
*************** get_printable_method_name (tree decl)
*** 6081,6085 ****
}

! to_return = lang_printable_name (decl, 0);
if (DECL_CONSTRUCTOR_P (decl))
DECL_NAME (decl) = name;
--- 6081,6085 ----
}

! to_return = lang_printable_name (decl, 2);
if (DECL_CONSTRUCTOR_P (decl))
DECL_NAME (decl) = name;
*************** check_abstract_method_definitions (int d
*** 6188,6192 ****
"Class `%s' doesn't define the abstract method `%s %s' from %s `%s'. This method must be defined or %s `%s' must be declared abstract",
IDENTIFIER_POINTER (DECL_NAME (class_decl)),
! t, lang_printable_name (method, 0),
(CLASS_INTERFACE (TYPE_NAME (DECL_CONTEXT (method))) ?
"interface" : "class"),
--- 6188,6192 ----
"Class `%s' doesn't define the abstract method `%s %s' from %s `%s'. This method must be defined or %s `%s' must be declared abstract",
IDENTIFIER_POINTER (DECL_NAME (class_decl)),
! t, lang_printable_name (method, 2),
(CLASS_INTERFACE (TYPE_NAME (DECL_CONTEXT (method))) ?
"interface" : "class"),
*************** java_check_regular_methods (tree class_d
*** 6366,6370 ****
parse_error_context
(method_wfl, "Method `%s' can't be static in inner class `%s'. Only members of interfaces and top-level classes can be static",
! lang_printable_name (method, 0), t);
free (t);
}
--- 6366,6370 ----
parse_error_context
(method_wfl, "Method `%s' can't be static in inner class `%s'. Only members of interfaces and top-level classes can be static",
! lang_printable_name (method, 2), t);
free (t);
}
*************** java_check_regular_methods (tree class_d
*** 6388,6392 ****
parse_error_context (method_wfl, "Class `%s' must override `%s' with a public method in order to implement interface `%s'",
IDENTIFIER_POINTER (DECL_NAME (class_decl)),
! lang_printable_name (method, 0),
IDENTIFIER_POINTER (DECL_NAME (found_decl)));
}
--- 6388,6392 ----
parse_error_context (method_wfl, "Class `%s' must override `%s' with a public method in order to implement interface `%s'",
IDENTIFIER_POINTER (DECL_NAME (class_decl)),
! lang_printable_name (method, 2),
IDENTIFIER_POINTER (DECL_NAME (found_decl)));
}
*************** java_check_regular_methods (tree class_d
*** 6397,6405 ****
{
char *t = xstrdup
! (lang_printable_name (TREE_TYPE (TREE_TYPE (found)), 0));
parse_error_context
(method_wfl,
"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)))));
--- 6397,6405 ----
{
char *t = xstrdup
! (lang_printable_name (TREE_TYPE (TREE_TYPE (found)), 2));
parse_error_context
(method_wfl,
"Method `%s' was defined with return type `%s' in class `%s'",
! lang_printable_name (found, 2), t,
IDENTIFIER_POINTER
(DECL_NAME (TYPE_NAME (DECL_CONTEXT (found)))));
*************** java_check_regular_methods (tree class_d
*** 6419,6423 ****
"%s methods can't be overridden. Method `%s' is %s in class `%s'",
(METHOD_FINAL (found) ? "Final" : "Static"),
! lang_printable_name (found, 0),
(METHOD_FINAL (found) ? "final" : "static"),
IDENTIFIER_POINTER
--- 6419,6423 ----
"%s methods can't be overridden. Method `%s' is %s in class `%s'",
(METHOD_FINAL (found) ? "Final" : "Static"),
! lang_printable_name (found, 2),
(METHOD_FINAL (found) ? "final" : "static"),
IDENTIFIER_POINTER
*************** java_check_regular_methods (tree class_d
*** 6432,6436 ****
(method_wfl,
"Instance methods can't be overridden by a static method. Method `%s' is an instance method in class `%s'",
! lang_printable_name (found, 0),
IDENTIFIER_POINTER
(DECL_NAME (TYPE_NAME (DECL_CONTEXT (found)))));
--- 6432,6436 ----
(method_wfl,
"Instance methods can't be overridden by a static method. Method `%s' is an instance method in class `%s'",
! lang_printable_name (found, 2),
IDENTIFIER_POINTER
(DECL_NAME (TYPE_NAME (DECL_CONTEXT (found)))));
*************** java_check_regular_methods (tree class_d
*** 6454,6458 ****
parse_error_context
(method_wfl,
! "Methods can't be overridden to be more private. Method `%s' is not %s in class `%s'", lang_printable_name (method, 0),
(METHOD_PUBLIC (method) ? "public" :
(METHOD_PRIVATE (method) ? "private" : "protected")),
--- 6454,6458 ----
parse_error_context
(method_wfl,
! "Methods can't be overridden to be more private. Method `%s' is not %s in class `%s'", lang_printable_name (method, 2),
(METHOD_PUBLIC (method) ? "public" :
(METHOD_PRIVATE (method) ? "private" : "protected")),
*************** check_throws_clauses (tree method, tree
*** 6597,6601 ****
(method_wfl, "Invalid checked exception class `%s' in `throws' clause. The exception must be a subclass of an exception thrown by `%s' from class `%s'",
IDENTIFIER_POINTER (DECL_NAME (TYPE_NAME (TREE_VALUE (mthrows)))),
! lang_printable_name (found, 0),
IDENTIFIER_POINTER
(DECL_NAME (TYPE_NAME (DECL_CONTEXT (found)))));
--- 6597,6601 ----
(method_wfl, "Invalid checked exception class `%s' in `throws' clause. The exception must be a subclass of an exception thrown by `%s' from class `%s'",
IDENTIFIER_POINTER (DECL_NAME (TYPE_NAME (TREE_VALUE (mthrows)))),
! lang_printable_name (found, 2),
IDENTIFIER_POINTER
(DECL_NAME (TYPE_NAME (DECL_CONTEXT (found)))));
*************** java_check_abstract_methods (tree interf
*** 6624,6632 ****
{
char *t;
! t = xstrdup (lang_printable_name (TREE_TYPE (TREE_TYPE (found)), 0));
parse_error_context
(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)))));
--- 6624,6632 ----
{
char *t;
! t = xstrdup (lang_printable_name (TREE_TYPE (TREE_TYPE (found)), 2));
parse_error_context
(DECL_FUNCTION_WFL (found),
"Method `%s' was defined with return type `%s' in class `%s'",
! lang_printable_name (found, 2), t,
IDENTIFIER_POINTER
(DECL_NAME (TYPE_NAME (DECL_CONTEXT (found)))));
*************** java_check_abstract_methods (tree interf
*** 6654,6658 ****
"Interface `%s' inherits method `%s' from interface `%s'. This method is redefined with a different return type in interface `%s'",
IDENTIFIER_POINTER (DECL_NAME (TYPE_NAME (interface))),
! lang_printable_name (found, 0),
IDENTIFIER_POINTER
(DECL_NAME (TYPE_NAME
--- 6654,6658 ----
"Interface `%s' inherits method `%s' from interface `%s'. This method is redefined with a different return type in interface `%s'",
IDENTIFIER_POINTER (DECL_NAME (TYPE_NAME (interface))),
! lang_printable_name (found, 2),
IDENTIFIER_POINTER
(DECL_NAME (TYPE_NAME
*************** check_inner_class_access (tree decl, tre
*** 7221,7225 ****
parse_error_context (cl, "Nested %s %s is %s; cannot be accessed from here",
(CLASS_INTERFACE (decl) ? "interface" : "class"),
! lang_printable_name (decl, 0), access);
}

--- 7221,7225 ----
parse_error_context (cl, "Nested %s %s is %s; cannot be accessed from here",
(CLASS_INTERFACE (decl) ? "interface" : "class"),
! lang_printable_name (decl, 2), access);
}

*************** fix_constructors (tree mdecl)
*** 8816,8820 ****
(lookup_cl (TYPE_NAME (class_type)),
"No constructor matching `%s' found in class `%s'",
! lang_printable_name (mdecl, 0), n);
DECL_NAME (mdecl) = save;
}
--- 8816,8820 ----
(lookup_cl (TYPE_NAME (class_type)),
"No constructor matching `%s' found in class `%s'",
! lang_printable_name (mdecl, 2), n);
DECL_NAME (mdecl) = save;
}
*************** patch_method_invocation (tree patch, tre
*** 10278,10282 ****
if (list && !METHOD_STATIC (list))
{
! char *fct_name = xstrdup (lang_printable_name (list, 0));
parse_error_context
(identifier_wfl,
--- 10278,10282 ----
if (list && !METHOD_STATIC (list))
{
! char *fct_name = xstrdup (lang_printable_name (list, 2));
parse_error_context
(identifier_wfl,
*************** patch_return (tree node)
*** 14649,14653 ****
"`return' with%s value from `%s %s'",
(error_found == 1 ? "" : "out"),
! t, lang_printable_name (meth, 0));
free (t);
}
--- 14649,14653 ----
"`return' with%s value from `%s %s'",
(error_found == 1 ? "" : "out"),
! t, lang_printable_name (meth, 2));
free (t);
}
*************** patch_return (tree node)
*** 14655,14659 ****
parse_error_context (wfl_operator,
"`return' with value from constructor `%s'",
! lang_printable_name (meth, 0));
return error_mark_node;
}
--- 14655,14659 ----
parse_error_context (wfl_operator,
"`return' with value from constructor `%s'",
! lang_printable_name (meth, 2));
return error_mark_node;
}