From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:38575) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bWgUu-000799-1P for qemu-devel@nongnu.org; Mon, 08 Aug 2016 05:05:27 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1bWgUo-00083C-1K for qemu-devel@nongnu.org; Mon, 08 Aug 2016 05:05:22 -0400 Received: from mail-wm0-x244.google.com ([2a00:1450:400c:c09::244]:34455) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bWgUn-000836-QD for qemu-devel@nongnu.org; Mon, 08 Aug 2016 05:05:17 -0400 Received: by mail-wm0-x244.google.com with SMTP id q128so14152014wma.1 for ; Mon, 08 Aug 2016 02:05:17 -0700 (PDT) Sender: Paolo Bonzini References: <20160807014121.18739-1-bobby.prani@gmail.com> From: Paolo Bonzini Message-ID: <31b8d7c7-6a5c-910f-b799-25a8e00c8908@redhat.com> Date: Mon, 8 Aug 2016 11:05:15 +0200 MIME-Version: 1.0 In-Reply-To: <20160807014121.18739-1-bobby.prani@gmail.com> Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit Subject: Re: [Qemu-devel] [PATCH 1/1] seqlock: Fix warning reg. incompatible cast List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Pranith Kumar , Richard Henderson , "Emilio G. Cota" , =?UTF-8?Q?Alex_Benn=c3=a9e?= , Sergey Fedorov , Markus Armbruster , "open list:All patches CC here" On 07/08/2016 03:41, Pranith Kumar wrote: > With the latest clang, we have the following warning. We are not using > the const qualifier consistently in other functions. So remove it from > the only one that uses it to fix the warning. > > /home/pranith/devops/code/qemu/include/qemu/seqlock.h:62:21: warning: passing 'typeof (*&sl->sequence) *' (aka 'const unsigned int *') to parameter of type 'unsigned int *' discards qualifier > s [-Wincompatible-pointer-types-discards-qualifiers] > return unlikely(atomic_read(&sl->sequence) != start); > ^~~~~~~~~~~~~~~~~~~~~~~~~~ > /home/pranith/devops/code/qemu/include/qemu/atomic.h:58:25: note: expanded from macro 'atomic_read' > __atomic_load(ptr, &_val, __ATOMIC_RELAXED); \ > ^~~~~ > /home/pranith/devops/code/qemu/include/qemu/compiler.h:62:43: note: expanded from macro 'unlikely' > #define unlikely(x) __builtin_expect(!!(x), 0) > > Signed-off-by: Pranith Kumar This is a compiler bug, isn't it? Atomic loads of a const pointer should be allowed. Paolo > --- > include/qemu/seqlock.h | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) > > diff --git a/include/qemu/seqlock.h b/include/qemu/seqlock.h > index 2e2be4c..aa4cf15 100644 > --- a/include/qemu/seqlock.h > +++ b/include/qemu/seqlock.h > @@ -55,7 +55,7 @@ static inline unsigned seqlock_read_begin(QemuSeqLock *sl) > return ret & ~1; > } > > -static inline int seqlock_read_retry(const QemuSeqLock *sl, unsigned start) > +static inline int seqlock_read_retry(QemuSeqLock *sl, unsigned start) > { > /* Read other fields before reading final sequence. */ > smp_rmb(); >