From: "Mahesh Bandewar (महेश बंडेवार)" <maheshb@google.com>
To: Stephen Hemminger <stephen@networkplumber.org>
Cc: Mahesh Bandewar <mahesh@bandewar.net>, netdev <netdev@vger.kernel.org>
Subject: Re: [PATCH iproute2] iproute: make clang happy
Date: Tue, 21 Aug 2018 09:19:46 -0700 [thread overview]
Message-ID: <CAF2d9jhgxJoOxTPB_36J0Zh5yrZOogkZEojEntSPtS_Bu3yx7Q@mail.gmail.com> (raw)
In-Reply-To: <20180820175232.6a0877fe@xeon-e3>
On Mon, Aug 20, 2018 at 5:52 PM, Stephen Hemminger
<stephen@networkplumber.org> wrote:
> On Mon, 20 Aug 2018 16:44:28 -0700
> Mahesh Bandewar (महेश बंडेवार) <maheshb@google.com> wrote:
>
>> On Mon, Aug 20, 2018 at 4:38 PM, Mahesh Bandewar (महेश बंडेवार)
>> <maheshb@google.com> wrote:
>> > On Mon, Aug 20, 2018 at 3:52 PM, Stephen Hemminger
>> > <stephen@networkplumber.org> wrote:
>> >> On Mon, 20 Aug 2018 14:42:15 -0700
>> >> Mahesh Bandewar <mahesh@bandewar.net> wrote:
>> >>
>> >>> diff --git a/tc/m_ematch.c b/tc/m_ematch.c
>> >>> index ace4b3dd738b..a524b520b276 100644
>> >>> --- a/tc/m_ematch.c
>> >>> +++ b/tc/m_ematch.c
>> >>> @@ -277,6 +277,7 @@ static int flatten_tree(struct ematch *head, struct ematch *tree)
>> >>> return count;
>> >>> }
>> >>>
>> >>> +__attribute__((format(printf, 5, 6)))
>> >>> int em_parse_error(int err, struct bstr *args, struct bstr *carg,
>> >>> struct ematch_util *e, char *fmt, ...)
>> >>
>> >> I think the printf attribute needs to go on the function prototype
>> >> here:
>> >> tc/m_ematch.h:extern int em_parse_error(int err, struct bstr *args, struct bstr *carg,
>> >>
>> > The attributes are attached to the definitions only and not prototype
>> > declarations. Please see the definition/declaration for jsonw_printf()
>> > in the same patch.
>> I take that back. Seems like it's fine either way.
>
> The reason to put the attributes in the .h file is that then the compiler
> can test for misuse in other files. For example if em_parse_error had
> a bad format in em_u32.c, then the warning would not happen unless
> the attribute was on the function prototype.
>
correct, will take care in v2
prev parent reply other threads:[~2018-08-21 19:40 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-08-20 21:42 [PATCH iproute2] iproute: make clang happy Mahesh Bandewar
2018-08-20 22:50 ` Stephen Hemminger
2018-08-21 0:32 ` Mahesh Bandewar (महेश बंडेवार)
2018-08-20 22:52 ` Stephen Hemminger
2018-08-20 23:38 ` Mahesh Bandewar (महेश बंडेवार)
2018-08-20 23:44 ` Mahesh Bandewar (महेश बंडेवार)
2018-08-21 0:33 ` Mahesh Bandewar (महेश बंडेवार)
2018-08-21 0:52 ` Stephen Hemminger
2018-08-21 16:19 ` Mahesh Bandewar (महेश बंडेवार) [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=CAF2d9jhgxJoOxTPB_36J0Zh5yrZOogkZEojEntSPtS_Bu3yx7Q@mail.gmail.com \
--to=maheshb@google.com \
--cc=mahesh@bandewar.net \
--cc=netdev@vger.kernel.org \
--cc=stephen@networkplumber.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;
as well as URLs for NNTP newsgroup(s).