[git commit future] fix the different views of the cleanup functions

Peter S. Mazinger ps.m at gmx.net
Thu Jul 7 16:50:17 UTC 2011


commit: http://git.uclibc.org/uClibc/commit/?id=cd73f451aa723d699bb0a4372aef7b7aade6754e
branch: http://git.uclibc.org/uClibc/commit/?id=refs/heads/future

Use everywhere internally the hidden __X cleanup functions, fixing compile
failure on MIPS. NPTL and LT new were affected, LT old had already the fix.

Signed-off-by: Peter S. Mazinger <ps.m at gmx.net>
---
 libpthread/linuxthreads/cancel.c                  |    2 ++
 libpthread/linuxthreads/forward.c                 |    2 ++
 libpthread/linuxthreads/sysdeps/pthread/pthread.h |   10 ++++++++++
 libpthread/nptl/cleanup_defer_compat.c            |    3 ++-
 libpthread/nptl/forward.c                         |    2 ++
 libpthread/nptl/pthreadP.h                        |    5 +++--
 6 files changed, 21 insertions(+), 3 deletions(-)

diff --git a/libpthread/linuxthreads/cancel.c b/libpthread/linuxthreads/cancel.c
index 70a4af6..5840715 100644
--- a/libpthread/linuxthreads/cancel.c
+++ b/libpthread/linuxthreads/cancel.c
@@ -171,6 +171,7 @@ void _pthread_cleanup_pop(struct _pthread_cleanup_buffer * buffer,
   THREAD_SETMEM(self, p_cleanup, buffer->__prev);
 }
 
