All of lore.kernel.org
 help / color / mirror / Atom feed
* [PULL 00/21] Fixes patches
@ 2022-03-22 12:25 marcandre.lureau
  2022-03-22 12:25 ` [PULL 01/21] qemu-options: define -spice only #ifdef CONFIG_SPICE marcandre.lureau
                   ` (21 more replies)
  0 siblings, 22 replies; 23+ messages in thread
From: marcandre.lureau @ 2022-03-22 12:25 UTC (permalink / raw)
  To: qemu-devel; +Cc: Peter Maydell, Marc-André Lureau

From: Marc-André Lureau <marcandre.lureau@redhat.com>

The following changes since commit 48fb0a826eea2e7b0135f49e7fa63e7efe2b7677:

  Merge tag 'for-upstream' of https://gitlab.com/bonzini/qemu into staging (2022-03-21 21:27:14 +0000)

are available in the Git repository at:

  git@gitlab.com:marcandre.lureau/qemu.git tags/fixes-pull-request

for you to fetch changes up to 4ea4bec6f459ff1af6af01677d5bfac240db0201:

  qapi: remove needless include (2022-03-22 14:46:18 +0400)

----------------------------------------------------------------
Fixes and cleanups for 7.0

Hi,

A collection of fixes & cleanup patches that should be safe for 7.0 inclusion.

----------------------------------------------------------------

Marc-André Lureau (21):
  qemu-options: define -spice only #ifdef CONFIG_SPICE
  vl: typo fix in a comment
  m68k/nios2-semi: fix gettimeofday() result check
  Drop qemu_foo() socket API wrapper
  Replace GCC_FMT_ATTR with G_GNUC_PRINTF
  compiler.h: replace QEMU_WARN_UNUSED_RESULT with
    G_GNUC_WARN_UNUSED_RESULT
  compiler.h: replace QEMU_SENTINEL with G_GNUC_NULL_TERMINATED
  Simplify HOST_LONG_BITS
  Move HOST_LONG_BITS to compiler.h
  scripts/modinfo-collect: remove unused/dead code
  util: remove needless includes
  util: remove the net/net.h dependency
  qapi: remove needless include
  meson: move int128 checks from configure
  meson: fix CONFIG_ATOMIC128 check
  qapi: remove needless include
  qga: remove bswap.h include
  error: use GLib to remember the program name
  tests: remove needless include
  Remove trailing ; after G_DEFINE_AUTO macro
  qapi: remove needless include

 configure                               | 49 +------------------------
 meson.build                             | 48 +++++++++++++++++++++---
 audio/audio.h                           |  4 +-
 block/qcow2.h                           |  2 +-
 bsd-user/qemu.h                         |  2 +-
 hw/display/qxl.h                        |  2 +-
 hw/net/rocker/rocker.h                  |  2 +-
 hw/xen/xen_pt.h                         |  2 +-
 include/chardev/char-fe.h               |  2 +-
 include/disas/dis-asm.h                 |  2 +-
 include/hw/acpi/aml-build.h             | 12 +++---
 include/hw/core/cpu.h                   |  2 +-
 include/hw/hw.h                         |  2 +-
 include/hw/virtio/virtio.h              |  2 +-
 include/hw/xen/xen-bus-helper.h         |  4 +-
 include/hw/xen/xen-bus.h                |  4 +-
 include/hw/xen/xen_common.h             |  2 +-
 include/hw/xen/xen_pvdev.h              |  2 +-
 include/monitor/monitor.h               |  4 +-
 include/qapi/error.h                    | 20 +++++-----
 include/qapi/qmp/qjson.h                |  8 ++--
 include/qemu-common.h                   | 22 +----------
 include/qemu/buffer.h                   |  2 +-
 include/qemu/compiler.h                 | 20 ++++------
 include/qemu/error-report.h             | 26 ++++++-------
 include/qemu/log-for-trace.h            |  2 +-
 include/qemu/log.h                      |  2 +-
 include/qemu/osdep.h                    |  9 -----
 include/qemu/qemu-print.h               |  8 ++--
 include/qemu/range.h                    |  4 +-
 include/qemu/readline.h                 |  2 +-
 include/qom/object.h                    |  6 +--
 qga/guest-agent-core.h                  |  2 +-
 qga/vss-win32/requester.h               |  2 +-
 scripts/cocci-macro-file.h              |  6 +--
 tests/qtest/libqos/libqtest.h           | 42 ++++++++++-----------
 tests/qtest/libqtest-single.h           |  2 +-
 tests/qtest/migration-helpers.h         |  6 +--
 audio/alsaaudio.c                       |  4 +-
 audio/dsoundaudio.c                     |  4 +-
 audio/ossaudio.c                        |  4 +-
 audio/paaudio.c                         |  2 +-
 audio/sdlaudio.c                        |  2 +-
 block/blkverify.c                       |  2 +-
 block/qcow2-refcount.c                  | 20 +++++-----
 block/ssh.c                             |  4 +-
 crypto/cipher-afalg.c                   |  4 +-
 crypto/hash-afalg.c                     |  4 +-
 fsdev/9p-marshal.c                      |  2 +-
 fsdev/virtfs-proxy-helper.c             |  2 +-
 gdbstub.c                               |  2 +-
 hw/9pfs/9p.c                            |  2 +-
 hw/acpi/aml-build.c                     |  4 +-
 hw/mips/fuloong2e.c                     |  2 +-
 hw/mips/malta.c                         |  2 +-
 hw/net/rtl8139.c                        |  2 +-
 hw/virtio/virtio.c                      |  2 +-
 io/channel-socket.c                     |  6 +--
 io/channel-websock.c                    |  2 +-
 monitor/hmp.c                           |  4 +-
 nbd/server.c                            | 12 +++---
 net/announce.c                          | 13 +++++++
 net/socket.c                            | 24 ++++++------
 qapi/qapi-forward-visitor.c             |  1 -
 qapi/qmp-dispatch.c                     |  1 -
 qapi/string-output-visitor.c            |  1 -
 qemu-img.c                              |  4 +-
 qemu-io.c                               | 12 +++---
 qga/main.c                              |  1 -
 qobject/json-parser.c                   |  2 +-
 softmmu/qtest.c                         |  4 +-
 softmmu/vl.c                            |  6 ++-
 storage-daemon/qemu-storage-daemon.c    |  2 +-
 target/m68k/m68k-semi.c                 |  2 +-
 target/nios2/nios2-semi.c               |  2 +-
 tests/qtest/e1000e-test.c               |  4 +-
 tests/qtest/libqtest.c                  |  6 +--
 tests/qtest/npcm7xx_emc-test.c          |  4 +-
 tests/qtest/test-filter-mirror.c        |  4 +-
 tests/qtest/test-filter-redirector.c    |  8 ++--
 tests/qtest/virtio-net-test.c           | 10 ++---
 tests/unit/check-qobject.c              |  1 -
 tests/unit/socket-helpers.c             |  2 +-
 tests/unit/test-qobject-input-visitor.c |  4 +-
 trace/control.c                         |  2 +-
 util/cutils.c                           | 16 --------
 util/osdep.c                            |  4 +-
 util/qemu-error.c                       | 24 +++---------
 util/qemu-sockets.c                     | 10 ++---
 audio/coreaudio.m                       |  4 +-
 qemu-options.hx                         |  2 +
 scripts/checkpatch.pl                   |  6 +--
 scripts/modinfo-collect.py              |  5 ---
 93 files changed, 278 insertions(+), 347 deletions(-)

-- 
2.35.1.273.ge6ebfd0e8cbb



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

* [PULL 01/21] qemu-options: define -spice only #ifdef CONFIG_SPICE
  2022-03-22 12:25 [PULL 00/21] Fixes patches marcandre.lureau
@ 2022-03-22 12:25 ` marcandre.lureau
  2022-03-22 12:25 ` [PULL 02/21] vl: typo fix in a comment marcandre.lureau
                   ` (20 subsequent siblings)
  21 siblings, 0 replies; 23+ messages in thread
From: marcandre.lureau @ 2022-03-22 12:25 UTC (permalink / raw)
  To: qemu-devel; +Cc: Peter Maydell, Marc-André Lureau

From: Marc-André Lureau <marcandre.lureau@redhat.com>

Fixes:
https://bugzilla.redhat.com/show_bug.cgi?id=1982600

Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
Reviewed-by: Philippe Mathieu-Daudé <philmd@redhat.com>
---
 softmmu/vl.c    | 2 ++
 qemu-options.hx | 2 ++
 2 files changed, 4 insertions(+)

diff --git a/softmmu/vl.c b/softmmu/vl.c
index 0b81f6153548..f7d7c9550d7e 100644
--- a/softmmu/vl.c
+++ b/softmmu/vl.c
@@ -3537,6 +3537,7 @@ void qemu_init(int argc, char **argv, char **envp)
             case QEMU_OPTION_readconfig:
                 qemu_read_config_file(optarg, qemu_parse_config_group, &error_fatal);
                 break;
+#ifdef CONFIG_SPICE
             case QEMU_OPTION_spice:
                 olist = qemu_find_opts_err("spice", NULL);
                 if (!olist) {
@@ -3549,6 +3550,7 @@ void qemu_init(int argc, char **argv, char **envp)
                 }
                 display_remote++;
                 break;
+#endif
             case QEMU_OPTION_writeconfig:
                 {
                     FILE *fp;
diff --git a/qemu-options.hx b/qemu-options.hx
index 58f2f76775c9..34e9b32a5c00 100644
--- a/qemu-options.hx
+++ b/qemu-options.hx
@@ -2097,6 +2097,7 @@ SRST
     Enable SDL.
 ERST
 
+#ifdef CONFIG_SPICE
 DEF("spice", HAS_ARG, QEMU_OPTION_spice,
     "-spice [port=port][,tls-port=secured-port][,x509-dir=<dir>]\n"
     "       [,x509-key-file=<file>][,x509-key-password=<file>]\n"
@@ -2118,6 +2119,7 @@ DEF("spice", HAS_ARG, QEMU_OPTION_spice,
     "   enable spice\n"
     "   at least one of {port, tls-port} is mandatory\n",
     QEMU_ARCH_ALL)
+#endif
 SRST
 ``-spice option[,option[,...]]``
     Enable the spice remote desktop protocol. Valid options are
-- 
2.35.1.273.ge6ebfd0e8cbb



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

* [PULL 02/21] vl: typo fix in a comment
  2022-03-22 12:25 [PULL 00/21] Fixes patches marcandre.lureau
  2022-03-22 12:25 ` [PULL 01/21] qemu-options: define -spice only #ifdef CONFIG_SPICE marcandre.lureau
@ 2022-03-22 12:25 ` marcandre.lureau
  2022-03-22 12:25 ` [PULL 03/21] m68k/nios2-semi: fix gettimeofday() result check marcandre.lureau
                   ` (19 subsequent siblings)
  21 siblings, 0 replies; 23+ messages in thread
From: marcandre.lureau @ 2022-03-22 12:25 UTC (permalink / raw)
  To: qemu-devel; +Cc: Peter Maydell, Marc-André Lureau

From: Marc-André Lureau <marcandre.lureau@redhat.com>

Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
Reviewed-by: Philippe Mathieu-Daudé <philmd@redhat.com>
---
 softmmu/vl.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/softmmu/vl.c b/softmmu/vl.c
index f7d7c9550d7e..7e4d55bc1dcc 100644
--- a/softmmu/vl.c
+++ b/softmmu/vl.c
@@ -1961,7 +1961,7 @@ static void qemu_create_early_backends(void)
     object_option_foreach_add(object_create_early);
 
     /* spice needs the timers to be initialized by this point */
-    /* spice must initialize before audio as it changes the default auiodev */
+    /* spice must initialize before audio as it changes the default audiodev */
     /* spice must initialize before chardevs (for spicevmc and spiceport) */
     qemu_spice.init();
 
-- 
2.35.1.273.ge6ebfd0e8cbb



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

* [PULL 03/21] m68k/nios2-semi: fix gettimeofday() result check
  2022-03-22 12:25 [PULL 00/21] Fixes patches marcandre.lureau
  2022-03-22 12:25 ` [PULL 01/21] qemu-options: define -spice only #ifdef CONFIG_SPICE marcandre.lureau
  2022-03-22 12:25 ` [PULL 02/21] vl: typo fix in a comment marcandre.lureau
@ 2022-03-22 12:25 ` marcandre.lureau
  2022-03-22 12:25 ` [PULL 04/21] Drop qemu_foo() socket API wrapper marcandre.lureau
                   ` (18 subsequent siblings)
  21 siblings, 0 replies; 23+ messages in thread
From: marcandre.lureau @ 2022-03-22 12:25 UTC (permalink / raw)
  To: qemu-devel; +Cc: Peter Maydell, Marc-André Lureau

From: Marc-André Lureau <marcandre.lureau@redhat.com>

gettimeofday() returns 0 for success.

Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
Reviewed-by: Laurent Vivier <laurent@vivier.eu>
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
---
 target/m68k/m68k-semi.c   | 2 +-
 target/nios2/nios2-semi.c | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/target/m68k/m68k-semi.c b/target/m68k/m68k-semi.c
index 44ec7e4612c6..c5c164e096c8 100644
--- a/target/m68k/m68k-semi.c
+++ b/target/m68k/m68k-semi.c
@@ -381,7 +381,7 @@ void do_m68k_semihosting(CPUM68KState *env, int nr)
             qemu_timeval tv;
             struct gdb_timeval *p;
             result = qemu_gettimeofday(&tv);
