public inbox for libc-ports@sourceware.org
 help / color / mirror / Atom feed
* Fix unused variable warnings from MIPS syscall macros
@ 2012-11-19 23:16 Joseph S. Myers
  0 siblings, 0 replies; only message in thread
From: Joseph S. Myers @ 2012-11-19 23:16 UTC (permalink / raw)
  To: libc-ports

Having dealt with "set but not used" warnings from MIPS atomics macros, 
the next largest cause of warnings in a MIPS glibc build is from the 
syscall macros - MIPS is an architecture where INTERNAL_SYSCALL_DECL 
declares a variable, but this variable may not end up getting used 
depending on the details of the syscall call site.  I've applied this 
patch to follow the approach used for Alpha, where that variable is 
declared with the "unused" attribute, and INTERNAL_SYSCALL_ERROR_P and 
INTERNAL_SYSCALL_ERRNO are made to cast the argument they don't use to 
void to avoid warnings in other cases about "val" being set but not used.

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

	* sysdeps/unix/sysv/linux/mips/mips32/sysdep.h
	(INTERNAL_SYSCALL_DECL): Use __attribute__ ((unused)).
	(INTERNAL_SYSCALL_ERROR_P): Cast val to void.
	(INTERNAL_SYSCALL_ERRNO): Cast err to void.
	* sysdeps/unix/sysv/linux/mips/mips64/n32/sysdep.h
	(INTERNAL_SYSCALL_DECL): Use __attribute__ ((unused)).
	(INTERNAL_SYSCALL_ERROR_P): Cast val to void.
	(INTERNAL_SYSCALL_ERRNO): Cast err to void.
	* sysdeps/unix/sysv/linux/mips/mips64/n64/sysdep.h
	(INTERNAL_SYSCALL_DECL): Use __attribute__ ((unused)).
	(INTERNAL_SYSCALL_ERROR_P): Cast val to void.
	(INTERNAL_SYSCALL_ERRNO): Cast err to void.

diff --git a/ports/sysdeps/unix/sysv/linux/mips/mips32/sysdep.h b/ports/sysdeps/unix/sysv/linux/mips/mips32/sysdep.h
index 8c024b0..1d6ab05 100644
--- a/ports/sysdeps/unix/sysv/linux/mips/mips32/sysdep.h
+++ b/ports/sysdeps/unix/sysv/linux/mips/mips32/sysdep.h
@@ -60,13 +60,13 @@
      result_var; })
 
 #undef INTERNAL_SYSCALL_DECL
-#define INTERNAL_SYSCALL_DECL(err) long err
+#define INTERNAL_SYSCALL_DECL(err) long err __attribute__ ((unused))
 
 #undef INTERNAL_SYSCALL_ERROR_P
-#define INTERNAL_SYSCALL_ERROR_P(val, err)   ((long) (err))
+#define INTERNAL_SYSCALL_ERROR_P(val, err)   ((void) (val), (long) (err))
 
 #undef INTERNAL_SYSCALL_ERRNO
-#define INTERNAL_SYSCALL_ERRNO(val, err)     (val)
+#define INTERNAL_SYSCALL_ERRNO(val, err)     ((void) (err), val)
 
 #undef INTERNAL_SYSCALL
 #define INTERNAL_SYSCALL(name, err, nr, args...) \
diff --git a/ports/sysdeps/unix/sysv/linux/mips/mips64/n32/sysdep.h b/ports/sysdeps/unix/sysv/linux/mips/mips64/n32/sysdep.h
index 98088d3..23b1c97 100644
--- a/ports/sysdeps/unix/sysv/linux/mips/mips64/n32/sysdep.h
+++ b/ports/sysdeps/unix/sysv/linux/mips/mips64/n32/sysdep.h
@@ -64,13 +64,13 @@
      result_var; })
 
 #undef INTERNAL_SYSCALL_DECL
-#define INTERNAL_SYSCALL_DECL(err) long err
+#define INTERNAL_SYSCALL_DECL(err) long err __attribute__ ((unused))
 
 #undef INTERNAL_SYSCALL_ERROR_P
-#define INTERNAL_SYSCALL_ERROR_P(val, err)   ((long) (err))
+#define INTERNAL_SYSCALL_ERROR_P(val, err)   ((void) (val), (long) (err))
 
 #undef INTERNAL_SYSCALL_ERRNO
-#define INTERNAL_SYSCALL_ERRNO(val, err)     (val)
+#define INTERNAL_SYSCALL_ERRNO(val, err)     ((void) (err), val)
 
 #undef INTERNAL_SYSCALL
 #define INTERNAL_SYSCALL(name, err, nr, args...) \
diff --git a/ports/sysdeps/unix/sysv/linux/mips/mips64/n64/sysdep.h b/ports/sysdeps/unix/sysv/linux/mips/mips64/n64/sysdep.h
index 0baa94f..1d0b7b7 100644
--- a/ports/sysdeps/unix/sysv/linux/mips/mips64/n64/sysdep.h
+++ b/ports/sysdeps/unix/sysv/linux/mips/mips64/n64/sysdep.h
@@ -60,13 +60,13 @@
      result_var; })
 
 #undef INTERNAL_SYSCALL_DECL
-#define INTERNAL_SYSCALL_DECL(err) long err
+#define INTERNAL_SYSCALL_DECL(err) long err __attribute__ ((unused))
 
 #undef INTERNAL_SYSCALL_ERROR_P
-#define INTERNAL_SYSCALL_ERROR_P(val, err)   ((long) (err))
+#define INTERNAL_SYSCALL_ERROR_P(val, err)   ((void) (val), (long) (err))
 
 #undef INTERNAL_SYSCALL_ERRNO
-#define INTERNAL_SYSCALL_ERRNO(val, err)     (val)
+#define INTERNAL_SYSCALL_ERRNO(val, err)     ((void) (err), val)
 
 #undef INTERNAL_SYSCALL
 #define INTERNAL_SYSCALL(name, err, nr, args...) \

-- 
Joseph S. Myers
joseph@codesourcery.com

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2012-11-19 23:16 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2012-11-19 23:16 Fix unused variable warnings from MIPS syscall macros Joseph S. Myers

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).