Fix compilation warning due to missing header for sigaction
PATCH 1/1 Fix compilation warning due to missing header for sigaction
Fix the following warning by including signal.h directly in qemu-common.h ----8<----iohandler.c: In function ‘qemu_init_child_watch’:
iohandler.c:172: warning: implicit declaration of function ‘sigaction’ iohandler.c:172: warning: nested extern declaration of ‘sigaction’ ----8<----
--- qemu-common.h | 1 + 1 files changed, 1 insertions(+), 0 deletions(-)
qemu-common.h +1 -0
@@ -39,6 +39,7 @@ typedef struct Monitor Monitor;#include <sys/stat.h> #include <sys/time.h> #include <assert.h> +#include <signal.h> #ifdef _WIN32#include "qemu-os-win32.h"
Signature · 1 line
1.7.5
Am 02.06.2011 um 04:21 schrieb Alexandre Raymond:
Quoted 8 lines
Fix the following warning by including
signal.hdirectly inqemu-common.h----8<----iohandler.c: In function ‘qemu_init_child_watch’:
iohandler.c:172: warning: implicit declaration of function ‘sigaction’ iohandler.c:172: warning: nested extern declaration of ‘sigaction’ ----8<----Signed-off-by Alexandre Raymond <[email protected]>
Why in qemu-common.h and not in iohandler.c though?
If we put it into qemu-common.h, you should remove other inclusions of signal.h.
Andreas
Quoted 20 lines
---
qemu-common.h| 1 +1 files changed, 1 insertions(+), 0 deletions(-)qemu-common.h +1
-0@@ -39,6 +39,7 @@ typedef struct Monitor Monitor;#include <sys/stat.h> #include <sys/time.h> #include <assert.h> +#include <signal.h> #ifdef _WIN32#include "qemu-os-win32.h" Signature · 1 line
1.7.5
Quoted 9 lines · Andreas Färber
Am 02.06.2011 um 04:21 schrieb Alexandre Raymond:
Quoted 7 lines
Fix the following warning by including
signal.hdirectly inqemu-common.h----8<----iohandler.c: In function ‘qemu_init_child_watch’:
iohandler.c:172: warning: implicit declaration of function ‘sigaction’ iohandler.c:172: warning: nested extern declaration of ‘sigaction’ ----8<----
Quoted 7 lines
Quoted 1 line
Signed-off-by Alexandre Raymond <[email protected]>Tested-by Andreas Färber <[email protected]>Why in
qemu-common.hand not iniohandler.cthough?
If we put it intoqemu-common.h, you should remove other inclusions ofsignal.h.
Well, I was simply following Anthony's advice from "[PATCH] #include cleanlines" : "The idea behind qemu-common.h is to avoid direct includes to help with portability."
Alexandre
Stefan Hajnoczi
AppliedQuoted 11 lines · Alexandre Raymond
Fix the following warning by including
signal.hdirectly inqemu-common.h----8<----iohandler.c: In function ‘qemu_init_child_watch’:
iohandler.c:172: warning: implicit declaration of function ‘sigaction’ iohandler.c:172: warning: nested extern declaration of ‘sigaction’ ----8<----Signed-off-by Alexandre Raymond <[email protected]>---
qemu-common.h | 1 +1 files changed, 1 insertions(+), 0 deletions(-)
Thanks, applied to the trivial patches tree:
http://repo.or.cz/w/qemu/stefanha.git/shortlog/refs/heads/trivial-patches
Stefan
Thanks Stefan,
Should I send a follow-up patch to remove signal.h wherever qemu-common.h is already included?
Alexandre
Quoted 18 lines · Stefan Hajnoczi
Quoted 11 lines · Alexandre Raymond
Fix the following warning by including
signal.hdirectly inqemu-common.h----8<----iohandler.c: In function ‘qemu_init_child_watch’:
iohandler.c:172: warning: implicit declaration of function ‘sigaction’ iohandler.c:172: warning: nested extern declaration of ‘sigaction’ ----8<----Signed-off-by Alexandre Raymond <[email protected]>---
qemu-common.h | 1 +1 files changed, 1 insertions(+), 0 deletions(-)Thanks, applied to the trivial patches tree:
http://repo.or.cz/w/qemu/stefanha.git/shortlog/refs/heads/trivial-patchesStefan
Quoted 2 lines · Alexandre Raymond
Should I send a follow-up patch to remove
signal.hwhereverqemu-common.his already included?
Yes, please.
I didn't know that qemu-common.h pulls in system headers so users don't need to, I always figured .c files should include what they use.
But if we use this approach we might as well update the codebase.
Stefan