[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <20131210.224900.1427512059771492387.davem@davemloft.net>
Date: Tue, 10 Dec 2013 22:49:00 -0500 (EST)
From: David Miller <davem@...emloft.net>
To: yangyingliang@...wei.com
Cc: netdev@...r.kernel.org
Subject: Re: [PATCH net-next 6/6] net_sched: make macro be enclosed in
parenthesis
From: Yang Yingliang <yangyingliang@...wei.com>
Date: Tue, 10 Dec 2013 20:55:34 +0800
> Macros with complex values should be enclosed in parenthesis
>
> Signed-off-by: Yang Yingliang <yangyingliang@...wei.com>
> ---
> net/sched/em_meta.c | 4 +++-
> 1 file changed, 3 insertions(+), 1 deletion(-)
>
> diff --git a/net/sched/em_meta.c b/net/sched/em_meta.c
> index e5cef956..852cd62 100644
> --- a/net/sched/em_meta.c
> +++ b/net/sched/em_meta.c
> @@ -272,10 +272,12 @@ META_COLLECTOR(int_rtiif)
> **************************************************************************/
>
> #define SKIP_NONLOCAL(skb) \
> +({ \
> if (unlikely(skb->sk == NULL)) { \
> *err = -1; \
> return; \
> - }
> + } \
> +})
I can't apply this.
First of all, "({ })" is for statements that evaluate to an lvalue,
this macro does not.
Second of all, and more importantly, this macro needs to be eliminated
entirely. It completely hides control flow, and in the past we've
killed macros which do this such as the old netlink attribute
builders.
The control flow should be inlined and expanded explicitly in the
code so that someone who reads it can tell the control flow can
be changed by the statement. Compare:
SKIP_NONLOCAL(skb)
to:
if (skip_nonlocal(skb)) {
*err = -1;
return;
}
--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Powered by blists - more mailing lists