On Mon, Sep 14, 2020 at 12:12 AM Paolo Bonzini wrote: > On 13/09/20 18:03, 罗勇刚(Yonggang Luo) wrote: > > > > _WIN32 are more precise and only depends on the compiler, on the > > other hand, CONFIG_POSIX and CONFIG_WIN32 need configure > > scripts. I prefer _WIN32 unless the compiler can not provide enough > > information. > > That's not what the QEMU coding standards say; we generally don't test > the preprocessor symbols. If we were to change to _WIN32, it should be > done at once on the whole codebase (don't do it :)).> > CONFIG_WIN32 are rarely used, most of the are using _WIN32 Search CONFIG_WIN32 ``` > 36 results - 20 files > > configure: > 6511 if test "$mingw32" = "yes" ; then > 6512: echo "CONFIG_WIN32=y" >> $config_host_mak > 6513 rc_version=$(cat $source_path/VERSION) > > Makefile: > 274 @echo '' > 275: ifdef CONFIG_WIN32 > 276 @echo 'Windows targets:' > > meson.build: > 853 blockdev_ss.add(when: 'CONFIG_POSIX', if_true: files('os-posix.c')) > 854: softmmu_ss.add(when: 'CONFIG_WIN32', if_true: [files('os-win32.c')]) > 855 > > backends\qemu\configure: > 6511 if test "$mingw32" = "yes" ; then > 6512: echo "CONFIG_WIN32=y" >> $config_host_mak > 6513 rc_version=$(cat $source_path/VERSION) > > backends\qemu\Makefile: > 272 @echo '' > 273: ifdef CONFIG_WIN32 > 274 @echo 'Windows targets:' > > backends\qemu\meson.build: > 856 blockdev_ss.add(when: 'CONFIG_POSIX', if_true: files('os-posix.c')) > 857: softmmu_ss.add(when: 'CONFIG_WIN32', if_true: [files('os-win32.c')]) > 858 > > block\meson.build: > 58 block_ss.add(when: [libxml2, 'CONFIG_PARALLELS'], if_true: > files('parallels.c')) > 59: block_ss.add(when: 'CONFIG_WIN32', if_true: files('file-win32.c', > 'win32-aio.c')) > 60 block_ss.add(when: 'CONFIG_POSIX', if_true: [files('file-posix.c'), > coref, iokit]) > > chardev\meson.build: > 20 )) > 21: chardev_ss.add(when: 'CONFIG_WIN32', if_true: files( > 22 'char-console.c', > > hw\usb\host-libusb.c: > 37 #include "qom/object.h" > 38: #ifndef CONFIG_WIN32 > 39 #include > > 228 > 229: #ifndef CONFIG_WIN32 > 230 > > 249 > 250: #endif /* !CONFIG_WIN32 */ > 251 > > 253 { > 254: #ifndef CONFIG_WIN32 > 255 const struct libusb_pollfd **poll; > > 270 #endif > 271: #ifdef CONFIG_WIN32 > 272 /* FIXME: add support for Windows. */ > > 916 } else { > 917: #if LIBUSB_API_VERSION >= 0x01000107 && !defined(CONFIG_WIN32) > 918 trace_usb_host_open_hostfd(hostfd); > > 1145 > 1146: #if LIBUSB_API_VERSION >= 0x01000107 && !defined(CONFIG_WIN32) > 1147 if (s->hostdevice) { > > io\channel-watch.c: > 32 > 33: #ifdef CONFIG_WIN32 > 34 typedef struct QIOChannelSocketSource QIOChannelSocketSource; > > 98 > 99: #ifdef CONFIG_WIN32 > 100 static gboolean > > 267 > 268: #ifdef CONFIG_WIN32 > 269 ssource->fd.fd = (gint64)_get_osfhandle(fd); > > 279 > 280: #ifdef CONFIG_WIN32 > 281 GSource *qio_channel_create_socket_watch(QIOChannel *ioc, > > 337 > 338: #ifdef CONFIG_WIN32 > 339 ssource->fdread.fd = (gint64)_get_osfhandle(fdread); > > net\meson.build: > 36 softmmu_ss.add(when: 'CONFIG_POSIX', if_true: files(tap_posix)) > 37: softmmu_ss.add(when: 'CONFIG_WIN32', if_true: files('tap-win32.c')) > 38 softmmu_ss.add(when: 'CONFIG_VHOST_NET_VDPA', if_true: > files('vhost-vdpa.c')) > > qga\meson.build: > 39 'commands-posix.c')) > 40: qga_ss.add(when: 'CONFIG_WIN32', if_true: files( > 41 'channel-win32.c', > > scripts\checkpatch.pl: > 2775 # check of hardware specific defines > 2776: # we have e.g. CONFIG_LINUX and CONFIG_WIN32 for common cases > 2777 # where they might be necessary. > > target\i386\hax-i386.h: > 22 > 23: #ifdef CONFIG_WIN32 > 24 typedef HANDLE hax_fd; > > 87 > 88: #ifdef CONFIG_WIN32 > 89 #include "target/i386/hax-windows.h" > > target\i386\meson.build: > 34 i386_softmmu_ss.add(when: ['CONFIG_POSIX', 'CONFIG_HAX'], if_true: > files('hax-all.c', 'hax-mem.c', 'hax-posix.c')) > 35: i386_softmmu_ss.add(when: ['CONFIG_WIN32', 'CONFIG_HAX'], if_true: > files('hax-all.c', 'hax-mem.c', 'hax-windows.c')) > 36 > > ui\gtk.c: > 1171 { > 1172: #ifdef CONFIG_WIN32 > 1173 /* > > ui\meson.build: > 48 if config_host.has_key('CONFIG_GTK') > 49: softmmu_ss.add(when: 'CONFIG_WIN32', if_true: > files('win32-kbd-hook.c')) > 50 > > 59 if sdl.found() > 60: softmmu_ss.add(when: 'CONFIG_WIN32', if_true: > files('win32-kbd-hook.c')) > 61 > > ui\sdl2.c: > 332 { > 333: #ifdef CONFIG_WIN32 > 334 SDL_SysWMinfo info; > > util\meson.build: > 14 util_ss.add(when: 'CONFIG_POSIX', if_true: files('memfd.c')) > 15: util_ss.add(when: 'CONFIG_WIN32', if_true: files('aio-win32.c')) > 16: util_ss.add(when: 'CONFIG_WIN32', if_true: > files('event_notifier-win32.c')) > 17: util_ss.add(when: 'CONFIG_WIN32', if_true: files('oslib-win32.c')) > 18: util_ss.add(when: 'CONFIG_WIN32', if_true: > files('qemu-thread-win32.c')) > 19: util_ss.add(when: 'CONFIG_WIN32', if_true: winmm) > 20 util_ss.add(files('envlist.c', 'path.c', 'module.c')) > > util\sys_membarrier.c: > 25 { > 26: #if defined CONFIG_WIN32 > 27 FlushProcessWriteBuffers(); > ``` > > Paolo > > Search _WIN32 ``` 561 results - 257 files block.c: 59 60: #ifdef _WIN32 61 #include 85 86: #ifdef _WIN32 87 static int is_windows_drive_prefix(const char *filename) 130 131: #ifdef _WIN32 132 if (is_windows_drive(path) || ``` 145 {-- 此致 礼 罗勇刚 Yours sincerely, Yonggang Luo