qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
* [Qemu-devel] [PATCH] qga/channel-posix.c: Explicitly include string.h
@ 2013-01-07 17:29 Peter Maydell
  2013-01-07 17:38 ` Stefan Weil
  2013-01-11  8:33 ` Stefan Hajnoczi
  0 siblings, 2 replies; 6+ messages in thread
From: Peter Maydell @ 2013-01-07 17:29 UTC (permalink / raw)
  To: qemu-devel; +Cc: qemu-trivial, patches

Explicitly include string.h to avoid warnings under MacOS X/clang
about implicit declarations of strerror() and strlen().

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
---
I assume under Linux these are implicitly dragged in via one of the
other headers.

 qga/channel-posix.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/qga/channel-posix.c b/qga/channel-posix.c
index d4fd628..ca9e4aa 100644
--- a/qga/channel-posix.c
+++ b/qga/channel-posix.c
@@ -4,6 +4,7 @@
 #include <unistd.h>
 #include <fcntl.h>
 #include <stdlib.h>
+#include <string.h>
 #include "qemu/osdep.h"
 #include "qemu/sockets.h"
 #include "qga/channel.h"
-- 
1.7.11.4

^ permalink raw reply related	[flat|nested] 6+ messages in thread

* Re: [Qemu-devel] [PATCH] qga/channel-posix.c: Explicitly include string.h
  2013-01-07 17:29 [Qemu-devel] [PATCH] qga/channel-posix.c: Explicitly include string.h Peter Maydell
@ 2013-01-07 17:38 ` Stefan Weil
  2013-01-07 17:50   ` Peter Maydell
  2013-01-11  8:33 ` Stefan Hajnoczi
  1 sibling, 1 reply; 6+ messages in thread
From: Stefan Weil @ 2013-01-07 17:38 UTC (permalink / raw)
  To: Peter Maydell; +Cc: qemu-trivial, qemu-devel, patches

Am 07.01.2013 18:29, schrieb Peter Maydell:
> Explicitly include string.h to avoid warnings under MacOS X/clang
> about implicit declarations of strerror() and strlen().
>
> Signed-off-by: Peter Maydell<peter.maydell@linaro.org>
> ---
> I assume under Linux these are implicitly dragged in via one of the
> other headers.
>
>   qga/channel-posix.c | 1 +
>   1 file changed, 1 insertion(+)
>
> diff --git a/qga/channel-posix.c b/qga/channel-posix.c
> index d4fd628..ca9e4aa 100644
> --- a/qga/channel-posix.c
> +++ b/qga/channel-posix.c
> @@ -4,6 +4,7 @@
>   #include<unistd.h>
>   #include<fcntl.h>
>   #include<stdlib.h>
> +#include<string.h>
>   #include "qemu/osdep.h"
>   #include "qemu/sockets.h"
>   #include "qga/channel.h"
>    

Better: include qemu-common.h first and remove all
three standard includes.

- Stefan

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [Qemu-devel] [PATCH] qga/channel-posix.c: Explicitly include string.h
  2013-01-07 17:38 ` Stefan Weil
@ 2013-01-07 17:50   ` Peter Maydell
  2013-01-07 22:12     ` Eduardo Habkost
  0 siblings, 1 reply; 6+ messages in thread
From: Peter Maydell @ 2013-01-07 17:50 UTC (permalink / raw)
  To: Stefan Weil
  Cc: qemu-trivial, Paolo Bonzini, qemu-devel, Eduardo Habkost, patches

On 7 January 2013 17:38, Stefan Weil <sw@weilnetz.de> wrote:
> Am 07.01.2013 18:29, schrieb Peter Maydell:
>
>> Explicitly include string.h to avoid warnings under MacOS X/clang
>> about implicit declarations of strerror() and strlen().

> Better: include qemu-common.h first and remove all
> three standard includes.

This would be reversing direction from commit 4d4922c33...
I took the commit message in that commit to imply that we
shouldn't be including qemu-common.h for standalone
executables like qga.

