Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1618287

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

From Johannes Berg <johannes@sipsolutions.net>
Newsgroups linux.kernel
Subject Re: [PATCH] mac80211: Fix clang warning about constant operand in logical operation
Date 2017-04-06 21:20 +0200
Message-ID <ttl6N-51d-1@gated-at.bofh.it> (permalink)
References <ttkNs-4Ff-21@gated-at.bofh.it> <ttl6N-51d-3@gated-at.bofh.it> <ttkNs-4Ff-21@gated-at.bofh.it>
Organization linux.* mail to news gateway

Show all headers | View raw


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

Back to linux.kernel | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

[PATCH] mac80211: Fix clang warning about constant operand in logical operation Matthias Kaehlcke <mka@chromium.org> - 2017-04-06 21:00 +0200
  Re: [PATCH] mac80211: Fix clang warning about constant operand in  logical operation Johannes Berg <johannes@sipsolutions.net> - 2017-04-06 21:20 +0200
    Re: [PATCH] mac80211: Fix clang warning about constant operand in  logical operation Matthias Kaehlcke <mka@chromium.org> - 2017-04-06 21:30 +0200
      Re: [PATCH] mac80211: Fix clang warning about constant operand in  logical operation Johannes Berg <johannes@sipsolutions.net> - 2017-04-06 23:20 +0200
        Re: [PATCH] mac80211: Fix clang warning about constant operand in  logical operation Matthias Kaehlcke <mka@chromium.org> - 2017-04-07 00:50 +0200
          Re: [PATCH] mac80211: Fix clang warning about constant operand in  logical operation Johannes Berg <johannes@sipsolutions.net> - 2017-04-07 01:00 +0200
            Re: [PATCH] mac80211: Fix clang warning about constant operand in  logical operation Matthias Kaehlcke <mka@chromium.org> - 2017-04-07 01:10 +0200
  RE: [PATCH] mac80211: Fix clang warning about constant operand in  logical operation David Laight <David.Laight@ACULAB.COM> - 2017-04-10 16:20 +0200

csiph-web