Skip to contentSkip to conversation

include/qemu/osdep.h: Move the __USE_MINGW_ANSI_STDIO define up to avoid confliction.

PATCH Applied Cao Jiaxi 2 participants 4 messages Apr 30, 2019 – May 2, 2019

v2 of 3 Applied Latest is v3 →

lore
Share & tools
lore

Cao Jiaxi

author
#0 lore raw

PATCH v2 4/4 include/qemu/osdep.h: Move the __USE_MINGW_ANSI_STDIO define up to avoid confliction.

---
 include/qemu/osdep.h | 10 +++++-----
 1 file changed, 5 insertions(+), 5 deletions(-)
include/qemu/osdep.h +5 -5
index 303d315c5d..af2b91f0b8 100644
@@ -85,17 +85,17 @@ extern int daemon(int, int);
 #endif
 #endif
 
+/* enable C99/POSIX format strings (needs mingw32-runtime 3.15 or later) */
+#ifdef __MINGW32__
+#define __USE_MINGW_ANSI_STDIO 1
+#endif
+
 #include <stdarg.h>
 #include <stddef.h>
 #include <stdbool.h>
 #include <stdint.h>
 #include <sys/types.h>
 #include <stdlib.h>
-
-/* enable C99/POSIX format strings (needs mingw32-runtime 3.15 or later) */
-#ifdef __MINGW32__
-#define __USE_MINGW_ANSI_STDIO 1
-#endif
 #include <stdio.h>
 
 #include <string.h>
Signature · 1 line
2.17.1
#1 lore raw
Quoted 1 line · Cao Jiaxi

Your entire series is missing 'In-Reply-To:' and 'References:' headers, making each message show up as individual new threads rather than properly threaded to a 0/4 cover letter. You'll want to fix your sending habits to avoid that problem in future submissions.

It's unusual to use a trailing '.' in the subject line. Also, your subject is very long; commit message summaries should typically be around 60-70 characters because 'git log' shows them with further indentation, where an 80-column terminal window makes it hard to see the tail at a glance. Better might be a short subject line explaining the "what", and then a non-empty commit message explaining the "why", perhaps looking like:

osdep: Fix mingw compilation regarding stdio formats

I encountered the following compilation error on mingw:
... PASTE SOMETHING HERE

It turns out that __USE_MINGW_ANSI_STDIO must be set before any system headers are included, not just before <stdio.h>.

Signed-off-by ...
Quoted 7 lines
include/qemu/osdep.h +5 -0
+/* enable C99/POSIX format strings (needs mingw32-runtime 3.15 or later) */
+#ifdef __MINGW32__
+#define __USE_MINGW_ANSI_STDIO 1
+#endif
+
 #include <stdarg.h>

include/qemu/osdep.h extern int daemon(int, int); · line 98

Quoted 10 lines
include/qemu/osdep.h +0 -5
 #include <stddef.h>
 #include <stdbool.h>
 #include <stdint.h>
 #include <sys/types.h>
 #include <stdlib.h>
-
-/* enable C99/POSIX format strings (needs mingw32-runtime 3.15 or later) */
-#ifdef __MINGW32__
-#define __USE_MINGW_ANSI_STDIO 1
-#endif

Question - does it hurt to make the define of __USE_MINGW_ANSI_STDIO unconditional? In other words, we're unlikely to break any non-mingw platform if we drop the #ifdef __MINGW32__ line.

Signature · 3 lines
Eric Blake, Principal Software Engineer
Red Hat, Inc.           +1-919-301-3226
Virtualization:  qemu.org | libvirt.org
author
#2 lore raw

Re: [Qemu-devel] [PATCH v2 4/4] include/qemu/osdep.h: Move the__USE_MINGW_ANSI_STDIO define up to avoid confliction.

Quoted 4 lines · Eric Blake

Your entire series is missing 'In-Reply-To:' and 'References:' headers, making each message show up as individual new threads rather than properly threaded to a 0/4 cover letter. You'll want to fix your sending habits to avoid that problem in future submissions.

I am terribly sorry about that, this is the first time I summit patches, and I am still getting used to the tooling. Thank you for pointing out the issue though.

Quoted 6 lines

It's unusual to use a trailing '.' in the subject line. Also, your subject is very long; commit message summaries should typically be around 60-70 characters because 'git log' shows them with further indentation, where an 80-column terminal window makes it hard to see the tail at a glance. Better might be a short subject line explaining the "what", and then a non-empty commit message explaining the "why"

Thank you for pointing out, I'll update that in the upcoming v3 set.

Quoted 3 lines

Question - does it hurt to make the define of __USE_MINGW_ANSI_STDIO unconditional? In other words, we're unlikely to break any non-mingw platform if we drop the #ifdef __MINGW32__ line.

I personally have no idea, so I'll keep it as is.

#3 lore raw

Re: [Qemu-devel] [PATCH v2 4/4] include/qemu/osdep.h: Move the__USE_MINGW_ANSI_STDIO define up to avoid confliction.

Quoted 7 lines · On 5/2/19 4:05 PM, driver1998 wrote:
Quoted 4 lines · Eric Blake

Your entire series is missing 'In-Reply-To:' and 'References:' headers, making each message show up as individual new threads rather than properly threaded to a 0/4 cover letter. You'll want to fix your sending habits to avoid that problem in future submissions.

I am terribly sorry about that, this is the first time I summit patches, and I am still getting used to the tooling.

That's okay, we were all first-timers once; and most human maintainers try to be more forgiving than automated tools when it comes to working around first-timer learning curves. There may be other useful hints you can use at https://wiki.qemu.org/Contribute/SubmitAPatch

Quoted 9 lines

Thank you for pointing out the issue though.

Quoted 6 lines

It's unusual to use a trailing '.' in the subject line. Also, your subject is very long; commit message summaries should typically be around 60-70 characters because 'git log' shows them with further indentation, where an 80-column terminal window makes it hard to see the tail at a glance. Better might be a short subject line explaining the "what", and then a non-empty commit message explaining the "why"

Quoted 7 lines

Thank you for pointing out, I'll update that in the upcoming v3 set.

Quoted 3 lines

Question - does it hurt to make the define of __USE_MINGW_ANSI_STDIO unconditional? In other words, we're unlikely to break any non-mingw platform if we drop the #ifdef __MINGW32__ line.

I personally have no idea, so I'll keep it as is.

Fair enough for your patch.

Signature · 3 lines
Eric Blake, Principal Software Engineer
Red Hat, Inc.           +1-919-301-3226
Virtualization:  qemu.org | libvirt.org