public inbox for libc-ports@sourceware.org
 help / color / mirror / Atom feed
* [PATCH ports] Use __unused0 instead of __unused for user visible struct members
@ 2012-01-02  3:19 Guillem Jover
  2012-01-02  6:06 ` Mike Frysinger
  0 siblings, 1 reply; 5+ messages in thread
From: Guillem Jover @ 2012-01-02  3:19 UTC (permalink / raw)
  To: libc-ports

On BSD systems __unused has traditionally been defined to mean the
equivalent of gcc's __attribute__((__unused__)). The problem comes when
defining such macro while trying to build unmodified source code with
BSD origins on systems with glibc ports headers. Separate patches have
been sent to fix the same issue on Linux kernel headers and the main
glibc project.

This patch renames the user visible struct members from __unused to
__unused0 to not cause compilation failures due to that macro, which
should not be a problem as those members are supposed to be private
anyway.

2012-01-02  Guillem Jover  <guillem@hadrons.org>

	* sysdeps/unix/sysv/linux/alpha/bits/stat.h (struct stat)
	(struct stat64): Rename __unused to __unused0.
	* sysdeps/unix/sysv/linux/alpha/kernel_stat.h
	(struct kernel_stat64, struct glibc21_stat): Likewise.
	* sysdeps/unix/sysv/linux/alpha/xstatconv.c (__xstat_conv):
	Likewise.
	* sysdeps/unix/sysv/linux/generic/bits/stat.h (struct stat)
	(struct stat64): Likewise.
---
 sysdeps/unix/sysv/linux/alpha/bits/stat.h   |    4 ++--
 sysdeps/unix/sysv/linux/alpha/kernel_stat.h |    4 ++--
 sysdeps/unix/sysv/linux/alpha/xstatconv.c   |   14 +++++++-------
 sysdeps/unix/sysv/linux/generic/bits/stat.h |    4 ++--
 4 files changed, 13 insertions(+), 13 deletions(-)

diff --git a/sysdeps/unix/sysv/linux/alpha/bits/stat.h b/sysdeps/unix/sysv/linux/alpha/bits/stat.h
index d7241bd..1d23bfc 100644
--- a/sysdeps/unix/sysv/linux/alpha/bits/stat.h
+++ b/sysdeps/unix/sysv/linux/alpha/bits/stat.h
@@ -93,7 +93,7 @@ struct stat
     __ST_TIME(a);		/* Time of last access.  */
     __ST_TIME(m);		/* Time of last modification.  */
     __ST_TIME(c);		/* Time of last status change.  */
-    long __unused[3];
+    long __unused0[3];
   };
 
 #ifdef __USE_LARGEFILE64
@@ -114,7 +114,7 @@ struct stat64
     __ST_TIME(a);		/* Time of last access.  */
     __ST_TIME(m);		/* Time of last modification.  */
     __ST_TIME(c);		/* Time of last status change.  */
-    long __unused[3];
+    long __unused0[3];
   };
 #endif
 
diff --git a/sysdeps/unix/sysv/linux/alpha/kernel_stat.h b/sysdeps/unix/sysv/linux/alpha/kernel_stat.h
index a1d012a..fbf6b62 100644
--- a/sysdeps/unix/sysv/linux/alpha/kernel_stat.h
+++ b/sysdeps/unix/sysv/linux/alpha/kernel_stat.h
@@ -40,7 +40,7 @@ struct kernel_stat64
     unsigned long   st_mtimensec;
     unsigned long   st_ctime;
     unsigned long   st_ctimensec;
-    long            __unused[3];
+    long            __unused0[3];
   };
 
 /* Definition of `struct stat' used by glibc 2.0.  */
@@ -82,7 +82,7 @@ struct glibc21_stat
     unsigned int st_flags;
     unsigned int st_gen;
     int __pad3;
-    long __unused[4];
+    long __unused0[4];
   };
 
 #define XSTAT_IS_XSTAT64 1
