From: John Ogness <john.ogness@linutronix.de>
To: Matthew Wilcox <willy@infradead.org>,
Andrew Morton <akpm@linux-foundation.org>
Cc: kernel test robot <lkp@intel.com>,
Maninder Singh <maninder1.s@samsung.com>,
kbuild-all@lists.01.org, linux-kernel@vger.kernel.org,
Johannes Weiner <hannes@cmpxchg.org>,
Vaneet Narang <v.narang@samsung.com>,
Linux Memory Management List <linux-mm@kvack.org>,
Petr Mladek <pmladek@suse.com>,
Sergey Senozhatsky <senozhatsky@chromium.org>,
Steven Rostedt <rostedt@goodmis.org>
Subject: Re: [hnaz-mm:master 272/379] lib/vsprintf.c:991:13: warning: variable 'modbuildid' set but not used
Date: Wed, 02 Mar 2022 10:58:49 +0106 [thread overview]
Message-ID: <8735k0isum.fsf@jogness.linutronix.de> (raw)
In-Reply-To: <Yh5yhoW+y9qcn1RM@casper.infradead.org>
On 2022-03-01, Matthew Wilcox <willy@infradead.org> wrote:
>> > lib/vsprintf.c: In function 'va_format':
>> > lib/vsprintf.c:1759:9: warning: function 'va_format' might be a candidate for 'gnu_printf' format attribute [-Wsuggest-attribute=format]
>> > 1759 | buf += vsnprintf(buf, end > buf ? end - buf : 0, va_fmt->fmt, va);
>> > | ^~~
>>
>> I wonder what this means.
>
> It means the compiler thinks we might want to add:
>
> __attribute__((format(gnu_printf, x, y))) to the function declaration so it
> can type-check the arguments.
>
> 'format (ARCHETYPE, STRING-INDEX, FIRST-TO-CHECK)'
> The 'format' attribute specifies that a function takes 'printf',
> 'scanf', 'strftime' or 'strfmon' style arguments that should be
> type-checked against a format string. For example, the
> declaration:
>
> extern int
> my_printf (void *my_object, const char *my_format, ...)
> __attribute__ ((format (printf, 2, 3)));
>
> causes the compiler to check the arguments in calls to 'my_printf'
> for consistency with the 'printf' style format string argument
> 'my_format'.
>
>
> I haven't looked into this at all and have no idea if we should.
AFAICT it is not possible to use the gnu_printf format attribute for
this because the va_list to check is a field within the passed in struct
pointer @va_fmt.
John Ogness
next prev parent reply other threads:[~2022-03-02 9:52 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-03-01 12:11 kernel test robot
2022-03-01 18:24 ` Andrew Morton
2022-03-01 19:22 ` Matthew Wilcox
2022-03-02 9:52 ` John Ogness [this message]
2022-03-02 11:52 ` Petr Mladek
2022-03-02 9:56 ` Petr Mladek
2022-03-02 12:07 ` Petr Mladek
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=8735k0isum.fsf@jogness.linutronix.de \
--to=john.ogness@linutronix.de \
--cc=akpm@linux-foundation.org \
--cc=hannes@cmpxchg.org \
--cc=kbuild-all@lists.01.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mm@kvack.org \
--cc=lkp@intel.com \
--cc=maninder1.s@samsung.com \
--cc=pmladek@suse.com \
--cc=rostedt@goodmis.org \
--cc=senozhatsky@chromium.org \
--cc=v.narang@samsung.com \
--cc=willy@infradead.org \
/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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox