Skip to contentSkip to conversation

Replace CONFIG_WIN32 with CONFIG_WIN64

PATCH In review Thomas Huth 5 participants 8 messages Jan 22

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 Replace CONFIG_WIN32 with CONFIG_WIN64

From: Thomas Huth <[email protected]>

We stopped supported 32-bit Windows hosts a while ago already, so let's rename CONFIG_WIN32 to CONFIG_WIN64 now to make it clear that this switch is not about 32-bit Windows anymore.

The patch has been created with a simple sed statement:

sed -i s/CONFIG_WIN32/CONFIG_WIN64/g $(grep -rl CONFIG_WIN32 *)

---
 meson.build           |  2 +-
 qapi/char.json        |  4 +--
 qapi/misc.json        |  2 +-
 qga/qapi-schema.json  | 76 +++++++++++++++++++++----------------------
 include/qemu/futex.h  |  2 +-
 include/qemu/xattr.h  |  2 +-
 hw/usb/host-libusb.c  | 18 +++++-----
 io/channel-watch.c    | 10 +++---
 ui/gtk.c              |  2 +-
 util/cacheflush.c     |  4 +--
 util/sys_membarrier.c |  2 +-
 scripts/checkpatch.pl |  2 +-
 12 files changed, 63 insertions(+), 63 deletions(-)
meson.build +1 -1
index a84f14258b0..01b9a5c22ce 100644
@@ -2422,7 +2422,7 @@ config_host_data.set('CONFIG_GCOV', get_option('b_coverage'))
 config_host_data.set('CONFIG_LIBUDEV', libudev.found())
 config_host_data.set('CONFIG_LINUX', host_os == 'linux')
 config_host_data.set('CONFIG_POSIX', host_os != 'windows')
-config_host_data.set('CONFIG_WIN32', host_os == 'windows')
+config_host_data.set('CONFIG_WIN64', host_os == 'windows')
 config_host_data.set('CONFIG_LZO', lzo.found())
 config_host_data.set('CONFIG_MPATH', mpathpersist.found())
 config_host_data.set('CONFIG_BLKIO', blkio.found())
qapi/char.json +2 -2
index 140614f82c3..7853a093b1b 100644
@@ -528,7 +528,7 @@
             { 'name': 'braille', 'if': 'CONFIG_BRLAPI' },
             'testdev',
             'stdio',
-            { 'name': 'console', 'if': 'CONFIG_WIN32' },
+            { 'name': 'console', 'if': 'CONFIG_WIN64' },
             { 'name': 'spicevmc', 'if': 'CONFIG_SPICE' },
             { 'name': 'spiceport', 'if': 'CONFIG_SPICE' },
             { 'name': 'qemu-vdagent', 'if': 'CONFIG_SPICE_PROTOCOL' },
@@ -722,7 +722,7 @@
             'testdev': 'ChardevCommonWrapper',
             'stdio': 'ChardevStdioWrapper',
             'console': { 'type': 'ChardevCommonWrapper',
-                         'if': 'CONFIG_WIN32' },
+                         'if': 'CONFIG_WIN64' },
             'spicevmc': { 'type': 'ChardevSpiceChannelWrapper',
                           'if': 'CONFIG_SPICE' },
             'spiceport': { 'type': 'ChardevSpicePortWrapper',
qapi/misc.json +1 -1
index 28c641fe2fe..1122fa899ca 100644
@@ -291,7 +291,7 @@
 #          "arguments": { "info": "abcd123..", "fdname": "skclient" } }
 #     <- { "return": {} }
 ##
-{ 'command': 'get-win32-socket', 'data': {'info': 'str', 'fdname': 'str'}, 'if': 'CONFIG_WIN32' }
+{ 'command': 'get-win32-socket', 'data': {'info': 'str', 'fdname': 'str'}, 'if': 'CONFIG_WIN64' }
 
 ##
 # @closefd:
qga/qapi-schema.json +38 -38

304 lines not on this page · raw message

include/qemu/futex.h +1 -1
index 607613eec83..7eb219daa37 100644
@@ -55,7 +55,7 @@ static inline void qemu_futex_wait(void *f, unsigned val)
         }
     }
 }
