public inbox for gcc-cvs@sourceware.org
help / color / mirror / Atom feed
* [gcc r13-561] Advise to call 'internal_error' instead of 'abort' or 'fancy_abort'
@ 2022-05-17 14:28 Thomas Schwinge
  0 siblings, 0 replies; only message in thread
From: Thomas Schwinge @ 2022-05-17 14:28 UTC (permalink / raw)
  To: gcc-cvs

https://gcc.gnu.org/g:cd4a0ddc120936f196e81f8463dd1d4856018112

commit r13-561-gcd4a0ddc120936f196e81f8463dd1d4856018112
Author: Thomas Schwinge <thomas@codesourcery.com>
Date:   Tue May 10 15:56:08 2022 +0200

    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>

Diff:
---
 gcc/diagnostic.cc | 4 +---
 gcc/system.h      | 6 ++++--
 2 files changed, 5 insertions(+), 5 deletions(-)

diff --git a/gcc/diagnostic.cc b/gcc/diagnostic.cc
index 73324a728fe..fef11467b6f 100644
--- a/gcc/diagnostic.cc
+++ b/gcc/diagnostic.cc
@@ -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, ...)
 {
diff --git a/gcc/system.h b/gcc/system.h
index 1c783c5331d..67158b70c78 100644
--- a/gcc/system.h
+++ b/gcc/system.h
@@ -774,8 +774,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__)


^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2022-05-17 14:28 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-05-17 14:28 [gcc r13-561] Advise to call 'internal_error' instead of 'abort' or 'fancy_abort' Thomas Schwinge

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).