Browse Source

builtin_unreachable is not available for older gcc

Waldemar Brodkorb 9 năm trước cách đây
mục cha
commit
590ae09af7
2 tập tin đã thay đổi với 5 bổ sung1 xóa
  1. 1 1
      ldso/include/dl-syscall.h
  2. 4 0
      libpthread/nptl/forward.c

+ 1 - 1
ldso/include/dl-syscall.h

@@ -51,7 +51,7 @@ extern int _dl_errno;
 static __always_inline attribute_noreturn __cold void _dl_exit(int status)
 {
 	INLINE_SYSCALL(_dl_exit, 1, status);
-#if defined __GNUC__ && !__GNUC_PREREQ (4, 4)
+#if defined __GNUC__ && (!__GNUC_PREREQ (4, 4) && !__GNUC_PREREQ (4, 2))
 	__builtin_unreachable(); /* shut up warning: 'noreturn' function does return*/
 #else
 	while (1);

+ 4 - 0
libpthread/nptl/forward.c

@@ -160,6 +160,10 @@ FORWARD2(__pthread_unwind,
 		       /* We cannot call abort() here.  */
 		       INTERNAL_SYSCALL_DECL (err);
 		       INTERNAL_SYSCALL (kill, err, 1, SIGKILL);
+#if defined __GNUC__ && (!__GNUC_PREREQ (4, 4) && !__GNUC_PREREQ (4, 2))
 		       __builtin_unreachable();
+#else
+			while(1);
+#endif
 		     })
 #undef return