diff options
-rw-r--r-- | m4/virt-compile-warnings.m4 | 1 | ||||
-rw-r--r-- | src/internal.h | 9 | ||||
-rw-r--r-- | src/lxc/lxc_container.c | 3 | ||||
-rw-r--r-- | tests/eventtest.c | 3 |
4 files changed, 12 insertions, 4 deletions
diff --git a/m4/virt-compile-warnings.m4 b/m4/virt-compile-warnings.m4 index 0431074cb..27413b09f 100644 --- a/m4/virt-compile-warnings.m4 +++ b/m4/virt-compile-warnings.m4 @@ -63,7 +63,6 @@ AC_DEFUN([LIBVIRT_COMPILE_WARNINGS],[ dontwarn="$dontwarn -Wconversion" dontwarn="$dontwarn -Wsign-conversion" dontwarn="$dontwarn -Wold-style-definition" - dontwarn="$dontwarn -Wmissing-noreturn" dontwarn="$dontwarn -Wpacked" dontwarn="$dontwarn -Wunused-macros" dontwarn="$dontwarn -Woverlength-strings" diff --git a/src/internal.h b/src/internal.h index 2afbd8db4..4641fc154 100644 --- a/src/internal.h +++ b/src/internal.h @@ -117,6 +117,15 @@ # endif /** + * ATTRIBUTE_NORETURN: + * + * Macro to indicate that a function won't return to the caller + */ +# ifndef ATTRIBUTE_NORETURN +# define ATTRIBUTE_NORETURN __attribute__((__noreturn__)) +# endif + +/** * ATTRIBUTE_SENTINEL: * * Macro to check for NULL-terminated varargs lists diff --git a/src/lxc/lxc_container.c b/src/lxc/lxc_container.c index 9830b71c2..af453f344 100644 --- a/src/lxc/lxc_container.c +++ b/src/lxc/lxc_container.c @@ -914,7 +914,8 @@ int lxcContainerStart(virDomainDefPtr def, return pid; } -static int lxcContainerDummyChild(void *argv ATTRIBUTE_UNUSED) +ATTRIBUTE_NORETURN static int +lxcContainerDummyChild(void *argv ATTRIBUTE_UNUSED) { _exit(0); } diff --git a/tests/eventtest.c b/tests/eventtest.c index 4d22070c7..eb4b7552a 100644 --- a/tests/eventtest.c +++ b/tests/eventtest.c @@ -119,7 +119,7 @@ static pthread_cond_t eventThreadJobCond = PTHREAD_COND_INITIALIZER; static int eventThreadJobDone = 0; -static void *eventThreadLoop(void *data ATTRIBUTE_UNUSED) { +ATTRIBUTE_NORETURN static void *eventThreadLoop(void *data ATTRIBUTE_UNUSED) { while (1) { pthread_mutex_lock(&eventThreadMutex); while (!eventThreadRunOnce) { @@ -135,7 +135,6 @@ static void *eventThreadLoop(void *data ATTRIBUTE_UNUSED) { pthread_cond_signal(&eventThreadJobCond); pthread_mutex_unlock(&eventThreadMutex); } - return NULL; } |