* [PATCH] include : compile warning by __const_hweight8
@ 2011-06-22 11:42 NamJae Jeon
0 siblings, 0 replies; 2+ messages in thread
From: NamJae Jeon @ 2011-06-22 11:42 UTC (permalink / raw)
To: Arnd Bergmann, linux-kernel, linux-arch
Hello, Arnd.
I make a patch again. Would you check this patch ?
Thanks.
>From 28589ea9aabb080020ab3c79adcecad5d7315f39 Mon Sep 17 00:00:00 2001
From: Namjae Jeon <linkinjeon@gmail.com>
Date: Tue, 21 Jun 2011 14:39:03 +0900
Subject: [PATCH] include : compile warning by __const_hweight8
compilation warning is caused by __const_hweight8 when using
hweight_long with -Wsign-compare option.
you can see warning message like the following.
include/linux/bitops.h: In function 'hweight_long':
include/linux/bitops.h:49: warning: signed and unsigned type in
conditional expression
The reason is that the default return value of this macro is signed.
So, need type casting to remove warning.
Signed-off-by: Namjae Jeon <linkinjeon@gmail.com>
---
include/asm-generic/bitops/const_hweight.h | 2 +-
1 files changed, 1 insertions(+), 1 deletions(-)
diff --git a/include/asm-generic/bitops/const_hweight.h
b/include/asm-generic/bitops/const_hweight.h
index fa2a50b..d91b1aa 100644
--- a/include/asm-generic/bitops/const_hweight.h
+++ b/include/asm-generic/bitops/const_hweight.h
@@ -4,7 +4,7 @@
/*
* Compile time versions of __arch_hweightN()
*/
-#define __const_hweight8(w) \
+#define __const_hweight8(w) (unsigned long) \
( (!!((w) & (1ULL << 0))) + \
(!!((w) & (1ULL << 1))) + \
(!!((w) & (1ULL << 2))) + \
--
1.7.4-rc2
---------------------------------------------------------------------------------------------------------------------------
2011/6/21 NamJae Jeon <linkinjeon@gmail.com>:
> Hello Arnd.
>
> I attached patch for this warning issue.
>
> If there is a problem of patch, plz reply ....
>
> Thanks.
>
>
> --------------------------------------------------------------------------------------------------------------------------------------
>
> From 28589ea9aabb080020ab3c79adcecad5d7315f39 Mon Sep 17 00:00:00 2001
> From: Namjae Jeon <linkinjeon@gmail.com>
> Date: Tue, 21 Jun 2011 14:39:03 +0900
> Subject: [PATCH] compilation warning is caused when using hweight_long
> with -Wsign-compare option.
> Warning message is '
> include/linux/bitops.h: In function 'hweight_long':
> include/linux/bitops.h:49: warning: signed and unsigned type in
> conditional expression
> The reason is that the default return value of this macro is signed.
> So, need type casting to remove warning.
>
> Signed-off-by: Namjae Jeon <linkinjeon@gmail.com>
> ---
> include/asm-generic/bitops/const_hweight.h | 2 +-
> 1 files changed, 1 insertions(+), 1 deletions(-)
>
> diff --git a/include/asm-generic/bitops/const_hweight.h
> b/include/asm-generic/bitops/const_hweight.h
> index fa2a50b..d91b1aa 100644
> --- a/include/asm-generic/bitops/const_hweight.h
> +++ b/include/asm-generic/bitops/const_hweight.h
> @@ -4,7 +4,7 @@
> /*
> * Compile time versions of __arch_hweightN()
> */
> -#define __const_hweight8(w) \
> +#define __const_hweight8(w) (unsigned long) \
> ( (!!((w) & (1ULL << 0))) + \
> (!!((w) & (1ULL << 1))) + \
> (!!((w) & (1ULL << 2))) + \
> --
> 1.7.4-rc2
>
>
>
> --------------------------------------------------------------------------------------------------------------------------------------
> 2011/6/20 Arnd Bergmann <arnd@arndb.de>:
>> On Monday 20 June 2011, NamJae Jeon wrote:
>>> I found compile warning while compiling module when using -Wsign-compare option.
>>>
>>> include/linux/bitops.h: In function 'hweight_long':
>>> include/linux/bitops.h:49: warning: signed and unsigned type in
>>> conditional expression
>>>
>>> I found the reason of this problem that the default return value of
>>> the below macro is signed.
>>>
>>> #define __const_hweight8(w) \
>>> ( (!!((w) & (1ULL << 0))) + \
>>> (!!((w) & (1ULL << 1))) + \
>>> (!!((w) & (1ULL << 2))) + \
>>> (!!((w) & (1ULL << 3))) + \
>>> (!!((w) & (1ULL << 4))) + \
>>> (!!((w) & (1ULL << 5))) + \
>>> (!!((w) & (1ULL << 6))) + \
>>> (!!((w) & (1ULL << 7))) )
>>>
>>> So, I try to add (unsigned long) in __const_hweight8 like this.
>>>
>>> #define __const_hweight8(w) (unsigned long ) \
>>> ( (!!((w) & (1ULL << 0))) + \
>>> (!!((w) & (1ULL << 1))) + \
>>> (!!((w) & (1ULL << 2))) + \
>>> (!!((w) & (1ULL << 3))) + \
>>> (!!((w) & (1ULL << 4))) + \
>>> (!!((w) & (1ULL << 5))) + \
>>> (!!((w) & (1ULL << 6))) + \
>>> (!!((w) & (1ULL << 7))) )
>>>
>>> so, I can't see compile warning after fixing it, Would you plz check this ?
>>
>> Yes, this looks correct to me. Could you send the change as a proper patch
>> with your Signed-off-by:?
>>
>> Arnd
>>
>
^ permalink raw reply related [flat|nested] 2+ messages in thread
* [PATCH] include : compile warning by __const_hweight8
@ 2011-07-03 11:42 Namjae Jeon
0 siblings, 0 replies; 2+ messages in thread
From: Namjae Jeon @ 2011-07-03 11:42 UTC (permalink / raw)
To: arnd; +Cc: linux-kernel, linkinjeon
The compilation warning is caused by __const_hweight8 when using hweight_long with -Wsign-compare option.
The reason is that the default return value of this macro is signed. So, need tye casting to remove warning.
Signed-off-by: Namjae Jeon <linkinjeon@gmail.com>
---
include/asm-generic/bitops/const_hweight.h | 2 +-
1 files changed, 1 insertions(+), 1 deletions(-)
diff --git a/include/asm-generic/bitops/const_hweight.h b/include/asm-generic/bitops/const_hweight.h
index fa2a50b..d91b1aa 100644
--- a/include/asm-generic/bitops/const_hweight.h
+++ b/include/asm-generic/bitops/const_hweight.h
@@ -4,7 +4,7 @@
/*
* Compile time versions of __arch_hweightN()
*/
-#define __const_hweight8(w) \
+#define __const_hweight8(w) (unsigned long) \
( (!!((w) & (1ULL << 0))) + \
(!!((w) & (1ULL << 1))) + \
(!!((w) & (1ULL << 2))) + \
--
1.7.4.4
^ permalink raw reply related [flat|nested] 2+ messages in thread
end of thread, other threads:[~2011-07-03 11:42 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2011-06-22 11:42 [PATCH] include : compile warning by __const_hweight8 NamJae Jeon
2011-07-03 11:42 Namjae Jeon
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).