mirror of https://gitee.com/openkylin/libvirt.git
Enable use of -Wmissing-noreturn
* src/internal.h: Define a ATTRIBUTE_NO_RETURN annotation * src/lxc/lxc_container.c: Annotate lxcContainerDummyChild with ATTRIBUTE_NO_RETURN * tests/eventtest.c: Mark async thread as ATTRIBUTE_NO_RETURN * m4/virt-compile-warnings.m4: Enable -Wmissing-noreturn
This commit is contained in:
parent
7d76d5d506
commit
329e9dc629
|
@ -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"
|
||||
|
|
|
@ -116,6 +116,15 @@
|
|||
# define ATTRIBUTE_UNUSED __attribute__((__unused__))
|
||||
# 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:
|
||||
*
|
||||
|
|
|
@ -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);
|
||||
}
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
|
||||
|
||||
|
|
Loading…
Reference in New Issue