Commit b0e3f7ec by Gabriel Dos Reis

re PR c++/11531 (ICE on invalid code (returning to void))

        PR c++/11531
        * diagnostic.c (diagnostic_report_diagnostic): Don't ICE if we're
        not recursing on hard error.
        (diagnostic_for_decl): Likewise.
        * diagnostic.def: Rearrange.

cp/
        * typeck.c (check_return_expr): Fix thinko in diagnostic.

From-SVN: r69425
parent 71628aa0
2003-07-16 Gabriel Dos Reis <gcc@integrable-solutions.net>
PR c++/11531
* diagnostic.c (diagnostic_report_diagnostic): Don't ICE if we're
not recursing on hard error.
(diagnostic_for_decl): Likewise.
* diagnostic.def: Rearrange.
2003-07-15 J"orn Rennecke <joern.rennecke@superh.com> 2003-07-15 J"orn Rennecke <joern.rennecke@superh.com>
* dwarf2out.c (expand_builtin_init_dwarf_reg_sizes): * dwarf2out.c (expand_builtin_init_dwarf_reg_sizes):
......
2003-07-16 Gabriel Dos Reis <gdr@integrable-solutions.net>
PR c++/11531
* typeck.c (check_return_expr): Fix thinko in diagnostic.
2003-07-15 Kriang Lerdsuwanakij <lerdsuwa@users.sourceforge.net> 2003-07-15 Kriang Lerdsuwanakij <lerdsuwa@users.sourceforge.net>
PR c++/10108 PR c++/10108
......
...@@ -6123,7 +6123,7 @@ check_return_expr (tree retval) ...@@ -6123,7 +6123,7 @@ check_return_expr (tree retval)
that's supposed to return a value. */ that's supposed to return a value. */
if (!retval && fn_returns_value_p) if (!retval && fn_returns_value_p)
{ {
pedwarn ("return-statement with no value, in function returning `%D'", pedwarn ("return-statement with no value, in function returning '%T'",
valtype); valtype);
/* Clear this, so finish_function won't say that we reach the /* Clear this, so finish_function won't say that we reach the
end of a non-void function (which we don't, we gave a end of a non-void function (which we don't, we gave a
...@@ -6140,8 +6140,8 @@ check_return_expr (tree retval) ...@@ -6140,8 +6140,8 @@ check_return_expr (tree retval)
its side-effects. */ its side-effects. */
finish_expr_stmt (retval); finish_expr_stmt (retval);
else else
pedwarn ("return-statement with a value, in function returning `%D'", pedwarn ("return-statement with a value, in function "
retval); "returning 'void'");
current_function_returns_null = 1; current_function_returns_null = 1;
......
...@@ -1020,7 +1020,7 @@ void ...@@ -1020,7 +1020,7 @@ void
diagnostic_report_diagnostic (diagnostic_context *context, diagnostic_report_diagnostic (diagnostic_context *context,
diagnostic_info *diagnostic) diagnostic_info *diagnostic)
{ {
if (context->lock++) if (context->lock++ && diagnostic->kind < DK_SORRY)
error_recursion (context); error_recursion (context);
if (diagnostic_count_diagnostic (context, diagnostic)) if (diagnostic_count_diagnostic (context, diagnostic))
...@@ -1042,7 +1042,7 @@ static void ...@@ -1042,7 +1042,7 @@ static void
diagnostic_for_decl (diagnostic_context *context, diagnostic_for_decl (diagnostic_context *context,
diagnostic_info *diagnostic, tree decl) diagnostic_info *diagnostic, tree decl)
{ {
if (context->lock++) if (context->lock++ && diagnostic->kind < DK_SORRY)
error_recursion (context); error_recursion (context);
if (diagnostic_count_diagnostic (context, diagnostic)) if (diagnostic_count_diagnostic (context, diagnostic))
......
DEFINE_DIAGNOSTIC_KIND (DK_FATAL, "fatal error: ") DEFINE_DIAGNOSTIC_KIND (DK_FATAL, "fatal error: ")
DEFINE_DIAGNOSTIC_KIND (DK_ICE, "internal compiler error: ") DEFINE_DIAGNOSTIC_KIND (DK_ICE, "internal compiler error: ")
DEFINE_DIAGNOSTIC_KIND (DK_SORRY, "sorry, unimplemented: ")
DEFINE_DIAGNOSTIC_KIND (DK_ERROR, "error: ") DEFINE_DIAGNOSTIC_KIND (DK_ERROR, "error: ")
DEFINE_DIAGNOSTIC_KIND (DK_SORRY, "sorry, unimplemented: ")
DEFINE_DIAGNOSTIC_KIND (DK_WARNING, "warning: ") DEFINE_DIAGNOSTIC_KIND (DK_WARNING, "warning: ")
DEFINE_DIAGNOSTIC_KIND (DK_ANACHRONISM, "anachronism: ") DEFINE_DIAGNOSTIC_KIND (DK_ANACHRONISM, "anachronism: ")
DEFINE_DIAGNOSTIC_KIND (DK_NOTE, "note: ") DEFINE_DIAGNOSTIC_KIND (DK_NOTE, "note: ")
......
void f() { return 0; } // { dg-error "return-statement" }
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