public inbox for libc-hacker@sourceware.org
 help / color / mirror / Atom feed
* [PATCH] Warning fix for __chk_fail
@ 2005-02-12 22:29 Jakub Jelinek
  0 siblings, 0 replies; only message in thread
From: Jakub Jelinek @ 2005-02-12 22:29 UTC (permalink / raw)
  To: Ulrich Drepper; +Cc: Glibc hackers

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

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

only message in thread, other threads:[~2005-02-12 22:29 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2005-02-12 22:29 [PATCH] Warning fix for __chk_fail Jakub Jelinek

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).