All of lore.kernel.org
 help / color / mirror / Atom feed
* [Qemu-devel] [PATCH] win32: Avoid compiler warning (WIN32_LEAN_AND_MEAN redefined)
@ 2010-04-01 14:20 Stefan Weil
  2010-04-21 20:13 ` [Qemu-devel] " Stefan Weil
  0 siblings, 1 reply; 6+ messages in thread
From: Stefan Weil @ 2010-04-01 14:20 UTC (permalink / raw)
  To: QEMU Developers

configure adds the macro WIN32_LEAN_AND_MEAN to
QEMU_CFLAGS, and SDL_syswm.h defines it, too.

This results in a compiler warning (redefinition of
WIN32_LEAN_AND_MEAN in SDL_syswm.h. That warning prevents
compilations for win32 with warning = error).

Fix this by removing the definition of WIN32_LEAN_AND_MEAN
before including SDL_syswm.h.

Signed-off-by: Stefan Weil <weil@mail.berlios.de>
---
 sdl.c |    4 ++++
 1 files changed, 4 insertions(+), 0 deletions(-)

diff --git a/sdl.c b/sdl.c
index 16a48e9..0334b4b 100644
--- a/sdl.c
+++ b/sdl.c
@@ -21,6 +21,10 @@
  * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
  * THE SOFTWARE.
  */
+
+/* Avoid compiler warning because macro is redefined in SDL_syswm.h. */
+#undef WIN32_LEAN_AND_MEAN
+
 #include <SDL.h>
 #include <SDL_syswm.h>
 
-- 
1.5.6.5

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

* [Qemu-devel] Re: [PATCH] win32: Avoid compiler warning (WIN32_LEAN_AND_MEAN redefined)
  2010-04-01 14:20 [Qemu-devel] [PATCH] win32: Avoid compiler warning (WIN32_LEAN_AND_MEAN redefined) Stefan Weil
@ 2010-04-21 20:13 ` Stefan Weil
  2010-04-22 10:11   ` Paolo Bonzini
  2010-05-08 14:46   ` Stefan Weil
  0 siblings, 2 replies; 6+ messages in thread
From: Stefan Weil @ 2010-04-21 20:13 UTC (permalink / raw)
  To: Anthony Liguori; +Cc: QEMU Developers

Stefan Weil schrieb:
> configure adds the macro WIN32_LEAN_AND_MEAN to
> QEMU_CFLAGS, and SDL_syswm.h defines it, too.
>
> This results in a compiler warning (redefinition of
> WIN32_LEAN_AND_MEAN in SDL_syswm.h. That warning prevents
> compilations for win32 with warning = error).
>
> Fix this by removing the definition of WIN32_LEAN_AND_MEAN
> before including SDL_syswm.h.
>
> Signed-off-by: Stefan Weil <weil@mail.berlios.de>
> ---
> sdl.c | 4 ++++
> 1 files changed, 4 insertions(+), 0 deletions(-)
>
> diff --git a/sdl.c b/sdl.c
> index 16a48e9..0334b4b 100644
> --- a/sdl.c
> +++ b/sdl.c
> @@ -21,6 +21,10 @@
> * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
> DEALINGS IN
> * THE SOFTWARE.
> */
> +
> +/* Avoid compiler warning because macro is redefined in SDL_syswm.h. */
> +#undef WIN32_LEAN_AND_MEAN
> +
> #include <SDL.h>
> #include <SDL_syswm.h>
>

No comments, no questions? The original patch still applies.

It would be nice to have this patch in QEMU master.

Regards,
Stefan

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

* [Qemu-devel] Re: [PATCH] win32: Avoid compiler warning (WIN32_LEAN_AND_MEAN redefined)
  2010-04-21 20:13 ` [Qemu-devel] " Stefan Weil
@ 2010-04-22 10:11   ` Paolo Bonzini
  2010-04-22 15:21     ` Richard Henderson
  2010-05-08 14:46   ` Stefan Weil
  1 sibling, 1 reply; 6+ messages in thread
From: Paolo Bonzini @ 2010-04-22 10:11 UTC (permalink / raw)
  To: Stefan Weil; +Cc: Anthony Liguori, QEMU Developers

On 04/21/2010 10:13 PM, Stefan Weil wrote:
> Stefan Weil schrieb:
>> configure adds the macro WIN32_LEAN_AND_MEAN to
>> QEMU_CFLAGS, and SDL_syswm.h defines it, too.
>>
>> This results in a compiler warning (redefinition of
>> WIN32_LEAN_AND_MEAN in SDL_syswm.h. That warning prevents
>> compilations for win32 with warning = error).
>>
>> Fix this by removing the definition of WIN32_LEAN_AND_MEAN
>> before including SDL_syswm.h.
 >>
>> +/* Avoid compiler warning because macro is redefined in SDL_syswm.h. */
>> +#undef WIN32_LEAN_AND_MEAN
>> +
>> #include<SDL.h>
>> #include<SDL_syswm.h>
>
> No comments, no questions? The original patch still applies.

Why does that conflict?  If the redefinition is with the same meaning, 
GCC should not conflict.

There is

#define WIN32_LEAN_AND_MEAN

in SDL_syswm.h and -DWIN32_LEAN_AND_MEAN in configure, so that should be 
okay.

Paolo

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

