[PATCH] Warning fix for __chk_fail
Jakub Jelinek
jakub@redhat.com
Sat Feb 12 22:29:00 GMT 2005
Hi!
As __chk_fail is noreturn, but __libc_message is not (depending on
arguments, it either returns or does not), we need this trick to shut GCC
up. __libc_fatal already uses the same.
2005-02-11 Jakub Jelinek <jakub@redhat.com>
* debug/chk_fail.c (__chk_fail): Add a while (1) loop around
__libc_message to kill GCC warning about noreturn function returning.
--- libc/debug/chk_fail.c.jj 2005-02-07 10:20:54.000000000 +0100
+++ libc/debug/chk_fail.c 2005-02-11 16:03:47.271886099 +0100
@@ -26,7 +26,9 @@ void
__attribute__ ((noreturn))
__chk_fail (void)
{
- __libc_message (1, "*** buffer overflow detected ***: %s terminated\n",
- __libc_argv[0] ?: "<unknown>");
+ /* The loop is added only to keep gcc happy. */
+ while (1)
+ __libc_message (1, "*** buffer overflow detected ***: %s terminated\n",
+ __libc_argv[0] ?: "<unknown>");
}
libc_hidden_def (__chk_fail)
Jakub
More information about the Libc-hacker
mailing list