From mboxrd@z Thu Jan 1 00:00:00 1970 From: =?UTF-8?B?TWFoZXNoIEJhbmRld2FyICjgpK7gpLngpYfgpLYg4KSs4KSC4KSh4KWH4KS14KS+4KSwKQ==?= Subject: Re: [PATCH iproute2] iproute: make clang happy Date: Tue, 21 Aug 2018 09:19:46 -0700 Message-ID: References: <20180820214215.218127-1-mahesh@bandewar.net> <20180820155223.0569b849@xeon-e3> <20180820175232.6a0877fe@xeon-e3> Mime-Version: 1.0 Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable Cc: Mahesh Bandewar , netdev To: Stephen Hemminger Return-path: Received: from mail-wr1-f65.google.com ([209.85.221.65]:36760 "EHLO mail-wr1-f65.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726935AbeHUTk4 (ORCPT ); Tue, 21 Aug 2018 15:40:56 -0400 Received: by mail-wr1-f65.google.com with SMTP id m27-v6so10129192wrf.3 for ; Tue, 21 Aug 2018 09:20:08 -0700 (PDT) In-Reply-To: <20180820175232.6a0877fe@xeon-e3> Sender: netdev-owner@vger.kernel.org List-ID: On Mon, Aug 20, 2018 at 5:52 PM, Stephen Hemminger wrote: > On Mon, 20 Aug 2018 16:44:28 -0700 > Mahesh Bandewar (=E0=A4=AE=E0=A4=B9=E0=A5=87=E0=A4=B6 =E0=A4=AC=E0=A4=82= =E0=A4=A1=E0=A5=87=E0=A4=B5=E0=A4=BE=E0=A4=B0) wrote: > >> On Mon, Aug 20, 2018 at 4:38 PM, Mahesh Bandewar (=E0=A4=AE=E0=A4=B9=E0= =A5=87=E0=A4=B6 =E0=A4=AC=E0=A4=82=E0=A4=A1=E0=A5=87=E0=A4=B5=E0=A4=BE=E0= =A4=B0) >> wrote: >> > On Mon, Aug 20, 2018 at 3:52 PM, Stephen Hemminger >> > wrote: >> >> On Mon, 20 Aug 2018 14:42:15 -0700 >> >> Mahesh Bandewar 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, str= uct 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, s= truct 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