+#undef _pthread_cleanup_push_defer
 void _pthread_cleanup_push_defer(struct _pthread_cleanup_buffer * buffer,
 				 void (*routine)(void *), void * arg)
 {
@@ -186,6 +187,7 @@ void _pthread_cleanup_push_defer(struct _pthread_cleanup_buffer * buffer,
 }
 strong_alias(_pthread_cleanup_push_defer,__pthread_cleanup_push_defer)
 
+#undef _pthread_cleanup_pop_restore
 void _pthread_cleanup_pop_restore(struct _pthread_cleanup_buffer * buffer,
 				  int execute)
 {
diff --git a/libpthread/linuxthreads/forward.c b/libpthread/linuxthreads/forward.c
index 90f49fc..ad3bcb8 100644
--- a/libpthread/linuxthreads/forward.c
+++ b/libpthread/linuxthreads/forward.c
@@ -147,9 +147,11 @@ FORWARD (pthread_setcancelstate, (int state, int *oldstate), (state, oldstate),
 FORWARD (pthread_setcanceltype, (int type, int *oldtype), (type, oldtype), 0)
 
 FORWARD2 (_pthread_cleanup_push, void, (struct _pthread_cleanup_buffer * buffer, void (*routine)(void *), void * arg), (buffer, routine, arg), return)
+#undef _pthread_cleanup_push_defer
 FORWARD2 (_pthread_cleanup_push_defer, void, (struct _pthread_cleanup_buffer * buffer, void (*routine)(void *), void * arg), (buffer, routine, arg), return)
 strong_alias(_pthread_cleanup_push_defer,__pthread_cleanup_push_defer)
 
 FORWARD2 (_pthread_cleanup_pop, void, (struct _pthread_cleanup_buffer * buffer, int execute), (buffer, execute), return)
+#undef _pthread_cleanup_pop_restore
 FORWARD2 (_pthread_cleanup_pop_restore, void, (struct _pthread_cleanup_buffer * buffer, int execute), (buffer, execute), return)
 strong_alias(_pthread_cleanup_pop_restore,__pthread_cleanup_pop_restore)
diff --git a/libpthread/linuxthreads/sysdeps/pthread/pthread.h b/libpthread/linuxthreads/sysdeps/pthread/pthread.h
index 947f911..b2ce6af 100644
--- a/libpthread/linuxthreads/sysdeps/pthread/pthread.h
+++ b/libpthread/linuxthreads/sysdeps/pthread/pthread.h
@@ -630,6 +630,11 @@ extern void _pthread_cleanup_push_defer (struct _pthread_cleanup_buffer *__buffe
 					 void (*__routine) (void *),
 					 void *__arg) __THROW;
 
+# ifdef _LIBC
+extern __typeof(_pthread_cleanup_push_defer) __pthread_cleanup_push_defer attribute_hidden;
+#  define _pthread_cleanup_push_defer __pthread_cleanup_push_defer
+# endif
+
 /* Remove a cleanup handler as pthread_cleanup_pop does, but also
    restores the cancellation type that was in effect when the matching
    pthread_cleanup_push_defer was called.  */
@@ -639,6 +644,11 @@ extern void _pthread_cleanup_push_defer (struct _pthread_cleanup_buffer *__buffe
 
 extern void _pthread_cleanup_pop_restore (struct _pthread_cleanup_buffer *__buffer,
 					  int __execute) __THROW;
+
+# ifdef _LIBC
+extern __typeof(_pthread_cleanup_pop_restore) __pthread_cleanup_pop_restore attribute_hidden;
+#  define _pthread_cleanup_pop_restore __pthread_cleanup_pop_restore
+# endif
 #endif
 
 
diff --git a/libpthread/nptl/cleanup_defer_compat.c b/libpthread/nptl/cleanup_defer_compat.c
index 95fa4a0..24f0553 100644
--- a/libpthread/nptl/cleanup_defer_compat.c
+++ b/libpthread/nptl/cleanup_defer_compat.c
@@ -19,7 +19,7 @@
 
 #include "pthreadP.h"
 
-
+#undef _pthread_cleanup_push_defer
 void
 attribute_protected
 _pthread_cleanup_push_defer (
@@ -60,6 +60,7 @@ _pthread_cleanup_push_defer (
 strong_alias (_pthread_cleanup_push_defer, __pthread_cleanup_push_defer)
 
 
+#undef _pthread_cleanup_pop_restore
 void
 attribute_protected
 _pthread_cleanup_pop_restore (
diff --git a/libpthread/nptl/forward.c b/libpthread/nptl/forward.c
index 7926e1d..13f0e39 100644
--- a/libpthread/nptl/forward.c
+++ b/libpthread/nptl/forward.c
@@ -156,12 +156,14 @@ FORWARD (pthread_setcancelstate, (int state, int *oldstate), (state, oldstate),
 FORWARD (pthread_setcanceltype, (int type, int *oldtype), (type, oldtype), 0)
 
 #define return /* value is void */
+#undef _pthread_cleanup_push_defer
 FORWARD2(_pthread_cleanup_push_defer,
 	 void, (struct _pthread_cleanup_buffer *buffer, void (*routine)(void *), void *arg),
 	 (buffer, routine, arg),
 	 { buffer->__routine = routine; buffer->__arg = arg; });
 strong_alias(_pthread_cleanup_push_defer,__pthread_cleanup_push_defer)
 
+#undef _pthread_cleanup_pop_restore
 FORWARD2(_pthread_cleanup_pop_restore,
 	 void, (struct _pthread_cleanup_buffer *buffer, int execute),
 	 (buffer, execute),
diff --git a/libpthread/nptl/pthreadP.h b/libpthread/nptl/pthreadP.h
index fabac23..382574c 100644
--- a/libpthread/nptl/pthreadP.h
+++ b/libpthread/nptl/pthreadP.h
@@ -552,13 +552,12 @@ extern void __pthread_cleanup_pop (struct _pthread_cleanup_buffer *buffer,
 # undef pthread_cleanup_pop
 # define pthread_cleanup_pop(execute) \
     __pthread_cleanup_pop (&_buffer, (execute)); }
+#endif
 
 extern void __pthread_cleanup_push_defer (struct _pthread_cleanup_buffer *buffer,
 					  void (*routine) (void *), void *arg) attribute_hidden;
 extern void __pthread_cleanup_pop_restore (struct _pthread_cleanup_buffer *buffer,
 					   int execute) attribute_hidden;
-#endif
-
 /* Old cleanup interfaces, still used in libc.so.  */
 extern void _pthread_cleanup_push (struct _pthread_cleanup_buffer *buffer,
                                    void (*routine) (void *), void *arg);
@@ -568,6 +567,8 @@ extern void _pthread_cleanup_push_defer (struct _pthread_cleanup_buffer *buffer,
                                          void (*routine) (void *), void *arg);
 extern void _pthread_cleanup_pop_restore (struct _pthread_cleanup_buffer *buffer,
                                           int execute);
+#define _pthread_cleanup_push_defer __pthread_cleanup_push_defer
+#define _pthread_cleanup_pop_restore __pthread_cleanup_pop_restore
 
 extern void __nptl_deallocate_tsd (void)
 #ifdef SHARED
-- 
1.7.3.4



More information about the uClibc-cvs mailing list