[PATCH 0/2] virtio-9p: move G_GNUC_PRINTF to header

Sean Wei posted 2 patches 5 months ago
Patches applied successfully (tree, apply log)
git fetch https://github.com/patchew-project/qemu tags/patchew/20250613.qemu.9p@sean.taipei
Maintainers: Christian Schoenebeck <qemu_oss@crudebyte.com>, Greg Kurz <groug@kaod.org>
fsdev/9p-marshal.c |  3 +--
fsdev/9p-marshal.h |  2 +-
hw/9pfs/9p.c       |  3 +--
hw/9pfs/9p.h       |  2 +-
4 files changed, 4 insertions(+), 6 deletions(-)
[PATCH 0/2] virtio-9p: move G_GNUC_PRINTF to header
Posted by Sean Wei 5 months ago
v9fs_string_sprintf() and v9fs_path_sprintf() already have
G_GNUC_PRINTF annotations in their own *.c files, but the
prototypes in the corresponding headers lack them.  When another
translation unit includes only the header, -Wformat can no longer
validate the argument list.

This series relocates the annotations to fsdev/9p-marshal.h and
hw/9pfs/9p.h, then drops the now-redundant annotations in
the *.c files.  There is no functional change.

I've checked all call sites for these two helper function, all
of them already passes the correct number of arguments.

A minimal PoC (sent as the next mail in the thread) demo how
G_GNUC_PRINTF behaves differently when the attribute is present
only in code.c or code.h file.

--

Sean Wei (3):
  fsdev/9p-marshal: move G_GNUC_PRINTF to header
  hw/9pfs: move G_GNUC_PRINTF to header

 fsdev/9p-marshal.c |  3 +--
 fsdev/9p-marshal.h |  2 +-
 hw/9pfs/9p.c       |  3 +--
 hw/9pfs/9p.h       |  2 +-
 4 files changed, 4 insertions(+), 6 deletions(-)

-- 
2.49.0
Re: [PATCH 0/2] virtio-9p: move G_GNUC_PRINTF to header
Posted by Christian Schoenebeck 4 months, 3 weeks ago
On Saturday, June 14, 2025 4:07:40 AM CEST Sean Wei wrote:
> v9fs_string_sprintf() and v9fs_path_sprintf() already have
> G_GNUC_PRINTF annotations in their own *.c files, but the
> prototypes in the corresponding headers lack them.  When another
> translation unit includes only the header, -Wformat can no longer
> validate the argument list.
> 
> This series relocates the annotations to fsdev/9p-marshal.h and
> hw/9pfs/9p.h, then drops the now-redundant annotations in
> the *.c files.  There is no functional change.
> 
> I've checked all call sites for these two helper function, all
> of them already passes the correct number of arguments.
> 
> A minimal PoC (sent as the next mail in the thread) demo how
> G_GNUC_PRINTF behaves differently when the attribute is present
> only in code.c or code.h file.
> 
> --
> 
> Sean Wei (3):
>   fsdev/9p-marshal: move G_GNUC_PRINTF to header
>   hw/9pfs: move G_GNUC_PRINTF to header
> 
>  fsdev/9p-marshal.c |  3 +--
>  fsdev/9p-marshal.h |  2 +-
>  hw/9pfs/9p.c       |  3 +--
>  hw/9pfs/9p.h       |  2 +-
>  4 files changed, 4 insertions(+), 6 deletions(-)
> 
>

With code style fix queued on 9p.next:
https://github.com/cschoenebeck/qemu/commits/9p.next

Please run scripts/checkpatch.pl next time.

Thanks!

/Christian
Re: [PATCH 0/2] virtio-9p: move G_GNUC_PRINTF to header
Posted by Sean Wei 4 months, 3 weeks ago
Hi Christian,

On 2025/6/20 10:17 AM, Christian Schoenebeck wrote:
> On Saturday, June 14, 2025 4:07:40 AM CEST Sean Wei wrote:
>> v9fs_string_sprintf() and v9fs_path_sprintf() already have
>> G_GNUC_PRINTF annotations in their own *.c files, but the
>> prototypes in the corresponding headers lack them.  When another
>> translation unit includes only the header, -Wformat can no longer
>> validate the argument list.
>>
>> This series relocates the annotations to fsdev/9p-marshal.h and
>> hw/9pfs/9p.h, then drops the now-redundant annotations in
>> the *.c files.  There is no functional change.
>>
>> I've checked all call sites for these two helper function, all
>> of them already passes the correct number of arguments.
>>
>> A minimal PoC (sent as the next mail in the thread) demo how
>> G_GNUC_PRINTF behaves differently when the attribute is present
>> only in code.c or code.h file.
>>
>> --
>>
>> Sean Wei (3):
>>    fsdev/9p-marshal: move G_GNUC_PRINTF to header
>>    hw/9pfs: move G_GNUC_PRINTF to header
>>
>>   fsdev/9p-marshal.c |  3 +--
>>   fsdev/9p-marshal.h |  2 +-
>>   hw/9pfs/9p.c       |  3 +--
>>   hw/9pfs/9p.h       |  2 +-
>>   4 files changed, 4 insertions(+), 6 deletions(-)
>>
>>
> 
> With code style fix queued on 9p.next:
> https://github.com/cschoenebeck/qemu/commits/9p.next
> 
> Please run scripts/checkpatch.pl next time.
> 
> Thanks!
> 
> /Christian
> 

Apologies for missing the check-patch step, I’ll make sure to run 
scripts/checkpatch.pl next time.

Thank you for fixing the code style and queuing the patch!

All the best,
Sean Wei