This is the mail archive of the libc-hacker@sources.redhat.com mailing list for the glibc project.

Note that libc-hacker is a closed list. You may look at the archives of this list, but subscription and posting are not open.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[PATCH] Warning fix for __chk_fail


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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]