aboutsummaryrefslogtreecommitdiff
path: root/gcc/java/lang.c
diff options
context:
space:
mode:
authorPer Bothner <per@bothner.com>2001-08-30 14:28:20 -0700
committerPer Bothner <bothner@gcc.gnu.org>2001-08-30 14:28:20 -0700
commitbc8a5e56c097ded69d54b3061bd5802e8e94a5a7 (patch)
tree54d6fc81c0ab3238037f261dd5e4f088a33ff456 /gcc/java/lang.c
parent1b9ee7233caa4e6ff8f964318f0762bf2df6639b (diff)
downloadgcc-bc8a5e56c097ded69d54b3061bd5802e8e94a5a7.zip
gcc-bc8a5e56c097ded69d54b3061bd5802e8e94a5a7.tar.gz
gcc-bc8a5e56c097ded69d54b3061bd5802e8e94a5a7.tar.bz2
jcf-io.c (open_class): Set filename field.
* jcf-io.c (open_class): Set filename field. * jcf-parse,c (parse_class_file): Set current_function_decl for better error message when Code attribute is missing. * lang.c (put_decl_node, lang_print_error): Re-arrange for better diagnostics, especially for constructors. From-SVN: r45299
Diffstat (limited to 'gcc/java/lang.c')
-rw-r--r--gcc/java/lang.c53
1 files changed, 30 insertions, 23 deletions
diff --git a/gcc/java/lang.c b/gcc/java/lang.c
index dd997a5..951d299 100644
--- a/gcc/java/lang.c
+++ b/gcc/java/lang.c
@@ -522,32 +522,36 @@ put_decl_node (node)
if (TREE_CODE_CLASS (TREE_CODE (node)) == 'd'
&& DECL_NAME (node) != NULL_TREE)
{
- /* We want to print the type the DECL belongs to. We don't do
- that when we handle constructors. */
- if (TREE_CODE (node) == FUNCTION_DECL
- && ! DECL_CONSTRUCTOR_P (node)
- && ! DECL_ARTIFICIAL (node) && DECL_CONTEXT (node))
+ if (TREE_CODE (node) == FUNCTION_DECL)
{
- put_decl_node (TYPE_NAME (DECL_CONTEXT (node)));
- put_decl_string (".", 1);
- }
- if (! DECL_CONSTRUCTOR_P (node))
- put_decl_node (DECL_NAME (node));
- if (TREE_CODE (node) == FUNCTION_DECL && TREE_TYPE (node) != NULL_TREE)
- {
- int i = 0;
- tree args = TYPE_ARG_TYPES (TREE_TYPE (node));
- if (TREE_CODE (TREE_TYPE (node)) == METHOD_TYPE)
- args = TREE_CHAIN (args);
- put_decl_string ("(", 1);
- for ( ; args != end_params_node; args = TREE_CHAIN (args), i++)
+ /* We want to print the type the DECL belongs to. We don't do
+ that when we handle constructors. */
+ if (! DECL_CONSTRUCTOR_P (node)
+ && ! DECL_ARTIFICIAL (node) && DECL_CONTEXT (node))
{
- if (i > 0)
- put_decl_string (",", 1);
- put_decl_node (TREE_VALUE (args));
+ put_decl_node (TYPE_NAME (DECL_CONTEXT (node)));
+ put_decl_string (".", 1);
+ }
+ if (! DECL_CONSTRUCTOR_P (node))
+ put_decl_node (DECL_NAME (node));
+ if (TREE_TYPE (node) != NULL_TREE)
+ {
+ int i = 0;
+ tree args = TYPE_ARG_TYPES (TREE_TYPE (node));
+ if (TREE_CODE (TREE_TYPE (node)) == METHOD_TYPE)
+ args = TREE_CHAIN (args);
+ put_decl_string ("(", 1);
+ for ( ; args != end_params_node; args = TREE_CHAIN (args), i++)
+ {
+ if (i > 0)
+ put_decl_string (",", 1);
+ put_decl_node (TREE_VALUE (args));
+ }
+ put_decl_string (")", 1);
}
- put_decl_string (")", 1);
}
+ else
+ put_decl_node (DECL_NAME (node));
}
else if (TREE_CODE_CLASS (TREE_CODE (node)) == 't'
&& TYPE_NAME (node) != NULL_TREE)
@@ -648,7 +652,10 @@ lang_print_error (context, file)
else
{
const char *name = lang_printable_name (current_function_decl, 2);
- fprintf (stderr, "In method `%s':\n", name);
+ fprintf (stderr, "In %s `%s':\n",
+ (DECL_CONSTRUCTOR_P (current_function_decl) ? "constructor"
+ : "method"),
+ name);
}
last_error_function = current_function_decl;