[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [PATCH 07/27] Replace GCC_FMT_ATTR with G_GNUC_PRINTF



Hi

On Wed, Mar 16, 2022 at 5:28 PM Thomas Huth <thuth@xxxxxxxxxx> wrote:
>
> On 16/03/2022 14.16, Philippe Mathieu-Daudé wrote:
> > On 16/3/22 10:52, marcandre.lureau@xxxxxxxxxx wrote:
> >> From: Marc-André Lureau <marcandre.lureau@xxxxxxxxxx>
> >>
> >> 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@xxxxxxxxxx>
> >> ---
> >>   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/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
> >
> > Can we also poison GCC_FMT_ATTR? Maybe split in 2 patches, 1 converting
> > and another removing unused & poisoning?
>
> I don't think that poisoning is required here since this macro is not used
> in "#ifdef" statements - so the compiler will complain to you if you still
> try to use it after the removal.

Yes (same for other macros in this series)
thanks




 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.