netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Johannes Berg <johannes@sipsolutions.net>
To: linux-wireless@vger.kernel.org, netdev@vger.kernel.org,
	linux-kernel <linux-kernel@vger.kernel.org>
Subject: GCOV_PROFILE_ALL breaks BUILD_BUG_ON(!is_power_of_2(8))
Date: Fri, 14 Aug 2015 10:29:04 +0200	[thread overview]
Message-ID: <1439540944.2091.10.camel@sipsolutions.net> (raw)
In-Reply-To: <1439457109-21833-1-git-send-email-johannes@sipsolutions.net> (sfid-20150813_111207_653261_1F4C7F80)

+linux-kernel

> +#define DECLARE_EWMA(name, _factor, _weight)> 	> 	> 	> 	> \
> +> 	> struct ewma_##name {> 	> 	> 	> 	> 	> 	> \
> +> 	> 	> unsigned long internal;> 	> 	> 	> 	> 	> \
> +> 	> };> 	> 	> 	> 	> 	> 	> 	> 	> \
> +> 	> static inline void ewma_##name##_init(struct ewma_##name *e)> 	> \
> +> 	> {> 	> 	> 	> 	> 	> 	> 	> 	> \
> +> 	> 	> BUILD_BUG_ON(!__builtin_constant_p(_factor));> 	> 	> \
> +> 	> 	> BUILD_BUG_ON(!__builtin_constant_p(_weight));> 	> 	> \
> +> 	> 	> BUILD_BUG_ON(!is_power_of_2(_factor));> 	> 	> 	> \
> +> 	> 	> BUILD_BUG_ON(!is_power_of_2(_weight));> 	> 	> 	> \
> 

So this seemed fine to me, but for some reason the compiler is saying
the BUILD_BUG_ON(!is_power_of_2(x)) fails, if and only if (!)
CONFIG_GCOV_PROFILE_ALL is enabled, which seems to boil down to the
compiler option -fprofile-arcs.

I'm going to replace this with just the code itself, i.e.

                /* both must be a power of 2 */
                BUILD_BUG_ON(_factor & (_factor - 1));
                BUILD_BUG_ON(_weight & (_weight - 1));

but should I have expected this?

johannes

  parent reply	other threads:[~2015-08-14  8:29 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-08-13  9:11 [PATCH 1/2] average: provide macro to create static EWMA Johannes Berg
     [not found] ` <1439457109-21833-1-git-send-email-johannes-cdvu00un1VgdHxzADdlk8Q@public.gmane.org>
2015-08-13  9:11   ` [PATCH 2/2] mac80211: use DECLARE_EWMA Johannes Berg
2015-08-14  0:26   ` [PATCH 1/2] average: provide macro to create static EWMA David Miller
     [not found]     ` <20150813.172655.794541030036505262.davem-fT/PcQaiUtIeIZ0/mPfg9Q@public.gmane.org>
2015-08-14  6:44       ` Johannes Berg
2015-08-14  8:29 ` Johannes Berg [this message]
2015-08-14  9:00   ` GCOV_PROFILE_ALL breaks BUILD_BUG_ON(!is_power_of_2(8)) Michal Kubecek
2015-08-14  9:05     ` Johannes Berg

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=1439540944.2091.10.camel@sipsolutions.net \
    --to=johannes@sipsolutions.net \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-wireless@vger.kernel.org \
    --cc=netdev@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
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;
as well as URLs for NNTP newsgroup(s).