This is the mail archive of the
libc-ports@sources.redhat.com
mailing list for the libc-ports project.
Fix unused variable warnings from MIPS syscall macros
- From: "Joseph S. Myers" <joseph at codesourcery dot com>
- To: <libc-ports at sourceware dot org>
- Date: Mon, 19 Nov 2012 23:16:26 +0000
- Subject: Fix unused variable warnings from MIPS syscall macros
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