This is the mail archive of the libc-alpha@sourceware.org mailing list for the glibc project.


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

Re: [PATCH] Add a few noreturn keywords


On 01/11/2012 03:47 PM, Ulrich Drepper wrote:
> That's too ugly.  Define an alternative FORWARD macro.

Like this?

nptl/ChangeLog:
2012-01-11  Marek Polacek  <polacek@redhat.com>

	* forward.c (FORWARD3): Define macro.
	(__pthread_unwind): Use FORWARD3 macro to avoid warning.
	(__pthread_exit): Likewise.

--- libc/nptl/forward.c.mp	2012-01-11 13:40:10.740045981 +0100
+++ libc/nptl/forward.c	2012-01-11 16:44:36.536008817 +0100
@@ -1,4 +1,4 @@
-/* Copyright (C) 2002, 2003, 2004, 2007 Free Software Foundation, Inc.
+/* Copyright (C) 2002, 2003, 2004, 2007, 2012 Free Software Foundation, Inc.
    This file is part of the GNU C Library.
    Contributed by Ulrich Drepper <drepper@redhat.com>, 2002.
 
@@ -42,6 +42,17 @@ name decl								      \
   return PTHFCT_CALL (ptr_##name, params);				      \
 }
 
+/* Same as FORWARD2, only without return.  */
+#define FORWARD3(name, rettype, decl, params, defaction) \
+rettype									      \
+name decl								      \
+{									      \
+  if (!__libc_pthread_functions_init)					      \
+    defaction;								      \
+									      \
+  PTHFCT_CALL (ptr_##name, params);					      \
+}
+
 #define FORWARD(name, decl, params, defretval) \
   FORWARD2 (name, int, decl, params, return defretval)
 
@@ -161,7 +172,7 @@ FORWARD (pthread_equal, (pthread_t threa
 
 
 /* Use an alias to avoid warning, as pthread_exit is declared noreturn.  */
-FORWARD2 (__pthread_exit, void, (void *retval), (retval), exit (EXIT_SUCCESS))
+FORWARD3 (__pthread_exit, void, (void *retval), (retval), exit (EXIT_SUCCESS))
 strong_alias (__pthread_exit, pthread_exit);
 
 
@@ -192,8 +203,7 @@ FORWARD (pthread_setcancelstate, (int st
 
 FORWARD (pthread_setcanceltype, (int type, int *oldtype), (type, oldtype), 0)
 
-#define return /* value is void */
-FORWARD2(__pthread_unwind,
+FORWARD3(__pthread_unwind,
 	 void attribute_hidden __attribute ((noreturn)) __cleanup_fct_attribute
 	 attribute_compat_text_section,
 	 (__pthread_unwind_buf_t *buf), (buf), {
@@ -201,4 +211,3 @@ FORWARD2(__pthread_unwind,
 		       INTERNAL_SYSCALL_DECL (err);
 		       INTERNAL_SYSCALL (kill, err, 1, SIGKILL);
 		     })
-#undef return

	Marek


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