OSDN Git Service

* cp-tree.h: Use __FUNCTION__ not __PRETTY_FUNCTION__.
authorzack <zack@138bc75d-0d04-0410-961f-82ee72b054a4>
Fri, 21 Jul 2000 06:41:39 +0000 (06:41 +0000)
committerzack <zack@138bc75d-0d04-0410-961f-82ee72b054a4>
Fri, 21 Jul 2000 06:41:39 +0000 (06:41 +0000)
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.

git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@35169 138bc75d-0d04-0410-961f-82ee72b054a4

gcc/cp/ChangeLog
gcc/cp/cp-tree.h
gcc/cp/decl.c
gcc/cp/typeck2.c
gcc/testsuite/ChangeLog
gcc/testsuite/g++.old-deja/g++.brendan/crash16.C
gcc/testsuite/g++.old-deja/g++.brendan/parse3.C
gcc/testsuite/g++.old-deja/g++.brendan/redecl1.C
gcc/testsuite/g++.old-deja/g++.ns/template13.C
gcc/testsuite/g++.old-deja/g++.other/decl4.C
gcc/testsuite/g++.old-deja/g++.pt/spec14.C

index 4aa9403..aa2a2fa 100644 (file)
@@ -1,3 +1,17 @@
+2000-07-20  Zack Weinberg  <zack@wolery.cumb.org>
+
+       * 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  <nathan@codesourcery.com>
 
        * typeck.c (comp_target_parms): Remove obsolete parameter.
index bba76fe..901e749 100644 (file)
@@ -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));
index f8c5ff2..a6b21fd 100644 (file)
@@ -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.
index 7b947d2..b2e6221 100644 (file)
@@ -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);
-}
 \f
 /* Perform appropriate conversions on the initial value of a variable,
    store it in the declaration DECL,
index 64ec6ae..ced776a 100644 (file)
@@ -1,5 +1,14 @@
 2000-07-20  Zack Weinberg  <zack@wolery.cumb.org>
 
+       * 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  <zack@wolery.cumb.org>
+
        * lib/old-dejagnu.exp: Check for both "Internal compiler error"
        and "Internal error".
 
index 5030b29..8031f75 100644 (file)
@@ -1,5 +1,6 @@
 // Build don't link: 
 // GROUPS passed old-abort
+// crash test - XFAIL *-*-*
 class Graph {
 public:
       unsigned         char N;
index 8be64a3..9b5991d 100644 (file)
@@ -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.
index 39a432c..f717c45 100644 (file)
@@ -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 - .*
index c1bca73..722666f 100644 (file)
@@ -1,5 +1,6 @@
 // Build don't link:
 // Templates defined outside must be declared inside
+// crash test - XFAIL *-*-*
 namespace bar
 {
   template<class T>
index d148452..395f5b3 100644 (file)
@@ -1,4 +1,5 @@
 // Build don't link:
+// crash test - XFAIL *-*-*
 
 // Reported by Harri Porten <porten@tu-harburg.de>
 // Simplified for testsuite by Alexandre Oliva