Skip to contentSkip to conversation

Fix compilation warning due to missing header for sigaction

PATCH Applied Alexandre Raymond 3 participants 6 messages Jun 2, 2011

lore
Share & tools
lore
#0 lore raw

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
index b851b20..39fabc9 100644
@@ -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
Tested-by on v1 1/1
#1 lore raw

Am 02.06.2011 um 04:21 schrieb Alexandre Raymond:

Quoted 8 lines

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<----

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
index b851b20..39fabc9 100644
@@ -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
#2 lore raw
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.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<----

Quoted 7 lines
Quoted 1 line

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.

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

#3 lore raw
In reply to Alexandre Raymond
Quoted 11 lines · Alexandre Raymond

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(-)

Thanks, applied to the trivial patches tree:
http://repo.or.cz/w/qemu/stefanha.git/shortlog/refs/heads/trivial-patches

Stefan

#4 lore raw

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.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(-)

Thanks, applied to the trivial patches tree:
http://repo.or.cz/w/qemu/stefanha.git/shortlog/refs/heads/trivial-patches

Stefan

#5 lore raw
Quoted 2 lines · Alexandre Raymond

Should I send a follow-up patch to remove signal.h wherever qemu-common.h is 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