Skip to contentSkip to conversation

mingw: Fix builds on f33 mingw

PATCH Applied Dr. David Alan Gilbert (git) 6 participants 7 messages Oct 8, 2020 – Oct 12, 2020

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 mingw: Fix builds on f33 mingw

From: "Dr. David Alan Gilbert" <[email protected]>

Fedora 33's mingw moans about:

In file included from ../tests/test-bitmap.c:12:
/home/dgilbert/git/migpull/include/qemu/osdep.h:76: error: "__USE_MINGW_ANSI_STDIO" redefined [-Werror]
76 | #define __USE_MINGW_ANSI_STDIO 1

      |

the fix is to make sure osdep.h is the first include - which is our rule anyway; but one we broke in a couple of places.

---
 migration/dirtyrate.c | 2 +-
 tests/test-bitmap.c   | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)
migration/dirtyrate.c +1 -1
index ab9e1301f6..42b71e771e 100644
@@ -10,8 +10,8 @@
  * See the COPYING file in the top-level directory.
  */
 
-#include <zlib.h>
 #include "qemu/osdep.h"
+#include <zlib.h>
 #include "qapi/error.h"
 #include "cpu.h"
 #include "qemu/config-file.h"
tests/test-bitmap.c +1 -1
index 2f5b71458a..c3c9d79667 100644
@@ -8,8 +8,8 @@
  * Author: Peter Xu <[email protected]>
  */
 
-#include <stdlib.h>
 #include "qemu/osdep.h"
+#include <stdlib.h>
 #include "qemu/bitmap.h"
 
 #define BMAP_SIZE  1024
Signature · 1 line
2.28.0
Reviewed-by on v1 1/1
#1 lore raw
Quoted 38 lines · Dr. David Alan Gilbert (git)

From: "Dr. David Alan Gilbert" <[email protected]>

Fedora 33's mingw moans about:

In file included from ../tests/test-bitmap.c:12:
/home/dgilbert/git/migpull/include/qemu/osdep.h:76: error: "__USE_MINGW_ANSI_STDIO" redefined [-Werror]
76 | #define __USE_MINGW_ANSI_STDIO 1

      |

the fix is to make sure osdep.h is the first include - which is our rule anyway; but one we broke in a couple of places.

---
 migration/dirtyrate.c | 2 +-
 tests/test-bitmap.c   | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)
migration/dirtyrate.c +1 -1
index ab9e1301f6..42b71e771e 100644
@@ -10,8 +10,8 @@
  * See the COPYING file in the top-level directory.
  */
 
-#include <zlib.h>
 #include "qemu/osdep.h"
+#include <zlib.h>
 #include "qapi/error.h"
 #include "cpu.h"
 #include "qemu/config-file.h"
tests/test-bitmap.c +0 -0
index 2f5b71458a..c3c9d79667 100644

tests/test-bitmap.c line 15

Quoted 9 lines
tests/test-bitmap.c +1 -1
@@ -8,8 +8,8 @@
  * Author: Peter Xu <[email protected]>
  */
 
-#include <stdlib.h>
 #include "qemu/osdep.h"
+#include <stdlib.h>
 #include "qemu/bitmap.h"
 
 #define BMAP_SIZE  1024
#5 lore raw
In reply to Dr. David Alan Gilbert (git)

tests/test-bitmap.c line 12

Quoted 3 lines · Dr. David Alan Gilbert (git)
tests/test-bitmap.c +1 -1
-#include <stdlib.h>
 #include "qemu/osdep.h"
+#include <stdlib.h>

As pointed out by pmm earlier, for someone else's version of this patch, <stdlib.h> should simply be removed here -- it's already included by osdep.h.

r~

#6 lore raw
In reply to Dr. David Alan Gilbert (git)
Quoted 11 lines · Dr. David Alan Gilbert (git)

From: "Dr. David Alan Gilbert" <[email protected]>

Fedora 33's mingw moans about:

In file included from ../tests/test-bitmap.c:12:
/home/dgilbert/git/migpull/include/qemu/osdep.h:76: error: "__USE_MINGW_ANSI_STDIO" redefined [-Werror]
76 | #define __USE_MINGW_ANSI_STDIO 1

      |

the fix is to make sure osdep.h is the first include - which is our rule anyway; but one we broke in a couple of places.

Marc-André sent the same fix:
https://lists.gnu.org/archive/html/qemu-devel/2020-10/msg02191.html

Quoted 36 lines
---
 migration/dirtyrate.c | 2 +-
 tests/test-bitmap.c   | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)
migration/dirtyrate.c +1 -1
index ab9e1301f6..42b71e771e 100644
@@ -10,8 +10,8 @@
  * See the COPYING file in the top-level directory.
  */
 
-#include <zlib.h>
 #include "qemu/osdep.h"
+#include <zlib.h>
 #include "qapi/error.h"
 #include "cpu.h"
 #include "qemu/config-file.h"
tests/test-bitmap.c +1 -1
index 2f5b71458a..c3c9d79667 100644
@@ -8,8 +8,8 @@
  * Author: Peter Xu <[email protected]>
  */
 
-#include <stdlib.h>
 #include "qemu/osdep.h"
+#include <stdlib.h>
 #include "qemu/bitmap.h"
 
 #define BMAP_SIZE  1024
#2 lore raw
In reply to Thomas Huth

Le 08/10/2020 à 19:46, Thomas Huth a écrit :

