linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
From: Matthew Wilcox <willy@infradead.org>
To: 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>,
	John Ogness <john.ogness@linutronix.de>
Subject: Re: [hnaz-mm:master 272/379] lib/vsprintf.c:991:13: warning: variable 'modbuildid' set but not used
Date: Tue, 1 Mar 2022 19:22:46 +0000	[thread overview]
Message-ID: <Yh5yhoW+y9qcn1RM@casper.infradead.org> (raw)
In-Reply-To: <20220301102448.ff9bf910213d705842a2dd45@linux-foundation.org>

On Tue, Mar 01, 2022 at 10:24:48AM -0800, Andrew Morton 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.


  reply	other threads:[~2022-03-01 19:23 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 [this message]
2022-03-02  9:52     ` John Ogness
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=Yh5yhoW+y9qcn1RM@casper.infradead.org \
    --to=willy@infradead.org \
    --cc=akpm@linux-foundation.org \
    --cc=hannes@cmpxchg.org \
    --cc=john.ogness@linutronix.de \
    --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 \
    /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