C++ PATCH: fix PR 11531
Gabriel Dos Reis
gdr@integrable-solutions.net
Tue Jul 15 23:41:00 GMT 2003
Nathan Sidwell's patch
http://gcc.gnu.org/ml/gcc-patches/2003-06/msg02076.html
supposed to "make cp_tree_equal unequivocal" did more than making
cp_tree_equal univocal: It messed up with diagnostic, hence causing
this PR.
I took the opportunity to stop bindly calling error_recursion -- a
long standing issue. (In the case of this PR, we're sorrying but the
uncondirional call to error_recursion turned the sorry into an ICE).
Bootstrapped and regtested on an i686-pc-linux-gnu.
Applied to mainline.
-- Gaby
Index: ChangeLog
===================================================================
RCS file: /cvs/gcc/gcc/gcc/ChangeLog,v
retrieving revision 2.517
diff -p -r2.517 ChangeLog
*** ChangeLog 15 Jul 2003 22:19:31 -0000 2.517
--- ChangeLog 15 Jul 2003 23:24:45 -0000
***************
*** 1,3 ****
--- 1,11 ----
+ 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 Neil Booth <neil@daikokuya.co.uk>
* c.opt: Document more options.
Index: diagnostic.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/diagnostic.c,v
retrieving revision 1.123
diff -p -r1.123 diagnostic.c
*** diagnostic.c 7 Jul 2003 19:11:55 -0000 1.123
--- diagnostic.c 15 Jul 2003 23:24:45 -0000
*************** void
*** 1020,1026 ****
diagnostic_report_diagnostic (diagnostic_context *context,
diagnostic_info *diagnostic)
{
! if (context->lock++)
error_recursion (context);
if (diagnostic_count_diagnostic (context, diagnostic))
--- 1020,1026 ----
diagnostic_report_diagnostic (diagnostic_context *context,
diagnostic_info *diagnostic)
{
! if (context->lock++ && diagnostic->kind < DK_SORRY)
error_recursion (context);
if (diagnostic_count_diagnostic (context, diagnostic))
*************** static void
*** 1042,1048 ****
diagnostic_for_decl (diagnostic_context *context,
diagnostic_info *diagnostic, tree decl)
{
! if (context->lock++)
error_recursion (context);
if (diagnostic_count_diagnostic (context, diagnostic))
--- 1042,1048 ----
diagnostic_for_decl (diagnostic_context *context,
diagnostic_info *diagnostic, tree decl)
{
! if (context->lock++ && diagnostic->kind < DK_SORRY)
error_recursion (context);
if (diagnostic_count_diagnostic (context, diagnostic))
Index: diagnostic.def
===================================================================
RCS file: /cvs/gcc/gcc/gcc/diagnostic.def,v
retrieving revision 1.3
diff -p -r1.3 diagnostic.def
*** diagnostic.def 12 Aug 2002 18:34:51 -0000 1.3
--- diagnostic.def 15 Jul 2003 23:24:45 -0000
***************
*** 1,7 ****
DEFINE_DIAGNOSTIC_KIND (DK_FATAL, "fatal 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_WARNING, "warning: ")
DEFINE_DIAGNOSTIC_KIND (DK_ANACHRONISM, "anachronism: ")
DEFINE_DIAGNOSTIC_KIND (DK_NOTE, "note: ")
--- 1,7 ----
DEFINE_DIAGNOSTIC_KIND (DK_FATAL, "fatal error: ")
DEFINE_DIAGNOSTIC_KIND (DK_ICE, "internal compiler error: ")
DEFINE_DIAGNOSTIC_KIND (DK_ERROR, "error: ")
+ DEFINE_DIAGNOSTIC_KIND (DK_SORRY, "sorry, unimplemented: ")
DEFINE_DIAGNOSTIC_KIND (DK_WARNING, "warning: ")
DEFINE_DIAGNOSTIC_KIND (DK_ANACHRONISM, "anachronism: ")
DEFINE_DIAGNOSTIC_KIND (DK_NOTE, "note: ")
Index: testsuite/g++.dg/other/crash-1.C
===================================================================
RCS file: testsuite/g++.dg/other/crash-1.C
diff -N testsuite/g++.dg/other/crash-1.C
*** /dev/null 1 Jan 1970 00:00:00 -0000
--- testsuite/g++.dg/other/crash-1.C 15 Jul 2003 23:24:46 -0000
***************
*** 0 ****
--- 1,3 ----
+
+ void f() { return 0; } // { dg-error "return-statement" }
+
Index: cp/ChangeLog
===================================================================
RCS file: /cvs/gcc/gcc/gcc/cp/ChangeLog,v
retrieving revision 1.3524
diff -p -r1.3524 ChangeLog
*** cp/ChangeLog 15 Jul 2003 15:28:36 -0000 1.3524
--- cp/ChangeLog 15 Jul 2003 23:24:59 -0000
***************
*** 1,3 ****
--- 1,8 ----
+ 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>
PR c++/10108
Index: cp/typeck.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/cp/typeck.c,v
retrieving revision 1.480
diff -p -r1.480 typeck.c
*** cp/typeck.c 11 Jul 2003 08:13:57 -0000 1.480
--- cp/typeck.c 15 Jul 2003 23:25:02 -0000
*************** check_return_expr (tree retval)
*** 6123,6129 ****
that's supposed to return a value. */
if (!retval && fn_returns_value_p)
{
! pedwarn ("return-statement with no value, in function returning `%D'",
valtype);
/* 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
--- 6123,6129 ----
that's supposed to return a value. */
if (!retval && fn_returns_value_p)
{
! pedwarn ("return-statement with no value, in function returning '%T'",
valtype);
/* 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
*************** check_return_expr (tree retval)
*** 6140,6147 ****
its side-effects. */
finish_expr_stmt (retval);
else
! pedwarn ("return-statement with a value, in function returning `%D'",
! retval);
current_function_returns_null = 1;
--- 6140,6147 ----
its side-effects. */
finish_expr_stmt (retval);
else
! pedwarn ("return-statement with a value, in function "
! "returning 'void'");
current_function_returns_null = 1;
More information about the Gcc-patches
mailing list