From: Fiona Ebner <f.ebner@proxmox.com>
To: Proxmox VE development discussion <pve-devel@lists.proxmox.com>,
Filip Schauer <f.schauer@proxmox.com>
Subject: Re: [pve-devel] [PATCH qemu] Add format attributes to function candidates
Date: Mon, 7 Aug 2023 14:05:28 +0200 [thread overview]
Message-ID: <9872ffce-d0a6-6028-55fc-746025a5ef58@proxmox.com> (raw)
In-Reply-To: <20230807091829.269932-1-f.schauer@proxmox.com>
Am 07.08.23 um 11:18 schrieb Filip Schauer:
> Add format attributes to functions that take printf-like arguments. This
> provides additional compile-time checking that the correct parameters
> are passed to the functions.
>
> This fixes compiler warnings generated by the -Wsuggest-attribute=format
> flag.
>
Which will actually be treated as an error after rebasing to QEMU 8.1,
so I already have a change for this lined-up. If you want, you can send
a v2 with my suggestion below, otherwise I'll just do the change when
rebasing to 8.1.
> @@ -177,6 +177,16 @@ index 0000000000..ac1fac6378
> + do { } while (0)
> +#endif
> +
> ++#ifdef __GNUC__
> ++#if __GNUC__ >= 5 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 4)
> ++#define PRINTF(i, j) __attribute__((format (gnu_printf, i, j)))
> ++#else
> ++#define PRINTF(i, j) __attribute__((format (printf, i, j)))
> ++#endif
> ++#else
> ++#define PRINTF(i, j)
> ++#endif
> ++
Note that QEMU already defines and uses a macro G_GNUC_PRINTF for this,
so I'd really like to use that in our patches too, no need to cook up
our own :)
prev parent reply other threads:[~2023-08-07 12:05 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-08-07 9:18 Filip Schauer
2023-08-07 12:05 ` Fiona Ebner [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=9872ffce-d0a6-6028-55fc-746025a5ef58@proxmox.com \
--to=f.ebner@proxmox.com \
--cc=f.schauer@proxmox.com \
--cc=pve-devel@lists.proxmox.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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.