소스 검색

Add noreturn attribute to starpu_pthread_exit

Samuel Thibault 10 년 전
부모
커밋
6c5886179e
3개의 변경된 파일4개의 추가작업 그리고 2개의 파일을 삭제
  1. 1 1
      include/starpu_thread.h
  2. 2 0
      include/starpu_util.h
  3. 1 1
      src/common/thread.c

+ 1 - 1
include/starpu_thread.h

@@ -45,7 +45,7 @@ typedef int starpu_pthread_attr_t;
 int starpu_pthread_create_on(char *name, starpu_pthread_t *thread, const starpu_pthread_attr_t *attr, void *(*start_routine) (void *), void *arg, msg_host_t host);
 int starpu_pthread_create(starpu_pthread_t *thread, const starpu_pthread_attr_t *attr, void *(*start_routine) (void *), void *arg);
 int starpu_pthread_join(starpu_pthread_t thread, void **retval);
-int starpu_pthread_exit(void *retval);
+int starpu_pthread_exit(void *retval) STARPU_ATTRIBUTE_NORETURN;
 int starpu_pthread_attr_init(starpu_pthread_attr_t *attr);
 int starpu_pthread_attr_destroy(starpu_pthread_attr_t *attr);
 int starpu_pthread_attr_setdetachstate(starpu_pthread_attr_t *attr, int detachstate);

+ 2 - 0
include/starpu_util.h

@@ -41,6 +41,7 @@ extern "C"
 #  define STARPU_UNLIKELY(expr)          (__builtin_expect(!!(expr),0))
 #  define STARPU_LIKELY(expr)            (__builtin_expect(!!(expr),1))
 #  define STARPU_ATTRIBUTE_UNUSED                  __attribute__((unused))
+#  define STARPU_ATTRIBUTE_NORETURN                  __attribute__((noreturn))
 #  define STARPU_ATTRIBUTE_INTERNAL      __attribute__ ((visibility ("internal")))
 #  define STARPU_ATTRIBUTE_MALLOC                  __attribute__((malloc))
 #  define STARPU_ATTRIBUTE_WARN_UNUSED_RESULT      __attribute__((warn_unused_result))
@@ -50,6 +51,7 @@ extern "C"
 #  define STARPU_UNLIKELY(expr)          (expr)
 #  define STARPU_LIKELY(expr)            (expr)
 #  define STARPU_ATTRIBUTE_UNUSED
+#  define STARPU_ATTRIBUTE_NORETURN
 #  define STARPU_ATTRIBUTE_INTERNAL
 #  define STARPU_ATTRIBUTE_MALLOC
 #  define STARPU_ATTRIBUTE_WARN_UNUSED_RESULT

+ 1 - 1
src/common/thread.c

@@ -72,7 +72,7 @@ int starpu_pthread_join(starpu_pthread_t thread STARPU_ATTRIBUTE_UNUSED, void **
 int starpu_pthread_exit(void *retval STARPU_ATTRIBUTE_UNUSED)
 {
 	MSG_process_kill(MSG_process_self());
-	return 0;
+	STARPU_ABORT_MSG("MSG_process_kill(MSG_process_self()) returned?!");
 }