Quoted 46 lines · Dr. David Alan Gilbert (git)
Quoted 45 lines

From: "Dr. David Alan Gilbert" <[email protected]>

Fedora 33's mingw moans about:

In file included from ../tests/test-bitmap.c:12:
/home/dgilbert/git/migpull/include/qemu/osdep.h:76: error: "__USE_MINGW_ANSI_STDIO" redefined [-Werror]
76 | #define __USE_MINGW_ANSI_STDIO 1

      |

the fix is to make sure osdep.h is the first include - which is our rule anyway; but one we broke in a couple of places.

---
 migration/dirtyrate.c | 2 +-
 tests/test-bitmap.c   | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)
migration/dirtyrate.c +1 -1
index ab9e1301f6..42b71e771e 100644
@@ -10,8 +10,8 @@
  * See the COPYING file in the top-level directory.
  */
 
-#include <zlib.h>
 #include "qemu/osdep.h"
+#include <zlib.h>
 #include "qapi/error.h"
 #include "cpu.h"
 #include "qemu/config-file.h"
tests/test-bitmap.c +1 -1
index 2f5b71458a..c3c9d79667 100644
@@ -8,8 +8,8 @@
  * Author: Peter Xu <[email protected]>
  */
 
-#include <stdlib.h>
 #include "qemu/osdep.h"
+#include <stdlib.h>
 #include "qemu/bitmap.h"
 
Quoted 6 lines

tests/test-bitmap.c line 15

Quoted 2 lines
tests/test-bitmap.c +0 -0
 #define BMAP_SIZE  1024

Applied to my trivial-patches branch.

Thanks,
Laurent

#3 lore raw
Quoted 48 lines · Laurent Vivier
Quoted 46 lines · Thomas Huth
Quoted 45 lines · Dr. David Alan Gilbert (git)

From: "Dr. David Alan Gilbert" <[email protected]>

Fedora 33's mingw moans about:

In file included from ../tests/test-bitmap.c:12:
/home/dgilbert/git/migpull/include/qemu/osdep.h:76: error: "__USE_MINGW_ANSI_STDIO" redefined [-Werror]
76 | #define __USE_MINGW_ANSI_STDIO 1

      |

the fix is to make sure osdep.h is the first include - which is our rule anyway; but one we broke in a couple of places.

---
 migration/dirtyrate.c | 2 +-
 tests/test-bitmap.c   | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)
migration/dirtyrate.c +1 -1
index ab9e1301f6..42b71e771e 100644
@@ -10,8 +10,8 @@
  * See the COPYING file in the top-level directory.
  */
 
-#include <zlib.h>
 #include "qemu/osdep.h"
+#include <zlib.h>
 #include "qapi/error.h"
 #include "cpu.h"
 #include "qemu/config-file.h"
tests/test-bitmap.c +1 -1
index 2f5b71458a..c3c9d79667 100644
@@ -8,8 +8,8 @@
  * Author: Peter Xu <[email protected]>
  */
 
-#include <stdlib.h>
 #include "qemu/osdep.h"
+#include <stdlib.h>
 #include "qemu/bitmap.h"
 
Quoted 8 lines
Quoted 6 lines

tests/test-bitmap.c line 15

Quoted 2 lines
tests/test-bitmap.c +0 -0
 #define BMAP_SIZE  1024

Applied to my trivial-patches branch.

This is the wrong version of this patch -- can you take Marc-André's instead, please?

thanks
-- PMM

#4 lore raw

Le 12/10/2020 à 17:05, Peter Maydell a écrit :

Quoted 56 lines · Laurent Vivier
Quoted 55 lines · Thomas Huth
Quoted 52 lines · Dr. David Alan Gilbert (git)
Quoted 38 lines

From: "Dr. David Alan Gilbert" <[email protected]>

Fedora 33's mingw moans about:

In file included from ../tests/test-bitmap.c:12:
/home/dgilbert/git/migpull/include/qemu/osdep.h:76: error: "__USE_MINGW_ANSI_STDIO" redefined [-Werror]
76 | #define __USE_MINGW_ANSI_STDIO 1

      |

the fix is to make sure osdep.h is the first include - which is our rule anyway; but one we broke in a couple of places.

---
 migration/dirtyrate.c | 2 +-
 tests/test-bitmap.c   | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)
migration/dirtyrate.c +1 -1
index ab9e1301f6..42b71e771e 100644
@@ -10,8 +10,8 @@
  * See the COPYING file in the top-level directory.
  */
 
-#include <zlib.h>
 #include "qemu/osdep.h"
+#include <zlib.h>
 #include "qapi/error.h"
 #include "cpu.h"
 #include "qemu/config-file.h"
tests/test-bitmap.c +0 -0
index 2f5b71458a..c3c9d79667 100644

tests/test-bitmap.c line 15

Quoted 9 lines
tests/test-bitmap.c +1 -1
@@ -8,8 +8,8 @@
  * Author: Peter Xu <[email protected]>
  */
 
-#include <stdlib.h>
 #include "qemu/osdep.h"
+#include <stdlib.h>
 #include "qemu/bitmap.h"
 
 #define BMAP_SIZE  1024
Quoted 4 lines
Quoted 1 line

Applied to my trivial-patches branch.

This is the wrong version of this patch -- can you take Marc-André's instead, please?

Yes, queueing instead:

"[PATCH v2] mingw: fix error __USE_MINGW_ANSI_STDIO redefined"

Thanks,
Laurent