-- PMM

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [Qemu-devel] [PATCH] qga/channel-posix.c: Explicitly include string.h
  2013-01-07 17:50   ` Peter Maydell
@ 2013-01-07 22:12     ` Eduardo Habkost
  2013-01-08  5:08       ` Stefan Weil
  0 siblings, 1 reply; 6+ messages in thread
From: Eduardo Habkost @ 2013-01-07 22:12 UTC (permalink / raw)
  To: Peter Maydell
  Cc: qemu-trivial, Stefan Weil, Paolo Bonzini, qemu-devel, patches

On Mon, Jan 07, 2013 at 05:50:14PM +0000, Peter Maydell wrote:
> On 7 January 2013 17:38, Stefan Weil <sw@weilnetz.de> wrote:
> > Am 07.01.2013 18:29, schrieb Peter Maydell:
> >
> >> Explicitly include string.h to avoid warnings under MacOS X/clang
> >> about implicit declarations of strerror() and strlen().
> 
> > Better: include qemu-common.h first and remove all
> > three standard includes.
> 
> This would be reversing direction from commit 4d4922c33...
> I took the commit message in that commit to imply that we
> shouldn't be including qemu-common.h for standalone
> executables like qga.

Including qemu-common.h from .c files is OK, although I wouldn't do that
in this specific case (I would include string.h instead).

The problem with qemu-common.h is when it is included by header files,
because qemu-common.h includes lots of other headers, easily leading to
circular header dependencies.

-- 
Eduardo

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [Qemu-devel] [PATCH] qga/channel-posix.c: Explicitly include string.h
  2013-01-07 22:12     ` Eduardo Habkost
@ 2013-01-08  5:08       ` Stefan Weil
  0 siblings, 0 replies; 6+ messages in thread
From: Stefan Weil @ 2013-01-08  5:08 UTC (permalink / raw)
  To: Eduardo Habkost
  Cc: Peter Maydell, patches, qemu-trivial, Stefan Weil, qemu-devel,
	Paolo Bonzini

> On Mon, Jan 07, 2013 at 05:50:14PM +0000, Peter Maydell wrote:
>> On 7 January 2013 17:38, Stefan Weil <sw@weilnetz.de> wrote:
>> > Am 07.01.2013 18:29, schrieb Peter Maydell:
>> >
>> >> Explicitly include string.h to avoid warnings under MacOS X/clang
>> >> about implicit declarations of strerror() and strlen().
>>
>> > Better: include qemu-common.h first and remove all
>> > three standard includes.
>>
>> This would be reversing direction from commit 4d4922c33...
>> I took the commit message in that commit to imply that we
>> shouldn't be including qemu-common.h for standalone
>> executables like qga.
>
> Including qemu-common.h from .c files is OK, although I wouldn't do that
> in this specific case (I would include string.h instead).
>
> The problem with qemu-common.h is when it is included by header files,
> because qemu-common.h includes lots of other headers, easily leading to
> circular header dependencies.
>
> --
> Eduardo
>


I just noticed that on my Linux host qemu-common.h is no longer
included indirectly (it was with earlier revisions of QEMU).

Therefore the patch is ok.

Reviewed-by: Stefan Weil <sw@weilnetz.de>

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [Qemu-devel] [PATCH] qga/channel-posix.c: Explicitly include string.h
  2013-01-07 17:29 [Qemu-devel] [PATCH] qga/channel-posix.c: Explicitly include string.h Peter Maydell
  2013-01-07 17:38 ` Stefan Weil
@ 2013-01-11  8:33 ` Stefan Hajnoczi
  1 sibling, 0 replies; 6+ messages in thread
From: Stefan Hajnoczi @ 2013-01-11  8:33 UTC (permalink / raw)
  To: Peter Maydell; +Cc: qemu-trivial, qemu-devel, patches

On Mon, Jan 07, 2013 at 05:29:55PM +0000, Peter Maydell wrote:
> Explicitly include string.h to avoid warnings under MacOS X/clang
> about implicit declarations of strerror() and strlen().
> 
> Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
> ---
> I assume under Linux these are implicitly dragged in via one of the
> other headers.
> 
>  qga/channel-posix.c | 1 +
>  1 file changed, 1 insertion(+)

Thanks, applied to the trivial patches tree:
https://github.com/stefanha/qemu/commits/trivial-patches

Stefan

^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2013-01-11  8:34 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-01-07 17:29 [Qemu-devel] [PATCH] qga/channel-posix.c: Explicitly include string.h Peter Maydell
2013-01-07 17:38 ` Stefan Weil
2013-01-07 17:50   ` Peter Maydell
2013-01-07 22:12     ` Eduardo Habkost
2013-01-08  5:08       ` Stefan Weil
2013-01-11  8:33 ` Stefan Hajnoczi

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).