* Fix "set but not used" warnings from MIPS bits/atomic.h
@ 2012-11-17 3:36 Joseph S. Myers
2012-11-17 20:44 ` Matt Turner
0 siblings, 1 reply; 2+ messages in thread
From: Joseph S. Myers @ 2012-11-17 3:36 UTC (permalink / raw)
To: libc-ports
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
^ permalink raw reply [flat|nested] 2+ messages in thread
* Re: Fix "set but not used" warnings from MIPS bits/atomic.h
2012-11-17 3:36 Fix "set but not used" warnings from MIPS bits/atomic.h Joseph S. Myers
@ 2012-11-17 20:44 ` Matt Turner
0 siblings, 0 replies; 2+ messages in thread
From: Matt Turner @ 2012-11-17 20:44 UTC (permalink / raw)
To: Joseph S. Myers; +Cc: libc-ports
On Fri, Nov 16, 2012 at 7:36 PM, Joseph S. Myers
<joseph@codesourcery.com> wrote:
> 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).
Thank you. This has annoyed me for a long time.
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2012-11-17 20:44 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2012-11-17 3:36 Fix "set but not used" warnings from MIPS bits/atomic.h Joseph S. Myers
2012-11-17 20:44 ` Matt Turner
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 read-only IMAP folder(s) and NNTP newsgroup(s).