aboutsummaryrefslogtreecommitdiff
path: root/gcc/java/decl.c
diff options
context:
space:
mode:
Diffstat (limited to 'gcc/java/decl.c')
-rw-r--r--gcc/java/decl.c78
1 files changed, 61 insertions, 17 deletions
diff --git a/gcc/java/decl.c b/gcc/java/decl.c
index 2737463eca0..7ddf704efad 100644
--- a/gcc/java/decl.c
+++ b/gcc/java/decl.c
@@ -1014,21 +1014,12 @@ pushdecl (tree x)
DECL_CONTEXT (x) = current_function_decl;
if (name)
{
- const char *file;
- int line;
-
t = lookup_name_current_level (name);
if (t != 0 && t == error_mark_node)
/* error_mark_node is 0 for a while during initialization! */
{
t = 0;
- error_with_decl (x, "`%s' used prior to declaration");
- }
-
- if (t != 0)
- {
- file = DECL_SOURCE_FILE (t);
- line = DECL_SOURCE_LINE (t);
+ error ("%J'%D' used prior to declaration", x, x);
}
/* If we're naming a hitherto-unnamed type, set its TYPE_NAME
@@ -1364,12 +1355,12 @@ poplevel (int keep, int reverse, int functionbody)
if (DECL_INITIAL (label) == 0)
{
- error_with_decl (label, "label `%s' used but not defined");
+ error ("%Jlabel '%D' used but not defined", label, label);
/* Avoid crashing later. */
define_label (input_location, DECL_NAME (label));
}
else if (warn_unused[UNUSED_LABEL] && !TREE_USED (label))
- warning_with_decl (label, "label `%s' defined but not used");
+ warning ("%Jlabel '%D' defined but not used", label, label);
IDENTIFIER_LABEL_VALUE (DECL_NAME (label)) = 0;
/* Put the labels into the "variables" of the
@@ -1497,9 +1488,9 @@ force_poplevels (int start_pc)
while (current_binding_level->start_pc > start_pc)
{
if (pedantic && current_binding_level->start_pc > start_pc)
- warning_with_decl (current_function_decl,
- "In %s: overlapped variable and exception ranges at %d",
- current_binding_level->start_pc);
+ warning ("%JIn %D: overlapped variable and exception ranges at %d",
+ current_function_decl, current_function_decl,
+ current_binding_level->start_pc);
expand_end_bindings (getdecls (), 1, 0);
poplevel (1, 0, 0);
}
@@ -1584,8 +1575,8 @@ give_name_to_locals (JCF *jcf)
tree decl = build_decl (VAR_DECL, name, type);
if (end_pc > DECL_CODE_LENGTH (current_function_decl))
{
- warning_with_decl (decl,
- "bad PC range for debug info for local `%s'");
+ warning ("%Jbad PC range for debug info for local '%D'",
+ decl, decl);
end_pc = DECL_CODE_LENGTH (current_function_decl);
}
@@ -1817,6 +1808,59 @@ end_java_method (void)
current_function_decl = NULL_TREE;
}
+/* Expand a function's body. */
+
+void
+java_expand_body (tree fndecl)
+{
+ const char *saved_input_filename = input_filename;
+ int saved_lineno = input_line;
+
+ current_function_decl = fndecl;
+ input_filename = DECL_SOURCE_FILE (fndecl);
+ input_line = DECL_SOURCE_LINE (fndecl);
+
+ timevar_push (TV_EXPAND);
+
+ /* Prepare the function for tree completion. */
+ start_complete_expand_method (fndecl);
+
+ if (! flag_emit_class_files && ! flag_emit_xref)
+ {
+ /* Initialize the RTL code for the function. */
+ init_function_start (fndecl);
+
+ /* Set up parameters and prepare for return, for the function. */
+ expand_function_start (fndecl, 0);
+
+ /* Generate the RTL for this function. */
+ expand_expr_stmt_value (DECL_SAVED_TREE (fndecl), 0, 1);
+ }
+
+ /* Pop out of its parameters. */
+ pushdecl_force_head (DECL_ARGUMENTS (fndecl));
+ poplevel (1, 0, 1);
+ BLOCK_SUPERCONTEXT (DECL_INITIAL (fndecl)) = fndecl;
+
+ if (! flag_emit_class_files && ! flag_emit_xref)
+ {
+ /* Generate RTL for function exit. */
+ input_line = DECL_FUNCTION_LAST_LINE (fndecl);
+ expand_function_end ();
+
+ /* Run the optimizers and output the assembler code
+ for this function. */
+ rest_of_compilation (fndecl);
+ }
+
+ timevar_pop (TV_EXPAND);
+
+ input_filename = saved_input_filename;
+ input_line = saved_lineno;
+
+ current_function_decl = NULL_TREE;
+}
+
/* Dump FUNCTION_DECL FN as tree dump PHASE. */
static void