This is the mail archive of the libc-ports@sources.redhat.com mailing list for the libc-ports project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Fix "set but not used" warnings from MIPS bits/atomic.h


MIPS glibc builds are very noisy with "set but not used" warnings
(among others).  Many of those warnings come from the bits/atomic.h
macros, which are structured so that an outer macro needs to provide
a variable __prev for use by an inner macro, but only in some cases is
the value the asm stores in that variable used.  I've applied this
patch to use __attribute__ ((unused)) in those macros that don't use
the value stored in __prev (so changing the numbers of warnings in
MIPS glibc builds from tens of thousands to hundreds).

2012-11-17  Joseph Myers  <joseph@codesourcery.com>

	* sysdeps/mips/bits/atomic.h
	(__arch_compare_and_exchange_bool_8_int): Mark __PREV variable
	with __attribute__ ((unused)).
	(__arch_compare_and_exchange_bool_16_int): Likewise.
	(__arch_compare_and_exchange_bool_32_int): Likewise.
	(__arch_compare_and_exchange_bool_64_int): Likewise.

diff --git a/ports/sysdeps/mips/bits/atomic.h b/ports/sysdeps/mips/bits/atomic.h
index 749e166..c5a26b9 100644
--- a/ports/sysdeps/mips/bits/atomic.h
+++ b/ports/sysdeps/mips/bits/atomic.h
@@ -261,22 +261,22 @@ typedef uintmax_t uatomic_max_t;
 /* For all "bool" routines, we return FALSE if exchange succesful.  */
 
 # define __arch_compare_and_exchange_bool_8_int(mem, new, old, rel, acq) \
-({ typeof (*mem) __prev; int __cmp;					\
+({ typeof (*mem) __prev __attribute__ ((unused)); int __cmp;		\
    __arch_compare_and_exchange_xxx_8_int(mem, new, old, rel, acq);	\
    !__cmp; })
 
 # define __arch_compare_and_exchange_bool_16_int(mem, new, old, rel, acq) \
-({ typeof (*mem) __prev; int __cmp;					\
+({ typeof (*mem) __prev __attribute__ ((unused)); int __cmp;		\
    __arch_compare_and_exchange_xxx_16_int(mem, new, old, rel, acq);	\
    !__cmp; })
 
 # define __arch_compare_and_exchange_bool_32_int(mem, new, old, rel, acq) \
-({ typeof (*mem) __prev; int __cmp;					\
+({ typeof (*mem) __prev __attribute__ ((unused)); int __cmp;		\
    __arch_compare_and_exchange_xxx_32_int(mem, new, old, rel, acq);	\
    !__cmp; })
 
 # define __arch_compare_and_exchange_bool_64_int(mem, new, old, rel, acq) \
-({ typeof (*mem) __prev; int __cmp;					\
+({ typeof (*mem) __prev __attribute__ ((unused)); int __cmp;		\
    __arch_compare_and_exchange_xxx_64_int(mem, new, old, rel, acq);	\
    !__cmp; })
 

-- 
Joseph S. Myers
joseph@codesourcery.com


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]