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]

[PATCH][BZ #14188] Allow pthread_cleanup_push to build withcompilers other than gcc


Hi,

As reported in bz #14188, programs using pthread_cleanup_push do not
compile cleanly with compilers that do not implement __builtin_*
functions. Attached trivial patch eliminates the __builtin_expect inside
pthread_cleanup_push macro definition in pthread.h if the compiler is
not gcc.

OK to commit?

Regards,
Siddhesh


nptl/ChangeLog:

2012-06-01  Siddhesh Poyarekar  <siddhesh@redhat.com>

	[BZ #14188]
	* sysdeps/pthread/pthread.h [!__GNUC__]: Define __builtin_expect
	when compiler is not gcc.
diff --git a/nptl/sysdeps/pthread/pthread.h b/nptl/sysdeps/pthread/pthread.h
index 88c7c25..636ca45 100644
--- a/nptl/sysdeps/pthread/pthread.h
+++ b/nptl/sysdeps/pthread/pthread.h
@@ -645,6 +645,11 @@ __pthread_cleanup_routine (struct __pthread_cleanup_frame *__frame)
 #  endif
 # endif
 #else
+
+# ifndef __GNUC__
+#  define __builtin_expect(cond, unused) (cond)
+# endif
+
 /* Install a cleanup handler: ROUTINE will be called with arguments ARG
    when the thread is canceled or calls pthread_exit.  ROUTINE will also
    be called with arguments ARG when the matching pthread_cleanup_pop
-- 
1.7.7.6


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