Re: [PATCH] mac80211: Fix clang warning about constant operand in logical operation

From: Johannes Berg
Date: Thu Apr 06 2017 - 15:11:43 EST


On Thu, 2017-04-06 at 11:56 -0700, Matthias Kaehlcke wrote:
> Clang raises a warning about the expression 'strlen(CONFIG_XXX)'
> being
> used in a logical operation. Clangs' builtin strlen function resolves
> the
> expression to a constant at compile time, which causes clang to
> generate
> a 'constant-logical-operand' warning.
>
> Split the if statement in two to avoid using the const expression in
> a logical operation.
>
I don't really see all much point in doing this for the warning's
sake... hopefully it doesn't actually generate worse code, but I think
the code ends up looking worse and people will forever wonder what the
goto is really doing there.

johannes