diff --git a/sysdeps/unix/sysv/linux/alpha/xstatconv.c b/sysdeps/unix/sysv/linux/alpha/xstatconv.c
index 86bb374..9f62b50 100644
--- a/sysdeps/unix/sysv/linux/alpha/xstatconv.c
+++ b/sysdeps/unix/sysv/linux/alpha/xstatconv.c
@@ -82,10 +82,10 @@ __xstat_conv (int vers, struct kernel_stat *kbuf, void *ubuf)
 	buf->st_flags = kbuf->st_flags;
 	buf->st_gen = kbuf->st_gen;
 	buf->__pad3 = 0;
-	buf->__unused[0] = 0;
-	buf->__unused[1] = 0;
-	buf->__unused[2] = 0;
-	buf->__unused[3] = 0;
+	buf->__unused0[0] = 0;
+	buf->__unused0[1] = 0;
+	buf->__unused0[2] = 0;
+	buf->__unused0[3] = 0;
       }
       break;
 
@@ -113,9 +113,9 @@ __xstat_conv (int vers, struct kernel_stat *kbuf, void *ubuf)
 	buf->st_ctime = kbuf->st_ctime;
 	buf->st_ctimensec = 0;
 
-	buf->__unused[0] = 0;
-	buf->__unused[1] = 0;
-	buf->__unused[2] = 0;
+	buf->__unused0[0] = 0;
+	buf->__unused0[1] = 0;
+	buf->__unused0[2] = 0;
       }
       break;
 
diff --git a/sysdeps/unix/sysv/linux/generic/bits/stat.h b/sysdeps/unix/sysv/linux/generic/bits/stat.h
index d3cec6f..490378b 100644
--- a/sysdeps/unix/sysv/linux/generic/bits/stat.h
+++ b/sysdeps/unix/sysv/linux/generic/bits/stat.h
@@ -88,7 +88,7 @@ struct stat
     __time_t st_ctime;			/* Time of last status change.  */
     unsigned long int st_ctimensec;	/* Nsecs of last status change.  */
 #endif
-    int __unused[2];
+    int __unused0[2];
   };
 
 #undef __field64
@@ -126,7 +126,7 @@ struct stat64
     __time_t st_ctime;			/* Time of last status change.  */
     unsigned long int st_ctimensec;	/* Nsecs of last status change.  */
 #endif
-    int __unused[2];
+    int __unused0[2];
   };
 #endif
 
-- 
1.7.7.3

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH ports] Use __unused0 instead of __unused for user visible struct members
  2012-01-02  3:19 [PATCH ports] Use __unused0 instead of __unused for user visible struct members Guillem Jover
@ 2012-01-02  6:06 ` Mike Frysinger
  2012-01-04  7:12   ` Guillem Jover
  0 siblings, 1 reply; 5+ messages in thread
From: Mike Frysinger @ 2012-01-02  6:06 UTC (permalink / raw)
  To: libc-ports; +Cc: Guillem Jover

