Message ID | 20160807014121.18739-1-bobby.prani@gmail.com (mailing list archive) |
---|---|
State | New, archived |
Headers | show |
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 <bobby.prani@gmail.com> 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(); >
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();
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 <bobby.prani@gmail.com> --- include/qemu/seqlock.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)