+
+/* Similar, but say we got an internal error. */
+
+void
+internal_error VPARAMS ((const char *format, ...))
+{
+ VA_OPEN (ap, format);
+ VA_FIXEDARG (ap, const char *, format);
+
+ fprintf (stderr, "%s: Internal error: ", progname);
+ vfprintf (stderr, format, ap);
+ VA_CLOSE (ap);
+ fputc ('\n', stderr);
+ exit (FATAL_EXIT_CODE);
+}
+
+/* Given a partial pathname as input, return another pathname that
+ shares no directory elements with the pathname of __FILE__. This
+ is used by fancy_abort() to print `Internal compiler error in expr.c'
+ instead of `Internal compiler error in ../../GCC/gcc/expr.c'. This
+ version if for the gen* programs and so needn't handle subdirectories. */
+
+const char *
+trim_filename (name)
+ const char *name;
+{
+ static const char this_file[] = __FILE__;
+ const char *p = name, *q = this_file;
+
+ /* Skip any parts the two filenames have in common. */
+ while (*p == *q && *p != 0 && *q != 0)
+ p++, q++;
+
+ /* Now go backwards until the previous directory separator. */
+ while (p > name && p[-1] != DIR_SEPARATOR
+#ifdef DIR_SEPARATOR_2
+ && p[-1] != DIR_SEPARATOR_2
+#endif
+ )
+ p--;
+
+ return p;
+}
+
+/* "Fancy" abort. Reports where in the compiler someone gave up.
+ This file is used only by build programs, so we're not as polite as
+ the version in diagnostic.c. */
+void
+fancy_abort (file, line, func)
+ const char *file;
+ int line;
+ const char *func;
+{
+ internal_error ("abort in %s, at %s:%d", func, file, line);
+}