qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Stefan Weil <sw@weilnetz.de>
To: Markus Armbruster <armbru@redhat.com>
Cc: kwolf@redhat.com, peter.maydell@linaro.org,
	Anthony Liguori <aliguori@amazon.com>,
	Jan Kiszka <jan.kiszka@siemens.com>,
	qemu-devel@nongnu.org, Gerd Hoffmann <kraxel@redhat.com>,
	stefanha@redhat.com, pbonzini@redhat.com
Subject: Re: [Qemu-devel] [PATCH v2 1/5] w32: Add and use intermediate include file for windows.h
Date: Mon, 10 Mar 2014 18:38:36 +0100	[thread overview]
Message-ID: <531DF89C.6080401@weilnetz.de> (raw)
In-Reply-To: <871tyah1p7.fsf@blackfin.pond.sub.org>

Am 10.03.2014 09:56, schrieb Markus Armbruster:
> Stefan Weil <sw@weilnetz.de> writes:
> 
>> Including windows.h from the new file include/qemu/winapi.h allows
>> better tracking of the files which depend on the Windows API.
>>
>> 1864 *.o files depend on windows.h in a typical build, only 88 *.o files
>> don't.
>>
>> The windows.h specific macro WIN32_LEAN_AND_MEAN is now defined in the new
>> file and no longer part of the QEMU_CFLAGS. A hack in ui/sdl.c can be
>> removed after this change.
>>
>> WINVER is still needed for all compilations with MinGW, so it cannot be
>> defined in the new file. Replace its numeric value by a symbolic value to
>> show which API is requested.
> [...]
>> diff --git a/block/raw-win32.c b/block/raw-win32.c
>> index ae1c8e6..95b27a5 100644
>> --- a/block/raw-win32.c
>> +++ b/block/raw-win32.c
>> @@ -23,13 +23,13 @@
>>   */
>>  #include "qemu-common.h"
>>  #include "qemu/timer.h"
>> +#include "qemu/winapi.h"        /* HANDLE (in raw-aio.h) */
> 
> Such comments get out of date real fast.  I treat them as noise.

I agree that dependencies change over time. That's the main reason for
this kind of comments: it is easy to check whether the comment still
applies. If not, chances are good that the include statement is no
longer needed and can be removed together with the comment. How can
human reviewers see quickly why an include statement is needed when
there is no comment? Usually they can see that only for the most common
cases, and for all others they need help from the compiler.

> 
> If raw-aio.h needs stuff from winapi.h, why doesn't raw-aio.h include
> it?

It could, of course, but I assume that there is no special reason why it
does not. A lot of QEMU sources don't include everything which they need
explicitly. I thought about moving the include statement from
block/raw-win32.c and block/win32-aio.c to raw-aio.h, but decided to
minimize my changes and keep the current structure.

Stefan

  reply	other threads:[~2014-03-10 17:39 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-03-07 22:17 [Qemu-devel] [PATCH v2 0/5] w32: Reduce dependency on Windows API Stefan Weil
2014-03-07 22:17 ` [Qemu-devel] [PATCH v2 1/5] w32: Add and use intermediate include file for windows.h Stefan Weil
2014-03-10  8:56   ` Markus Armbruster
2014-03-10 17:38     ` Stefan Weil [this message]
2014-03-07 22:17 ` [Qemu-devel] [PATCH v2 2/5] w32: Move inline function from header file to C source Stefan Weil
2014-03-07 22:17 ` [Qemu-devel] [PATCH v2 3/5] w32: Reduce dependencies in sysemu/os-win32.h Stefan Weil
2014-03-07 22:17 ` [Qemu-devel] [PATCH v2 4/5] w32: Replace Windows specific data types in common header files Stefan Weil
2014-03-10 15:17   ` Stefan Hajnoczi
2014-03-10 18:34     ` Stefan Weil
2014-03-11  7:51       ` Stefan Hajnoczi
2014-03-11  8:06       ` Paolo Bonzini
2014-03-07 22:17 ` [Qemu-devel] [PATCH v2 5/5] block: Review include statements for winioctl.h Stefan Weil
2014-03-10 15:18 ` [Qemu-devel] [PATCH v2 0/5] w32: Reduce dependency on Windows API Stefan Hajnoczi

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=531DF89C.6080401@weilnetz.de \
    --to=sw@weilnetz.de \
    --cc=aliguori@amazon.com \
    --cc=armbru@redhat.com \
    --cc=jan.kiszka@siemens.com \
    --cc=kraxel@redhat.com \
    --cc=kwolf@redhat.com \
    --cc=pbonzini@redhat.com \
    --cc=peter.maydell@linaro.org \
    --cc=qemu-devel@nongnu.org \
    --cc=stefanha@redhat.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).