public inbox for libc-alpha@sourceware.org
 help / color / mirror / Atom feed
* [PATCH] alpha: Remove anonymous union in struct stat [BZ #27042]
@ 2020-12-09 16:20 Matt Turner
  2020-12-09 17:11 ` Florian Weimer
  2020-12-10  1:19 ` [PATCHv2] " Matt Turner
  0 siblings, 2 replies; 10+ messages in thread
From: Matt Turner @ 2020-12-09 16:20 UTC (permalink / raw)
  To: libc-alpha

This is clever, but it confuses downstream detection in at least zstd
and GNOME's glib. zstd has preprocessor tests for the 'st_mtime' macro,
which is not provided by the path using the anonymous union; glib checks
for the presence of 'st_mtimensec' in struct stat but then tries to
access that field in struct statx (which might be a bug on its own).
---
 .../unix/sysv/linux/alpha/bits/struct_stat.h  | 23 ++++---------------
 1 file changed, 5 insertions(+), 18 deletions(-)

diff --git a/sysdeps/unix/sysv/linux/alpha/bits/struct_stat.h b/sysdeps/unix/sysv/linux/alpha/bits/struct_stat.h
index 1c9b4248b8..dddc5fb5a0 100644
--- a/sysdeps/unix/sysv/linux/alpha/bits/struct_stat.h
+++ b/sysdeps/unix/sysv/linux/alpha/bits/struct_stat.h
@@ -27,26 +27,13 @@
    'struct timespec'.  This is the type used whenever possible but the
    Unix namespace rules do not allow the identifier 'timespec' to appear
    in the <sys/stat.h> header.  Therefore we have to handle the use of
-   this header in strictly standard-compliant sources special.
-
-   Use neat tidy anonymous unions and structures when possible.  */
+   this header in strictly standard-compliant sources special.  */
 
 #ifdef __USE_XOPEN2K8
-# if __GNUC_PREREQ(3,3)
-#  define __ST_TIME(X)				\
-	__extension__ union {			\
-	    struct timespec st_##X##tim;	\
-	    struct {				\
-		__time_t st_##X##time;		\
-		unsigned long st_##X##timensec;	\
-	    };					\
-	}
-# else
-#  define __ST_TIME(X) struct timespec st_##X##tim
-#  define st_atime st_atim.tv_sec
-#  define st_mtime st_mtim.tv_sec
-#  define st_ctime st_ctim.tv_sec
-# endif
+# define __ST_TIME(X) struct timespec st_##X##tim
+# define st_atime st_atim.tv_sec
+# define st_mtime st_mtim.tv_sec
+# define st_ctime st_ctim.tv_sec
 #else
 # define __ST_TIME(X)				\
 	__time_t st_##X##time;			\
-- 
2.26.2


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

end of thread, other threads:[~2020-12-17 19:10 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-12-09 16:20 [PATCH] alpha: Remove anonymous union in struct stat [BZ #27042] Matt Turner
2020-12-09 17:11 ` Florian Weimer
2020-12-10  1:25   ` Matt Turner
2020-12-10  1:19 ` [PATCHv2] " Matt Turner
2020-12-10 21:18   ` Adhemerval Zanella
2020-12-15 16:43     ` Matt Turner
2020-12-15 16:48       ` Adhemerval Zanella
2020-12-15 16:56       ` Florian Weimer
2020-12-17 18:18         ` Matt Turner
2020-12-17 19:10           ` Adhemerval Zanella

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