From a8017c7b5fa7b5e8210b6446acf7dd09989a7517 Mon Sep 17 00:00:00 2001
From: Thomas Schwinge <thomas@codesourcery.com>
Date: Tue, 10 May 2022 15:56:08 +0200
Subject: [PATCH] Advise to call 'internal_error' instead of 'abort' or
'fancy_abort'
gcc/
* diagnostic.cc: Don't advise to call 'abort' instead of
'internal_error'.
* system.h: Advise to call 'internal_error' instead of 'abort' or
'fancy_abort'.
Suggested-by: Richard Biener <richard.guenther@gmail.com>
---
gcc/diagnostic.cc | 4 +---
gcc/system.h | 6 ++++--
2 files changed, 5 insertions(+), 5 deletions(-)
@@ -1935,9 +1935,7 @@ fatal_error (location_t loc, const char *gmsgid, ...)
}
/* An internal consistency check has failed. We make no attempt to
- continue. Note that unless there is debugging value to be had from
- a more specific message, or some other good reason, you should use
- abort () instead of calling this function directly. */
+ continue. */
void
internal_error (const char *gmsgid, ...)
{
@@ -770,8 +770,10 @@ extern int vsnprintf (char *, size_t, const char *, va_list);
#endif
#endif
-/* Redefine abort to report an internal error w/o coredump, and
- reporting the location of the error in the source file. */
+/* Redefine 'abort' to report an internal error w/o coredump, and
+ reporting the location of the error in the source file.
+ Instead of directly calling 'abort' or 'fancy_abort', GCC code
+ should normally call 'internal_error' with a specific message. */
extern void fancy_abort (const char *, int, const char *)
ATTRIBUTE_NORETURN ATTRIBUTE_COLD;
#define abort() fancy_abort (__FILE__, __LINE__, __FUNCTION__)
--
2.25.1