From 1b493b8185a04b875c99c0dc4ef63005bb5fc54b Mon Sep 17 00:00:00 2001 From: Zack Weinberg Date: Fri, 21 Jul 2000 06:41:39 +0000 Subject: [PATCH] cp-tree.h: Use __FUNCTION__ not __PRETTY_FUNCTION__. * cp-tree.h: Use __FUNCTION__ not __PRETTY_FUNCTION__. Define my_friendly_assert and my_friendly_abort as macros which may call friendly_abort. Prototype friendly abort, not my_friendly_abort or my_friendly_assert. * decl.c (signal_catch): Report the signal caught in the error message. Call fatal directly. * typeck2.c (ack, my_friendly_assert): Delete. (my_friendly_abort): Rename to friendly_abort. Expect file, line, and function parameters. Report the abort code, then call fancy_abort. Do not mask an abort if errors have already occurred. * g++.old-deja/g++.brendan/crash16.C, g++.old-deja/g++.brendan/parse3.C, g++.old-deja/g++.brendan/redecl1.C, g++.old-deja/g++.ns/template13.C, g++.old-deja/g++.other/decl4.C, g++.old-deja/g++.pt/spec14.C: Mark as crash test, expected to fail. From-SVN: r35169 --- gcc/cp/ChangeLog | 14 +++ gcc/cp/cp-tree.h | 26 +++--- gcc/cp/decl.c | 7 +- gcc/cp/typeck2.c | 104 +++-------------------- gcc/testsuite/ChangeLog | 9 ++ gcc/testsuite/g++.old-deja/g++.brendan/crash16.C | 1 + gcc/testsuite/g++.old-deja/g++.brendan/parse3.C | 1 + gcc/testsuite/g++.old-deja/g++.brendan/redecl1.C | 3 +- gcc/testsuite/g++.old-deja/g++.ns/template13.C | 1 + gcc/testsuite/g++.old-deja/g++.other/decl4.C | 1 + gcc/testsuite/g++.old-deja/g++.pt/spec14.C | 1 + 11 files changed, 63 insertions(+), 105 deletions(-) diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog index 4aa9403..aa2a2fa 100644 --- a/gcc/cp/ChangeLog +++ b/gcc/cp/ChangeLog @@ -1,3 +1,17 @@ +2000-07-20 Zack Weinberg + + * cp-tree.h: Use __FUNCTION__ not __PRETTY_FUNCTION__. + Define my_friendly_assert and my_friendly_abort as macros + which may call friendly_abort. Prototype friendly abort, not + my_friendly_abort or my_friendly_assert. + * decl.c (signal_catch): Report the signal caught in the error + message. Call fatal directly. + * typeck2.c (ack, my_friendly_assert): Delete. + (my_friendly_abort): Rename to friendly_abort. Expect file, + line, and function parameters. Report the abort code, then + call fancy_abort. Do not mask an abort if errors have + already occurred. + 2000-07-18 Nathan Sidwell * typeck.c (comp_target_parms): Remove obsolete parameter. diff --git a/gcc/cp/cp-tree.h b/gcc/cp/cp-tree.h index bba76fe..901e749 100644 --- a/gcc/cp/cp-tree.h +++ b/gcc/cp/cp-tree.h @@ -161,8 +161,8 @@ Boston, MA 02111-1307, USA. */ ({ const tree __t = NODE; \ enum tree_code __c = TREE_CODE(__t); \ if (__c != VAR_DECL && __c != FUNCTION_DECL) \ - tree_check_failed (__t, VAR_DECL, __FILE__, \ - __LINE__, __PRETTY_FUNCTION__); \ + tree_check_failed (__t, VAR_DECL, __FILE__, __LINE__, \ + __FUNCTION__); \ __t; }) #define VAR_FUNCTION_OR_PARM_DECL_CHECK(NODE) \ @@ -171,8 +171,8 @@ Boston, MA 02111-1307, USA. */ if (__c != VAR_DECL \ && __c != FUNCTION_DECL \ && __c != PARM_DECL) \ - tree_check_failed (__t, VAR_DECL, __FILE__, \ - __LINE__, __PRETTY_FUNCTION__); \ + tree_check_failed (__t, VAR_DECL, __FILE__, __LINE__, \ + __FUNCTION__); \ __t; }) #define VAR_TEMPL_TYPE_OR_FUNCTION_DECL_CHECK(NODE) \ @@ -182,16 +182,16 @@ Boston, MA 02111-1307, USA. */ && __c != FUNCTION_DECL \ && __c != TYPE_DECL \ && __c != TEMPLATE_DECL) \ - tree_check_failed (__t, VAR_DECL, __FILE__, \ - __LINE__, __PRETTY_FUNCTION__); \ + tree_check_failed (__t, VAR_DECL, __FILE__, __LINE__, \ + __FUNCTION__); \ __t; }) #define RECORD_OR_UNION_TYPE_CHECK(NODE) \ ({ const tree __t = NODE; \ enum tree_code __c = TREE_CODE(__t); \ if (__c != RECORD_TYPE && __c != UNION_TYPE) \ - tree_check_failed (__t, RECORD_TYPE, __FILE__, \ - __LINE__, __PRETTY_FUNCTION__); \ + tree_check_failed (__t, RECORD_TYPE, __FILE__, __LINE__, \ + __FUNCTION__); \ __t; }) #else /* not ENABLE_TREE_CHECKING, or not gcc */ @@ -4629,9 +4629,15 @@ extern tree binfo_or_else PARAMS ((tree, tree)); extern void readonly_error PARAMS ((tree, const char *, int)); extern int abstract_virtuals_error PARAMS ((tree, tree)); extern void incomplete_type_error PARAMS ((tree, tree)); -extern void my_friendly_abort PARAMS ((int)) +extern void friendly_abort PARAMS ((int, const char *, + int, const char *)) ATTRIBUTE_NORETURN; -extern void my_friendly_assert PARAMS ((int, int)); + +#define my_friendly_abort(N) \ + friendly_abort (N, __FILE__, __LINE__, __FUNCTION__) +#define my_friendly_assert(EXP, N) \ + (((EXP) == 0) ? (friendly_abort (N, __FILE__, __LINE__, __FUNCTION__), 0) : 0) + extern tree store_init_value PARAMS ((tree, tree)); extern tree digest_init PARAMS ((tree, tree, tree *)); extern tree build_scoped_ref PARAMS ((tree, tree)); diff --git a/gcc/cp/decl.c b/gcc/cp/decl.c index f8c5ff2..a6b21fd 100644 --- a/gcc/cp/decl.c +++ b/gcc/cp/decl.c @@ -6105,7 +6105,7 @@ end_only_namespace_names () static void signal_catch (sig) - int sig ATTRIBUTE_UNUSED; + int sig; { signal (SIGSEGV, SIG_DFL); #ifdef SIGIOT @@ -6120,7 +6120,10 @@ signal_catch (sig) #ifdef SIGBUS signal (SIGBUS, SIG_DFL); #endif - my_friendly_abort (0); + + fatal ("Internal error: %s\n\ +Please submit a full bug report.\n\ +See %s for instructions.", strsignal (sig), GCCBUGURL); } /* Push the declarations of builtin types into the namespace. diff --git a/gcc/cp/typeck2.c b/gcc/cp/typeck2.c index 7b947d2..b2e6221 100644 --- a/gcc/cp/typeck2.c +++ b/gcc/cp/typeck2.c @@ -40,7 +40,6 @@ Boston, MA 02111-1307, USA. */ #include "output.h" static tree process_init_constructor PARAMS ((tree, tree, tree *)); -static void ack PARAMS ((const char *, ...)) ATTRIBUTE_PRINTF_1; /* Print an error message stemming from an attempt to use BASETYPE as a base class for TYPE. */ @@ -246,102 +245,23 @@ retry: cp_error_at ("incomplete `%D' defined here", value); } -/* Like error(), but don't call report_error_function(). */ - -static void -ack VPARAMS ((const char *msg, ...)) -{ -#ifndef ANSI_PROTOTYPES - const char *msg; -#endif - va_list ap; - - VA_START (ap, msg); - -#ifndef ANSI_PROTOTYPES - msg = va_arg (ap, const char *); -#endif - - if (input_filename) - fprintf (stderr, "%s:%d: ", input_filename, lineno); - else - fprintf (stderr, "%s: ", progname); - - vfprintf (stderr, msg, ap); - va_end (ap); - - fprintf (stderr, "\n"); -} - -/* There are times when the compiler can get very confused, confused - to the point of giving up by aborting, simply because of previous - input errors. It is much better to have the user go back and - correct those errors first, and see if it makes us happier, than it - is to abort on him. This is because when one has a 10,000 line - program, and the compiler comes back with ``core dump'', the user - is left not knowing even where to begin to fix things and no place - to even try and work around things. - - The parameter is to uniquely identify the problem to the user, so - that they can say, I am having problem 59, and know that fix 7 will - probably solve their problem. Or, we can document what problem - 59 is, so they can understand how to work around it, should they - ever run into it. - - We used to tell people to "fix the above error[s] and try recompiling - the program" via a call to fatal, but that message tended to look - silly. So instead, we just do the equivalent of a call to fatal in the - same situation (call exit). - - We used to assign sequential numbers for the aborts; now we use an - encoding of the date the abort was added, since that has more meaning - when we only see the error message. */ - -static int abortcount = 0; - +/* This is a wrapper around fancy_abort, as used in the back end and + other front ends. It will also report the magic number assigned to + this particular abort. That is for backward compatibility with the + old C++ abort handler, which would just report the magic number. */ void -my_friendly_abort (i) - int i; +friendly_abort (where, file, line, func) + int where; + const char *file; + int line; + const char *func; { - /* if the previous error came through here, i.e. report_error_function - ended up calling us again, don't just exit; we want a diagnostic of - some kind. */ - if (abortcount == 1) - current_function_decl = NULL_TREE; - else if (errorcount > 0 || sorrycount > 0) - { - if (abortcount > 1) - { - if (i == 0) - ack ("Internal compiler error."); - else - ack ("Internal compiler error %d.", i); - ack ("Please submit a full bug report."); - ack ("See %s for instructions.", GCCBUGURL); - } - else - error ("confused by earlier errors, bailing out"); - - exit (34); - } - ++abortcount; - - if (i == 0) - error ("Internal compiler error."); - else - error ("Internal compiler error %d.", i); + if (where > 0) + error ("Internal error #%d.", where); - error ("Please submit a full bug report."); - fatal ("See %s for instructions.", GCCBUGURL); + fancy_abort (file, line, func); } -void -my_friendly_assert (cond, where) - int cond, where; -{ - if (cond == 0) - my_friendly_abort (where); -} /* Perform appropriate conversions on the initial value of a variable, store it in the declaration DECL, diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 64ec6ae..ced776a 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,5 +1,14 @@ 2000-07-20 Zack Weinberg + * g++.old-deja/g++.brendan/crash16.C, + g++.old-deja/g++.brendan/parse3.C, + g++.old-deja/g++.brendan/redecl1.C, + g++.old-deja/g++.ns/template13.C, + g++.old-deja/g++.other/decl4.C, + g++.old-deja/g++.pt/spec14.C: Mark as crash test, expected to fail. + +2000-07-20 Zack Weinberg + * lib/old-dejagnu.exp: Check for both "Internal compiler error" and "Internal error". diff --git a/gcc/testsuite/g++.old-deja/g++.brendan/crash16.C b/gcc/testsuite/g++.old-deja/g++.brendan/crash16.C index 5030b29..8031f75 100644 --- a/gcc/testsuite/g++.old-deja/g++.brendan/crash16.C +++ b/gcc/testsuite/g++.old-deja/g++.brendan/crash16.C @@ -1,5 +1,6 @@ // Build don't link: // GROUPS passed old-abort +// crash test - XFAIL *-*-* class Graph { public: unsigned char N; diff --git a/gcc/testsuite/g++.old-deja/g++.brendan/parse3.C b/gcc/testsuite/g++.old-deja/g++.brendan/parse3.C index 8be64a3..9b5991d 100644 --- a/gcc/testsuite/g++.old-deja/g++.brendan/parse3.C +++ b/gcc/testsuite/g++.old-deja/g++.brendan/parse3.C @@ -1,4 +1,5 @@ // Build don't link: +// crash test - XFAIL *-*-* // these are marked as expected errors because they evidence an // ambiguity in the grammar between expressions and declarations. diff --git a/gcc/testsuite/g++.old-deja/g++.brendan/redecl1.C b/gcc/testsuite/g++.old-deja/g++.brendan/redecl1.C index 39a432c..f717c45 100644 --- a/gcc/testsuite/g++.old-deja/g++.brendan/redecl1.C +++ b/gcc/testsuite/g++.old-deja/g++.brendan/redecl1.C @@ -1,5 +1,6 @@ // Build don't link: // GROUPS passed redeclaration -inline int min(int x, int y) {return x < y ? x : y;} /* 235 */// ERROR - .* +// crash test - XFAIL *-*-* +inline int min(int x, int y) {return x < y ? x : y;} /* 235 */// ERROR - .* int min(int a, int b); inline int min(int a, int b) {return (a < b)?a:b;}// ERROR - .* diff --git a/gcc/testsuite/g++.old-deja/g++.ns/template13.C b/gcc/testsuite/g++.old-deja/g++.ns/template13.C index c1bca73..722666f 100644 --- a/gcc/testsuite/g++.old-deja/g++.ns/template13.C +++ b/gcc/testsuite/g++.old-deja/g++.ns/template13.C @@ -1,5 +1,6 @@ // Build don't link: // Templates defined outside must be declared inside +// crash test - XFAIL *-*-* namespace bar { template diff --git a/gcc/testsuite/g++.old-deja/g++.other/decl4.C b/gcc/testsuite/g++.old-deja/g++.other/decl4.C index d148452..395f5b3 100644 --- a/gcc/testsuite/g++.old-deja/g++.other/decl4.C +++ b/gcc/testsuite/g++.old-deja/g++.other/decl4.C @@ -1,4 +1,5 @@ // Build don't link: +// crash test - XFAIL *-*-* // Reported by Harri Porten // Simplified for testsuite by Alexandre Oliva diff --git a/gcc/testsuite/g++.old-deja/g++.pt/spec14.C b/gcc/testsuite/g++.old-deja/g++.pt/spec14.C index 0380c61..997c732 100644 --- a/gcc/testsuite/g++.old-deja/g++.pt/spec14.C +++ b/gcc/testsuite/g++.old-deja/g++.pt/spec14.C @@ -1,3 +1,4 @@ +// crash test - XFAIL *-*-* class X { public: -- 2.7.4