-#elif defined(CONFIG_WIN32)
+#elif defined(CONFIG_WIN64)
 #include <synchapi.h>
 
 static inline void qemu_futex_wake_all(void *f)
include/qemu/xattr.h +1 -1
index 224ba1276e6..063c93a66e7 100644
@@ -25,7 +25,7 @@
 #  if !defined(ENOATTR)
 #    define ENOATTR ENODATA
 #  endif
-#  ifndef CONFIG_WIN32
+#  ifndef CONFIG_WIN64
 #    ifdef CONFIG_FREEBSD
 #      include <sys/extattr.h>
 #    else
hw/usb/host-libusb.c +9 -9
index b9f3ad3f66d..2f20614534f 100644
@@ -35,7 +35,7 @@
 
 #include "qemu/osdep.h"
 #include "qom/object.h"
-#ifndef CONFIG_WIN32
+#ifndef CONFIG_WIN64
 #include <poll.h>
 #endif
 #include <libusb.h>
@@ -233,7 +233,7 @@ static const char *err_names[] = {
 static libusb_context *ctx;
 static uint32_t loglevel;
 
-#ifndef CONFIG_WIN32
+#ifndef CONFIG_WIN64
 
 static void usb_host_handle_fd(void *opaque)
 {
@@ -277,11 +277,11 @@ static void usb_host_timer(void *opaque)
     usb_host_timer_kick();
 }
 
-#endif /* !CONFIG_WIN32 */
+#endif /* !CONFIG_WIN64 */
 
 static int usb_host_init(void)
 {
-#ifndef CONFIG_WIN32
+#ifndef CONFIG_WIN64
     const struct libusb_pollfd **poll;
 #endif
     int rc;
@@ -298,7 +298,7 @@ static int usb_host_init(void)
 #else
     libusb_set_debug(ctx, loglevel);
 #endif
-#ifdef CONFIG_WIN32
+#ifdef CONFIG_WIN64
     poll_timer = timer_new_ns(QEMU_CLOCK_VIRTUAL, usb_host_timer, NULL);
     usb_host_timer_kick();
 #else
@@ -388,7 +388,7 @@ static USBHostRequest *usb_host_req_alloc(USBHostDevice *s, USBPacket *p,
         r->buffer = g_malloc(bufsize);
     }
     QTAILQ_INSERT_TAIL(&s->requests, r, next);
-#ifdef CONFIG_WIN32
+#ifdef CONFIG_WIN64
     request_count++;
     usb_host_timer_kick();
 #endif
@@ -397,7 +397,7 @@ static USBHostRequest *usb_host_req_alloc(USBHostDevice *s, USBPacket *p,
 
 static void usb_host_req_free(USBHostRequest *r)
 {
-#ifdef CONFIG_WIN32
+#ifdef CONFIG_WIN64
     request_count--;
 #endif
     QTAILQ_REMOVE(&r->host->requests, r, next);
@@ -971,7 +971,7 @@ static int usb_host_open(USBHostDevice *s, libusb_device *dev, int hostfd)
             goto fail;
         }
     } else {
-#if LIBUSB_API_VERSION >= 0x01000107 && !defined(CONFIG_WIN32)
+#if LIBUSB_API_VERSION >= 0x01000107 && !defined(CONFIG_WIN64)
         trace_usb_host_open_hostfd(hostfd);
 
         rc = libusb_wrap_sys_device(ctx, hostfd, &s->dh);
@@ -1208,7 +1208,7 @@ static void usb_host_realize(USBDevice *udev, Error **errp)
     QTAILQ_INIT(&s->isorings);
     s->hostfd = -1;
 
-#if LIBUSB_API_VERSION >= 0x01000107 && !defined(CONFIG_WIN32)
+#if LIBUSB_API_VERSION >= 0x01000107 && !defined(CONFIG_WIN64)
     if (s->hostdevice) {
         int fd;
         s->needs_autoscan = false;
io/channel-watch.c +5 -5
index 018648b36b4..ddd0aa1548a 100644
@@ -30,7 +30,7 @@ struct QIOChannelFDSource {
 };
 
 
-#ifdef CONFIG_WIN32
+#ifdef CONFIG_WIN64
 typedef struct QIOChannelSocketSource QIOChannelSocketSource;
 struct QIOChannelSocketSource {
     GSource parent;
@@ -96,7 +96,7 @@ qio_channel_fd_source_finalize(GSource *source)
 }
 
 
-#ifdef CONFIG_WIN32
+#ifdef CONFIG_WIN64
 static gboolean
 qio_channel_socket_source_prepare(GSource *source G_GNUC_UNUSED,
                                   gint *timeout)
@@ -261,7 +261,7 @@ GSource *qio_channel_create_fd_watch(QIOChannel *ioc,
 
     ssource->condition = condition;
 
-#ifdef CONFIG_WIN32
+#ifdef CONFIG_WIN64
     ssource->fd.fd = (gint64)_get_osfhandle(fd);
 #else
     ssource->fd.fd = fd;
@@ -273,7 +273,7 @@ GSource *qio_channel_create_fd_watch(QIOChannel *ioc,
     return source;
 }
 
-#ifdef CONFIG_WIN32
+#ifdef CONFIG_WIN64
 GSource *qio_channel_create_socket_watch(QIOChannel *ioc,
                                          int sockfd,
                                          GIOCondition condition)
@@ -329,7 +329,7 @@ GSource *qio_channel_create_fd_pair_watch(QIOChannel *ioc,
 
     ssource->condition = condition;
 
-#ifdef CONFIG_WIN32
+#ifdef CONFIG_WIN64
     ssource->fdread.fd = (gint64)_get_osfhandle(fdread);
     ssource->fdwrite.fd = (gint64)_get_osfhandle(fdwrite);
 #else
ui/gtk.c +1 -1
index e83a3666258..60eb1c245a0 100644
@@ -1363,7 +1363,7 @@ static gboolean gd_key_event(GtkWidget *widget, GdkEventKey *key, void *opaque)
 static gboolean gd_grab_broken_event(GtkWidget *widget,
                                      GdkEventGrabBroken *event, void *opaque)
 {
-#ifdef CONFIG_WIN32
+#ifdef CONFIG_WIN64
     /*
      * On Windows the Ctrl-Alt-Del key combination can't be grabbed. This
      * key combination leaves all three keys in a stuck condition. We use
util/cacheflush.c +2 -2
index c043c5f881a..70cf924a263 100644
@@ -121,7 +121,7 @@ static void sys_cache_info(int *isize, int *dsize)
 static bool have_coherent_icache;
 #endif
 
-#if defined(__aarch64__) && !defined(CONFIG_DARWIN) && !defined(CONFIG_WIN32)
+#if defined(__aarch64__) && !defined(CONFIG_DARWIN) && !defined(CONFIG_WIN64)
 /*
  * Apple does not expose CTR_EL0, so we must use system interfaces.
  * Windows neither, but we use a generic implementation of flush_idcache_range
@@ -231,7 +231,7 @@ static void __attribute__((constructor)) init_cache_info(void)
 
 /* Wasm doesn't have executable region of memory. */
 
-#elif defined(__aarch64__) && !defined(CONFIG_WIN32)
+#elif defined(__aarch64__) && !defined(CONFIG_WIN64)
 /*
  * For Windows, we use generic implementation of flush_idcache_range, that
  * performs a call to FlushInstructionCache, through __builtin___clear_cache.
util/sys_membarrier.c +1 -1
index 1362c0c4c59..a866f4faadc 100644
@@ -23,7 +23,7 @@ membarrier(int cmd, int flags)
 
 void smp_mb_global(void)
 {
-#if defined CONFIG_WIN32
+#if defined CONFIG_WIN64
     FlushProcessWriteBuffers();
 #elif defined CONFIG_LINUX
     membarrier(MEMBARRIER_CMD_SHARED, 0);
scripts/checkpatch.pl +1 -1
index 3a9557417f7..4cb583bdebd 100755
@@ -3110,7 +3110,7 @@ sub process {
 			}
 		}
 # check of hardware specific defines
-# we have e.g. CONFIG_LINUX and CONFIG_WIN32 for common cases
+# we have e.g. CONFIG_LINUX and CONFIG_WIN64 for common cases
 # where they might be necessary.
 		if ($line =~ m@^.\s*\#\s*if.*\b__@) {
 			WARN("architecture specific defines should be avoided\n" .  $herecurr);
Signature · 1 line
2.52.0
#1 lore raw
Quoted 32 lines · Thomas Huth

From: Thomas Huth <[email protected]>

We stopped supported 32-bit Windows hosts a while ago already, so let's rename CONFIG_WIN32 to CONFIG_WIN64 now to make it clear that this switch is not about 32-bit Windows anymore.

The patch has been created with a simple sed statement:

  sed -i s/CONFIG_WIN32/CONFIG_WIN64/g $(grep -rl CONFIG_WIN32 *)
---
  meson.build           |  2 +-
  qapi/char.json        |  4 +--
  qapi/misc.json        |  2 +-
  qga/qapi-schema.json  | 76 +++++++++++++++++++++----------------------
  include/qemu/futex.h  |  2 +-
  include/qemu/xattr.h  |  2 +-
  hw/usb/host-libusb.c  | 18 +++++-----
  io/channel-watch.c    | 10 +++---
  ui/gtk.c              |  2 +-
  util/cacheflush.c     |  4 +--
  util/sys_membarrier.c |  2 +-
  scripts/checkpatch.pl |  2 +-
  12 files changed, 63 insertions(+), 63 deletions(-)
scripts/checkpatch.pl +0 -0
index 3a9557417f7..4cb583bdebd 100755

scripts/checkpatch.pl sub process { · line 3113

Quoted 5 lines
scripts/checkpatch.pl +1 -1
@@ -3110,7 +3110,7 @@ sub process {
  			}
  		}
  # check of hardware specific defines
-# we have e.g. CONFIG_LINUX and CONFIG_WIN32 for common cases
+# we have e.g. CONFIG_LINUX and CONFIG_WIN64 for common cases

Alternatively CONFIG_[MS]WINDOWS?

#2 lore raw
In reply to Thomas Huth
Quoted 31 lines · Thomas Huth

From: Thomas Huth <[email protected]>

We stopped supported 32-bit Windows hosts a while ago already, so let's rename CONFIG_WIN32 to CONFIG_WIN64 now to make it clear that this switch is not about 32-bit Windows anymore.

The patch has been created with a simple sed statement:

sed -i s/CONFIG_WIN32/CONFIG_WIN64/g $(grep -rl CONFIG_WIN32 *)

---
 meson.build           |  2 +-
 qapi/char.json        |  4 +--
 qapi/misc.json        |  2 +-
 qga/qapi-schema.json  | 76 +++++++++++++++++++++----------------------
 include/qemu/futex.h  |  2 +-
 include/qemu/xattr.h  |  2 +-
 hw/usb/host-libusb.c  | 18 +++++-----
 io/channel-watch.c    | 10 +++---
 ui/gtk.c              |  2 +-
 util/cacheflush.c     |  4 +--
 util/sys_membarrier.c |  2 +-
 scripts/checkpatch.pl |  2 +-
 12 files changed, 63 insertions(+), 63 deletions(-)
meson.build +0 -0
index a84f14258b0..01b9a5c22ce 100644

meson.build config_host_data.set('CONFIG_GCOV', get_option('b_coverage')) · line 2425

Quoted 5 lines
meson.build +1 -1
@@ -2422,7 +2422,7 @@ config_host_data.set('CONFIG_GCOV', get_option('b_coverage'))
 config_host_data.set('CONFIG_LIBUDEV', libudev.found())
 config_host_data.set('CONFIG_LINUX', host_os == 'linux')
 config_host_data.set('CONFIG_POSIX', host_os != 'windows')
-config_host_data.set('CONFIG_WIN32', host_os == 'windows')
+config_host_data.set('CONFIG_WIN64', host_os == 'windows')

While relevant to qapi file conditions, from a C code pov all of these are redundant as the compiler has all these facts built-in

  #ifdef CONFIG_LINUX =>    #ifdef __linux__
  #ifdef CONFIG_POSIX =>    #if !defined(_WIN32) 
  #ifdef CONFIG_WIN32 =>    #ifdef _WIN32

NB, _WIN32 *is* set on 64-bit Windows platforms too, so using _WIN64 is only needed if you have a code path that is exclusively 64-bit only, so there's little need for us to use _WIN64.

And of course we are horribly inconsistent in what we use:

$ git grep -E '#if.*_WIN32' | wc -l
284
$ git grep -E '#if.*__linux__' | wc -l
90
$ git grep -E '#if.*CONFIG_LINUX' | wc -l
142
$ git grep -E '#if.*CONFIG_WIN' | wc -l
16

I'm inclined to posion all these from the C source though, and only these them from non-C locations.

Also IMHO CONFIG_WIN or CONFIG_WINDOWS is preferrable - we don't add '32' or '64' suffixes to CONFIG_LINUX or CONFIG_POSIX, so I don't see a reason to keep doing it for Windows.

With regards,
Daniel

Signature · 3 lines
|: https://berrange.com      -o-    https://www.flickr.com/photos/dberrange :|
|: https://libvirt.org         -o-            https://fstop138.berrange.com :|
|: https://entangle-photo.org    -o-    https://www.instagram.com/dberrange :|
#3 lore raw
Quoted 24 lines · Daniel P. Berrangé
Quoted 13 lines · Thomas Huth

From: Thomas Huth <[email protected]>

We stopped supported 32-bit Windows hosts a while ago already, so let's rename CONFIG_WIN32 to CONFIG_WIN64 now to make it clear that this switch is not about 32-bit Windows anymore.

The patch has been created with a simple sed statement:

sed -i s/CONFIG_WIN32/CONFIG_WIN64/g $(grep -rl CONFIG_WIN32 *)

meson.build config_host_data.set('CONFIG_GCOV', get_option('b_coverage')) · line 2425

Quoted 5 lines
meson.build +1 -1
@@ -2422,7 +2422,7 @@ config_host_data.set('CONFIG_GCOV', get_option('b_coverage'))
 config_host_data.set('CONFIG_LIBUDEV', libudev.found())
 config_host_data.set('CONFIG_LINUX', host_os == 'linux')
 config_host_data.set('CONFIG_POSIX', host_os != 'windows')
-config_host_data.set('CONFIG_WIN32', host_os == 'windows')
+config_host_data.set('CONFIG_WIN64', host_os == 'windows')

While relevant to qapi file conditions, from a C code pov all of these are redundant as the compiler has all these facts built-in

Quoted 3 lines
  #ifdef CONFIG_LINUX =>    #ifdef __linux__
  #ifdef CONFIG_POSIX =>    #if !defined(_WIN32)
  #ifdef CONFIG_WIN32 =>    #ifdef _WIN32

checkpatch will warn about use of __linux__, though, so hopefully we don't get more of them in new code:

WARNING: architecture specific defines should be avoided #4761: FILE: block/file-posix.c:4761:
+#ifdef __linux__

It fails to catch _WIN32 because it's looking for "__".

thanks
-- PMM

#4 lore raw
Quoted 25 lines · Peter Maydell
Quoted 24 lines · Daniel P. Berrangé
Quoted 13 lines · Thomas Huth

From: Thomas Huth <[email protected]>

We stopped supported 32-bit Windows hosts a while ago already, so let's rename CONFIG_WIN32 to CONFIG_WIN64 now to make it clear that this switch is not about 32-bit Windows anymore.

The patch has been created with a simple sed statement:

sed -i s/CONFIG_WIN32/CONFIG_WIN64/g $(grep -rl CONFIG_WIN32 *)

meson.build config_host_data.set('CONFIG_GCOV', get_option('b_coverage')) · line 2425

Quoted 5 lines
meson.build +1 -1
@@ -2422,7 +2422,7 @@ config_host_data.set('CONFIG_GCOV', get_option('b_coverage'))
 config_host_data.set('CONFIG_LIBUDEV', libudev.found())
 config_host_data.set('CONFIG_LINUX', host_os == 'linux')
 config_host_data.set('CONFIG_POSIX', host_os != 'windows')
-config_host_data.set('CONFIG_WIN32', host_os == 'windows')
+config_host_data.set('CONFIG_WIN64', host_os == 'windows')

While relevant to qapi file conditions, from a C code pov all of these are redundant as the compiler has all these facts built-in

Quoted 6 lines
Quoted 3 lines
  #ifdef CONFIG_LINUX =>    #ifdef __linux__
  #ifdef CONFIG_POSIX =>    #if !defined(_WIN32)
  #ifdef CONFIG_WIN32 =>    #ifdef _WIN32

checkpatch will warn about use of __linux__, though, so hopefully we don't get more of them in new code:

I guess I'd ask why we consider __linux__ to be worse than CONFIG_LINUX ?

Every contributor we know __linux__, but CONFIG_LINUX needs QEMU specific knowledge. It feels like we should prefer the choice that everyone will know *provided* they're both functionally equivalent.

Quoted 3 lines

WARNING: architecture specific defines should be avoided #4761: FILE: block/file-posix.c:4761:
+#ifdef __linux__

That warning has never made that much sense when I've seen it appear, as __linux__ isn't an architecture, its an OS :-)

Quoted 1 line

It fails to catch _WIN32 because it's looking for "__".

With regards,
Daniel

Signature · 3 lines
|: https://berrange.com      -o-    https://www.flickr.com/photos/dberrange :|
|: https://libvirt.org         -o-            https://fstop138.berrange.com :|
|: https://entangle-photo.org    -o-    https://www.instagram.com/dberrange :|
#5 lore raw
Quoted 31 lines · Daniel P. Berrangé
Quoted 29 lines · Peter Maydell
Quoted 27 lines · Daniel P. Berrangé
Quoted 13 lines · Thomas Huth

From: Thomas Huth <[email protected]>

We stopped supported 32-bit Windows hosts a while ago already, so let's rename CONFIG_WIN32 to CONFIG_WIN64 now to make it clear that this switch is not about 32-bit Windows anymore.

The patch has been created with a simple sed statement:

sed -i s/CONFIG_WIN32/CONFIG_WIN64/g $(grep -rl CONFIG_WIN32 *)

meson.build config_host_data.set('CONFIG_GCOV', get_option('b_coverage')) · line 2425

Quoted 5 lines
meson.build +1 -1
@@ -2422,7 +2422,7 @@ config_host_data.set('CONFIG_GCOV', get_option('b_coverage'))
 config_host_data.set('CONFIG_LIBUDEV', libudev.found())
 config_host_data.set('CONFIG_LINUX', host_os == 'linux')
 config_host_data.set('CONFIG_POSIX', host_os != 'windows')
-config_host_data.set('CONFIG_WIN32', host_os == 'windows')
+config_host_data.set('CONFIG_WIN64', host_os == 'windows')

While relevant to qapi file conditions, from a C code pov all of these are redundant as the compiler has all these facts built-in

  #ifdef CONFIG_LINUX =>    #ifdef __linux__
  #ifdef CONFIG_POSIX =>    #if !defined(_WIN32)
  #ifdef CONFIG_WIN32 =>    #ifdef _WIN32
Quoted 8 lines
Quoted 2 lines

checkpatch will warn about use of __linux__, though, so hopefully we don't get more of them in new code:

I guess I'd ask why we consider __linux__ to be worse than CONFIG_LINUX ?

Every contributor we know __linux__, but CONFIG_LINUX needs QEMU specific knowledge. It feels like we should prefer the choice that everyone will know *provided* they're both functionally equivalent.

I guess my take would be that part of the reason for the warning is to nudge people away from "just make it #ifdef linux" and towards "make meson do a check for the existence of whatever function or feature I care about, and then ifdef on that".

Also, I know that e.g. CONFIG_WIN32 is definitely going to be checking the right thing and will have abstracted away any odd complications in what to check. I don't know that and would have to look it up for the things the compiler defines. (For instance, can we just look at __APPLE__ for macos specific code, or do we need to check __APPLE__ && __MACH__ ? Currently we have examples of both in different places.)

thanks
-- PMM

#6 lore raw
In reply to Daniel P. Berrangé

Hi

Quoted 55 lines · Daniel P. Berrangé
Quoted 31 lines · Thomas Huth

From: Thomas Huth <[email protected]>

We stopped supported 32-bit Windows hosts a while ago already, so let's rename CONFIG_WIN32 to CONFIG_WIN64 now to make it clear that this switch is not about 32-bit Windows anymore.

The patch has been created with a simple sed statement:

sed -i s/CONFIG_WIN32/CONFIG_WIN64/g $(grep -rl CONFIG_WIN32 *)

---
 meson.build           |  2 +-
 qapi/char.json        |  4 +--
 qapi/misc.json        |  2 +-
 qga/qapi-schema.json  | 76 +++++++++++++++++++++----------------------
 include/qemu/futex.h  |  2 +-
 include/qemu/xattr.h  |  2 +-
 hw/usb/host-libusb.c  | 18 +++++-----
 io/channel-watch.c    | 10 +++---
 ui/gtk.c              |  2 +-
 util/cacheflush.c     |  4 +--
 util/sys_membarrier.c |  2 +-
 scripts/checkpatch.pl |  2 +-
 12 files changed, 63 insertions(+), 63 deletions(-)
meson.build +0 -0
index a84f14258b0..01b9a5c22ce 100644

meson.build config_host_data.set('CONFIG_GCOV', get_option('b_coverage')) · line 2425

Quoted 5 lines
meson.build +1 -1
@@ -2422,7 +2422,7 @@ config_host_data.set('CONFIG_GCOV', get_option('b_coverage'))
 config_host_data.set('CONFIG_LIBUDEV', libudev.found())
 config_host_data.set('CONFIG_LINUX', host_os == 'linux')
 config_host_data.set('CONFIG_POSIX', host_os != 'windows')
-config_host_data.set('CONFIG_WIN32', host_os == 'windows')
+config_host_data.set('CONFIG_WIN64', host_os == 'windows')

While relevant to qapi file conditions, from a C code pov all of these are redundant as the compiler has all these facts built-in

  #ifdef CONFIG_LINUX =>    #ifdef __linux__
  #ifdef CONFIG_POSIX =>    #if !defined(_WIN32)
  #ifdef CONFIG_WIN32 =>    #ifdef _WIN32

NB, _WIN32 *is* set on 64-bit Windows platforms too, so using _WIN64 is only needed if you have a code path that is exclusively 64-bit only, so there's little need for us to use _WIN64.

And of course we are horribly inconsistent in what we use:

$ git grep -E '#if.*_WIN32' | wc -l
284
Quoted 8 lines
$ git grep -E '#if.*__linux__' | wc -l
90
$ git grep -E '#if.*CONFIG_LINUX' | wc -l
142
$ git grep -E '#if.*CONFIG_WIN' | wc -l
16

There is also G_OS_*

$ git grep G_OS_UNIX | wc -l
15
$ git grep G_OS_WIN32 | wc -l
23

Replacing WIN32 with WIN64 doesn't make much sense. It should be either WINDOWS or WIN32.

The Windows API is still called that way, even on 64-bit systems:
https://learn.microsoft.com/en-us/windows/win32/

Quoted 14 lines

I'm inclined to posion all these from the C source though, and only these them from non-C locations.

Also IMHO CONFIG_WIN or CONFIG_WINDOWS is preferrable - we don't add '32' or '64' suffixes to CONFIG_LINUX or CONFIG_POSIX, so I don't see a reason to keep doing it for Windows.

With regards,
Daniel
--

|: https://berrange.com      -o-    https://www.flickr.com/photos/dberrange :|
|: https://libvirt.org         -o-            https://fstop138.berrange.com :|
|: https://entangle-photo.org    -o-    https://www.instagram.com/dberrange :|
#7 lore raw
Quoted 73 lines · Marc-André Lureau

Hi

Quoted 55 lines · Daniel P. Berrangé
Quoted 31 lines · Thomas Huth

From: Thomas Huth <[email protected]>

We stopped supported 32-bit Windows hosts a while ago already, so let's rename CONFIG_WIN32 to CONFIG_WIN64 now to make it clear that this switch is not about 32-bit Windows anymore.

The patch has been created with a simple sed statement:

  sed -i s/CONFIG_WIN32/CONFIG_WIN64/g $(grep -rl CONFIG_WIN32 *)
---
  meson.build           |  2 +-
  qapi/char.json        |  4 +--
  qapi/misc.json        |  2 +-
  qga/qapi-schema.json  | 76 +++++++++++++++++++++----------------------
  include/qemu/futex.h  |  2 +-
  include/qemu/xattr.h  |  2 +-
  hw/usb/host-libusb.c  | 18 +++++-----
  io/channel-watch.c    | 10 +++---
  ui/gtk.c              |  2 +-
  util/cacheflush.c     |  4 +--
  util/sys_membarrier.c |  2 +-
  scripts/checkpatch.pl |  2 +-
  12 files changed, 63 insertions(+), 63 deletions(-)
meson.build +0 -0
index a84f14258b0..01b9a5c22ce 100644

meson.build config_host_data.set('CONFIG_GCOV', get_option('b_coverage')) · line 2425

Quoted 5 lines
meson.build +1 -1
@@ -2422,7 +2422,7 @@ config_host_data.set('CONFIG_GCOV', get_option('b_coverage'))
  config_host_data.set('CONFIG_LIBUDEV', libudev.found())
  config_host_data.set('CONFIG_LINUX', host_os == 'linux')
  config_host_data.set('CONFIG_POSIX', host_os != 'windows')
-config_host_data.set('CONFIG_WIN32', host_os == 'windows')
+config_host_data.set('CONFIG_WIN64', host_os == 'windows')

While relevant to qapi file conditions, from a C code pov all of these are redundant as the compiler has all these facts built-in

   #ifdef CONFIG_LINUX =>    #ifdef __linux__
   #ifdef CONFIG_POSIX =>    #if !defined(_WIN32)
   #ifdef CONFIG_WIN32 =>    #ifdef _WIN32

NB, _WIN32 *is* set on 64-bit Windows platforms too, so using _WIN64 is only needed if you have a code path that is exclusively 64-bit only, so there's little need for us to use _WIN64.

And of course we are horribly inconsistent in what we use:

$ git grep -E '#if.*_WIN32' | wc -l
284
Quoted 8 lines
$ git grep -E '#if.*__linux__' | wc -l
90
$ git grep -E '#if.*CONFIG_LINUX' | wc -l
142
$ git grep -E '#if.*CONFIG_WIN' | wc -l
16

There is also G_OS_*

$ git grep G_OS_UNIX | wc -l
15
$ git grep G_OS_WIN32 | wc -l
23
Quoted 5 lines

Replacing WIN32 with WIN64 doesn't make much sense. It should be either WINDOWS or WIN32.

The Windows API is still called that way, even on 64-bit systems:
https://learn.microsoft.com/en-us/windows/win32/

Oh, ok! Then I'll simply drop this patch (and let others come up with a patch in case they want to replace CONFIG_WIN32 with _WIN32 or G_OS_WIN32 or whatever).

Thomas