More 'unused but set variable warnings' on 32 bit mips.

Carmelo Amoroso carmelo73 at gmail.com
Tue Apr 10 05:15:46 UTC 2012


On 10 April 2012 01:46, Anthony G. Basile <basile at opensource.dyc.edu> wrote:
> Hi everyone,
>
> I hit this warning yesterday after a fresh pull from the repo on a big
> endian 32-bit mips compiling with gentoo's mips-gentoo-linux-uclibc-4.6.2.
>  It was repeat many times.
>

Hi,
4.6.2 has started enabling more checks and producing more warnings


>  CC libc/pwd_grp/getpwnam.os
> In file included from ./include/bits/libc-lock.h:36:0,
>                 from ./include/bits/stdio-lock.h:23,
>                 from ./include/bits/uClibc_mutex.h:71,
>                 from ./include/bits/uClibc_stdio.h:119,
>                 from ./include/stdio.h:72,
>                 from libc/pwd_grp/pwd_grp.c:23,
>                 from libc/pwd_grp/getpwnam.c:8:
> ./libpthread/nptl/sysdeps/unix/sysv/linux/mips/lowlevellock.h: In function
> '__lll_cond_lock':
> ./libpthread/nptl/sysdeps/unix/sysv/linux/mips/lowlevellock.h:194:1:
> warning: variable '__prev' set but not used [-Wunused-but-set-variable]
> ./libpthread/nptl/sysdeps/unix/sysv/linux/mips/lowlevellock.h:194:1:
> warning: variable '__prev' set but not used [-Wunused-but-set-variable]
> ./libpthread/nptl/sysdeps/unix/sysv/linux/mips/lowlevellock.h:194:1:
> warning: variable '__prev' set but not used [-Wunused-but-set-variable]
> ./libpthread/nptl/sysdeps/unix/sysv/linux/mips/lowlevellock.h: In function
> '__lll_timedlock':
> ./libpthread/nptl/sysdeps/unix/sysv/linux/mips/lowlevellock.h:213:1:
> warning: variable '__prev' set but not used [-Wunused-but-set-variable]
> ./libpthread/nptl/sysdeps/unix/sysv/linux/mips/lowlevellock.h:213:1:
> warning: variable '__prev' set but not used [-Wunused-but-set-variable]
> ./libpthread/nptl/sysdeps/unix/sysv/linux/mips/lowlevellock.h:213:1:
> warning: variable '__prev' set but not used [-Wunused-but-set-variable]
> ./libpthread/nptl/sysdeps/unix/sysv/linux/mips/lowlevellock.h: In function
> '__lll_robust_timedlock':
> ./libpthread/nptl/sysdeps/unix/sysv/linux/mips/lowlevellock.h:226:1:
> warning: variable '__prev' set but not used [-Wunused-but-set-variable]
> ./libpthread/nptl/sysdeps/unix/sysv/linux/mips/lowlevellock.h:226:1:
> warning: variable '__prev' set but not used [-Wunused-but-set-variable]
> ./libpthread/nptl/sysdeps/unix/sysv/linux/mips/lowlevellock.h:226:1:
> warning: variable '__prev' set but not used [-Wunused-but-set-variable]
>
>
> I traced it back through the macros
>
>        atomic_compare_and_exchange_bool_acq
>
> ->     __atomic_bool_bysize
>
> ->    __arch_compare_and_exchange_bool_32_int
>
> -> { __typeof (*mem) __prev; int __cmp;                                   \
>       __arch_compare_and_exchange_xxx_32_int(mem, new, old, rel, acq);     \
>       !__cmp; }
>
> where __arch_compare_and_exchange_xxx_32_int contains the mips asm that sets
> __prev.  I see why __prev is unused but set, but I'm not sure how to fix
> this properly.  A hack that works is to comment out
>  atomic_compare_and_exchange_bool_acq in
> libc/sysdeps/linux/mips/bits/atomic.h = include/bits/atomic.h and fall back
> on the #define atomic_compare_and_exchange_bool_acq in include/atomic.h, but
> that doesn't seem like the right way.
>

would attribute used help ?

cheers,
Carmelo
> Its only a warning and the resulting libs are good.
>
> --
> Anthony G. Basile, Ph. D.
> Chair of Information Technology
> D'Youville College
> Buffalo, NY 14201
> (716) 829-8197
>
> _______________________________________________
> uClibc mailing list
> uClibc at uclibc.org
> http://lists.busybox.net/mailman/listinfo/uclibc


More information about the uClibc mailing list