-            if (result != 0) {
+            if (result == 0) {
                 if (!(p = lock_user(VERIFY_WRITE,
                                     arg0, sizeof(struct gdb_timeval), 0))) {
                     /* FIXME - check error code? */
diff --git a/target/nios2/nios2-semi.c b/target/nios2/nios2-semi.c
index fe5598bae4d7..5a7ad0c7108d 100644
--- a/target/nios2/nios2-semi.c
+++ b/target/nios2/nios2-semi.c
@@ -403,7 +403,7 @@ void do_nios2_semihosting(CPUNios2State *env)
             qemu_timeval tv;
             struct gdb_timeval *p;
             result = qemu_gettimeofday(&tv);
-            if (result != 0) {
+            if (result == 0) {
                 p = lock_user(VERIFY_WRITE, arg0, sizeof(struct gdb_timeval),
                               0);
                 if (!p) {
-- 
2.35.1.273.ge6ebfd0e8cbb



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

* [PULL 04/21] Drop qemu_foo() socket API wrapper
  2022-03-22 12:25 [PULL 00/21] Fixes patches marcandre.lureau
                   ` (2 preceding siblings ...)
  2022-03-22 12:25 ` [PULL 03/21] m68k/nios2-semi: fix gettimeofday() result check marcandre.lureau
@ 2022-03-22 12:25 ` marcandre.lureau
  2022-03-22 12:25 ` [PULL 05/21] Replace GCC_FMT_ATTR with G_GNUC_PRINTF marcandre.lureau
                   ` (17 subsequent siblings)
  21 siblings, 0 replies; 23+ messages in thread
From: marcandre.lureau @ 2022-03-22 12:25 UTC (permalink / raw)
  To: qemu-devel; +Cc: Peter Maydell, Marc-André Lureau

From: Marc-André Lureau <marcandre.lureau@redhat.com>

The socket API wrappers were initially introduced in commit
00aa0040 ("Wrap recv to avoid warnings"), but made redundant with
commit a2d96af4 ("osdep: add wrappers for socket functions") which fixes
the win32 declarations and thus removed the earlier warnings.

Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
Reviewed-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
---
 include/qemu-common.h                | 19 -------------------
 crypto/cipher-afalg.c                |  4 ++--
 crypto/hash-afalg.c                  |  4 ++--
 gdbstub.c                            |  2 +-
 io/channel-socket.c                  |  6 +++---
 net/socket.c                         | 24 ++++++++++++------------
 tests/qtest/e1000e-test.c            |  4 ++--
 tests/qtest/libqtest.c               |  4 ++--
 tests/qtest/npcm7xx_emc-test.c       |  4 ++--
 tests/qtest/test-filter-mirror.c     |  4 ++--
 tests/qtest/test-filter-redirector.c |  8 ++++----
 tests/qtest/virtio-net-test.c        | 10 +++++-----
 tests/unit/socket-helpers.c          |  2 +-
 util/osdep.c                         |  4 ++--
 util/qemu-sockets.c                  | 10 +++++-----
 15 files changed, 45 insertions(+), 64 deletions(-)

diff --git a/include/qemu-common.h b/include/qemu-common.h
index 8c0d9ab0f771..9c04fa94e89a 100644
--- a/include/qemu-common.h
+++ b/include/qemu-common.h
@@ -35,25 +35,6 @@ int qemu_pipe(int pipefd[2]);
 int qemu_openpty_raw(int *aslave, char *pty_name);
 #endif
 
-#ifdef _WIN32
-/* MinGW needs type casts for the 'buf' and 'optval' arguments. */
-#define qemu_getsockopt(sockfd, level, optname, optval, optlen) \
-    getsockopt(sockfd, level, optname, (void *)optval, optlen)
-#define qemu_setsockopt(sockfd, level, optname, optval, optlen) \
-    setsockopt(sockfd, level, optname, (const void *)optval, optlen)
-#define qemu_recv(sockfd, buf, len, flags) recv(sockfd, (void *)buf, len, flags)
-#define qemu_sendto(sockfd, buf, len, flags, destaddr, addrlen) \
-    sendto(sockfd, (const void *)buf, len, flags, destaddr, addrlen)
-#else
-#define qemu_getsockopt(sockfd, level, optname, optval, optlen) \
-    getsockopt(sockfd, level, optname, optval, optlen)
-#define qemu_setsockopt(sockfd, level, optname, optval, optlen) \
-    setsockopt(sockfd, level, optname, optval, optlen)
-#define qemu_recv(sockfd, buf, len, flags) recv(sockfd, buf, len, flags)
-#define qemu_sendto(sockfd, buf, len, flags, destaddr, addrlen) \
-    sendto(sockfd, buf, len, flags, destaddr, addrlen)
-#endif
-
 void cpu_exec_init_all(void);
 void cpu_exec_step_atomic(CPUState *cpu);
 
diff --git a/crypto/cipher-afalg.c b/crypto/cipher-afalg.c
index 052355a8a921..c55cd28bf01c 100644
--- a/crypto/cipher-afalg.c
+++ b/crypto/cipher-afalg.c
@@ -84,8 +84,8 @@ qcrypto_afalg_cipher_ctx_new(QCryptoCipherAlgorithm alg,
     g_free(name);
 
     /* setkey */
-    if (qemu_setsockopt(afalg->tfmfd, SOL_ALG, ALG_SET_KEY, key,
-                        nkey) != 0) {
+    if (setsockopt(afalg->tfmfd, SOL_ALG, ALG_SET_KEY, key,
+                   nkey) != 0) {
         error_setg_errno(errp, errno, "Set key failed");
         qcrypto_afalg_comm_free(afalg);
         return NULL;
diff --git a/crypto/hash-afalg.c b/crypto/hash-afalg.c
index cf34c694af6f..4ac18c7c1db7 100644
--- a/crypto/hash-afalg.c
+++ b/crypto/hash-afalg.c
@@ -88,8 +88,8 @@ qcrypto_afalg_hash_hmac_ctx_new(QCryptoHashAlgorithm alg,
 
     /* HMAC needs setkey */
     if (is_hmac) {
-        if (qemu_setsockopt(afalg->tfmfd, SOL_ALG, ALG_SET_KEY,
-                            key, nkey) != 0) {
+        if (setsockopt(afalg->tfmfd, SOL_ALG, ALG_SET_KEY,
+                       key, nkey) != 0) {
             error_setg_errno(errp, errno, "Set hmac key failed");
             qcrypto_afalg_comm_free(afalg);
             return NULL;
diff --git a/gdbstub.c b/gdbstub.c
index 3c14c6a03831..c8375e3c3ffe 100644
--- a/gdbstub.c
+++ b/gdbstub.c
@@ -426,7 +426,7 @@ static int get_char(void)
     int ret;
 
     for(;;) {
-        ret = qemu_recv(gdbserver_state.fd, &ch, 1, 0);
+        ret = recv(gdbserver_state.fd, &ch, 1, 0);
         if (ret < 0) {
             if (errno == ECONNRESET)
                 gdbserver_state.fd = -1;
diff --git a/io/channel-socket.c b/io/channel-socket.c
index 459922c87480..7a8d9f69c92d 100644
--- a/io/channel-socket.c
+++ b/io/channel-socket.c
@@ -681,9 +681,9 @@ qio_channel_socket_set_delay(QIOChannel *ioc,
     QIOChannelSocket *sioc = QIO_CHANNEL_SOCKET(ioc);
     int v = enabled ? 0 : 1;
 
-    qemu_setsockopt(sioc->fd,
-                    IPPROTO_TCP, TCP_NODELAY,
-                    &v, sizeof(v));
+    setsockopt(sioc->fd,
+               IPPROTO_TCP, TCP_NODELAY,
+               &v, sizeof(v));
 }
 
 
diff --git a/net/socket.c b/net/socket.c
index 15b410e8d825..c4b80e9228d7 100644
--- a/net/socket.c
+++ b/net/socket.c
@@ -120,9 +120,9 @@ static ssize_t net_socket_receive_dgram(NetClientState *nc, const uint8_t *buf,
 
     do {
         if (s->dgram_dst.sin_family != AF_UNIX) {
-            ret = qemu_sendto(s->fd, buf, size, 0,
-                              (struct sockaddr *)&s->dgram_dst,
-                              sizeof(s->dgram_dst));
+            ret = sendto(s->fd, buf, size, 0,
+                         (struct sockaddr *)&s->dgram_dst,
+                         sizeof(s->dgram_dst));
         } else {
             ret = send(s->fd, buf, size, 0);
         }
@@ -163,7 +163,7 @@ static void net_socket_send(void *opaque)
     uint8_t buf1[NET_BUFSIZE];
     const uint8_t *buf;
 
-    size = qemu_recv(s->fd, buf1, sizeof(buf1), 0);
+    size = recv(s->fd, buf1, sizeof(buf1), 0);
     if (size < 0) {
         if (errno != EWOULDBLOCK)
             goto eoc;
@@ -198,7 +198,7 @@ static void net_socket_send_dgram(void *opaque)
     NetSocketState *s = opaque;
     int size;
 
-    size = qemu_recv(s->fd, s->rs.buf, sizeof(s->rs.buf), 0);
+    size = recv(s->fd, s->rs.buf, sizeof(s->rs.buf), 0);
     if (size < 0)
         return;
     if (size == 0) {
@@ -246,7 +246,7 @@ static int net_socket_mcast_create(struct sockaddr_in *mcastaddr,
      * only on posix systems.
      */
     val = 1;
-    ret = qemu_setsockopt(fd, SOL_SOCKET, SO_REUSEADDR, &val, sizeof(val));
+    ret = setsockopt(fd, SOL_SOCKET, SO_REUSEADDR, &val, sizeof(val));
     if (ret < 0) {
         error_setg_errno(errp, errno,
                          "can't set socket option SO_REUSEADDR");
@@ -268,8 +268,8 @@ static int net_socket_mcast_create(struct sockaddr_in *mcastaddr,
         imr.imr_interface.s_addr = htonl(INADDR_ANY);
     }
 
-    ret = qemu_setsockopt(fd, IPPROTO_IP, IP_ADD_MEMBERSHIP,
-                          &imr, sizeof(struct ip_mreq));
+    ret = setsockopt(fd, IPPROTO_IP, IP_ADD_MEMBERSHIP,
+                     &imr, sizeof(struct ip_mreq));
     if (ret < 0) {
         error_setg_errno(errp, errno,
                          "can't add socket to multicast group %s",
@@ -279,8 +279,8 @@ static int net_socket_mcast_create(struct sockaddr_in *mcastaddr,
 
     /* Force mcast msgs to loopback (eg. several QEMUs in same host */
     loop = 1;
-    ret = qemu_setsockopt(fd, IPPROTO_IP, IP_MULTICAST_LOOP,
-                          &loop, sizeof(loop));
+    ret = setsockopt(fd, IPPROTO_IP, IP_MULTICAST_LOOP,
+                     &loop, sizeof(loop));
     if (ret < 0) {
         error_setg_errno(errp, errno,
                          "can't force multicast message to loopback");
@@ -289,8 +289,8 @@ static int net_socket_mcast_create(struct sockaddr_in *mcastaddr,
 
     /* If a bind address is given, only send packets from that address */
     if (localaddr != NULL) {
-        ret = qemu_setsockopt(fd, IPPROTO_IP, IP_MULTICAST_IF,
-                              localaddr, sizeof(*localaddr));
+        ret = setsockopt(fd, IPPROTO_IP, IP_MULTICAST_IF,
+                         localaddr, sizeof(*localaddr));
         if (ret < 0) {
             error_setg_errno(errp, errno,
                              "can't set the default network send interface");
diff --git a/tests/qtest/e1000e-test.c b/tests/qtest/e1000e-test.c
index 0273fe4c1566..e648fdd409cd 100644
--- a/tests/qtest/e1000e-test.c
+++ b/tests/qtest/e1000e-test.c
@@ -91,9 +91,9 @@ static void e1000e_send_verify(QE1000E *d, int *test_sockets, QGuestAllocator *a
     g_assert_cmphex(le32_to_cpu(descr.upper.data) & dsta_dd, ==, dsta_dd);
 
     /* Check data sent to the backend */
-    ret = qemu_recv(test_sockets[0], &recv_len, sizeof(recv_len), 0);
+    ret = recv(test_sockets[0], &recv_len, sizeof(recv_len), 0);
     g_assert_cmpint(ret, == , sizeof(recv_len));
-    ret = qemu_recv(test_sockets[0], buffer, 64, 0);
+    ret = recv(test_sockets[0], buffer, 64, 0);
     g_assert_cmpint(ret, >=, 5);
     g_assert_cmpstr(buffer, == , "TEST");
 
diff --git a/tests/qtest/libqtest.c b/tests/qtest/libqtest.c
index 41f4da4e54fc..9dac018fcba0 100644
--- a/tests/qtest/libqtest.c
+++ b/tests/qtest/libqtest.c
@@ -94,8 +94,8 @@ static int socket_accept(int sock)
     struct timeval timeout = { .tv_sec = SOCKET_TIMEOUT,
                                .tv_usec = 0 };
 
-    if (qemu_setsockopt(sock, SOL_SOCKET, SO_RCVTIMEO,
-                        (void *)&timeout, sizeof(timeout))) {
+    if (setsockopt(sock, SOL_SOCKET, SO_RCVTIMEO,
+                   (void *)&timeout, sizeof(timeout))) {
         fprintf(stderr, "%s failed to set SO_RCVTIMEO: %s\n",
                 __func__, strerror(errno));
         close(sock);
diff --git a/tests/qtest/npcm7xx_emc-test.c b/tests/qtest/npcm7xx_emc-test.c
index 9eec71d87c1f..7c435ac91576 100644
--- a/tests/qtest/npcm7xx_emc-test.c
+++ b/tests/qtest/npcm7xx_emc-test.c
@@ -521,12 +521,12 @@ static void emc_send_verify1(QTestState *qts, const EMCModule *mod, int fd,
 
     /* Check data sent to the backend. */
     recv_len = ~0;
-    ret = qemu_recv(fd, &recv_len, sizeof(recv_len), MSG_DONTWAIT);
+    ret = recv(fd, &recv_len, sizeof(recv_len), MSG_DONTWAIT);
     g_assert_cmpint(ret, == , sizeof(recv_len));
 
     g_assert(wait_socket_readable(fd));
     memset(buffer, 0xff, sizeof(buffer));
-    ret = qemu_recv(fd, buffer, test_size, MSG_DONTWAIT);
+    ret = recv(fd, buffer, test_size, MSG_DONTWAIT);
     g_assert_cmpmem(buffer, ret, test_data, test_size);
 }
 
diff --git a/tests/qtest/test-filter-mirror.c b/tests/qtest/test-filter-mirror.c
index 95367d14d36d..da4f94de727a 100644
--- a/tests/qtest/test-filter-mirror.c
+++ b/tests/qtest/test-filter-mirror.c
@@ -58,13 +58,13 @@ static void test_mirror(void)
     g_assert_cmpint(ret, ==, sizeof(send_buf) + sizeof(size));
     close(send_sock[0]);
 
-    ret = qemu_recv(recv_sock[0], &len, sizeof(len), 0);
+    ret = recv(recv_sock[0], &len, sizeof(len), 0);
     g_assert_cmpint(ret, ==, sizeof(len));
     len = ntohl(len);
 
     g_assert_cmpint(len, ==, sizeof(send_buf));
     recv_buf = g_malloc(len);
-    ret = qemu_recv(recv_sock[0], recv_buf, len, 0);
+    ret = recv(recv_sock[0], recv_buf, len, 0);
     g_assert_cmpstr(recv_buf, ==, send_buf);
 
     g_free(recv_buf);
diff --git a/tests/qtest/test-filter-redirector.c b/tests/qtest/test-filter-redirector.c
index 4f3f59cba865..fc16cf7e8d5f 100644
--- a/tests/qtest/test-filter-redirector.c
+++ b/tests/qtest/test-filter-redirector.c
@@ -115,13 +115,13 @@ static void test_redirector_tx(void)
     g_assert_cmpint(ret, ==, sizeof(send_buf) + sizeof(size));
     close(backend_sock[0]);
 
-    ret = qemu_recv(recv_sock, &len, sizeof(len), 0);
+    ret = recv(recv_sock, &len, sizeof(len), 0);
     g_assert_cmpint(ret, ==, sizeof(len));
     len = ntohl(len);
 
     g_assert_cmpint(len, ==, sizeof(send_buf));
     recv_buf = g_malloc(len);
-    ret = qemu_recv(recv_sock, recv_buf, len, 0);
+    ret = recv(recv_sock, recv_buf, len, 0);
     g_assert_cmpstr(recv_buf, ==, send_buf);
 
     g_free(recv_buf);
@@ -182,13 +182,13 @@ static void test_redirector_rx(void)
     ret = iov_send(send_sock, iov, 2, 0, sizeof(size) + sizeof(send_buf));
     g_assert_cmpint(ret, ==, sizeof(send_buf) + sizeof(size));
 
-    ret = qemu_recv(backend_sock[0], &len, sizeof(len), 0);
+    ret = recv(backend_sock[0], &len, sizeof(len), 0);
     g_assert_cmpint(ret, ==, sizeof(len));
     len = ntohl(len);
 
     g_assert_cmpint(len, ==, sizeof(send_buf));
     recv_buf = g_malloc(len);
-    ret = qemu_recv(backend_sock[0], recv_buf, len, 0);
+    ret = recv(backend_sock[0], recv_buf, len, 0);
     g_assert_cmpstr(recv_buf, ==, send_buf);
 
     close(send_sock);
diff --git a/tests/qtest/virtio-net-test.c b/tests/qtest/virtio-net-test.c
index 8bf74e516cce..a71395849f33 100644
--- a/tests/qtest/virtio-net-test.c
+++ b/tests/qtest/virtio-net-test.c
@@ -87,11 +87,11 @@ static void tx_test(QVirtioDevice *dev,
                            QVIRTIO_NET_TIMEOUT_US);
     guest_free(alloc, req_addr);
 
-    ret = qemu_recv(socket, &len, sizeof(len), 0);
+    ret = recv(socket, &len, sizeof(len), 0);
     g_assert_cmpint(ret, ==, sizeof(len));
     len = ntohl(len);
 
-    ret = qemu_recv(socket, buffer, len, 0);
+    ret = recv(socket, buffer, len, 0);
     g_assert_cmpstr(buffer, ==, "TEST");
 }
 
@@ -202,11 +202,11 @@ static void announce_self(void *obj, void *data, QGuestAllocator *t_alloc)
     qobject_unref(rsp);
 
     /* Catch the first packet and make sure it's a RARP */
-    ret = qemu_recv(sv[0], &len, sizeof(len), 0);
+    ret = recv(sv[0], &len, sizeof(len), 0);
     g_assert_cmpint(ret, ==,  sizeof(len));
     len = ntohl(len);
 
-    ret = qemu_recv(sv[0], buffer, len, 0);
+    ret = recv(sv[0], buffer, len, 0);
     g_assert_cmpint(*proto, ==, htons(ETH_P_RARP));
 
     /*
@@ -230,7 +230,7 @@ static void announce_self(void *obj, void *data, QGuestAllocator *t_alloc)
 
     while (true) {
         int saved_err;
-        ret = qemu_recv(sv[0], buffer, 60, MSG_DONTWAIT);
+        ret = recv(sv[0], buffer, 60, MSG_DONTWAIT);
         saved_err = errno;
         now = g_get_monotonic_time();
         g_assert_cmpint(now, <, deadline);
diff --git a/tests/unit/socket-helpers.c b/tests/unit/socket-helpers.c
index f704fd1a69ce..ef31664d0224 100644
--- a/tests/unit/socket-helpers.c
+++ b/tests/unit/socket-helpers.c
@@ -105,7 +105,7 @@ static int socket_can_bind_connect(const char *hostname, int family)
     }
 
     if (check_soerr) {
-        if (qemu_getsockopt(cfd, SOL_SOCKET, SO_ERROR, &soerr, &soerrlen) < 0) {
+        if (getsockopt(cfd, SOL_SOCKET, SO_ERROR, &soerr, &soerrlen) < 0) {
             goto cleanup;
         }
         if (soerr) {
diff --git a/util/osdep.c b/util/osdep.c
index 394804d32e1b..84575ec21881 100644
--- a/util/osdep.c
+++ b/util/osdep.c
@@ -39,7 +39,7 @@ static const char *hw_version = QEMU_HW_VERSION;
 int socket_set_cork(int fd, int v)
 {
 #if defined(SOL_TCP) && defined(TCP_CORK)
-    return qemu_setsockopt(fd, SOL_TCP, TCP_CORK, &v, sizeof(v));
+    return setsockopt(fd, SOL_TCP, TCP_CORK, &v, sizeof(v));
 #else
     return 0;
 #endif
@@ -48,7 +48,7 @@ int socket_set_cork(int fd, int v)
 int socket_set_nodelay(int fd)
 {
     int v = 1;
-    return qemu_setsockopt(fd, IPPROTO_TCP, TCP_NODELAY, &v, sizeof(v));
+    return setsockopt(fd, IPPROTO_TCP, TCP_NODELAY, &v, sizeof(v));
 }
 
 int qemu_madvise(void *addr, size_t len, int advice)
diff --git a/util/qemu-sockets.c b/util/qemu-sockets.c
index 0585e7a6298e..e8f45a7d30a5 100644
--- a/util/qemu-sockets.c
+++ b/util/qemu-sockets.c
@@ -97,7 +97,7 @@ bool fd_is_socket(int fd)
 {
     int optval;
     socklen_t optlen = sizeof(optval);
-    return !qemu_getsockopt(fd, SOL_SOCKET, SO_TYPE, &optval, &optlen);
+    return !getsockopt(fd, SOL_SOCKET, SO_TYPE, &optval, &optlen);
 }
 
 
@@ -185,8 +185,8 @@ static int try_bind(int socket, InetSocketAddress *saddr, struct addrinfo *e)
 
  rebind:
     if (e->ai_family == PF_INET6) {
-        qemu_setsockopt(socket, IPPROTO_IPV6, IPV6_V6ONLY, &v6only,
-                        sizeof(v6only));
+        setsockopt(socket, IPPROTO_IPV6, IPV6_V6ONLY, &v6only,
+                   sizeof(v6only));
     }
 
     stat = bind(socket, e->ai_addr, e->ai_addrlen);
@@ -483,8 +483,8 @@ int inet_connect_saddr(InetSocketAddress *saddr, Error **errp)
 
     if (saddr->keep_alive) {
         int val = 1;
-        int ret = qemu_setsockopt(sock, SOL_SOCKET, SO_KEEPALIVE,
-                                  &val, sizeof(val));
+        int ret = setsockopt(sock, SOL_SOCKET, SO_KEEPALIVE,
+                             &val, sizeof(val));
 
         if (ret < 0) {
             error_setg_errno(errp, errno, "Unable to set KEEPALIVE");
-- 
2.35.1.273.ge6ebfd0e8cbb



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

* [PULL 05/21] Replace GCC_FMT_ATTR with G_GNUC_PRINTF
  2022-03-22 12:25 [PULL 00/21] Fixes patches marcandre.lureau
                   ` (3 preceding siblings ...)
  2022-03-22 12:25 ` [PULL 04/21] Drop qemu_foo() socket API wrapper marcandre.lureau
@ 2022-03-22 12:25 ` marcandre.lureau
  2022-03-22 12:25 ` [PULL 06/21] compiler.h: replace QEMU_WARN_UNUSED_RESULT with G_GNUC_WARN_UNUSED_RESULT marcandre.lureau
                   ` (16 subsequent siblings)
  21 siblings, 0 replies; 23+ messages in thread
From: marcandre.lureau @ 2022-03-22 12:25 UTC (permalink / raw)
  To: qemu-devel; +Cc: Peter Maydell, Marc-André Lureau

From: Marc-André Lureau <marcandre.lureau@redhat.com>

One less qemu-specific macro. It also helps to make some headers/units
only depend on glib, and thus moved in standalone projects eventually.

Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
Reviewed-by: Richard W.M. Jones <rjones@redhat.com>
---
 audio/audio.h                           |  4 +--
 block/qcow2.h                           |  2 +-
 bsd-user/qemu.h                         |  2 +-
 hw/display/qxl.h                        |  2 +-
 hw/net/rocker/rocker.h                  |  2 +-
 hw/xen/xen_pt.h                         |  2 +-
 include/chardev/char-fe.h               |  2 +-
 include/disas/dis-asm.h                 |  2 +-
 include/hw/acpi/aml-build.h             | 12 +++----
 include/hw/core/cpu.h                   |  2 +-
 include/hw/hw.h                         |  2 +-
 include/hw/virtio/virtio.h              |  2 +-
 include/hw/xen/xen-bus-helper.h         |  4 +--
 include/hw/xen/xen-bus.h                |  4 +--
 include/hw/xen/xen_common.h             |  2 +-
 include/hw/xen/xen_pvdev.h              |  2 +-
 include/monitor/monitor.h               |  4 +--
 include/qapi/error.h                    | 20 ++++++------
 include/qapi/qmp/qjson.h                |  8 ++---
 include/qemu/buffer.h                   |  2 +-
 include/qemu/compiler.h                 | 11 ++-----
 include/qemu/error-report.h             | 24 +++++++-------
 include/qemu/log-for-trace.h            |  2 +-
 include/qemu/log.h                      |  2 +-
 include/qemu/qemu-print.h               |  8 ++---
 include/qemu/readline.h                 |  2 +-
 qga/guest-agent-core.h                  |  2 +-
 qga/vss-win32/requester.h               |  2 +-
 scripts/cocci-macro-file.h              |  2 +-
 tests/qtest/libqos/libqtest.h           | 42 ++++++++++++-------------
 tests/qtest/libqtest-single.h           |  2 +-
 tests/qtest/migration-helpers.h         |  6 ++--
 audio/alsaaudio.c                       |  4 +--
 audio/dsoundaudio.c                     |  4 +--
 audio/ossaudio.c                        |  4 +--
 audio/paaudio.c                         |  2 +-
 audio/sdlaudio.c                        |  2 +-
 block/blkverify.c                       |  2 +-
 block/ssh.c                             |  4 +--
 fsdev/9p-marshal.c                      |  2 +-
 fsdev/virtfs-proxy-helper.c             |  2 +-
 hw/9pfs/9p.c                            |  2 +-
 hw/acpi/aml-build.c                     |  4 +--
 hw/mips/fuloong2e.c                     |  2 +-
 hw/mips/malta.c                         |  2 +-
 hw/net/rtl8139.c                        |  2 +-
 hw/virtio/virtio.c                      |  2 +-
 io/channel-websock.c                    |  2 +-
 monitor/hmp.c                           |  4 +--
 nbd/server.c                            | 10 +++---
 qemu-img.c                              |  4 +--
 qemu-io.c                               |  2 +-
 qobject/json-parser.c                   |  2 +-
 softmmu/qtest.c                         |  4 +--
 tests/qtest/libqtest.c                  |  2 +-
 tests/unit/test-qobject-input-visitor.c |  4 +--
 audio/coreaudio.m                       |  4 +--
 scripts/checkpatch.pl                   |  2 +-
 58 files changed, 130 insertions(+), 137 deletions(-)

diff --git a/audio/audio.h b/audio/audio.h
index c8bde536b5cd..cbb10f4816e5 100644
--- a/audio/audio.h
+++ b/audio/audio.h
@@ -91,8 +91,8 @@ typedef struct QEMUAudioTimeStamp {
     uint64_t old_ts;
 } QEMUAudioTimeStamp;
 
-void AUD_vlog (const char *cap, const char *fmt, va_list ap) GCC_FMT_ATTR(2, 0);
-void AUD_log (const char *cap, const char *fmt, ...) GCC_FMT_ATTR(2, 3);
+void AUD_vlog (const char *cap, const char *fmt, va_list ap) G_GNUC_PRINTF(2, 0);
+void AUD_log (const char *cap, const char *fmt, ...) G_GNUC_PRINTF(2, 3);
 
 void AUD_register_card (const char *name, QEMUSoundCard *card);
 void AUD_remove_card (QEMUSoundCard *card);
diff --git a/block/qcow2.h b/block/qcow2.h
index fd48a89d452c..ba436a8d0d68 100644
--- a/block/qcow2.h
+++ b/block/qcow2.h
@@ -838,7 +838,7 @@ int qcow2_update_header(BlockDriverState *bs);
 
 void qcow2_signal_corruption(BlockDriverState *bs, bool fatal, int64_t offset,
                              int64_t size, const char *message_format, ...)
-                             GCC_FMT_ATTR(5, 6);
+                             G_GNUC_PRINTF(5, 6);
 
 int qcow2_validate_table(BlockDriverState *bs, uint64_t offset,
                          uint64_t entries, size_t entry_len,
diff --git a/bsd-user/qemu.h b/bsd-user/qemu.h
index af272c2a802a..21c06f2e7003 100644
--- a/bsd-user/qemu.h
+++ b/bsd-user/qemu.h
@@ -175,7 +175,7 @@ abi_long do_netbsd_syscall(void *cpu_env, int num, abi_long arg1,
 abi_long do_openbsd_syscall(void *cpu_env, int num, abi_long arg1,
                             abi_long arg2, abi_long arg3, abi_long arg4,
                             abi_long arg5, abi_long arg6);
-void gemu_log(const char *fmt, ...) GCC_FMT_ATTR(1, 2);
+void gemu_log(const char *fmt, ...) G_GNUC_PRINTF(1, 2);
 extern __thread CPUState *thread_cpu;
 void cpu_loop(CPUArchState *env);
 char *target_strerror(int err);
diff --git a/hw/display/qxl.h b/hw/display/qxl.h
index 30d21f4d0bdc..e74de9579df3 100644
--- a/hw/display/qxl.h
+++ b/hw/display/qxl.h
@@ -149,7 +149,7 @@ OBJECT_DECLARE_SIMPLE_TYPE(PCIQXLDevice, PCI_QXL)
 /* qxl.c */
 void *qxl_phys2virt(PCIQXLDevice *qxl, QXLPHYSICAL phys, int group_id);
 void qxl_set_guest_bug(PCIQXLDevice *qxl, const char *msg, ...)
-    GCC_FMT_ATTR(2, 3);
+    G_GNUC_PRINTF(2, 3);
 
 void qxl_spice_update_area(PCIQXLDevice *qxl, uint32_t surface_id,
                            struct QXLRect *area, struct QXLRect *dirty_rects,
diff --git a/hw/net/rocker/rocker.h b/hw/net/rocker/rocker.h
index 412fa44d0171..f85354d9d136 100644
--- a/hw/net/rocker/rocker.h
+++ b/hw/net/rocker/rocker.h
@@ -30,7 +30,7 @@
         fprintf(stderr, "%s ROCKER: " fmt, nowstr, ## __VA_ARGS__);\
     } while (0)
 #else
-static inline GCC_FMT_ATTR(1, 2) int DPRINTF(const char *fmt, ...)
+static inline G_GNUC_PRINTF(1, 2) int DPRINTF(const char *fmt, ...)
 {
     return 0;
 }
diff --git a/hw/xen/xen_pt.h b/hw/xen/xen_pt.h
index c74c4678f20d..6b8e13cdeed5 100644
--- a/hw/xen/xen_pt.h
+++ b/hw/xen/xen_pt.h
@@ -9,7 +9,7 @@
 bool xen_igd_gfx_pt_enabled(void);
 void xen_igd_gfx_pt_set(bool value, Error **errp);
 
-void xen_pt_log(const PCIDevice *d, const char *f, ...) GCC_FMT_ATTR(2, 3);
+void xen_pt_log(const PCIDevice *d, const char *f, ...) G_GNUC_PRINTF(2, 3);
 
 #define XEN_PT_ERR(d, _f, _a...) xen_pt_log(d, "%s: Error: "_f, __func__, ##_a)
 
diff --git a/include/chardev/char-fe.h b/include/chardev/char-fe.h
index 867ef1b3b28a..8c420fa36e3c 100644
--- a/include/chardev/char-fe.h
+++ b/include/chardev/char-fe.h
@@ -172,7 +172,7 @@ void qemu_chr_fe_set_open(CharBackend *be, int fe_open);
  * Chardev.
  */
 void qemu_chr_fe_printf(CharBackend *be, const char *fmt, ...)
-    GCC_FMT_ATTR(2, 3);
+    G_GNUC_PRINTF(2, 3);
 
 
 typedef gboolean (*FEWatchFunc)(void *do_not_use, GIOCondition condition, void *data);
diff --git a/include/disas/dis-asm.h b/include/disas/dis-asm.h
index 102a1e7f504e..fadf6a65ef15 100644
--- a/include/disas/dis-asm.h
+++ b/include/disas/dis-asm.h
@@ -269,7 +269,7 @@ typedef struct symbol_cache_entry
 } asymbol;
 
 typedef int (*fprintf_function)(FILE *f, const char *fmt, ...)
-    GCC_FMT_ATTR(2, 3);
+    G_GNUC_PRINTF(2, 3);
 
 enum dis_insn_type {
   dis_noninsn,			/* Not a valid instruction */
diff --git a/include/hw/acpi/aml-build.h b/include/hw/acpi/aml-build.h
index 8346003a224b..d1fb08514bfa 100644
--- a/include/hw/acpi/aml-build.h
+++ b/include/hw/acpi/aml-build.h
@@ -289,7 +289,7 @@ void free_aml_allocator(void);
 void aml_append(Aml *parent_ctx, Aml *child);
 
 /* non block AML object primitives */
-Aml *aml_name(const char *name_format, ...) GCC_FMT_ATTR(1, 2);
+Aml *aml_name(const char *name_format, ...) G_GNUC_PRINTF(1, 2);
 Aml *aml_name_decl(const char *name, Aml *val);
 Aml *aml_debug(void);
 Aml *aml_return(Aml *val);
@@ -344,13 +344,13 @@ Aml *aml_irq_no_flags(uint8_t irq);
 Aml *aml_named_field(const char *name, unsigned length);
 Aml *aml_reserved_field(unsigned length);
 Aml *aml_local(int num);
-Aml *aml_string(const char *name_format, ...) GCC_FMT_ATTR(1, 2);
+Aml *aml_string(const char *name_format, ...) G_GNUC_PRINTF(1, 2);
 Aml *aml_lnot(Aml *arg);
 Aml *aml_equal(Aml *arg1, Aml *arg2);
 Aml *aml_lgreater(Aml *arg1, Aml *arg2);
 Aml *aml_lgreater_equal(Aml *arg1, Aml *arg2);
 Aml *aml_processor(uint8_t proc_id, uint32_t pblk_addr, uint8_t pblk_len,
-                   const char *name_format, ...) GCC_FMT_ATTR(4, 5);
+                   const char *name_format, ...) G_GNUC_PRINTF(4, 5);
 Aml *aml_eisaid(const char *str);
 Aml *aml_word_bus_number(AmlMinFixed min_fixed, AmlMaxFixed max_fixed,
                          AmlDecode dec, uint16_t addr_gran,
@@ -384,8 +384,8 @@ Aml *aml_sleep(uint64_t msec);
 Aml *aml_i2c_serial_bus_device(uint16_t address, const char *resource_source);
 
 /* Block AML object primitives */
-Aml *aml_scope(const char *name_format, ...) GCC_FMT_ATTR(1, 2);
-Aml *aml_device(const char *name_format, ...) GCC_FMT_ATTR(1, 2);
+Aml *aml_scope(const char *name_format, ...) G_GNUC_PRINTF(1, 2);
+Aml *aml_device(const char *name_format, ...) G_GNUC_PRINTF(1, 2);
 Aml *aml_method(const char *name, int arg_count, AmlSerializeFlag sflag);
 Aml *aml_if(Aml *predicate);
 Aml *aml_else(void);
@@ -460,7 +460,7 @@ build_xsdt(GArray *table_data, BIOSLinker *linker, GArray *table_offsets,
 
 int
 build_append_named_dword(GArray *array, const char *name_format, ...)
-GCC_FMT_ATTR(2, 3);
+G_GNUC_PRINTF(2, 3);
 
 void build_append_gas(GArray *table, AmlAddressSpace as,
                       uint8_t bit_width, uint8_t bit_offset,
diff --git a/include/hw/core/cpu.h b/include/hw/core/cpu.h
index 0efc6153ed03..136973655c1a 100644
--- a/include/hw/core/cpu.h
+++ b/include/hw/core/cpu.h
@@ -1016,7 +1016,7 @@ int cpu_watchpoint_address_matches(CPUState *cpu, vaddr addr, vaddr len);
 AddressSpace *cpu_get_address_space(CPUState *cpu, int asidx);
 
 void QEMU_NORETURN cpu_abort(CPUState *cpu, const char *fmt, ...)
-    GCC_FMT_ATTR(2, 3);
+    G_GNUC_PRINTF(2, 3);
 
 /* $(top_srcdir)/cpu.c */
 void cpu_class_init_props(DeviceClass *dc);
diff --git a/include/hw/hw.h b/include/hw/hw.h
index fc5301f29372..34377f5309d3 100644
--- a/include/hw/hw.h
+++ b/include/hw/hw.h
@@ -5,6 +5,6 @@
 #error Cannot include hw/hw.h from user emulation
 #endif
 
-void QEMU_NORETURN hw_error(const char *fmt, ...) GCC_FMT_ATTR(1, 2);
+void QEMU_NORETURN hw_error(const char *fmt, ...) G_GNUC_PRINTF(1, 2);
 
 #endif
diff --git a/include/hw/virtio/virtio.h b/include/hw/virtio/virtio.h
index f095637058dc..b31c4507f5dd 100644
--- a/include/hw/virtio/virtio.h
+++ b/include/hw/virtio/virtio.h
@@ -169,7 +169,7 @@ void virtio_init(VirtIODevice *vdev, const char *name,
                          uint16_t device_id, size_t config_size);
 void virtio_cleanup(VirtIODevice *vdev);
 
-void virtio_error(VirtIODevice *vdev, const char *fmt, ...) GCC_FMT_ATTR(2, 3);
+void virtio_error(VirtIODevice *vdev, const char *fmt, ...) G_GNUC_PRINTF(2, 3);
 
 /* Set the child bus name. */
 void virtio_device_set_child_bus_name(VirtIODevice *vdev, char *bus_name);
diff --git a/include/hw/xen/xen-bus-helper.h b/include/hw/xen/xen-bus-helper.h
index 4c0f747445c2..629a904d1a86 100644
--- a/include/hw/xen/xen-bus-helper.h
+++ b/include/hw/xen/xen-bus-helper.h
@@ -22,11 +22,11 @@ void xs_node_destroy(struct xs_handle *xsh,  xs_transaction_t tid,
 void xs_node_vprintf(struct xs_handle *xsh,  xs_transaction_t tid,
                      const char *node, const char *key, Error **errp,
                      const char *fmt, va_list ap)
-    GCC_FMT_ATTR(6, 0);
+    G_GNUC_PRINTF(6, 0);
 void xs_node_printf(struct xs_handle *xsh,  xs_transaction_t tid,
                     const char *node, const char *key, Error **errp,
                     const char *fmt, ...)
-    GCC_FMT_ATTR(6, 7);
+    G_GNUC_PRINTF(6, 7);
 
 /* Read from node/key unless node is empty, in which case read from key */
 int xs_node_vscanf(struct xs_handle *xsh,  xs_transaction_t tid,
diff --git a/include/hw/xen/xen-bus.h b/include/hw/xen/xen-bus.h
index 6bdbf3ff8220..713e763348f4 100644
--- a/include/hw/xen/xen-bus.h
+++ b/include/hw/xen/xen-bus.h
@@ -88,10 +88,10 @@ enum xenbus_state xen_device_backend_get_state(XenDevice *xendev);
 
 void xen_device_backend_printf(XenDevice *xendev, const char *key,
                                const char *fmt, ...)
-    GCC_FMT_ATTR(3, 4);
+    G_GNUC_PRINTF(3, 4);
 void xen_device_frontend_printf(XenDevice *xendev, const char *key,
                                 const char *fmt, ...)
-    GCC_FMT_ATTR(3, 4);
+    G_GNUC_PRINTF(3, 4);
 
 int xen_device_frontend_scanf(XenDevice *xendev, const char *key,
                               const char *fmt, ...);
diff --git a/include/hw/xen/xen_common.h b/include/hw/xen/xen_common.h
index a8118b41acfb..179741ff791c 100644
--- a/include/hw/xen/xen_common.h
+++ b/include/hw/xen/xen_common.h
@@ -358,7 +358,7 @@ static inline int xen_restrict(domid_t domid)
 void destroy_hvm_domain(bool reboot);
 
 /* shutdown/destroy current domain because of an error */
-void xen_shutdown_fatal_error(const char *fmt, ...) GCC_FMT_ATTR(1, 2);
+void xen_shutdown_fatal_error(const char *fmt, ...) G_GNUC_PRINTF(1, 2);
 
 #ifdef HVM_PARAM_VMPORT_REGS_PFN
 static inline int xen_get_vmport_regs_pfn(xc_interface *xc, domid_t dom,
diff --git a/include/hw/xen/xen_pvdev.h b/include/hw/xen/xen_pvdev.h
index 83e5174d9029..7cd4bc2b8284 100644
--- a/include/hw/xen/xen_pvdev.h
+++ b/include/hw/xen/xen_pvdev.h
@@ -76,6 +76,6 @@ void xen_pv_unbind_evtchn(struct XenLegacyDevice *xendev);
 int xen_pv_send_notify(struct XenLegacyDevice *xendev);
 
 void xen_pv_printf(struct XenLegacyDevice *xendev, int msg_level,
-                   const char *fmt, ...)  GCC_FMT_ATTR(3, 4);
+                   const char *fmt, ...)  G_GNUC_PRINTF(3, 4);
 
 #endif /* QEMU_HW_XEN_PVDEV_H */
diff --git a/include/monitor/monitor.h b/include/monitor/monitor.h
index 12d395d62d6b..cc4cc6c6adcf 100644
--- a/include/monitor/monitor.h
+++ b/include/monitor/monitor.h
@@ -32,8 +32,8 @@ int monitor_get_fd(Monitor *mon, const char *fdname, Error **errp);
 int monitor_fd_param(Monitor *mon, const char *fdname, Error **errp);
 
 int monitor_vprintf(Monitor *mon, const char *fmt, va_list ap)
-    GCC_FMT_ATTR(2, 0);
-int monitor_printf(Monitor *mon, const char *fmt, ...) GCC_FMT_ATTR(2, 3);
+    G_GNUC_PRINTF(2, 0);
+int monitor_printf(Monitor *mon, const char *fmt, ...) G_GNUC_PRINTF(2, 3);
 void monitor_flush(Monitor *mon);
 int monitor_set_cpu(Monitor *mon, int cpu_index);
 int monitor_get_cpu_index(Monitor *mon);
diff --git a/include/qapi/error.h b/include/qapi/error.h
index 4a9260b0cc00..d798faeec3e9 100644
--- a/include/qapi/error.h
+++ b/include/qapi/error.h
@@ -320,7 +320,7 @@ ErrorClass error_get_class(const Error *err);
 void error_setg_internal(Error **errp,
                          const char *src, int line, const char *func,
                          const char *fmt, ...)
-    GCC_FMT_ATTR(5, 6);
+    G_GNUC_PRINTF(5, 6);
 
 /*
  * Just like error_setg(), with @os_error info added to the message.
@@ -336,7 +336,7 @@ void error_setg_internal(Error **errp,
 void error_setg_errno_internal(Error **errp,
                                const char *fname, int line, const char *func,
                                int os_error, const char *fmt, ...)
-    GCC_FMT_ATTR(6, 7);
+    G_GNUC_PRINTF(6, 7);
 
 #ifdef _WIN32
 /*
@@ -350,7 +350,7 @@ void error_setg_errno_internal(Error **errp,
 void error_setg_win32_internal(Error **errp,
                                const char *src, int line, const char *func,
                                int win32_err, const char *fmt, ...)
-    GCC_FMT_ATTR(6, 7);
+    G_GNUC_PRINTF(6, 7);
 #endif
 
 /*
@@ -383,21 +383,21 @@ void error_propagate(Error **dst_errp, Error *local_err);
  */
 void error_propagate_prepend(Error **dst_errp, Error *local_err,
                              const char *fmt, ...)
-    GCC_FMT_ATTR(3, 4);
+    G_GNUC_PRINTF(3, 4);
 
 /*
  * Prepend some text to @errp's human-readable error message.
  * The text is made by formatting @fmt, @ap like vprintf().
  */
 void error_vprepend(Error *const *errp, const char *fmt, va_list ap)
-    GCC_FMT_ATTR(2, 0);
+    G_GNUC_PRINTF(2, 0);
 
 /*
  * Prepend some text to @errp's human-readable error message.
  * The text is made by formatting @fmt, ... like printf().
  */
 void error_prepend(Error *const *errp, const char *fmt, ...)
-    GCC_FMT_ATTR(2, 3);
+    G_GNUC_PRINTF(2, 3);
 
 /*
  * Append a printf-style human-readable explanation to an existing error.
@@ -414,7 +414,7 @@ void error_prepend(Error *const *errp, const char *fmt, ...)
  * newline.
  */
 void error_append_hint(Error *const *errp, const char *fmt, ...)
-    GCC_FMT_ATTR(2, 3);
+    G_GNUC_PRINTF(2, 3);
 
 /*
  * Convenience function to report open() failure.
@@ -458,13 +458,13 @@ void error_report_err(Error *err);
  * Convenience function to error_prepend(), warn_report() and free @err.
  */
 void warn_reportf_err(Error *err, const char *fmt, ...)
-    GCC_FMT_ATTR(2, 3);
+    G_GNUC_PRINTF(2, 3);
 
 /*
  * Convenience function to error_prepend(), error_report() and free @err.
  */
 void error_reportf_err(Error *err, const char *fmt, ...)
-    GCC_FMT_ATTR(2, 3);
+    G_GNUC_PRINTF(2, 3);
 
 /*
  * Just like error_setg(), except you get to specify the error class.
@@ -477,7 +477,7 @@ void error_reportf_err(Error *err, const char *fmt, ...)
 void error_set_internal(Error **errp,
                         const char *src, int line, const char *func,
                         ErrorClass err_class, const char *fmt, ...)
-    GCC_FMT_ATTR(6, 7);
+    G_GNUC_PRINTF(6, 7);
 
 /*
  * Make @errp parameter easier to use regardless of argument value
diff --git a/include/qapi/qmp/qjson.h b/include/qapi/qmp/qjson.h
index 593b40b4e0a4..7bd8d2de1b33 100644
--- a/include/qapi/qmp/qjson.h
+++ b/include/qapi/qmp/qjson.h
@@ -17,13 +17,13 @@
 QObject *qobject_from_json(const char *string, Error **errp);
 
 QObject *qobject_from_vjsonf_nofail(const char *string, va_list ap)
-    GCC_FMT_ATTR(1, 0);
+    G_GNUC_PRINTF(1, 0);
 QObject *qobject_from_jsonf_nofail(const char *string, ...)
-    GCC_FMT_ATTR(1, 2);
+    G_GNUC_PRINTF(1, 2);
 QDict *qdict_from_vjsonf_nofail(const char *string, va_list ap)
-    GCC_FMT_ATTR(1, 0);
+    G_GNUC_PRINTF(1, 0);
 QDict *qdict_from_jsonf_nofail(const char *string, ...)
-    GCC_FMT_ATTR(1, 2);
+    G_GNUC_PRINTF(1, 2);
 
 GString *qobject_to_json(const QObject *obj);
 GString *qobject_to_json_pretty(const QObject *obj, bool pretty);
diff --git a/include/qemu/buffer.h b/include/qemu/buffer.h
index d34d2c857ccc..e95dfd696ca8 100644
--- a/include/qemu/buffer.h
+++ b/include/qemu/buffer.h
@@ -49,7 +49,7 @@ struct Buffer {
  * to identify in debug traces.
  */
 void buffer_init(Buffer *buffer, const char *name, ...)
-        GCC_FMT_ATTR(2, 3);
+        G_GNUC_PRINTF(2, 3);
 
 /**
  * buffer_shrink:
diff --git a/include/qemu/compiler.h b/include/qemu/compiler.h
index 3baa5e3790f7..f2bd050e3b9a 100644
--- a/include/qemu/compiler.h
+++ b/include/qemu/compiler.h
@@ -79,19 +79,12 @@
 #define QEMU_BUILD_BUG_ON_ZERO(x) (sizeof(QEMU_BUILD_BUG_ON_STRUCT(x)) - \
                                    sizeof(QEMU_BUILD_BUG_ON_STRUCT(x)))
 
-#if defined(__clang__)
-/* clang doesn't support gnu_printf, so use printf. */
-# define GCC_FMT_ATTR(n, m) __attribute__((format(printf, n, m)))
-#else
-/* Use gnu_printf (qemu uses standard format strings). */
-# define GCC_FMT_ATTR(n, m) __attribute__((format(gnu_printf, n, m)))
-# if defined(_WIN32)
+#if !defined(__clang__) && defined(_WIN32)
 /*
  * Map __printf__ to __gnu_printf__ because we want standard format strings even
  * when MinGW or GLib include files use __printf__.
  */
-#  define __printf__ __gnu_printf__
-# endif
+# define __printf__ __gnu_printf__
 #endif
 
 #ifndef __has_warning
diff --git a/include/qemu/error-report.h b/include/qemu/error-report.h
index 9d197daca387..33e662db44c6 100644
--- a/include/qemu/error-report.h
+++ b/include/qemu/error-report.h
@@ -30,23 +30,23 @@ void loc_set_none(void);
 void loc_set_cmdline(char **argv, int idx, int cnt);
 void loc_set_file(const char *fname, int lno);
 
-int error_vprintf(const char *fmt, va_list ap) GCC_FMT_ATTR(1, 0);
-int error_printf(const char *fmt, ...) GCC_FMT_ATTR(1, 2);
-int error_vprintf_unless_qmp(const char *fmt, va_list ap) GCC_FMT_ATTR(1, 0);
-int error_printf_unless_qmp(const char *fmt, ...) GCC_FMT_ATTR(1, 2);
+int error_vprintf(const char *fmt, va_list ap) G_GNUC_PRINTF(1, 0);
+int error_printf(const char *fmt, ...) G_GNUC_PRINTF(1, 2);
+int error_vprintf_unless_qmp(const char *fmt, va_list ap) G_GNUC_PRINTF(1, 0);
+int error_printf_unless_qmp(const char *fmt, ...) G_GNUC_PRINTF(1, 2);
 
-void error_vreport(const char *fmt, va_list ap) GCC_FMT_ATTR(1, 0);
-void warn_vreport(const char *fmt, va_list ap) GCC_FMT_ATTR(1, 0);
-void info_vreport(const char *fmt, va_list ap) GCC_FMT_ATTR(1, 0);
+void error_vreport(const char *fmt, va_list ap) G_GNUC_PRINTF(1, 0);
+void warn_vreport(const char *fmt, va_list ap) G_GNUC_PRINTF(1, 0);
+void info_vreport(const char *fmt, va_list ap) G_GNUC_PRINTF(1, 0);
 
-void error_report(const char *fmt, ...) GCC_FMT_ATTR(1, 2);
-void warn_report(const char *fmt, ...) GCC_FMT_ATTR(1, 2);
-void info_report(const char *fmt, ...) GCC_FMT_ATTR(1, 2);
+void error_report(const char *fmt, ...) G_GNUC_PRINTF(1, 2);
+void warn_report(const char *fmt, ...) G_GNUC_PRINTF(1, 2);
+void info_report(const char *fmt, ...) G_GNUC_PRINTF(1, 2);
 
 bool error_report_once_cond(bool *printed, const char *fmt, ...)
-    GCC_FMT_ATTR(2, 3);
+    G_GNUC_PRINTF(2, 3);
 bool warn_report_once_cond(bool *printed, const char *fmt, ...)
-    GCC_FMT_ATTR(2, 3);
+    G_GNUC_PRINTF(2, 3);
 
 void error_init(const char *argv0);
 
diff --git a/include/qemu/log-for-trace.h b/include/qemu/log-for-trace.h
index 2f0a5b080eab..5e415172278a 100644
--- a/include/qemu/log-for-trace.h
+++ b/include/qemu/log-for-trace.h
@@ -30,6 +30,6 @@ static inline bool qemu_loglevel_mask(int mask)
 }
 
 /* main logging function */
-int GCC_FMT_ATTR(1, 2) qemu_log(const char *fmt, ...);
+int G_GNUC_PRINTF(1, 2) qemu_log(const char *fmt, ...);
 
 #endif
diff --git a/include/qemu/log.h b/include/qemu/log.h
index 9b8066020729..5739c7e6d819 100644
--- a/include/qemu/log.h
+++ b/include/qemu/log.h
@@ -96,7 +96,7 @@ static inline void qemu_log_unlock(FILE *fd)
 
 /* vfprintf-like logging function
  */
-static inline void GCC_FMT_ATTR(1, 0)
+static inline void G_GNUC_PRINTF(1, 0)
 qemu_log_vprintf(const char *fmt, va_list va)
 {
     QemuLogFile *logfile;
diff --git a/include/qemu/qemu-print.h b/include/qemu/qemu-print.h
index 40b596262fae..1b70920648b8 100644
--- a/include/qemu/qemu-print.h
+++ b/include/qemu/qemu-print.h
@@ -13,11 +13,11 @@
 #ifndef QEMU_PRINT_H
 #define QEMU_PRINT_H
 
-int qemu_vprintf(const char *fmt, va_list ap) GCC_FMT_ATTR(1, 0);
-int qemu_printf(const char *fmt, ...) GCC_FMT_ATTR(1, 2);
+int qemu_vprintf(const char *fmt, va_list ap) G_GNUC_PRINTF(1, 0);
+int qemu_printf(const char *fmt, ...) G_GNUC_PRINTF(1, 2);
 
 int qemu_vfprintf(FILE *stream, const char *fmt, va_list ap)
-    GCC_FMT_ATTR(2, 0);
-int qemu_fprintf(FILE *stream, const char *fmt, ...) GCC_FMT_ATTR(2, 3);
+    G_GNUC_PRINTF(2, 0);
+int qemu_fprintf(FILE *stream, const char *fmt, ...) G_GNUC_PRINTF(2, 3);
 
 #endif
diff --git a/include/qemu/readline.h b/include/qemu/readline.h
index e81258322be6..622aa4564f67 100644
--- a/include/qemu/readline.h
+++ b/include/qemu/readline.h
@@ -5,7 +5,7 @@
 #define READLINE_MAX_CMDS 64
 #define READLINE_MAX_COMPLETIONS 256
 
-typedef void GCC_FMT_ATTR(2, 3) ReadLinePrintfFunc(void *opaque,
+typedef void G_GNUC_PRINTF(2, 3) ReadLinePrintfFunc(void *opaque,
                                                    const char *fmt, ...);
 typedef void ReadLineFlushFunc(void *opaque);
 typedef void ReadLineFunc(void *opaque, const char *str,
diff --git a/qga/guest-agent-core.h b/qga/guest-agent-core.h
index 9d01ea9c82ab..29cd50402fdb 100644
--- a/qga/guest-agent-core.h
+++ b/qga/guest-agent-core.h
@@ -36,7 +36,7 @@ void ga_command_state_free(GACommandState *cs);
 bool ga_logging_enabled(GAState *s);
 void ga_disable_logging(GAState *s);
 void ga_enable_logging(GAState *s);
-void GCC_FMT_ATTR(1, 2) slog(const gchar *fmt, ...);
+void G_GNUC_PRINTF(1, 2) slog(const gchar *fmt, ...);
 void ga_set_response_delimited(GAState *s);
 bool ga_is_frozen(GAState *s);
 void ga_set_frozen(GAState *s);
diff --git a/qga/vss-win32/requester.h b/qga/vss-win32/requester.h
index 5a8e8faf0cea..ecc5f2acb4fd 100644
--- a/qga/vss-win32/requester.h
+++ b/qga/vss-win32/requester.h
@@ -25,7 +25,7 @@ struct Error;
 typedef void (*ErrorSetFunc)(struct Error **errp,
                              const char *src, int line, const char *func,
                              int win32_err, const char *fmt, ...)
-    GCC_FMT_ATTR(6, 7);
+    G_GNUC_PRINTF(6, 7);
 typedef struct ErrorSet {
     ErrorSetFunc error_setg_win32_wrapper;
     struct Error **errp;        /* restriction: must not be null */
diff --git a/scripts/cocci-macro-file.h b/scripts/cocci-macro-file.h
index 20eea6b708f5..c2fcea8e77a2 100644
--- a/scripts/cocci-macro-file.h
+++ b/scripts/cocci-macro-file.h
@@ -34,7 +34,7 @@
 #define QEMU_BUILD_BUG_ON(x) \
     typedef char cat2(qemu_build_bug_on__,__LINE__)[(x)?-1:1] __attribute__((unused));
 
-#define GCC_FMT_ATTR(n, m) __attribute__((format(gnu_printf, n, m)))
+#define G_GNUC_PRINTF(n, m) __attribute__((format(gnu_printf, n, m)))
 
 #define xglue(x, y) x ## y
 #define glue(x, y) xglue(x, y)
diff --git a/tests/qtest/libqos/libqtest.h b/tests/qtest/libqos/libqtest.h
index cf38d273f5c0..552667f17e37 100644
--- a/tests/qtest/libqos/libqtest.h
+++ b/tests/qtest/libqos/libqtest.h
@@ -31,7 +31,7 @@ typedef struct QTestState QTestState;
  *
  * Returns: #QTestState instance.
  */
-QTestState *qtest_initf(const char *fmt, ...) GCC_FMT_ATTR(1, 2);
+QTestState *qtest_initf(const char *fmt, ...) G_GNUC_PRINTF(1, 2);
 
 /**
  * qtest_vinitf:
@@ -43,7 +43,7 @@ QTestState *qtest_initf(const char *fmt, ...) GCC_FMT_ATTR(1, 2);
  *
  * Returns: #QTestState instance.
  */
-QTestState *qtest_vinitf(const char *fmt, va_list ap) GCC_FMT_ATTR(1, 0);
+QTestState *qtest_vinitf(const char *fmt, va_list ap) G_GNUC_PRINTF(1, 0);
 
 /**
  * qtest_init:
@@ -106,7 +106,7 @@ void qtest_quit(QTestState *s);
  */
 QDict *qtest_qmp_fds(QTestState *s, int *fds, size_t fds_num,
                      const char *fmt, ...)
-    GCC_FMT_ATTR(4, 5);
+    G_GNUC_PRINTF(4, 5);
 
 /**
  * qtest_qmp:
@@ -118,7 +118,7 @@ QDict *qtest_qmp_fds(QTestState *s, int *fds, size_t fds_num,
  * Sends a QMP message to QEMU and returns the response.
  */
 QDict *qtest_qmp(QTestState *s, const char *fmt, ...)
-    GCC_FMT_ATTR(2, 3);
+    G_GNUC_PRINTF(2, 3);
 
 /**
  * qtest_qmp_send:
@@ -130,7 +130,7 @@ QDict *qtest_qmp(QTestState *s, const char *fmt, ...)
  * Sends a QMP message to QEMU and leaves the response in the stream.
  */
 void qtest_qmp_send(QTestState *s, const char *fmt, ...)
-    GCC_FMT_ATTR(2, 3);
+    G_GNUC_PRINTF(2, 3);
 
 /**
  * qtest_qmp_send_raw:
@@ -141,7 +141,7 @@ void qtest_qmp_send(QTestState *s, const char *fmt, ...)
  * this is useful for negative tests.
  */
 void qtest_qmp_send_raw(QTestState *s, const char *fmt, ...)
-    GCC_FMT_ATTR(2, 3);
+    G_GNUC_PRINTF(2, 3);
 
 /**
  * qtest_socket_server:
@@ -165,7 +165,7 @@ int qtest_socket_server(const char *socket_path);
  */
 QDict *qtest_vqmp_fds(QTestState *s, int *fds, size_t fds_num,
                       const char *fmt, va_list ap)
-    GCC_FMT_ATTR(4, 0);
+    G_GNUC_PRINTF(4, 0);
 
 /**
  * qtest_vqmp:
@@ -178,7 +178,7 @@ QDict *qtest_vqmp_fds(QTestState *s, int *fds, size_t fds_num,
  * Sends a QMP message to QEMU and returns the response.
  */
 QDict *qtest_vqmp(QTestState *s, const char *fmt, va_list ap)
-    GCC_FMT_ATTR(2, 0);
+    G_GNUC_PRINTF(2, 0);
 
 /**
  * qtest_qmp_vsend_fds:
@@ -194,7 +194,7 @@ QDict *qtest_vqmp(QTestState *s, const char *fmt, va_list ap)
  */
 void qtest_qmp_vsend_fds(QTestState *s, int *fds, size_t fds_num,
                          const char *fmt, va_list ap)
-    GCC_FMT_ATTR(4, 0);
+    G_GNUC_PRINTF(4, 0);
 
 /**
  * qtest_qmp_vsend:
@@ -207,7 +207,7 @@ void qtest_qmp_vsend_fds(QTestState *s, int *fds, size_t fds_num,
  * Sends a QMP message to QEMU and leaves the response in the stream.
  */
 void qtest_qmp_vsend(QTestState *s, const char *fmt, va_list ap)
-    GCC_FMT_ATTR(2, 0);
+    G_GNUC_PRINTF(2, 0);
 
 /**
  * qtest_qmp_receive_dict:
@@ -269,7 +269,7 @@ QDict *qtest_qmp_event_ref(QTestState *s, const char *event);
  *
  * Returns: the command's output.  The caller should g_free() it.
  */
-char *qtest_hmp(QTestState *s, const char *fmt, ...) GCC_FMT_ATTR(2, 3);
+char *qtest_hmp(QTestState *s, const char *fmt, ...) G_GNUC_PRINTF(2, 3);
 
 /**
  * qtest_hmpv:
@@ -283,7 +283,7 @@ char *qtest_hmp(QTestState *s, const char *fmt, ...) GCC_FMT_ATTR(2, 3);
  * Returns: the command's output.  The caller should g_free() it.
  */
 char *qtest_vhmp(QTestState *s, const char *fmt, va_list ap)
-    GCC_FMT_ATTR(2, 0);
+    G_GNUC_PRINTF(2, 0);
 
 void qtest_module_load(QTestState *s, const char *prefix, const char *libname);
 
@@ -688,17 +688,17 @@ void qtest_remove_abrt_handler(void *data);
  * the response.
  */
 void qtest_qmp_assert_success(QTestState *qts, const char *fmt, ...)
-    GCC_FMT_ATTR(2, 3);
+    G_GNUC_PRINTF(2, 3);
 
 QDict *qmp_fd_receive(int fd);
 void qmp_fd_vsend_fds(int fd, int *fds, size_t fds_num,
-                      const char *fmt, va_list ap) GCC_FMT_ATTR(4, 0);
-void qmp_fd_vsend(int fd, const char *fmt, va_list ap) GCC_FMT_ATTR(2, 0);
-void qmp_fd_send(int fd, const char *fmt, ...) GCC_FMT_ATTR(2, 3);
-void qmp_fd_send_raw(int fd, const char *fmt, ...) GCC_FMT_ATTR(2, 3);
-void qmp_fd_vsend_raw(int fd, const char *fmt, va_list ap) GCC_FMT_ATTR(2, 0);
-QDict *qmp_fdv(int fd, const char *fmt, va_list ap) GCC_FMT_ATTR(2, 0);
-QDict *qmp_fd(int fd, const char *fmt, ...) GCC_FMT_ATTR(2, 3);
+                      const char *fmt, va_list ap) G_GNUC_PRINTF(4, 0);
+void qmp_fd_vsend(int fd, const char *fmt, va_list ap) G_GNUC_PRINTF(2, 0);
+void qmp_fd_send(int fd, const char *fmt, ...) G_GNUC_PRINTF(2, 3);
+void qmp_fd_send_raw(int fd, const char *fmt, ...) G_GNUC_PRINTF(2, 3);
+void qmp_fd_vsend_raw(int fd, const char *fmt, va_list ap) G_GNUC_PRINTF(2, 0);
+QDict *qmp_fdv(int fd, const char *fmt, va_list ap) G_GNUC_PRINTF(2, 0);
+QDict *qmp_fd(int fd, const char *fmt, ...) G_GNUC_PRINTF(2, 3);
 
 /**
  * qtest_cb_for_every_machine:
@@ -750,7 +750,7 @@ void qtest_qmp_device_add_qdict(QTestState *qts, const char *drv,
  * Generic hot-plugging test via the device_add QMP command.
  */
 void qtest_qmp_device_add(QTestState *qts, const char *driver, const char *id,
-                          const char *fmt, ...) GCC_FMT_ATTR(4, 5);
+                          const char *fmt, ...) G_GNUC_PRINTF(4, 5);
 
 /**
  * qtest_qmp_add_client:
diff --git a/tests/qtest/libqtest-single.h b/tests/qtest/libqtest-single.h
index 0d7f568678e5..b0838b9e0e71 100644
--- a/tests/qtest/libqtest-single.h
+++ b/tests/qtest/libqtest-single.h
@@ -52,7 +52,7 @@ static inline void qtest_end(void)
  *
  * Sends a QMP message to QEMU and returns the response.
  */
-GCC_FMT_ATTR(1, 2)
+G_GNUC_PRINTF(1, 2)
 static inline QDict *qmp(const char *fmt, ...)
 {
     va_list ap;
diff --git a/tests/qtest/migration-helpers.h b/tests/qtest/migration-helpers.h
index d63bba9630f9..555adafce129 100644
--- a/tests/qtest/migration-helpers.h
+++ b/tests/qtest/migration-helpers.h
@@ -16,13 +16,13 @@
 
 extern bool got_stop;
 
-GCC_FMT_ATTR(3, 4)
+G_GNUC_PRINTF(3, 4)
 QDict *wait_command_fd(QTestState *who, int fd, const char *command, ...);
 
-GCC_FMT_ATTR(2, 3)
+G_GNUC_PRINTF(2, 3)
 QDict *wait_command(QTestState *who, const char *command, ...);
 
-GCC_FMT_ATTR(3, 4)
+G_GNUC_PRINTF(3, 4)
 void migrate_qmp(QTestState *who, const char *uri, const char *fmt, ...);
 
 QDict *migrate_query(QTestState *who);
diff --git a/audio/alsaaudio.c b/audio/alsaaudio.c
index b04716a6cc21..4a61378cd757 100644
--- a/audio/alsaaudio.c
+++ b/audio/alsaaudio.c
@@ -72,7 +72,7 @@ struct alsa_params_obt {
     snd_pcm_uframes_t samples;
 };
 
-static void GCC_FMT_ATTR (2, 3) alsa_logerr (int err, const char *fmt, ...)
+static void G_GNUC_PRINTF (2, 3) alsa_logerr (int err, const char *fmt, ...)
 {
     va_list ap;
 
@@ -83,7 +83,7 @@ static void GCC_FMT_ATTR (2, 3) alsa_logerr (int err, const char *fmt, ...)
     AUD_log (AUDIO_CAP, "Reason: %s\n", snd_strerror (err));
 }
 
-static void GCC_FMT_ATTR (3, 4) alsa_logerr2 (
+static void G_GNUC_PRINTF (3, 4) alsa_logerr2 (
     int err,
     const char *typ,
     const char *fmt,
diff --git a/audio/dsoundaudio.c b/audio/dsoundaudio.c
index 2b41db217e7a..3fb67ec3eed4 100644
--- a/audio/dsoundaudio.c
+++ b/audio/dsoundaudio.c
@@ -222,7 +222,7 @@ static void dsound_log_hresult (HRESULT hr)
     AUD_log (AUDIO_CAP, "Reason: %s\n", str);
 }
 
-static void GCC_FMT_ATTR (2, 3) dsound_logerr (
+static void G_GNUC_PRINTF (2, 3) dsound_logerr (
     HRESULT hr,
     const char *fmt,
     ...
@@ -237,7 +237,7 @@ static void GCC_FMT_ATTR (2, 3) dsound_logerr (
     dsound_log_hresult (hr);
 }
 
-static void GCC_FMT_ATTR (3, 4) dsound_logerr2 (
+static void G_GNUC_PRINTF (3, 4) dsound_logerr2 (
     HRESULT hr,
     const char *typ,
     const char *fmt,
diff --git a/audio/ossaudio.c b/audio/ossaudio.c
index da9c232222e3..8e075edb70d6 100644
--- a/audio/ossaudio.c
+++ b/audio/ossaudio.c
@@ -63,7 +63,7 @@ struct oss_params {
     int fragsize;
 };
 
-static void GCC_FMT_ATTR (2, 3) oss_logerr (int err, const char *fmt, ...)
+static void G_GNUC_PRINTF (2, 3) oss_logerr (int err, const char *fmt, ...)
 {
     va_list ap;
 
@@ -74,7 +74,7 @@ static void GCC_FMT_ATTR (2, 3) oss_logerr (int err, const char *fmt, ...)
     AUD_log (AUDIO_CAP, "Reason: %s\n", strerror (err));
 }
 
-static void GCC_FMT_ATTR (3, 4) oss_logerr2 (
+static void G_GNUC_PRINTF (3, 4) oss_logerr2 (
     int err,
     const char *typ,
     const char *fmt,
diff --git a/audio/paaudio.c b/audio/paaudio.c
index ed4f4376c4ba..e91116f2396c 100644
--- a/audio/paaudio.c
+++ b/audio/paaudio.c
@@ -43,7 +43,7 @@ typedef struct {
 
 static void qpa_conn_fini(PAConnection *c);
 
-static void GCC_FMT_ATTR (2, 3) qpa_logerr (int err, const char *fmt, ...)
+static void G_GNUC_PRINTF (2, 3) qpa_logerr (int err, const char *fmt, ...)
 {
     va_list ap;
 
diff --git a/audio/sdlaudio.c b/audio/sdlaudio.c
index 797b47bbddb1..68a237b76b45 100644
--- a/audio/sdlaudio.c
+++ b/audio/sdlaudio.c
@@ -55,7 +55,7 @@ typedef struct SDLVoiceIn {
     SDL_AudioDeviceID devid;
 } SDLVoiceIn;
 
-static void GCC_FMT_ATTR (1, 2) sdl_logerr (const char *fmt, ...)
+static void G_GNUC_PRINTF (1, 2) sdl_logerr (const char *fmt, ...)
 {
     va_list ap;
 
diff --git a/block/blkverify.c b/block/blkverify.c
index 53ba1c919572..e4a37af3b2ef 100644
--- a/block/blkverify.c
+++ b/block/blkverify.c
@@ -44,7 +44,7 @@ typedef struct BlkverifyRequest {
     QEMUIOVector *raw_qiov;     /* cloned I/O vector for raw file */
 } BlkverifyRequest;
 
-static void GCC_FMT_ATTR(2, 3) blkverify_err(BlkverifyRequest *r,
+static void G_GNUC_PRINTF(2, 3) blkverify_err(BlkverifyRequest *r,
                                              const char *fmt, ...)
 {
     va_list ap;
diff --git a/block/ssh.c b/block/ssh.c
index a64db146dbdc..a2dc64653699 100644
--- a/block/ssh.c
+++ b/block/ssh.c
@@ -108,7 +108,7 @@ static void ssh_state_free(BDRVSSHState *s)
     }
 }
 
-static void GCC_FMT_ATTR(3, 4)
+static void G_GNUC_PRINTF(3, 4)
 session_error_setg(Error **errp, BDRVSSHState *s, const char *fs, ...)
 {
     va_list args;
@@ -133,7 +133,7 @@ session_error_setg(Error **errp, BDRVSSHState *s, const char *fs, ...)
     g_free(msg);
 }
 
-static void GCC_FMT_ATTR(3, 4)
+static void G_GNUC_PRINTF(3, 4)
 sftp_error_setg(Error **errp, BDRVSSHState *s, const char *fs, ...)
 {
     va_list args;
diff --git a/fsdev/9p-marshal.c b/fsdev/9p-marshal.c
index 51881fe22010..f9b0336cd59d 100644
--- a/fsdev/9p-marshal.c
+++ b/fsdev/9p-marshal.c
@@ -27,7 +27,7 @@ void v9fs_string_free(V9fsString *str)
     str->size = 0;
 }
 
-void GCC_FMT_ATTR(2, 3)
+void G_GNUC_PRINTF(2, 3)
 v9fs_string_sprintf(V9fsString *str, const char *fmt, ...)
 {
     va_list ap;
diff --git a/fsdev/virtfs-proxy-helper.c b/fsdev/virtfs-proxy-helper.c
index 15c0e79b067b..d06a0f7b8326 100644
--- a/fsdev/virtfs-proxy-helper.c
+++ b/fsdev/virtfs-proxy-helper.c
@@ -57,7 +57,7 @@ static bool is_daemon;
 static bool get_version; /* IOC getversion IOCTL supported */
 static char *prog_name;
 
-static void GCC_FMT_ATTR(2, 3) do_log(int loglevel, const char *format, ...)
+static void G_GNUC_PRINTF(2, 3) do_log(int loglevel, const char *format, ...)
 {
     va_list ap;
 
diff --git a/hw/9pfs/9p.c b/hw/9pfs/9p.c
index 8e9d4aea737f..dcaa602d4cd1 100644
--- a/hw/9pfs/9p.c
+++ b/hw/9pfs/9p.c
@@ -203,7 +203,7 @@ void v9fs_path_free(V9fsPath *path)
 }
 
 
-void GCC_FMT_ATTR(2, 3)
+void G_GNUC_PRINTF(2, 3)
 v9fs_path_sprintf(V9fsPath *path, const char *fmt, ...)
 {
     va_list ap;
diff --git a/hw/acpi/aml-build.c b/hw/acpi/aml-build.c
index 1773cf55f1ee..4086879ebff9 100644
--- a/hw/acpi/aml-build.c
+++ b/hw/acpi/aml-build.c
@@ -207,7 +207,7 @@ build_append_nameseg(GArray *array, const char *seg)
     g_array_append_vals(array, "____", ACPI_NAMESEG_LEN - len);
 }
 
-static void GCC_FMT_ATTR(2, 0)
+static void G_GNUC_PRINTF(2, 0)
 build_append_namestringv(GArray *array, const char *format, va_list ap)
 {
     char *s;
@@ -270,7 +270,7 @@ build_append_namestringv(GArray *array, const char *format, va_list ap)
     g_strfreev(segs);
 }
 
-GCC_FMT_ATTR(2, 3)
+G_GNUC_PRINTF(2, 3)
 static void build_append_namestring(GArray *array, const char *format, ...)
 {
     va_list ap;
diff --git a/hw/mips/fuloong2e.c b/hw/mips/fuloong2e.c
index c1b8066a13b0..c9f14e70a077 100644
--- a/hw/mips/fuloong2e.c
+++ b/hw/mips/fuloong2e.c
@@ -72,7 +72,7 @@ static struct _loaderparams {
     const char *initrd_filename;
 } loaderparams;
 
-static void GCC_FMT_ATTR(3, 4) prom_set(uint32_t *prom_buf, int index,
+static void G_GNUC_PRINTF(3, 4) prom_set(uint32_t *prom_buf, int index,
                                         const char *string, ...)
 {
     va_list ap;
diff --git a/hw/mips/malta.c b/hw/mips/malta.c
index 55037eb90f0e..6288511723e1 100644
--- a/hw/mips/malta.c
+++ b/hw/mips/malta.c
@@ -995,7 +995,7 @@ static void write_bootloader(uint8_t *base, uint64_t run_addr,
 
 }
 
-static void GCC_FMT_ATTR(3, 4) prom_set(uint32_t *prom_buf, int index,
+static void G_GNUC_PRINTF(3, 4) prom_set(uint32_t *prom_buf, int index,
                                         const char *string, ...)
 {
     va_list ap;
diff --git a/hw/net/rtl8139.c b/hw/net/rtl8139.c
index 90b4fc63ce64..6b65823b4bf8 100644
--- a/hw/net/rtl8139.c
+++ b/hw/net/rtl8139.c
@@ -86,7 +86,7 @@
 #  define DPRINTF(fmt, ...) \
     do { fprintf(stderr, "RTL8139: " fmt, ## __VA_ARGS__); } while (0)
 #else
-static inline GCC_FMT_ATTR(1, 2) int DPRINTF(const char *fmt, ...)
+static inline G_GNUC_PRINTF(1, 2) int DPRINTF(const char *fmt, ...)
 {
     return 0;
 }
diff --git a/hw/virtio/virtio.c b/hw/virtio/virtio.c
index 32b18593915b..9d637e043e6b 100644
--- a/hw/virtio/virtio.c
+++ b/hw/virtio/virtio.c
@@ -3579,7 +3579,7 @@ void virtio_device_set_child_bus_name(VirtIODevice *vdev, char *bus_name)
     vdev->bus_name = g_strdup(bus_name);
 }
 
-void GCC_FMT_ATTR(2, 3) virtio_error(VirtIODevice *vdev, const char *fmt, ...)
+void G_GNUC_PRINTF(2, 3) virtio_error(VirtIODevice *vdev, const char *fmt, ...)
 {
     va_list ap;
 
diff --git a/io/channel-websock.c b/io/channel-websock.c
index 70889bb54da5..55145a6a8c5d 100644
--- a/io/channel-websock.c
+++ b/io/channel-websock.c
@@ -157,7 +157,7 @@ enum {
     QIO_CHANNEL_WEBSOCK_OPCODE_PONG = 0xA
 };
 
-static void GCC_FMT_ATTR(2, 3)
+static void G_GNUC_PRINTF(2, 3)
 qio_channel_websock_handshake_send_res(QIOChannelWebsock *ioc,
                                        const char *resmsg,
                                        ...)
diff --git a/monitor/hmp.c b/monitor/hmp.c
index 569066036dc1..24fd2e5f34bf 100644
--- a/monitor/hmp.c
+++ b/monitor/hmp.c
@@ -308,7 +308,7 @@ void help_cmd(Monitor *mon, const char *name)
 static const char *pch;
 static sigjmp_buf expr_env;
 
-static void GCC_FMT_ATTR(2, 3) QEMU_NORETURN
+static void G_GNUC_PRINTF(2, 3) QEMU_NORETURN
 expr_error(Monitor *mon, const char *fmt, ...)
 {
     va_list ap;
@@ -1462,7 +1462,7 @@ static void monitor_event(void *opaque, QEMUChrEvent event)
  * These functions just adapt the readline interface in a typesafe way.  We
  * could cast function pointers but that discards compiler checks.
  */
-static void GCC_FMT_ATTR(2, 3) monitor_readline_printf(void *opaque,
+static void G_GNUC_PRINTF(2, 3) monitor_readline_printf(void *opaque,
                                                        const char *fmt, ...)
 {
     MonitorHMP *mon = opaque;
diff --git a/nbd/server.c b/nbd/server.c
index 5da884c2fc35..735381aacfcb 100644
--- a/nbd/server.c
+++ b/nbd/server.c
@@ -213,7 +213,7 @@ static int nbd_negotiate_send_rep(NBDClient *client, uint32_t type,
 
 /* Send an error reply.
  * Return -errno on error, 0 on success. */
-static int GCC_FMT_ATTR(4, 0)
+static int G_GNUC_PRINTF(4, 0)
 nbd_negotiate_send_rep_verr(NBDClient *client, uint32_t type,
                             Error **errp, const char *fmt, va_list va)
 {
@@ -253,7 +253,7 @@ nbd_sanitize_name(const char *name)
 
 /* Send an error reply.
  * Return -errno on error, 0 on success. */
-static int GCC_FMT_ATTR(4, 5)
+static int G_GNUC_PRINTF(4, 5)
 nbd_negotiate_send_rep_err(NBDClient *client, uint32_t type,
                            Error **errp, const char *fmt, ...)
 {
@@ -269,7 +269,7 @@ nbd_negotiate_send_rep_err(NBDClient *client, uint32_t type,
 /* Drop remainder of the current option, and send a reply with the
  * given error type and message. Return -errno on read or write
  * failure; or 0 if connection is still live. */
-static int GCC_FMT_ATTR(4, 0)
+static int G_GNUC_PRINTF(4, 0)
 nbd_opt_vdrop(NBDClient *client, uint32_t type, Error **errp,
               const char *fmt, va_list va)
 {
@@ -282,7 +282,7 @@ nbd_opt_vdrop(NBDClient *client, uint32_t type, Error **errp,
     return ret;
 }
 
-static int GCC_FMT_ATTR(4, 5)
+static int G_GNUC_PRINTF(4, 5)
 nbd_opt_drop(NBDClient *client, uint32_t type, Error **errp,
              const char *fmt, ...)
 {
@@ -296,7 +296,7 @@ nbd_opt_drop(NBDClient *client, uint32_t type, Error **errp,
     return ret;
 }
 
-static int GCC_FMT_ATTR(3, 4)
+static int G_GNUC_PRINTF(3, 4)
 nbd_opt_invalid(NBDClient *client, Error **errp, const char *fmt, ...)
 {
     int ret;
diff --git a/qemu-img.c b/qemu-img.c
index 5dffb3e61601..1caddfb23a71 100644
--- a/qemu-img.c
+++ b/qemu-img.c
@@ -99,7 +99,7 @@ static void format_print(void *opaque, const char *name)
     printf(" %s", name);
 }
 
-static void QEMU_NORETURN GCC_FMT_ATTR(1, 2) error_exit(const char *fmt, ...)
+static void QEMU_NORETURN G_GNUC_PRINTF(1, 2) error_exit(const char *fmt, ...)
 {
     va_list ap;
 
@@ -284,7 +284,7 @@ static QemuOptsList qemu_source_opts = {
     },
 };
 
-static int GCC_FMT_ATTR(2, 3) qprintf(bool quiet, const char *fmt, ...)
+static int G_GNUC_PRINTF(2, 3) qprintf(bool quiet, const char *fmt, ...)
 {
     int ret = 0;
     if (!quiet) {
diff --git a/qemu-io.c b/qemu-io.c
index 3924639b92bd..e45a15c41aac 100644
--- a/qemu-io.c
+++ b/qemu-io.c
@@ -329,7 +329,7 @@ static char *get_prompt(void)
     return prompt;
 }
 
-static void GCC_FMT_ATTR(2, 3) readline_printf_func(void *opaque,
+static void G_GNUC_PRINTF(2, 3) readline_printf_func(void *opaque,
                                                     const char *fmt, ...)
 {
     va_list ap;
diff --git a/qobject/json-parser.c b/qobject/json-parser.c
index 008b326fb81a..d498db6e7027 100644
--- a/qobject/json-parser.c
+++ b/qobject/json-parser.c
@@ -54,7 +54,7 @@ static QObject *parse_value(JSONParserContext *ctxt);
 /**
  * Error handler
  */
-static void GCC_FMT_ATTR(3, 4) parse_error(JSONParserContext *ctxt,
+static void G_GNUC_PRINTF(3, 4) parse_error(JSONParserContext *ctxt,
                                            JSONToken *token, const char *msg, ...)
 {
     va_list ap;
diff --git a/softmmu/qtest.c b/softmmu/qtest.c
index 8b7cb6aa8e46..cc586233a974 100644
--- a/softmmu/qtest.c
+++ b/softmmu/qtest.c
@@ -288,7 +288,7 @@ static void qtest_send_prefix(CharBackend *chr)
             (long) tv.tv_sec, (long) tv.tv_usec);
 }
 
-static void GCC_FMT_ATTR(1, 2) qtest_log_send(const char *fmt, ...)
+static void G_GNUC_PRINTF(1, 2) qtest_log_send(const char *fmt, ...)
 {
     va_list ap;
 
@@ -318,7 +318,7 @@ static void qtest_send(CharBackend *chr, const char *str)
     qtest_server_send(qtest_server_send_opaque, str);
 }
 
-static void GCC_FMT_ATTR(2, 3) qtest_sendf(CharBackend *chr,
+static void G_GNUC_PRINTF(2, 3) qtest_sendf(CharBackend *chr,
                                            const char *fmt, ...)
 {
     va_list ap;
diff --git a/tests/qtest/libqtest.c b/tests/qtest/libqtest.c
index 9dac018fcba0..dc5566ccfd60 100644
--- a/tests/qtest/libqtest.c
+++ b/tests/qtest/libqtest.c
@@ -437,7 +437,7 @@ static void qtest_client_socket_send(QTestState *s, const char *buf)
     socket_send(s->fd, buf, strlen(buf));
 }
 
-static void GCC_FMT_ATTR(2, 3) qtest_sendf(QTestState *s, const char *fmt, ...)
+static void G_GNUC_PRINTF(2, 3) qtest_sendf(QTestState *s, const char *fmt, ...)
 {
     va_list ap;
 
diff --git a/tests/unit/test-qobject-input-visitor.c b/tests/unit/test-qobject-input-visitor.c
index 6f59a7f43249..22538f814099 100644
--- a/tests/unit/test-qobject-input-visitor.c
+++ b/tests/unit/test-qobject-input-visitor.c
@@ -64,7 +64,7 @@ static Visitor *test_init_internal(TestInputVisitorData *data, bool keyval,
     return data->qiv;
 }
 
-static GCC_FMT_ATTR(3, 4)
+static G_GNUC_PRINTF(3, 4)
 Visitor *visitor_input_test_init_full(TestInputVisitorData *data,
                                       bool keyval,
                                       const char *json_string, ...)
@@ -79,7 +79,7 @@ Visitor *visitor_input_test_init_full(TestInputVisitorData *data,
     return v;
 }
 
-static GCC_FMT_ATTR(2, 3)
+static G_GNUC_PRINTF(2, 3)
 Visitor *visitor_input_test_init(TestInputVisitorData *data,
                                  const char *json_string, ...)
 {
diff --git a/audio/coreaudio.m b/audio/coreaudio.m
index 3186b68474d0..4695291621a3 100644
--- a/audio/coreaudio.m
+++ b/audio/coreaudio.m
@@ -211,7 +211,7 @@ static void coreaudio_logstatus (OSStatus status)
     AUD_log (AUDIO_CAP, "Reason: %s\n", str);
 }
 
-static void GCC_FMT_ATTR (2, 3) coreaudio_logerr (
+static void G_GNUC_PRINTF (2, 3) coreaudio_logerr (
     OSStatus status,
     const char *fmt,
     ...
@@ -226,7 +226,7 @@ static void GCC_FMT_ATTR (2, 3) coreaudio_logerr (
     coreaudio_logstatus (status);
 }
 
-static void GCC_FMT_ATTR (3, 4) coreaudio_logerr2 (
+static void G_GNUC_PRINTF (3, 4) coreaudio_logerr2 (
     OSStatus status,
     const char *typ,
     const char *fmt,
diff --git a/scripts/checkpatch.pl b/scripts/checkpatch.pl
index ddd8148d87e5..a07f0effb540 100755
--- a/scripts/checkpatch.pl
+++ b/scripts/checkpatch.pl
@@ -227,7 +227,7 @@ our $Attribute	= qr{
 			QEMU_WARN_UNUSED_RESULT|
 			QEMU_SENTINEL|
 			QEMU_PACKED|
-			GCC_FMT_ATTR
+			G_GNUC_PRINTF
 		  }x;
 our $Modifier;
 our $Inline	= qr{inline};
-- 
2.35.1.273.ge6ebfd0e8cbb



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

* [PULL 06/21] compiler.h: replace QEMU_WARN_UNUSED_RESULT with G_GNUC_WARN_UNUSED_RESULT
  2022-03-22 12:25 [PULL 00/21] Fixes patches marcandre.lureau
                   ` (4 preceding siblings ...)
  2022-03-22 12:25 ` [PULL 05/21] Replace GCC_FMT_ATTR with G_GNUC_PRINTF marcandre.lureau
@ 2022-03-22 12:25 ` marcandre.lureau
  2022-03-22 12:25 ` [PULL 07/21] compiler.h: replace QEMU_SENTINEL with G_GNUC_NULL_TERMINATED marcandre.lureau
                   ` (15 subsequent siblings)
  21 siblings, 0 replies; 23+ messages in thread
From: marcandre.lureau @ 2022-03-22 12:25 UTC (permalink / raw)
  To: qemu-devel; +Cc: Peter Maydell, Marc-André Lureau

From: Marc-André Lureau <marcandre.lureau@redhat.com>

One less qemu-specific macro. It also helps to make some headers/units
only depend on glib, and thus moved in standalone projects eventually.

Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
Reviewed-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
---
 include/qemu-common.h      |  2 +-
 include/qemu/compiler.h    |  2 --
 include/qemu/range.h       |  4 ++--
 scripts/cocci-macro-file.h |  2 +-
 block/qcow2-refcount.c     | 20 +++++++++++---------
 scripts/checkpatch.pl      |  2 +-
 6 files changed, 16 insertions(+), 16 deletions(-)

diff --git a/include/qemu-common.h b/include/qemu-common.h
index 9c04fa94e89a..19e254dbe53e 100644
--- a/include/qemu-common.h
+++ b/include/qemu-common.h
@@ -27,7 +27,7 @@ int qemu_main(int argc, char **argv, char **envp);
 #endif
 
 ssize_t qemu_write_full(int fd, const void *buf, size_t count)
-    QEMU_WARN_UNUSED_RESULT;
+    G_GNUC_WARN_UNUSED_RESULT;
 
 #ifndef _WIN32
 int qemu_pipe(int pipefd[2]);
diff --git a/include/qemu/compiler.h b/include/qemu/compiler.h
index f2bd050e3b9a..8385e477c18e 100644
--- a/include/qemu/compiler.h
+++ b/include/qemu/compiler.h
@@ -19,8 +19,6 @@
 
 #define QEMU_NORETURN __attribute__ ((__noreturn__))
 
-#define QEMU_WARN_UNUSED_RESULT __attribute__((warn_unused_result))
-
 #define QEMU_SENTINEL __attribute__((sentinel))
 
 #if defined(_WIN32) && (defined(__x86_64__) || defined(__i386__))
diff --git a/include/qemu/range.h b/include/qemu/range.h
index f62b363e0d12..7e2b1cc447af 100644
--- a/include/qemu/range.h
+++ b/include/qemu/range.h
@@ -114,8 +114,8 @@ static inline uint64_t range_upb(Range *range)
  * @size may be 0. If the range would overflow, returns -ERANGE, otherwise
  * 0.
  */
-static inline int QEMU_WARN_UNUSED_RESULT range_init(Range *range, uint64_t lob,
-                                                     uint64_t size)
+G_GNUC_WARN_UNUSED_RESULT
+static inline int range_init(Range *range, uint64_t lob, uint64_t size)
 {
     if (lob + size < lob) {
         return -ERANGE;
diff --git a/scripts/cocci-macro-file.h b/scripts/cocci-macro-file.h
index c2fcea8e77a2..9daec24d7825 100644
--- a/scripts/cocci-macro-file.h
+++ b/scripts/cocci-macro-file.h
@@ -20,7 +20,7 @@
 
 /* From qemu/compiler.h */
 #define QEMU_NORETURN __attribute__ ((__noreturn__))
-#define QEMU_WARN_UNUSED_RESULT __attribute__((warn_unused_result))
+#define G_GNUC_WARN_UNUSED_RESULT __attribute__((warn_unused_result))
 #define QEMU_SENTINEL __attribute__((sentinel))
 
 #if defined(_WIN32) && (defined(__x86_64__) || defined(__i386__))
diff --git a/block/qcow2-refcount.c b/block/qcow2-refcount.c
index 94033972bedc..b91499410c0c 100644
--- a/block/qcow2-refcount.c
+++ b/block/qcow2-refcount.c
@@ -33,9 +33,11 @@
 
 static int64_t alloc_clusters_noref(BlockDriverState *bs, uint64_t size,
                                     uint64_t max);
-static int QEMU_WARN_UNUSED_RESULT update_refcount(BlockDriverState *bs,
-                            int64_t offset, int64_t length, uint64_t addend,
-                            bool decrease, enum qcow2_discard_type type);
+
+G_GNUC_WARN_UNUSED_RESULT
+static int update_refcount(BlockDriverState *bs,
+                           int64_t offset, int64_t length, uint64_t addend,
+                           bool decrease, enum qcow2_discard_type type);
 
 static uint64_t get_refcount_ro0(const void *refcount_array, uint64_t index);
 static uint64_t get_refcount_ro1(const void *refcount_array, uint64_t index);
@@ -803,12 +805,12 @@ found:
 /* XXX: cache several refcount block clusters ? */
 /* @addend is the absolute value of the addend; if @decrease is set, @addend
  * will be subtracted from the current refcount, otherwise it will be added */
-static int QEMU_WARN_UNUSED_RESULT update_refcount(BlockDriverState *bs,
-                                                   int64_t offset,
-                                                   int64_t length,
-                                                   uint64_t addend,
-                                                   bool decrease,
-                                                   enum qcow2_discard_type type)
+static int update_refcount(BlockDriverState *bs,
+                           int64_t offset,
+                           int64_t length,
+                           uint64_t addend,
+                           bool decrease,
+                           enum qcow2_discard_type type)
 {
     BDRVQcow2State *s = bs->opaque;
     int64_t start, last, cluster_offset;
diff --git a/scripts/checkpatch.pl b/scripts/checkpatch.pl
index a07f0effb540..797738a8e839 100755
--- a/scripts/checkpatch.pl
+++ b/scripts/checkpatch.pl
@@ -224,7 +224,7 @@ our $Attribute	= qr{
 			const|
 			volatile|
 			QEMU_NORETURN|
-			QEMU_WARN_UNUSED_RESULT|
+			G_GNUC_WARN_UNUSED_RESULT|
 			QEMU_SENTINEL|
 			QEMU_PACKED|
 			G_GNUC_PRINTF
-- 
2.35.1.273.ge6ebfd0e8cbb



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

* [PULL 07/21] compiler.h: replace QEMU_SENTINEL with G_GNUC_NULL_TERMINATED
  2022-03-22 12:25 [PULL 00/21] Fixes patches marcandre.lureau
                   ` (5 preceding siblings ...)
  2022-03-22 12:25 ` [PULL 06/21] compiler.h: replace QEMU_WARN_UNUSED_RESULT with G_GNUC_WARN_UNUSED_RESULT marcandre.lureau
@ 2022-03-22 12:25 ` marcandre.lureau
  2022-03-22 12:25 ` [PULL 08/21] Simplify HOST_LONG_BITS marcandre.lureau
                   ` (14 subsequent siblings)
  21 siblings, 0 replies; 23+ messages in thread
From: marcandre.lureau @ 2022-03-22 12:25 UTC (permalink / raw)
  To: qemu-devel; +Cc: Peter Maydell, Marc-André Lureau

From: Marc-André Lureau <marcandre.lureau@redhat.com>

One less qemu-specific macro. It also helps to make some headers/units
only depend on glib, and thus moved in standalone projects eventually.

Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
Reviewed-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
---
 include/qemu/compiler.h    | 2 --
 include/qom/object.h       | 6 +++---
 scripts/cocci-macro-file.h | 2 +-
 scripts/checkpatch.pl      | 2 +-
 4 files changed, 5 insertions(+), 7 deletions(-)

diff --git a/include/qemu/compiler.h b/include/qemu/compiler.h
index 8385e477c18e..0a5e67fb970e 100644
--- a/include/qemu/compiler.h
+++ b/include/qemu/compiler.h
@@ -19,8 +19,6 @@
 
 #define QEMU_NORETURN __attribute__ ((__noreturn__))
 
-#define QEMU_SENTINEL __attribute__((sentinel))
-
 #if defined(_WIN32) && (defined(__x86_64__) || defined(__i386__))
 # define QEMU_PACKED __attribute__((gcc_struct, packed))
 #else
diff --git a/include/qom/object.h b/include/qom/object.h
index fae096f51cce..5f3d5b5bf532 100644
--- a/include/qom/object.h
+++ b/include/qom/object.h
@@ -616,7 +616,7 @@ Object *object_new_with_props(const char *typename,
                               Object *parent,
                               const char *id,
                               Error **errp,
-                              ...) QEMU_SENTINEL;
+                              ...) G_GNUC_NULL_TERMINATED;
 
 /**
  * object_new_with_propv:
@@ -676,7 +676,7 @@ void object_apply_compat_props(Object *obj);
  *
  * Returns: %true on success, %false on error.
  */
-bool object_set_props(Object *obj, Error **errp, ...) QEMU_SENTINEL;
+bool object_set_props(Object *obj, Error **errp, ...) G_GNUC_NULL_TERMINATED;
 
 /**
  * object_set_propv:
@@ -728,7 +728,7 @@ void object_initialize(void *obj, size_t size, const char *typename);
 bool object_initialize_child_with_props(Object *parentobj,
                              const char *propname,
                              void *childobj, size_t size, const char *type,
-                             Error **errp, ...) QEMU_SENTINEL;
+                             Error **errp, ...) G_GNUC_NULL_TERMINATED;
 
 /**
  * object_initialize_child_with_propsv:
diff --git a/scripts/cocci-macro-file.h b/scripts/cocci-macro-file.h
index 9daec24d7825..3d1e9b50919a 100644
--- a/scripts/cocci-macro-file.h
+++ b/scripts/cocci-macro-file.h
@@ -21,7 +21,7 @@
 /* From qemu/compiler.h */
 #define QEMU_NORETURN __attribute__ ((__noreturn__))
 #define G_GNUC_WARN_UNUSED_RESULT __attribute__((warn_unused_result))
-#define QEMU_SENTINEL __attribute__((sentinel))
+#define G_GNUC_NULL_TERMINATED __attribute__((sentinel))
 
 #if defined(_WIN32) && (defined(__x86_64__) || defined(__i386__))
 # define QEMU_PACKED __attribute__((gcc_struct, packed))
diff --git a/scripts/checkpatch.pl b/scripts/checkpatch.pl
index 797738a8e839..ddc6003de280 100755
--- a/scripts/checkpatch.pl
+++ b/scripts/checkpatch.pl
@@ -225,7 +225,7 @@ our $Attribute	= qr{
 			volatile|
 			QEMU_NORETURN|
 			G_GNUC_WARN_UNUSED_RESULT|
-			QEMU_SENTINEL|
+			G_GNUC_NULL_TERMINATED|
 			QEMU_PACKED|
 			G_GNUC_PRINTF
 		  }x;
-- 
2.35.1.273.ge6ebfd0e8cbb



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

* [PULL 08/21] Simplify HOST_LONG_BITS
  2022-03-22 12:25 [PULL 00/21] Fixes patches marcandre.lureau
                   ` (6 preceding siblings ...)
  2022-03-22 12:25 ` [PULL 07/21] compiler.h: replace QEMU_SENTINEL with G_GNUC_NULL_TERMINATED marcandre.lureau
@ 2022-03-22 12:25 ` marcandre.lureau
  2022-03-22 12:25 ` [PULL 09/21] Move HOST_LONG_BITS to compiler.h marcandre.lureau
                   ` (13 subsequent siblings)
  21 siblings, 0 replies; 23+ messages in thread
From: marcandre.lureau @ 2022-03-22 12:25 UTC (permalink / raw)
  To: qemu-devel; +Cc: Peter Maydell, Marc-André Lureau

From: Marc-André Lureau <marcandre.lureau@redhat.com>

Simplify the macro, not depending on headers defines, but compiler
predefined __SIZEOF__POINTER__ only.

Available since gcc 4.3 and clang 2.8.

Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
Acked-by: Richard Henderson <richard.henderson@linaro.org>
---
 include/qemu/osdep.h | 8 +-------
 1 file changed, 1 insertion(+), 7 deletions(-)

diff --git a/include/qemu/osdep.h b/include/qemu/osdep.h
index f2274b24cbf5..8b070dee21c4 100644
--- a/include/qemu/osdep.h
+++ b/include/qemu/osdep.h
@@ -245,13 +245,7 @@ extern "C" {
 #endif
 
 /* HOST_LONG_BITS is the size of a native pointer in bits. */
-#if UINTPTR_MAX == UINT32_MAX
-# define HOST_LONG_BITS 32
-#elif UINTPTR_MAX == UINT64_MAX
-# define HOST_LONG_BITS 64
-#else
-# error Unknown pointer size
-#endif
+#define HOST_LONG_BITS (__SIZEOF_POINTER__ * 8)
 
 /* Mac OSX has a <stdint.h> bug that incorrectly defines SIZE_MAX with
  * the wrong type. Our replacement isn't usable in preprocessor
-- 
2.35.1.273.ge6ebfd0e8cbb



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

* [PULL 09/21] Move HOST_LONG_BITS to compiler.h
  2022-03-22 12:25 [PULL 00/21] Fixes patches marcandre.lureau
                   ` (7 preceding siblings ...)
  2022-03-22 12:25 ` [PULL 08/21] Simplify HOST_LONG_BITS marcandre.lureau
@ 2022-03-22 12:25 ` marcandre.lureau
  2022-03-22 12:25 ` [PULL 10/21] scripts/modinfo-collect: remove unused/dead code marcandre.lureau
                   ` (12 subsequent siblings)
  21 siblings, 0 replies; 23+ messages in thread
From: marcandre.lureau @ 2022-03-22 12:25 UTC (permalink / raw)
  To: qemu-devel; +Cc: Peter Maydell, Marc-André Lureau

From: Marc-André Lureau <marcandre.lureau@redhat.com>

This will help to make common code independent.

Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
Reviewed-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
---
 include/qemu/compiler.h | 5 +++++
 include/qemu/osdep.h    | 3 ---
 2 files changed, 5 insertions(+), 3 deletions(-)

diff --git a/include/qemu/compiler.h b/include/qemu/compiler.h
index 0a5e67fb970e..d9359859d435 100644
--- a/include/qemu/compiler.h
+++ b/include/qemu/compiler.h
@@ -7,6 +7,11 @@
 #ifndef COMPILER_H
 #define COMPILER_H
 
+#define HOST_BIG_ENDIAN (__BYTE_ORDER__ == __ORDER_BIG_ENDIAN__)
+
+/* HOST_LONG_BITS is the size of a native pointer in bits. */
+#define HOST_LONG_BITS (__SIZEOF_POINTER__ * 8)
+
 #if defined __clang_analyzer__ || defined __COVERITY__
 #define QEMU_STATIC_ANALYSIS 1
 #endif
diff --git a/include/qemu/osdep.h b/include/qemu/osdep.h
index 8b070dee21c4..9f06bf536fb1 100644
--- a/include/qemu/osdep.h
+++ b/include/qemu/osdep.h
@@ -244,9 +244,6 @@ extern "C" {
 #define TIME_MAX TYPE_MAXIMUM(time_t)
 #endif
 
-/* HOST_LONG_BITS is the size of a native pointer in bits. */
-#define HOST_LONG_BITS (__SIZEOF_POINTER__ * 8)
-
 /* Mac OSX has a <stdint.h> bug that incorrectly defines SIZE_MAX with
  * the wrong type. Our replacement isn't usable in preprocessor
  * expressions, but it is sufficient for our needs. */
-- 
2.35.1.273.ge6ebfd0e8cbb



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

* [PULL 10/21] scripts/modinfo-collect: remove unused/dead code
  2022-03-22 12:25 [PULL 00/21] Fixes patches marcandre.lureau
                   ` (8 preceding siblings ...)
  2022-03-22 12:25 ` [PULL 09/21] Move HOST_LONG_BITS to compiler.h marcandre.lureau
@ 2022-03-22 12:25 ` marcandre.lureau
  2022-03-22 12:25 ` [PULL 11/21] util: remove needless includes marcandre.lureau
                   ` (11 subsequent siblings)
  21 siblings, 0 replies; 23+ messages in thread
From: marcandre.lureau @ 2022-03-22 12:25 UTC (permalink / raw)
  To: qemu-devel; +Cc: Peter Maydell, Marc-André Lureau

From: Marc-André Lureau <marcandre.lureau@redhat.com>

Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
Acked-by: Gerd Hoffmann <kraxel@redhat.com>
Acked-by: John Snow <jsnow@redhat.com>
---
 scripts/modinfo-collect.py | 5 -----
 1 file changed, 5 deletions(-)

diff --git a/scripts/modinfo-collect.py b/scripts/modinfo-collect.py
index 61b90688c6dc..4e7584df6676 100755
--- a/scripts/modinfo-collect.py
+++ b/scripts/modinfo-collect.py
@@ -18,13 +18,8 @@ def find_command(src, target, compile_commands):
 
 def process_command(src, command):
     skip = False
-    arg = False
     out = []
     for item in shlex.split(command):
-        if arg:
-            out.append(x)
-            arg = False
-            continue
         if skip:
             skip = False
             continue
-- 
2.35.1.273.ge6ebfd0e8cbb



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

* [PULL 11/21] util: remove needless includes
  2022-03-22 12:25 [PULL 00/21] Fixes patches marcandre.lureau
                   ` (9 preceding siblings ...)
  2022-03-22 12:25 ` [PULL 10/21] scripts/modinfo-collect: remove unused/dead code marcandre.lureau
@ 2022-03-22 12:25 ` marcandre.lureau
  2022-03-22 12:25 ` [PULL 12/21] util: remove the net/net.h dependency marcandre.lureau
                   ` (10 subsequent siblings)
  21 siblings, 0 replies; 23+ messages in thread
From: marcandre.lureau @ 2022-03-22 12:25 UTC (permalink / raw)
  To: qemu-devel; +Cc: Peter Maydell, Marc-André Lureau

From: Marc-André Lureau <marcandre.lureau@redhat.com>

Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
---
 util/cutils.c | 2 --
 1 file changed, 2 deletions(-)

diff --git a/util/cutils.c b/util/cutils.c
index c9b91e7535a8..53346138c970 100644
--- a/util/cutils.c
+++ b/util/cutils.c
@@ -27,8 +27,6 @@
 #include <math.h>
 
 #include "qemu-common.h"
-#include "qemu/sockets.h"
-#include "qemu/iov.h"
 #include "net/net.h"
 #include "qemu/ctype.h"
 #include "qemu/cutils.h"
-- 
2.35.1.273.ge6ebfd0e8cbb



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

* [PULL 12/21] util: remove the net/net.h dependency
  2022-03-22 12:25 [PULL 00/21] Fixes patches marcandre.lureau
                   ` (10 preceding siblings ...)
  2022-03-22 12:25 ` [PULL 11/21] util: remove needless includes marcandre.lureau
@ 2022-03-22 12:25 ` marcandre.lureau
  2022-03-22 12:25 ` [PULL 13/21] qapi: remove needless include marcandre.lureau
                   ` (9 subsequent siblings)
  21 siblings, 0 replies; 23+ messages in thread
From: marcandre.lureau @ 2022-03-22 12:25 UTC (permalink / raw)
  To: qemu-devel; +Cc: Peter Maydell, Marc-André Lureau

From: Marc-André Lureau <marcandre.lureau@redhat.com>

Move qemu_ether_ntoa() which is only needed in net/.

Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
Reviewed-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
---
 include/qemu-common.h |  1 -
 net/announce.c        | 13 +++++++++++++
 util/cutils.c         | 14 --------------
 3 files changed, 13 insertions(+), 15 deletions(-)

diff --git a/include/qemu-common.h b/include/qemu-common.h
index 19e254dbe53e..f0fe07cd74c3 100644
--- a/include/qemu-common.h
+++ b/include/qemu-common.h
@@ -108,7 +108,6 @@ void qemu_hexdump(FILE *fp, const char *prefix,
  */
 int parse_debug_env(const char *name, int max, int initial);
 
-const char *qemu_ether_ntoa(const MACAddr *mac);
 void page_size_init(void);
 
 /* returns non-zero if dump is in progress, otherwise zero is
diff --git a/net/announce.c b/net/announce.c
index 26f057f5ee47..3b9e2f1f14e8 100644
--- a/net/announce.c
+++ b/net/announce.c
@@ -120,6 +120,19 @@ static int announce_self_create(uint8_t *buf,
     return 60; /* len (FCS will be added by hardware) */
 }
 
+/*
+ * Helper to print ethernet mac address
+ */
+static const char *qemu_ether_ntoa(const MACAddr *mac)
+{
+    static char ret[18];
+
+    snprintf(ret, sizeof(ret), "%02x:%02x:%02x:%02x:%02x:%02x",
+             mac->a[0], mac->a[1], mac->a[2], mac->a[3], mac->a[4], mac->a[5]);
+
+    return ret;
+}
+
 static void qemu_announce_self_iter(NICState *nic, void *opaque)
 {
     AnnounceTimer *timer = opaque;
diff --git a/util/cutils.c b/util/cutils.c
index 53346138c970..0d475ec4cddd 100644
--- a/util/cutils.c
+++ b/util/cutils.c
@@ -27,7 +27,6 @@
 #include <math.h>
 
 #include "qemu-common.h"
-#include "net/net.h"
 #include "qemu/ctype.h"
 #include "qemu/cutils.h"
 #include "qemu/error-report.h"
@@ -936,19 +935,6 @@ int parse_debug_env(const char *name, int max, int initial)
     return debug;
 }
 
-/*
- * Helper to print ethernet mac address
- */
-const char *qemu_ether_ntoa(const MACAddr *mac)
-{
-    static char ret[18];
-
-    snprintf(ret, sizeof(ret), "%02x:%02x:%02x:%02x:%02x:%02x",
-             mac->a[0], mac->a[1], mac->a[2], mac->a[3], mac->a[4], mac->a[5]);
-
-    return ret;
-}
-
 /*
  * Return human readable string for size @val.
  * @val can be anything that uint64_t allows (no more than "16 EiB").
-- 
2.35.1.273.ge6ebfd0e8cbb



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

* [PULL 13/21] qapi: remove needless include
  2022-03-22 12:25 [PULL 00/21] Fixes patches marcandre.lureau
                   ` (11 preceding siblings ...)
  2022-03-22 12:25 ` [PULL 12/21] util: remove the net/net.h dependency marcandre.lureau
@ 2022-03-22 12:25 ` marcandre.lureau
  2022-03-22 12:25 ` [PULL 14/21] meson: move int128 checks from configure marcandre.lureau
                   ` (8 subsequent siblings)
  21 siblings, 0 replies; 23+ messages in thread
From: marcandre.lureau @ 2022-03-22 12:25 UTC (permalink / raw)
  To: qemu-devel; +Cc: Peter Maydell, Marc-André Lureau

From: Marc-André Lureau <marcandre.lureau@redhat.com>

Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
---
 qapi/qmp-dispatch.c | 1 -
 1 file changed, 1 deletion(-)

diff --git a/qapi/qmp-dispatch.c b/qapi/qmp-dispatch.c
index d378bccac73b..0990873ec8ec 100644
--- a/qapi/qmp-dispatch.c
+++ b/qapi/qmp-dispatch.c
@@ -21,7 +21,6 @@
 #include "qapi/qmp/qjson.h"
 #include "qapi/qobject-input-visitor.h"
 #include "qapi/qobject-output-visitor.h"
-#include "sysemu/runstate.h"
 #include "qapi/qmp/qbool.h"
 #include "qemu/coroutine.h"
 #include "qemu/main-loop.h"
-- 
2.35.1.273.ge6ebfd0e8cbb



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

* [PULL 14/21] meson: move int128 checks from configure
  2022-03-22 12:25 [PULL 00/21] Fixes patches marcandre.lureau
                   ` (12 preceding siblings ...)
  2022-03-22 12:25 ` [PULL 13/21] qapi: remove needless include marcandre.lureau
@ 2022-03-22 12:25 ` marcandre.lureau
  2022-03-22 12:25 ` [PULL 15/21] meson: fix CONFIG_ATOMIC128 check marcandre.lureau
                   ` (7 subsequent siblings)
  21 siblings, 0 replies; 23+ messages in thread
From: marcandre.lureau @ 2022-03-22 12:25 UTC (permalink / raw)
  To: qemu-devel; +Cc: Peter Maydell, Marc-André Lureau

From: Marc-André Lureau <marcandre.lureau@redhat.com>

(note: the test isn't working as intended, the next patches fixes it)

Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
---
 configure   | 47 -----------------------------------------------
 meson.build | 39 +++++++++++++++++++++++++++++++++++++++
 2 files changed, 39 insertions(+), 47 deletions(-)

diff --git a/configure b/configure
index cd4946b43ee8..9e9b85147a5f 100755
--- a/configure
+++ b/configure
@@ -2481,41 +2481,6 @@ if compile_prog "" "" ; then
     int128=yes
 fi
 
-#########################################
-# See if 128-bit atomic operations are supported.
-
-atomic128=no
-if test "$int128" = "yes"; then
-  cat > $TMPC << EOF
-int main(void)
-{
-  unsigned __int128 x = 0, y = 0;
-  y = __atomic_load(&x, 0);
-  __atomic_store(&x, y, 0);
-  __atomic_compare_exchange(&x, &y, x, 0, 0, 0);
-  return 0;
-}
-EOF
-  if compile_prog "" "" ; then
-    atomic128=yes
-  fi
-fi
-
-cmpxchg128=no
-if test "$int128" = yes && test "$atomic128" = no; then
-  cat > $TMPC << EOF
-int main(void)
-{
-  unsigned __int128 x = 0, y = 0;
-  __sync_val_compare_and_swap_16(&x, y, x);
-  return 0;
-}
-EOF
-  if compile_prog "" "" ; then
-    cmpxchg128=yes
-  fi
-fi
-
 ########################################
 # check if ccache is interfering with
 # semantic analysis of macros
@@ -2959,18 +2924,6 @@ if test "$have_tsan" = "yes" && test "$have_tsan_iface_fiber" = "yes" ; then
     echo "CONFIG_TSAN=y" >> $config_host_mak
 fi
 
-if test "$int128" = "yes" ; then
-  echo "CONFIG_INT128=y" >> $config_host_mak
-fi
-
-if test "$atomic128" = "yes" ; then
-  echo "CONFIG_ATOMIC128=y" >> $config_host_mak
-fi
-
-if test "$cmpxchg128" = "yes" ; then
-  echo "CONFIG_CMPXCHG128=y" >> $config_host_mak
-fi
-
 if test "$rdma" = "yes" ; then
   echo "CONFIG_RDMA=y" >> $config_host_mak
   echo "RDMA_LIBS=$rdma_libs" >> $config_host_mak
diff --git a/meson.build b/meson.build
index 282e7c46505f..85f3f84ec6f8 100644
--- a/meson.build
+++ b/meson.build
@@ -1869,6 +1869,45 @@ config_host_data.set('CONFIG_ATOMIC64', cc.links('''
     return 0;
   }'''))
 
+has_int128 = cc.links('''
+  __int128_t a;
+  __uint128_t b;
+  int main (void) {
+    a = a + b;
+    b = a * b;
+    a = a * a;
+    return 0;
+  }''')
+
+config_host_data.set('CONFIG_INT128', has_int128)
+
+if has_int128
+  has_atomic128 = cc.links('''
+    int main(void)
+    {
+      unsigned __int128 x = 0, y = 0;
+      y = __atomic_load(&x, 0);
+      __atomic_store(&x, y, 0);
+      __atomic_compare_exchange(&x, &y, x, 0, 0, 0);
+      return 0;
+    }''')
+
+  config_host_data.set('CONFIG_ATOMIC128', has_atomic128)
+
+  if not has_atomic128
+    has_cmpxchg128 = cc.links('''
+      int main(void)
+      {
+        unsigned __int128 x = 0, y = 0;
+        __sync_val_compare_and_swap_16(&x, y, x);
+        return 0;
+      }
+    ''')
+
+    config_host_data.set('CONFIG_CMPXCHG128', has_cmpxchg128)
+  endif
+endif
+
 config_host_data.set('CONFIG_GETAUXVAL', cc.links(gnu_source_prefix + '''
   #include <sys/auxv.h>
   int main(void) {
-- 
2.35.1.273.ge6ebfd0e8cbb



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

* [PULL 15/21] meson: fix CONFIG_ATOMIC128 check
  2022-03-22 12:25 [PULL 00/21] Fixes patches marcandre.lureau
                   ` (13 preceding siblings ...)
  2022-03-22 12:25 ` [PULL 14/21] meson: move int128 checks from configure marcandre.lureau
@ 2022-03-22 12:25 ` marcandre.lureau
  2022-03-22 12:25 ` [PULL 16/21] qapi: remove needless include marcandre.lureau
                   ` (6 subsequent siblings)
  21 siblings, 0 replies; 23+ messages in thread
From: marcandre.lureau @ 2022-03-22 12:25 UTC (permalink / raw)
  To: qemu-devel; +Cc: Peter Maydell, Marc-André Lureau

From: Marc-André Lureau <marcandre.lureau@redhat.com>

The current testing code isn't correct and matching QEMU usage:

testfile.c: In function 'main':
testfile.c:5:11: error: incorrect number of arguments to function '__atomic_load'
    5 |       y = __atomic_load(&x, 0);
      |           ^~~~~~~~~~~~~
testfile.c:6:7: error: argument 2 of '__atomic_store' must be a pointer type
    6 |       __atomic_store(&x, y, 0);
      |       ^~~~~~~~~~~~~~
testfile.c:7:7: error: argument 3 of '__atomic_compare_exchange' must be a pointer type
    7 |       __atomic_compare_exchange(&x, &y, x, 0, 0, 0);
      |       ^~~~~~~~~~~~~~~~~~~~~~~~~

Replace the test with common atomics test for u64 and u128 that matches
better QEMU needs.

Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
Reviewed-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
---
 meson.build | 27 ++++++++++++---------------
 1 file changed, 12 insertions(+), 15 deletions(-)

diff --git a/meson.build b/meson.build
index 85f3f84ec6f8..58520aab508f 100644
--- a/meson.build
+++ b/meson.build
@@ -1853,21 +1853,23 @@ config_host_data.set('HAVE_BROKEN_SIZE_MAX', not cc.compiles('''
         return printf("%zu", SIZE_MAX);
     }''', args: ['-Werror']))
 
-# See if 64-bit atomic operations are supported.
-# Note that without __atomic builtins, we can only
-# assume atomic loads/stores max at pointer size.
-config_host_data.set('CONFIG_ATOMIC64', cc.links('''
+atomic_test = '''
   #include <stdint.h>
   int main(void)
   {
-    uint64_t x = 0, y = 0;
+    @0@ x = 0, y = 0;
     y = __atomic_load_n(&x, __ATOMIC_RELAXED);
     __atomic_store_n(&x, y, __ATOMIC_RELAXED);
     __atomic_compare_exchange_n(&x, &y, x, 0, __ATOMIC_RELAXED, __ATOMIC_RELAXED);
     __atomic_exchange_n(&x, y, __ATOMIC_RELAXED);
     __atomic_fetch_add(&x, y, __ATOMIC_RELAXED);
     return 0;
-  }'''))
+  }'''
+
+# See if 64-bit atomic operations are supported.
+# Note that without __atomic builtins, we can only
+# assume atomic loads/stores max at pointer size.
+config_host_data.set('CONFIG_ATOMIC64', cc.links(atomic_test.format('uint64_t')))
 
 has_int128 = cc.links('''
   __int128_t a;
@@ -1882,15 +1884,10 @@ has_int128 = cc.links('''
 config_host_data.set('CONFIG_INT128', has_int128)
 
 if has_int128
-  has_atomic128 = cc.links('''
-    int main(void)
-    {
-      unsigned __int128 x = 0, y = 0;
-      y = __atomic_load(&x, 0);
-      __atomic_store(&x, y, 0);
-      __atomic_compare_exchange(&x, &y, x, 0, 0, 0);
-      return 0;
-    }''')
+  # "do we have 128-bit atomics which are handled inline and specifically not
+  # via libatomic". The reason we can't use libatomic is documented in the
+  # comment starting "GCC is a house divided" in include/qemu/atomic128.h.
+  has_atomic128 = cc.links(atomic_test.format('unsigned __int128'))
 
   config_host_data.set('CONFIG_ATOMIC128', has_atomic128)
 
-- 
2.35.1.273.ge6ebfd0e8cbb



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

* [PULL 16/21] qapi: remove needless include
  2022-03-22 12:25 [PULL 00/21] Fixes patches marcandre.lureau
                   ` (14 preceding siblings ...)
  2022-03-22 12:25 ` [PULL 15/21] meson: fix CONFIG_ATOMIC128 check marcandre.lureau
@ 2022-03-22 12:25 ` marcandre.lureau
  2022-03-22 12:25 ` [PULL 17/21] qga: remove bswap.h include marcandre.lureau
                   ` (5 subsequent siblings)
  21 siblings, 0 replies; 23+ messages in thread
From: marcandre.lureau @ 2022-03-22 12:25 UTC (permalink / raw)
  To: qemu-devel; +Cc: Peter Maydell, Marc-André Lureau

From: Marc-André Lureau <marcandre.lureau@redhat.com>

Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
Reviewed-by: Markus Armbruster <armbru@redhat.com>
---
 qapi/string-output-visitor.c | 1 -
 1 file changed, 1 deletion(-)

diff --git a/qapi/string-output-visitor.c b/qapi/string-output-visitor.c
index 5506c933deef..71ddc92b7b98 100644
--- a/qapi/string-output-visitor.c
+++ b/qapi/string-output-visitor.c
@@ -14,7 +14,6 @@
 #include "qemu/cutils.h"
 #include "qapi/string-output-visitor.h"
 #include "qapi/visitor-impl.h"
-#include "qemu/host-utils.h"
 #include <math.h>
 #include "qemu/range.h"
 
-- 
2.35.1.273.ge6ebfd0e8cbb



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

* [PULL 17/21] qga: remove bswap.h include
  2022-03-22 12:25 [PULL 00/21] Fixes patches marcandre.lureau
                   ` (15 preceding siblings ...)
  2022-03-22 12:25 ` [PULL 16/21] qapi: remove needless include marcandre.lureau
@ 2022-03-22 12:25 ` marcandre.lureau
  2022-03-22 12:25 ` [PULL 18/21] error: use GLib to remember the program name marcandre.lureau
                   ` (4 subsequent siblings)
  21 siblings, 0 replies; 23+ messages in thread
From: marcandre.lureau @ 2022-03-22 12:25 UTC (permalink / raw)
  To: qemu-devel; +Cc: Peter Maydell, Marc-André Lureau

From: Marc-André Lureau <marcandre.lureau@redhat.com>

Apparently not needed anymore.

Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
---
 qga/main.c | 1 -
 1 file changed, 1 deletion(-)

diff --git a/qga/main.c b/qga/main.c
index 15fd3a4149f4..b9dd19918e47 100644
--- a/qga/main.c
+++ b/qga/main.c
@@ -27,7 +27,6 @@
 #include "qapi/qmp/qerror.h"
 #include "qapi/error.h"
 #include "channel.h"
-#include "qemu/bswap.h"
 #include "qemu/cutils.h"
 #include "qemu/help_option.h"
 #include "qemu/sockets.h"
-- 
2.35.1.273.ge6ebfd0e8cbb



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

* [PULL 18/21] error: use GLib to remember the program name
  2022-03-22 12:25 [PULL 00/21] Fixes patches marcandre.lureau
                   ` (16 preceding siblings ...)
  2022-03-22 12:25 ` [PULL 17/21] qga: remove bswap.h include marcandre.lureau
@ 2022-03-22 12:25 ` marcandre.lureau
  2022-03-22 12:25 ` [PULL 19/21] tests: remove needless include marcandre.lureau
                   ` (3 subsequent siblings)
  21 siblings, 0 replies; 23+ messages in thread
From: marcandre.lureau @ 2022-03-22 12:25 UTC (permalink / raw)
  To: qemu-devel; +Cc: Peter Maydell, Marc-André Lureau

From: Marc-André Lureau <marcandre.lureau@redhat.com>

Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
Reviewed-by: Markus Armbruster <armbru@redhat.com>
---
 include/qemu/error-report.h          |  2 --
 qemu-io.c                            | 10 +++++-----
 softmmu/vl.c                         |  2 +-
 storage-daemon/qemu-storage-daemon.c |  2 +-
 trace/control.c                      |  2 +-
 util/qemu-error.c                    | 24 +++++-------------------
 6 files changed, 13 insertions(+), 29 deletions(-)

diff --git a/include/qemu/error-report.h b/include/qemu/error-report.h
index 33e662db44c6..b6f45e69d79a 100644
--- a/include/qemu/error-report.h
+++ b/include/qemu/error-report.h
@@ -72,8 +72,6 @@ void error_init(const char *argv0);
                               fmt, ##__VA_ARGS__);      \
     })
 
-const char *error_get_progname(void);
-
 extern bool message_with_timestamp;
 extern bool error_with_guestname;
 extern const char *error_guest_name;
diff --git a/qemu-io.c b/qemu-io.c
index e45a15c41aac..eb8afc8b413b 100644
--- a/qemu-io.c
+++ b/qemu-io.c
@@ -323,7 +323,7 @@ static char *get_prompt(void)
     static char prompt[FILENAME_MAX + 2 /*"> "*/ + 1 /*"\0"*/ ];
 
     if (!prompt[0]) {
-        snprintf(prompt, sizeof(prompt), "%s> ", error_get_progname());
+        snprintf(prompt, sizeof(prompt), "%s> ", g_get_prgname());
     }
 
     return prompt;
@@ -598,10 +598,10 @@ int main(int argc, char **argv)
             break;
         case 'V':
             printf("%s version " QEMU_FULL_VERSION "\n"
-                   QEMU_COPYRIGHT "\n", error_get_progname());
+                   QEMU_COPYRIGHT "\n", g_get_prgname());
             exit(0);
         case 'h':
-            usage(error_get_progname());
+            usage(g_get_prgname());
             exit(0);
         case 'U':
             force_share = true;
@@ -613,13 +613,13 @@ int main(int argc, char **argv)
             imageOpts = true;
             break;
         default:
-            usage(error_get_progname());
+            usage(g_get_prgname());
             exit(1);
         }
     }
 
     if ((argc - optind) > 1) {
-        usage(error_get_progname());
+        usage(g_get_prgname());
         exit(1);
     }
 
diff --git a/softmmu/vl.c b/softmmu/vl.c
index 7e4d55bc1dcc..6f646531a0ae 100644
--- a/softmmu/vl.c
+++ b/softmmu/vl.c
@@ -836,7 +836,7 @@ static void help(int exitcode)
     version();
     printf("usage: %s [options] [disk_image]\n\n"
            "'disk_image' is a raw hard disk image for IDE hard disk 0\n\n",
-            error_get_progname());
+            g_get_prgname());
 
 #define DEF(option, opt_arg, opt_enum, opt_help, arch_mask)    \
     if ((arch_mask) & arch_type)                               \
diff --git a/storage-daemon/qemu-storage-daemon.c b/storage-daemon/qemu-storage-daemon.c
index dd18b2cde8c4..eb724072579a 100644
--- a/storage-daemon/qemu-storage-daemon.c
+++ b/storage-daemon/qemu-storage-daemon.c
@@ -141,7 +141,7 @@ static void help(void)
 "  --pidfile <path>       write process ID to a file after startup\n"
 "\n"
 QEMU_HELP_BOTTOM "\n",
-    error_get_progname());
+    g_get_prgname());
 }
 
 enum {
diff --git a/trace/control.c b/trace/control.c
index d5b68e846eeb..6c77cc631800 100644
--- a/trace/control.c
+++ b/trace/control.c
@@ -161,7 +161,7 @@ void trace_list_events(FILE *f)
     fprintf(f, "This list of names of trace points may be incomplete "
                "when using the DTrace/SystemTap backends.\n"
                "Run 'qemu-trace-stap list %s' to print the full list.\n",
-            error_get_progname());
+            g_get_prgname());
 #endif
 }
 
diff --git a/util/qemu-error.c b/util/qemu-error.c
index 52a9e013c490..7769aee8e791 100644
--- a/util/qemu-error.c
+++ b/util/qemu-error.c
@@ -146,22 +146,6 @@ void loc_set_file(const char *fname, int lno)
     }
 }
 
-static const char *progname;
-
-/*
- * Set the program name for error_print_loc().
- */
-static void error_set_progname(const char *argv0)
-{
-    const char *p = strrchr(argv0, '/');
-    progname = p ? p + 1 : argv0;
-}
-
-const char *error_get_progname(void)
-{
-    return progname;
-}
-
 /*
  * Print current location to current monitor if we have one, else to stderr.
  */
@@ -171,8 +155,8 @@ static void print_loc(void)
     int i;
     const char *const *argp;
 
-    if (!monitor_cur() && progname) {
-        fprintf(stderr, "%s:", progname);
+    if (!monitor_cur() && g_get_prgname()) {
+        fprintf(stderr, "%s:", g_get_prgname());
         sep = " ";
     }
     switch (cur_loc->kind) {
@@ -400,8 +384,10 @@ static void qemu_log_func(const gchar *log_domain,
 
 void error_init(const char *argv0)
 {
+    const char *p = strrchr(argv0, '/');
+
     /* Set the program name for error_print_loc(). */
-    error_set_progname(argv0);
+    g_set_prgname(p ? p + 1 : argv0);
 
     /*
      * This sets up glib logging so libraries using it also print their logs
-- 
2.35.1.273.ge6ebfd0e8cbb



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

* [PULL 19/21] tests: remove needless include
  2022-03-22 12:25 [PULL 00/21] Fixes patches marcandre.lureau
                   ` (17 preceding siblings ...)
  2022-03-22 12:25 ` [PULL 18/21] error: use GLib to remember the program name marcandre.lureau
@ 2022-03-22 12:25 ` marcandre.lureau
  2022-03-22 12:26 ` [PULL 20/21] Remove trailing ; after G_DEFINE_AUTO macro marcandre.lureau
                   ` (2 subsequent siblings)
  21 siblings, 0 replies; 23+ messages in thread
From: marcandre.lureau @ 2022-03-22 12:25 UTC (permalink / raw)
  To: qemu-devel; +Cc: Peter Maydell, Marc-André Lureau

From: Marc-André Lureau <marcandre.lureau@redhat.com>

Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
Reviewed-by: Markus Armbruster <armbru@redhat.com>
---
 tests/unit/check-qobject.c | 1 -
 1 file changed, 1 deletion(-)

diff --git a/tests/unit/check-qobject.c b/tests/unit/check-qobject.c
index c1713d15af4e..c3d50e99949a 100644
--- a/tests/unit/check-qobject.c
+++ b/tests/unit/check-qobject.c
@@ -8,7 +8,6 @@
  */
 
 #include "qemu/osdep.h"
-#include "block/qdict.h"
 #include "qapi/error.h"
 #include "qapi/qmp/qbool.h"
 #include "qapi/qmp/qdict.h"
-- 
2.35.1.273.ge6ebfd0e8cbb



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

* [PULL 20/21] Remove trailing ; after G_DEFINE_AUTO macro
  2022-03-22 12:25 [PULL 00/21] Fixes patches marcandre.lureau
                   ` (18 preceding siblings ...)
  2022-03-22 12:25 ` [PULL 19/21] tests: remove needless include marcandre.lureau
@ 2022-03-22 12:26 ` marcandre.lureau
  2022-03-22 12:26 ` [PULL 21/21] qapi: remove needless include marcandre.lureau
  2022-03-22 20:45 ` [PULL 00/21] Fixes patches Peter Maydell
  21 siblings, 0 replies; 23+ messages in thread
From: marcandre.lureau @ 2022-03-22 12:26 UTC (permalink / raw)
  To: qemu-devel; +Cc: Peter Maydell, Marc-André Lureau

From: Marc-André Lureau <marcandre.lureau@redhat.com>

The macro doesn't need it.

Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
Reviewed-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
---
 configure    | 2 +-
 nbd/server.c | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/configure b/configure
index 9e9b85147a5f..6d9cb23ac562 100755
--- a/configure
+++ b/configure
@@ -2248,7 +2248,7 @@ static void foo_free(Foo *f)
 {
     g_free(f);
 }
-G_DEFINE_AUTOPTR_CLEANUP_FUNC(Foo, foo_free);
+G_DEFINE_AUTOPTR_CLEANUP_FUNC(Foo, foo_free)
 int main(void) { return 0; }
 EOF
 if ! compile_prog "$glib_cflags -Werror" "$glib_libs" ; then
diff --git a/nbd/server.c b/nbd/server.c
index 735381aacfcb..c5644fd3f6ad 100644
--- a/nbd/server.c
+++ b/nbd/server.c
@@ -2064,7 +2064,7 @@ static void nbd_extent_array_free(NBDExtentArray *ea)
     g_free(ea->extents);
     g_free(ea);
 }
-G_DEFINE_AUTOPTR_CLEANUP_FUNC(NBDExtentArray, nbd_extent_array_free);
+G_DEFINE_AUTOPTR_CLEANUP_FUNC(NBDExtentArray, nbd_extent_array_free)
 
 /* Further modifications of the array after conversion are abandoned */
 static void nbd_extent_array_convert_to_be(NBDExtentArray *ea)
-- 
2.35.1.273.ge6ebfd0e8cbb



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

* [PULL 21/21] qapi: remove needless include
  2022-03-22 12:25 [PULL 00/21] Fixes patches marcandre.lureau
                   ` (19 preceding siblings ...)
  2022-03-22 12:26 ` [PULL 20/21] Remove trailing ; after G_DEFINE_AUTO macro marcandre.lureau
@ 2022-03-22 12:26 ` marcandre.lureau
  2022-03-22 20:45 ` [PULL 00/21] Fixes patches Peter Maydell
  21 siblings, 0 replies; 23+ messages in thread
From: marcandre.lureau @ 2022-03-22 12:26 UTC (permalink / raw)
  To: qemu-devel; +Cc: Peter Maydell, Marc-André Lureau

From: Marc-André Lureau <marcandre.lureau@redhat.com>

Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
Reviewed-by: Markus Armbruster <armbru@redhat.com>
---
 qapi/qapi-forward-visitor.c | 1 -
 1 file changed, 1 deletion(-)

diff --git a/qapi/qapi-forward-visitor.c b/qapi/qapi-forward-visitor.c
index 4ea7e0bec3f5..e36d9bc9ba7e 100644
--- a/qapi/qapi-forward-visitor.c
+++ b/qapi/qapi-forward-visitor.c
@@ -23,7 +23,6 @@
 #include "qapi/qmp/qnum.h"
 #include "qapi/qmp/qstring.h"
 #include "qemu/cutils.h"
-#include "qemu/option.h"
 
 struct ForwardFieldVisitor {
     Visitor visitor;
-- 
2.35.1.273.ge6ebfd0e8cbb



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

* Re: [PULL 00/21] Fixes patches
  2022-03-22 12:25 [PULL 00/21] Fixes patches marcandre.lureau
                   ` (20 preceding siblings ...)
  2022-03-22 12:26 ` [PULL 21/21] qapi: remove needless include marcandre.lureau
@ 2022-03-22 20:45 ` Peter Maydell
  21 siblings, 0 replies; 23+ messages in thread
From: Peter Maydell @ 2022-03-22 20:45 UTC (permalink / raw)
  To: marcandre.lureau; +Cc: qemu-devel

On Tue, 22 Mar 2022 at 12:26, <marcandre.lureau@redhat.com> wrote:
>
> From: Marc-André Lureau <marcandre.lureau@redhat.com>
>
> The following changes since commit 48fb0a826eea2e7b0135f49e7fa63e7efe2b7677:
>
>   Merge tag 'for-upstream' of https://gitlab.com/bonzini/qemu into staging (2022-03-21 21:27:14 +0000)
>
> are available in the Git repository at:
>
>   git@gitlab.com:marcandre.lureau/qemu.git tags/fixes-pull-request
>
> for you to fetch changes up to 4ea4bec6f459ff1af6af01677d5bfac240db0201:
>
>   qapi: remove needless include (2022-03-22 14:46:18 +0400)
>
> ----------------------------------------------------------------
> Fixes and cleanups for 7.0
>
> Hi,
>
> A collection of fixes & cleanup patches that should be safe for 7.0 inclusion.
>
> ----------------------------------------------------------------


Applied, thanks.

Please update the changelog at https://wiki.qemu.org/ChangeLog/7.0
for any user-visible changes.

-- PMM


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

end of thread, other threads:[~2022-03-22 20:46 UTC | newest]

Thread overview: 23+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-03-22 12:25 [PULL 00/21] Fixes patches marcandre.lureau
2022-03-22 12:25 ` [PULL 01/21] qemu-options: define -spice only #ifdef CONFIG_SPICE marcandre.lureau
2022-03-22 12:25 ` [PULL 02/21] vl: typo fix in a comment marcandre.lureau
2022-03-22 12:25 ` [PULL 03/21] m68k/nios2-semi: fix gettimeofday() result check marcandre.lureau
2022-03-22 12:25 ` [PULL 04/21] Drop qemu_foo() socket API wrapper marcandre.lureau
2022-03-22 12:25 ` [PULL 05/21] Replace GCC_FMT_ATTR with G_GNUC_PRINTF marcandre.lureau
2022-03-22 12:25 ` [PULL 06/21] compiler.h: replace QEMU_WARN_UNUSED_RESULT with G_GNUC_WARN_UNUSED_RESULT marcandre.lureau
2022-03-22 12:25 ` [PULL 07/21] compiler.h: replace QEMU_SENTINEL with G_GNUC_NULL_TERMINATED marcandre.lureau
2022-03-22 12:25 ` [PULL 08/21] Simplify HOST_LONG_BITS marcandre.lureau
2022-03-22 12:25 ` [PULL 09/21] Move HOST_LONG_BITS to compiler.h marcandre.lureau
2022-03-22 12:25 ` [PULL 10/21] scripts/modinfo-collect: remove unused/dead code marcandre.lureau
2022-03-22 12:25 ` [PULL 11/21] util: remove needless includes marcandre.lureau
2022-03-22 12:25 ` [PULL 12/21] util: remove the net/net.h dependency marcandre.lureau
2022-03-22 12:25 ` [PULL 13/21] qapi: remove needless include marcandre.lureau
2022-03-22 12:25 ` [PULL 14/21] meson: move int128 checks from configure marcandre.lureau
2022-03-22 12:25 ` [PULL 15/21] meson: fix CONFIG_ATOMIC128 check marcandre.lureau
2022-03-22 12:25 ` [PULL 16/21] qapi: remove needless include marcandre.lureau
2022-03-22 12:25 ` [PULL 17/21] qga: remove bswap.h include marcandre.lureau
2022-03-22 12:25 ` [PULL 18/21] error: use GLib to remember the program name marcandre.lureau
2022-03-22 12:25 ` [PULL 19/21] tests: remove needless include marcandre.lureau
2022-03-22 12:26 ` [PULL 20/21] Remove trailing ; after G_DEFINE_AUTO macro marcandre.lureau
2022-03-22 12:26 ` [PULL 21/21] qapi: remove needless include marcandre.lureau
2022-03-22 20:45 ` [PULL 00/21] Fixes patches Peter Maydell

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.