[-- Attachment #1: Type: Text/Plain, Size: 930 bytes --]

On Sunday 01 January 2012 22:18:59 Guillem Jover wrote:
> On BSD systems __unused has traditionally been defined to mean the
> equivalent of gcc's __attribute__((__unused__)). The problem comes when
> defining such macro while trying to build unmodified source code with
> BSD origins on systems with glibc ports headers. Separate patches have
> been sent to fix the same issue on Linux kernel headers and the main
> glibc project.

don't define __unused before including C library headers.  problem solved.

> This patch renames the user visible struct members from __unused to
> __unused0 to not cause compilation failures due to that macro, which
> should not be a problem as those members are supposed to be private
> anyway.

the main tree needs modification in more places.  so unless you can convince 
drepper to make the modification to the main tree, updating the ports doesn't 
make much sense.
-mike

[-- Attachment #2: This is a digitally signed message part. --]
[-- Type: application/pgp-signature, Size: 836 bytes --]

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH ports] Use __unused0 instead of __unused for user visible struct members
  2012-01-02  6:06 ` Mike Frysinger
@ 2012-01-04  7:12   ` Guillem Jover
  2012-01-04 11:57     ` Joseph S. Myers
  0 siblings, 1 reply; 5+ messages in thread
From: Guillem Jover @ 2012-01-04  7:12 UTC (permalink / raw)
  To: Mike Frysinger; +Cc: libc-ports

On Mon, 2012-01-02 at 01:06:15 -0500, Mike Frysinger wrote:
> On Sunday 01 January 2012 22:18:59 Guillem Jover wrote:
> > On BSD systems __unused has traditionally been defined to mean the
> > equivalent of gcc's __attribute__((__unused__)). The problem comes when
> > defining such macro while trying to build unmodified source code with
> > BSD origins on systems with glibc ports headers. Separate patches have
> > been sent to fix the same issue on Linux kernel headers and the main
> > glibc project.
> 
> don't define __unused before including C library headers.  problem solved.

Sure, but as I mentioned above, the point is to avoid the need to modify
upstream source, with something like -D, -include, or -isystem + overlay
headers using #include_next for example.

> > This patch renames the user visible struct members from __unused to
> > __unused0 to not cause compilation failures due to that macro, which
> > should not be a problem as those members are supposed to be private
> > anyway.
> 
> the main tree needs modification in more places.  so unless you can convince 
> drepper to make the modification to the main tree, updating the ports doesn't 
> make much sense.

The patch seems to have arrived now on the libc-alpha list. In any
case I don't see the harm in applying this one to the ports tree?

thanks,
guillem

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH ports] Use __unused0 instead of __unused for user visible struct members
  2012-01-04  7:12   ` Guillem Jover
@ 2012-01-04 11:57     ` Joseph S. Myers
  2012-01-09  5:35       ` Guillem Jover
  0 siblings, 1 reply; 5+ messages in thread
From: Joseph S. Myers @ 2012-01-04 11:57 UTC (permalink / raw)
  To: Guillem Jover; +Cc: Mike Frysinger, libc-ports

On Wed, 4 Jan 2012, Guillem Jover wrote:

> The patch seems to have arrived now on the libc-alpha list. In any
> case I don't see the harm in applying this one to the ports tree?

In general, textual differences (including whitespace) between libc and 
ports versions of a file should be limited to those that genuinely result 
from differences between the architectures, kernel ports, etc.; a cleanup 
is applied to ports versions only after it is applied to the libc 
versions.

-- 
Joseph S. Myers
joseph@codesourcery.com

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH ports] Use __unused0 instead of __unused for user visible struct members
  2012-01-04 11:57     ` Joseph S. Myers
@ 2012-01-09  5:35       ` Guillem Jover
  0 siblings, 0 replies; 5+ messages in thread
From: Guillem Jover @ 2012-01-09  5:35 UTC (permalink / raw)
  To: Joseph S. Myers; +Cc: Mike Frysinger, libc-ports

On Wed, 2012-01-04 at 11:57:22 +0000, Joseph S. Myers wrote:
> On Wed, 4 Jan 2012, Guillem Jover wrote:
> > The patch seems to have arrived now on the libc-alpha list. In any
> > case I don't see the harm in applying this one to the ports tree?
> 
> In general, textual differences (including whitespace) between libc and 
> ports versions of a file should be limited to those that genuinely result 
> from differences between the architectures, kernel ports, etc.; a cleanup 
> is applied to ports versions only after it is applied to the libc 
> versions.

Fair enough.

thanks,
guillem

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2012-01-09  5:35 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2012-01-02  3:19 [PATCH ports] Use __unused0 instead of __unused for user visible struct members Guillem Jover
2012-01-02  6:06 ` Mike Frysinger
2012-01-04  7:12   ` Guillem Jover
2012-01-04 11:57     ` Joseph S. Myers
2012-01-09  5:35       ` Guillem Jover

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