Skip to content
Snippets Groups Projects
Commit f900ecd8 authored by Richard Kenner's avatar Richard Kenner Committed by Richard Kenner
Browse files

errors.c (internal_error, [...]): New functions.

	* errors.c (internal_error, trim_filename): New functions.
	(fancy_abort): Call internal_error.
	* errors.h (internal_error, trim_filename): New declarations.

From-SVN: r40037
parent 1db87931
No related branches found
No related tags found
No related merge requests found
Sat Feb 24 06:45:21 2001 Richard Kenner <kenner@vlsi1.ultra.nyu.edu>
* errors.c (internal_error, trim_filename): New functions.
(fancy_abort): Call internal_error.
* errors.h (internal_error, trim_filename): New declarations.
2001-02-24 Alexandre Oliva <aoliva@redhat.com> 2001-02-24 Alexandre Oliva <aoliva@redhat.com>
* config/mn10300/mn10300.h (DBX_REGISTER_NUMBER): Reverted * config/mn10300/mn10300.h (DBX_REGISTER_NUMBER): Reverted
......
/* Basic error reporting routines. /* Basic error reporting routines.
Copyright (C) 1999, 2000 Free Software Foundation, Inc. Copyright (C) 1999, 2000, 2001 Free Software Foundation, Inc.
This file is part of GNU CC. This file is part of GNU CC.
...@@ -105,6 +105,57 @@ fatal VPARAMS ((const char *format, ...)) ...@@ -105,6 +105,57 @@ fatal VPARAMS ((const char *format, ...))
exit (FATAL_EXIT_CODE); exit (FATAL_EXIT_CODE);
} }
/* Similar, but say we got an internal error. */
void
internal_error VPARAMS ((const char *format, ...))
{
#ifndef ANSI_PROTOTYPES
const char *format;
#endif
va_list ap;
VA_START (ap, format);
#ifndef ANSI_PROTOTYPES
format = va_arg (ap, const char *);
#endif
fprintf (stderr, "%s: Internal error", progname);
vfprintf (stderr, format, ap);
va_end (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 neededn'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. /* "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 This file is used only by build programs, so we're not as polite as
the version in diagnostic.c. */ the version in diagnostic.c. */
...@@ -114,5 +165,5 @@ fancy_abort (file, line, func) ...@@ -114,5 +165,5 @@ fancy_abort (file, line, func)
int line; int line;
const char *func; const char *func;
{ {
fatal ("ICE in %s, at %s:%d", func, file, line); internal_error ("abort in %s, at %s:%d", func, file, line);
} }
/* Basic error reporting routines. /* Basic error reporting routines.
Copyright (C) 1999, 2000 Free Software Foundation, Inc. Copyright (C) 1999, 2000, 2001 Free Software Foundation, Inc.
This file is part of GNU CC. This file is part of GNU CC.
...@@ -25,11 +25,14 @@ Boston, MA 02111-1307, USA. */ ...@@ -25,11 +25,14 @@ Boston, MA 02111-1307, USA. */
#ifndef __GCC_ERRORS_H__ #ifndef __GCC_ERRORS_H__
#define __GCC_ERRORS_H__ #define __GCC_ERRORS_H__
extern void warning PARAMS ((const char *format, ...)) ATTRIBUTE_PRINTF_1; extern void warning PARAMS ((const char *, ...)) ATTRIBUTE_PRINTF_1;
extern void error PARAMS ((const char *format, ...)) ATTRIBUTE_PRINTF_1; extern void error PARAMS ((const char *, ...)) ATTRIBUTE_PRINTF_1;
extern void fatal PARAMS ((const char *format, ...)) extern void fatal PARAMS ((const char *, ...))
ATTRIBUTE_PRINTF_1 ATTRIBUTE_NORETURN; ATTRIBUTE_PRINTF_1 ATTRIBUTE_NORETURN;
extern void fancy_abort PARAMS ((const char *file, int line, const char *func)) extern void internal_error PARAMS ((const char *, ...))
ATTRIBUTE_PRINTF_1 ATTRIBUTE_NORETURN;
extern const char *trim_filename PARAMS ((const char *));
extern void fancy_abort PARAMS ((const char *, int, const char *))
ATTRIBUTE_NORETURN; ATTRIBUTE_NORETURN;
extern int have_error; extern int have_error;
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment