Commit c8608cd6 by Gabriel Dos Reis Committed by Gabriel Dos Reis

stmt.c (emit_locus): New macro.

	* stmt.c (emit_locus): New macro.
	(emit_filename): Remove.
	(emit_lineno): Likewise.
	(struct stmt_status): Replace members x_emit_filename and
	x_emit_lineno with x_emit_locus.
	(set_file_and_line_for_stmt): Adjust.
	(expand_expr_stmt_value): Don't use warning_with_file_and_file.
	(warn_if_unused_value): Likewise.
	(check_seenlabel): Likewise.

From-SVN: r66603
parent cb1f476f
2003-05-08 Gabriel Dos Reis <gdr@integrable-solutions.net> 2003-05-08 Gabriel Dos Reis <gdr@integrable-solutions.net>
* stmt.c (emit_locus): New macro.
(emit_filename): Remove.
(emit_lineno): Likewise.
(struct stmt_status): Replace members x_emit_filename and
x_emit_lineno with x_emit_locus.
(set_file_and_line_for_stmt): Adjust.
(expand_expr_stmt_value): Don't use warning_with_file_and_file.
(warn_if_unused_value): Likewise.
(check_seenlabel): Likewise.
2003-05-08 Gabriel Dos Reis <gdr@integrable-solutions.net>
* c-decl.c (define_label): Tidy. Don't use any of * c-decl.c (define_label): Tidy. Don't use any of
error_with_file_and_line or warning_with_file_and_file. error_with_file_and_line or warning_with_file_and_file.
(pending_xref_error): Likewise. (pending_xref_error): Likewise.
......
...@@ -366,10 +366,9 @@ struct stmt_status GTY(()) ...@@ -366,10 +366,9 @@ struct stmt_status GTY(())
always compute a value for each expr-stmt in case it is the last one. */ always compute a value for each expr-stmt in case it is the last one. */
int x_expr_stmts_for_value; int x_expr_stmts_for_value;
/* Filename and line number of last line-number note, /* Location of last line-number note, whether we actually
whether we actually emitted it or not. */ emitted it or not. */
const char *x_emit_filename; location_t x_emit_locus;
int x_emit_lineno;
struct goto_fixup *x_goto_fixup_chain; struct goto_fixup *x_goto_fixup_chain;
}; };
...@@ -385,8 +384,7 @@ struct stmt_status GTY(()) ...@@ -385,8 +384,7 @@ struct stmt_status GTY(())
#define last_expr_type (cfun->stmt->x_last_expr_type) #define last_expr_type (cfun->stmt->x_last_expr_type)
#define last_expr_value (cfun->stmt->x_last_expr_value) #define last_expr_value (cfun->stmt->x_last_expr_value)
#define expr_stmts_for_value (cfun->stmt->x_expr_stmts_for_value) #define expr_stmts_for_value (cfun->stmt->x_expr_stmts_for_value)
#define emit_filename (cfun->stmt->x_emit_filename) #define emit_locus (cfun->stmt->x_emit_locus)
#define emit_lineno (cfun->stmt->x_emit_lineno)
#define goto_fixup_chain (cfun->stmt->x_goto_fixup_chain) #define goto_fixup_chain (cfun->stmt->x_goto_fixup_chain)
/* Nonzero if we are using EH to handle cleanups. */ /* Nonzero if we are using EH to handle cleanups. */
...@@ -474,8 +472,8 @@ set_file_and_line_for_stmt (file, line) ...@@ -474,8 +472,8 @@ set_file_and_line_for_stmt (file, line)
update it. */ update it. */
if (cfun->stmt) if (cfun->stmt)
{ {
emit_filename = file; emit_locus.file = file;
emit_lineno = line; emit_locus.line = line;
} }
} }
...@@ -2200,8 +2198,7 @@ expand_expr_stmt_value (exp, want_value, maybe_last) ...@@ -2200,8 +2198,7 @@ expand_expr_stmt_value (exp, want_value, maybe_last)
if (warn_unused_value if (warn_unused_value
&& !(TREE_CODE (exp) == CONVERT_EXPR && !(TREE_CODE (exp) == CONVERT_EXPR
&& VOID_TYPE_P (TREE_TYPE (exp)))) && VOID_TYPE_P (TREE_TYPE (exp))))
warning_with_file_and_line (emit_filename, emit_lineno, warning ("%Hstatement with no effect", &emit_locus);
"statement with no effect");
} }
else if (warn_unused_value) else if (warn_unused_value)
warn_if_unused_value (exp); warn_if_unused_value (exp);
...@@ -2361,8 +2358,7 @@ warn_if_unused_value (exp) ...@@ -2361,8 +2358,7 @@ warn_if_unused_value (exp)
if (TREE_SIDE_EFFECTS (exp)) if (TREE_SIDE_EFFECTS (exp))
return 0; return 0;
warning_with_file_and_line (emit_filename, emit_lineno, warning ("%Hvalue computed is not used", &emit_locus);
"value computed is not used");
return 1; return 1;
} }
} }
...@@ -4507,10 +4503,13 @@ check_seenlabel () ...@@ -4507,10 +4503,13 @@ check_seenlabel ()
/* If insn is zero, then there must have been a syntax error. */ /* If insn is zero, then there must have been a syntax error. */
if (insn) if (insn)
warning_with_file_and_line (NOTE_SOURCE_FILE (insn), {
NOTE_LINE_NUMBER (insn), location_t locus;
"unreachable code at beginning of %s", locus.file = NOTE_SOURCE_FILE (insn);
locus.line = NOTE_LINE_NUMBER (insn);
warning ("%Hunreachable code at beginning of %s", &locus,
case_stack->data.case_stmt.printname); case_stack->data.case_stmt.printname);
}
break; break;
} }
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment