public inbox for netdev@vger.kernel.org 
 help / color / mirror / Atom feed
From: Jakub Kicinski <kuba@kernel•org>
To: Shay Agroskin <shayagr@amazon•com>
Cc: Paolo Abeni <pabeni@redhat•com>,
	David Miller <davem@davemloft•net>, <netdev@vger•kernel.org>,
	"Woodhouse, David" <dwmw@amazon•com>,
	"Machulsky, Zorik" <zorik@amazon•com>,
	"Matushevsky, Alexander" <matua@amazon•com>,
	Saeed Bshara <saeedb@amazon•com>, "Wilson, Matt" <msw@amazon•com>,
	"Liguori, Anthony" <aliguori@amazon•com>,
	"Bshara, Nafea" <nafea@amazon•com>,
	"Belgazal, Netanel" <netanel@amazon•com>,
	"Saidi, Ali" <alisaidi@amazon•com>,
	"Herrenschmidt, Benjamin" <benh@amazon•com>,
	"Kiyanovski, Arthur" <akiyano@amazon•com>,
	"Dagan, Noam" <ndagan@amazon•com>,
	"Arinzon, David" <darinzon@amazon•com>,
	"Itzko, Shahar" <itzko@amazon•com>,
	"Abboud, Osama" <osamaabb@amazon•com>,
	Eric Dumazet <edumazet@google•com>,
	Vladimir Oltean <vladimir.oltean@nxp•com>,
	Andrew Lunn <andrew@lunn•ch>,
	Guangbin Huang <huangguangbin2@huawei•com>,
	Jie Wang <wangjie125@huawei•com>,
	Johannes Berg <johannes@sipsolutions•net>,
	Edward Cree <ecree.xilinx@gmail•com>,
	Florian Westphal <fw@strlen•de>
Subject: Re: [PATCH v6 net-next 1/7] netlink: Add a macro to set policy message with format string
Date: Wed, 22 Mar 2023 11:40:41 -0700	[thread overview]
Message-ID: <20230322114041.71df75d1@kernel.org> (raw)
In-Reply-To: <pj41zlsfdxymx0.fsf@u570694869fb251.ant.amazon.com>

On Wed, 22 Mar 2023 14:39:49 +0200 Shay Agroskin wrote:
> > You should use '__extack' even above, to avoid multiple 
> > evaluation of
> > the 'extack' expression.  
> 
> I've got to admit that I don't understand the cost of such 
> evaluations. I thought that it was added to help readers of the 
> source code to understand what is the type of this attribute and 
> have a better warning message when the wrong variable is passed 
> (kind of typing in Python which isn't strictly needed).
> What cost is there for casting a pointer ?

It's not about the cost, the macros are unfolded by the preprocessor,
in the unlikely case someone passes extack++ as an argument using it
twice inside the body of the macro will increment the value twice.

#define MACRO(arg) function_bla(arg, arg) // use arg twice

int a = 1;
MACRO(a++);
print(a); // should print 2, will print 3

  reply	other threads:[~2023-03-22 18:40 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-03-20 13:25 [PATCH v6 net-next 0/7] Add tx push buf len param to ethtool Shay Agroskin
2023-03-20 13:25 ` [PATCH v6 net-next 1/7] netlink: Add a macro to set policy message with format string Shay Agroskin
2023-03-22  9:31   ` Paolo Abeni
2023-03-22 12:39     ` Shay Agroskin
2023-03-22 18:40       ` Jakub Kicinski [this message]
2023-03-23 16:38         ` Shay Agroskin
2023-03-23 16:54           ` Jakub Kicinski
2023-03-23 17:13             ` Shay Agroskin
2023-03-23 19:44             ` Shay Agroskin
2023-03-23 20:34               ` Jakub Kicinski
2023-03-25 13:49                 ` Shay Agroskin
2023-03-27 17:33                   ` Jakub Kicinski
2023-03-20 13:25 ` [PATCH v6 net-next 2/7] ethtool: Add support for configuring tx_push_buf_len Shay Agroskin
2023-03-20 13:25 ` [PATCH v6 net-next 3/7] net: ena: Make few cosmetic preparations to support large LLQ Shay Agroskin
2023-03-20 13:25 ` [PATCH v6 net-next 4/7] net: ena: Add an option to configure large LLQ headers Shay Agroskin
2023-03-20 13:25 ` [PATCH v6 net-next 5/7] net: ena: Recalculate TX state variables every device reset Shay Agroskin
2023-03-20 13:25 ` [PATCH v6 net-next 6/7] net: ena: Add support to changing tx_push_buf_len Shay Agroskin
2023-03-20 13:25 ` [PATCH v6 net-next 7/7] net: ena: Advertise TX push support Shay Agroskin

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=20230322114041.71df75d1@kernel.org \
    --to=kuba@kernel$(echo .)org \
    --cc=akiyano@amazon$(echo .)com \
    --cc=aliguori@amazon$(echo .)com \
    --cc=alisaidi@amazon$(echo .)com \
    --cc=andrew@lunn$(echo .)ch \
    --cc=benh@amazon$(echo .)com \
    --cc=darinzon@amazon$(echo .)com \
    --cc=davem@davemloft$(echo .)net \
    --cc=dwmw@amazon$(echo .)com \
    --cc=ecree.xilinx@gmail$(echo .)com \
    --cc=edumazet@google$(echo .)com \
    --cc=fw@strlen$(echo .)de \
    --cc=huangguangbin2@huawei$(echo .)com \
    --cc=itzko@amazon$(echo .)com \
    --cc=johannes@sipsolutions$(echo .)net \
    --cc=matua@amazon$(echo .)com \
    --cc=msw@amazon$(echo .)com \
    --cc=nafea@amazon$(echo .)com \
    --cc=ndagan@amazon$(echo .)com \
    --cc=netanel@amazon$(echo .)com \
    --cc=netdev@vger$(echo .)kernel.org \
    --cc=osamaabb@amazon$(echo .)com \
    --cc=pabeni@redhat$(echo .)com \
    --cc=saeedb@amazon$(echo .)com \
    --cc=shayagr@amazon$(echo .)com \
    --cc=vladimir.oltean@nxp$(echo .)com \
    --cc=wangjie125@huawei$(echo .)com \
    --cc=zorik@amazon$(echo .)com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html
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