* Re: [Qemu-devel] Re: [PATCH] win32: Avoid compiler warning (WIN32_LEAN_AND_MEAN redefined)
  2010-04-22 10:11   ` Paolo Bonzini
@ 2010-04-22 15:21     ` Richard Henderson
  0 siblings, 0 replies; 6+ messages in thread
From: Richard Henderson @ 2010-04-22 15:21 UTC (permalink / raw)
  To: Paolo Bonzini; +Cc: Anthony Liguori, QEMU Developers

On 04/22/2010 03:11 AM, Paolo Bonzini wrote:
> There is
> 
> #define WIN32_LEAN_AND_MEAN
> 
> in SDL_syswm.h and -DWIN32_LEAN_AND_MEAN in configure, so that should be
> okay.

-DFOO   =>  #define FOO 1
-DFOO=  =>  #define FOO


r~

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

* [Qemu-devel] Re: [PATCH] win32: Avoid compiler warning (WIN32_LEAN_AND_MEAN redefined)
  2010-04-21 20:13 ` [Qemu-devel] " Stefan Weil
  2010-04-22 10:11   ` Paolo Bonzini
@ 2010-05-08 14:46   ` Stefan Weil
  2010-05-10  8:20     ` Paolo Bonzini
  1 sibling, 1 reply; 6+ messages in thread
From: Stefan Weil @ 2010-05-08 14:46 UTC (permalink / raw)
  To: Anthony Liguori; +Cc: Paolo Bonzini, QEMU Developers, Richard Henderson

Am 21.04.2010 22:13, schrieb Stefan Weil:
> Stefan Weil schrieb:
>> configure adds the macro WIN32_LEAN_AND_MEAN to
>> QEMU_CFLAGS, and SDL_syswm.h defines it, too.
>>
>> This results in a compiler warning (redefinition of
>> WIN32_LEAN_AND_MEAN in SDL_syswm.h. That warning prevents
>> compilations for win32 with warning = error).
>>
>> Fix this by removing the definition of WIN32_LEAN_AND_MEAN
>> before including SDL_syswm.h.
>>
>> Signed-off-by: Stefan Weil <weil@mail.berlios.de>
>> ---
>> sdl.c | 4 ++++
>> 1 files changed, 4 insertions(+), 0 deletions(-)
>>
>> diff --git a/sdl.c b/sdl.c
>> index 16a48e9..0334b4b 100644
>> --- a/sdl.c
>> +++ b/sdl.c
>> @@ -21,6 +21,10 @@
>> * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
>> DEALINGS IN
>> * THE SOFTWARE.
>> */
>> +
>> +/* Avoid compiler warning because macro is redefined in SDL_syswm.h. */
>> +#undef WIN32_LEAN_AND_MEAN
>> +
>> #include <SDL.h>
>> #include <SDL_syswm.h>
>>
>
> No comments, no questions? The original patch still applies.
>
> It would be nice to have this patch in QEMU master.
>
> Regards,
> Stefan

Hello Anthony,

is this patch still in your work queue? It is still valid for qemu master.

There were two feedbacks: Paolo had a question which was answered by 
Richard.

The compiler warning for Windows still exists, and I see 3 ways to fix it:

1. Use my patch.

2. Don't define WIN32_LEAN_AND_MEAN in configure/make.

3. Change the definition of WIN32_LEAN_AND_MEAN in configure/make.

I personally prefer solution 2, but we had this once and some
developers decided to change that, so I don't think it's a
realistic solution now.

Solution 3 is a very simple change. It works for the moment,
but would raise warnings when a library header file with a
different definition of WIN32_LEAN_AND_MEAN is used.
When I scanned the system headers of my mingw32
installation, I saw these two variants:
#define WIN32_LEAN_AND_MEAN
#define WIN32_LEAN_AND_MEAN 1

So I still think my patch is the best solution.

Regards,
Stefan

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

* Re: [Qemu-devel] Re: [PATCH] win32: Avoid compiler warning (WIN32_LEAN_AND_MEAN redefined)
  2010-05-08 14:46   ` Stefan Weil
@ 2010-05-10  8:20     ` Paolo Bonzini
  0 siblings, 0 replies; 6+ messages in thread
From: Paolo Bonzini @ 2010-05-10  8:20 UTC (permalink / raw)
  To: Stefan Weil; +Cc: Anthony Liguori, QEMU Developers, Richard Henderson

> 3. Change the definition of WIN32_LEAN_AND_MEAN in configure/make.
> 
> Solution 3 is a very simple change. It works for the moment,
> but would raise warnings when a library header file with a
> different definition of WIN32_LEAN_AND_MEAN is used.
> When I scanned the system headers of my mingw32
> installation, I saw these two variants:
> #define WIN32_LEAN_AND_MEAN
> #define WIN32_LEAN_AND_MEAN 1

Same here.

> So I still think my patch is the best solution.

I agree.  Let's report a bug to SDL as well.

Paolo

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

end of thread, other threads:[~2010-05-10  9:43 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2010-04-01 14:20 [Qemu-devel] [PATCH] win32: Avoid compiler warning (WIN32_LEAN_AND_MEAN redefined) Stefan Weil
2010-04-21 20:13 ` [Qemu-devel] " Stefan Weil
2010-04-22 10:11   ` Paolo Bonzini
2010-04-22 15:21     ` Richard Henderson
2010-05-08 14:46   ` Stefan Weil
2010-05-10  8:20     ` Paolo Bonzini

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.