All of lore.kernel.org
 help / color / mirror / Atom feed
From: eugeniy.paltsev@synopsys.com (Eugeniy Paltsev)
To: linux-snps-arc@lists.infradead.org
Subject: [PATCH] ARC: fix __ffs return value to avoid build warnings
Date: Fri, 14 Dec 2018 10:47:30 +0000	[thread overview]
Message-ID: <1544784449.3270.30.camel@synopsys.com> (raw)
In-Reply-To: <C2D7FE5348E1B147BCA15975FBA23075014641F6E3@US01WEMBX2.internal.synopsys.com>

Hi Vineet,

On Thu, 2018-12-13@18:23 +0000, Vineet Gupta wrote:
> On 12/13/18 7:43 AM, Eugeniy Paltsev wrote:
> > Change __ffs return value from 'int' to 'unsigned long' as it
> > is done in other implementations (like asm-generic, x86, etc...)
> > to avoid build-time warnings in places where type is strictly
> > checked.
> > 
> > As __ffs may return values in [0-31] interval changing return
> > type to unsigned is valid.
> > 
> > Signed-off-by: Eugeniy Paltsev <Eugeniy.Paltsev at synopsys.com>
> 
> Can you please paste a couple of lines of offending output !

---------------------------------->8---------------------------------
  CC      mm/nobootmem.o
In file included from ./include/asm-generic/bug.h:18:0,
                 from ./arch/arc/include/asm/bug.h:32,
                 from ./include/linux/bug.h:5,
                 from ./include/linux/mmdebug.h:5,
                 from ./include/linux/gfp.h:5,
                 from ./include/linux/slab.h:15,
                 from mm/nobootmem.c:14:
mm/nobootmem.c: In function ?__free_pages_memory?:
./include/linux/kernel.h:845:29: warning: comparison of distinct pointer types lacks a cast
   (!!(sizeof((typeof(x) *)1 == (typeof(y) *)1)))
                             ^
./include/linux/kernel.h:859:4: note: in expansion of macro ?__typecheck?
   (__typecheck(x, y) && __no_side_effects(x, y))
    ^~~~~~~~~~~
./include/linux/kernel.h:869:24: note: in expansion of macro ?__safe_cmp?
  __builtin_choose_expr(__safe_cmp(x, y), \
                        ^~~~~~~~~~
./include/linux/kernel.h:878:19: note: in expansion of macro ?__careful_cmp?
 #define min(x, y) __careful_cmp(x, y, <)
                   ^~~~~~~~~~~~~
mm/nobootmem.c:104:11: note: in expansion of macro ?min?
   order = min(MAX_ORDER - 1UL, __ffs(start));
           ^~~
---------------------------------->8---------------------------------

> 
> -Vineet
-- 
 Eugeniy Paltsev

WARNING: multiple messages have this Message-ID (diff)
From: Eugeniy Paltsev <eugeniy.paltsev@synopsys.com>
To: "Eugeniy.Paltsev@synopsys.com" <Eugeniy.Paltsev@synopsys.com>,
	"Vineet Gupta" <vineet.gupta1@synopsys.com>,
	"linux-snps-arc@lists.infradead.org" 
	<linux-snps-arc@lists.infradead.org>
Cc: "linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
	"Alexey Brodkin" <alexey.brodkin@synopsys.com>
Subject: Re: [PATCH] ARC: fix __ffs return value to avoid build warnings
Date: Fri, 14 Dec 2018 10:47:30 +0000	[thread overview]
Message-ID: <1544784449.3270.30.camel@synopsys.com> (raw)
In-Reply-To: <C2D7FE5348E1B147BCA15975FBA23075014641F6E3@US01WEMBX2.internal.synopsys.com>

Hi Vineet,

On Thu, 2018-12-13 at 18:23 +0000, Vineet Gupta wrote:
> On 12/13/18 7:43 AM, Eugeniy Paltsev wrote:
> > Change __ffs return value from 'int' to 'unsigned long' as it
> > is done in other implementations (like asm-generic, x86, etc...)
> > to avoid build-time warnings in places where type is strictly
> > checked.
> > 
> > As __ffs may return values in [0-31] interval changing return
> > type to unsigned is valid.
> > 
> > Signed-off-by: Eugeniy Paltsev <Eugeniy.Paltsev@synopsys.com>
> 
> Can you please paste a couple of lines of offending output !

---------------------------------->8---------------------------------
  CC      mm/nobootmem.o
In file included from ./include/asm-generic/bug.h:18:0,
                 from ./arch/arc/include/asm/bug.h:32,
                 from ./include/linux/bug.h:5,
                 from ./include/linux/mmdebug.h:5,
                 from ./include/linux/gfp.h:5,
                 from ./include/linux/slab.h:15,
                 from mm/nobootmem.c:14:
mm/nobootmem.c: In function ‘__free_pages_memory’:
./include/linux/kernel.h:845:29: warning: comparison of distinct pointer types lacks a cast
   (!!(sizeof((typeof(x) *)1 == (typeof(y) *)1)))
                             ^
./include/linux/kernel.h:859:4: note: in expansion of macro ‘__typecheck’
   (__typecheck(x, y) && __no_side_effects(x, y))
    ^~~~~~~~~~~
./include/linux/kernel.h:869:24: note: in expansion of macro ‘__safe_cmp’
  __builtin_choose_expr(__safe_cmp(x, y), \
                        ^~~~~~~~~~
./include/linux/kernel.h:878:19: note: in expansion of macro ‘__careful_cmp’
 #define min(x, y) __careful_cmp(x, y, <)
                   ^~~~~~~~~~~~~
mm/nobootmem.c:104:11: note: in expansion of macro ‘min’
   order = min(MAX_ORDER - 1UL, __ffs(start));
           ^~~
---------------------------------->8---------------------------------

> 
> -Vineet
-- 
 Eugeniy Paltsev

  reply	other threads:[~2018-12-14 10:47 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-12-13 15:42 [PATCH] ARC: fix __ffs return value to avoid build warnings Eugeniy Paltsev
2018-12-13 15:42 ` Eugeniy Paltsev
2018-12-13 18:23 ` Vineet Gupta
2018-12-13 18:23   ` Vineet Gupta
2018-12-14 10:47   ` Eugeniy Paltsev [this message]
2018-12-14 10:47     ` Eugeniy Paltsev

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=1544784449.3270.30.camel@synopsys.com \
    --to=eugeniy.paltsev@synopsys.com \
    --cc=linux-snps-arc@lists.infradead.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.