public inbox for libstdc++-cvs@sourceware.org
help / color / mirror / Atom feed
* [gcc r14-10076] libstdc++: Workaround kernel-headers on s390x-linux
@ 2024-04-22 16:01 Jakub Jelinek
  0 siblings, 0 replies; only message in thread
From: Jakub Jelinek @ 2024-04-22 16:01 UTC (permalink / raw)
  To: gcc-cvs, libstdc++-cvs

https://gcc.gnu.org/g:cf5f7791056b3ed993bc8024be767a86157514a9

commit r14-10076-gcf5f7791056b3ed993bc8024be767a86157514a9
Author: Jakub Jelinek <jakub@redhat.com>
Date:   Mon Apr 22 18:00:06 2024 +0200

    libstdc++: Workaround kernel-headers on s390x-linux
    
    We see
    FAIL: 17_intro/headers/c++1998/all_attributes.cc   (test for excess errors)
    FAIL: 17_intro/headers/c++2011/all_attributes.cc   (test for excess errors)
    FAIL: 17_intro/headers/c++2014/all_attributes.cc   (test for excess errors)
    FAIL: 17_intro/headers/c++2017/all_attributes.cc   (test for excess errors)
    FAIL: 17_intro/headers/c++2020/all_attributes.cc   (test for excess errors)
    FAIL: 17_intro/names.cc  -std=gnu++17 (test for excess errors)
    on s390x-linux.
    The first 5 are due to kernel-headers not using uglified attribute names,
    where <asm/types.h> contains
    __attribute__((packed, aligned(4)))
    I've filed a downstream bugreport for this in
    https://bugzilla.redhat.com/show_bug.cgi?id=2276084
    (not really sure where to report kernel-headers issues upstream), while the
    last one is due to <sys/ucontext.h> from glibc containing:
      #ifdef __USE_MISC
      # define __ctx(fld) fld
      #else
      # define __ctx(fld) __ ## fld
      #endif
      ...
      typedef union
        {
          double  __ctx(d);
          float   __ctx(f);
        } fpreg_t;
    and g++ predefining -D_GNU_SOURCE which implies define __USE_MISC.
    
    The following patch adds a workaround for this on the libstdc++ testsuite
    side.
    
    2024-04-22  Jakub Jelinek  <jakub@redhat.com>
    
            * testsuite/17_intro/names.cc (d, f): Undefine on s390*-linux*.
            * testsuite/17_intro/headers/c++1998/all_attributes.cc (packed): Don't
            define on s390.
            * testsuite/17_intro/headers/c++2011/all_attributes.cc (packed):
            Likewise.
            * testsuite/17_intro/headers/c++2014/all_attributes.cc (packed):
            Likewise.
            * testsuite/17_intro/headers/c++2017/all_attributes.cc (packed):
            Likewise.
            * testsuite/17_intro/headers/c++2020/all_attributes.cc (packed):
            Likewise.

Diff:
---
 libstdc++-v3/testsuite/17_intro/headers/c++1998/all_attributes.cc | 4 ++++
 libstdc++-v3/testsuite/17_intro/headers/c++2011/all_attributes.cc | 4 ++++
 libstdc++-v3/testsuite/17_intro/headers/c++2014/all_attributes.cc | 4 ++++
 libstdc++-v3/testsuite/17_intro/headers/c++2017/all_attributes.cc | 4 ++++
 libstdc++-v3/testsuite/17_intro/headers/c++2020/all_attributes.cc | 4 ++++
 libstdc++-v3/testsuite/17_intro/names.cc                          | 6 ++++++
 6 files changed, 26 insertions(+)

diff --git a/libstdc++-v3/testsuite/17_intro/headers/c++1998/all_attributes.cc b/libstdc++-v3/testsuite/17_intro/headers/c++1998/all_attributes.cc
index ae81846b9a3..0c38259b74e 100644
--- a/libstdc++-v3/testsuite/17_intro/headers/c++1998/all_attributes.cc
+++ b/libstdc++-v3/testsuite/17_intro/headers/c++1998/all_attributes.cc
@@ -29,7 +29,11 @@
 # define noreturn 1
 # define visibility 1
 #endif
+#ifndef __s390__
+// kernel-headers <asm/types.h> uses __attribute__((packed,aligned(4))) on
+// S390.
 #define packed 1
+#endif
 #define pure 1
 // glibc's sysdeps/unix/sysv/linux/arm/sys/ucontext.h uses this on ARM.
 #ifndef __arm__
diff --git a/libstdc++-v3/testsuite/17_intro/headers/c++2011/all_attributes.cc b/libstdc++-v3/testsuite/17_intro/headers/c++2011/all_attributes.cc
index 5f7f31ad5da..cc34a35ae4d 100644
--- a/libstdc++-v3/testsuite/17_intro/headers/c++2011/all_attributes.cc
+++ b/libstdc++-v3/testsuite/17_intro/headers/c++2011/all_attributes.cc
@@ -29,7 +29,11 @@
 # define visibility 1
 #endif
 #define no_unique_address 1
+#ifndef __s390__
+// kernel-headers <asm/types.h> uses __attribute__((packed,aligned(4))) on
+// S390.
 #define packed 1
+#endif
 #define pure 1
 // glibc's sysdeps/unix/sysv/linux/arm/sys/ucontext.h uses this on ARM.
 #ifndef __arm__
diff --git a/libstdc++-v3/testsuite/17_intro/headers/c++2014/all_attributes.cc b/libstdc++-v3/testsuite/17_intro/headers/c++2014/all_attributes.cc
index befc1ca8bfb..80d0852453b 100644
--- a/libstdc++-v3/testsuite/17_intro/headers/c++2014/all_attributes.cc
+++ b/libstdc++-v3/testsuite/17_intro/headers/c++2014/all_attributes.cc
@@ -29,7 +29,11 @@
 # define visibility 1
 #endif
 #define no_unique_address 1
+#ifndef __s390__
+// kernel-headers <asm/types.h> uses __attribute__((packed,aligned(4))) on
+// S390.
 #define packed 1
+#endif
 #define pure 1
 // glibc's sysdeps/unix/sysv/linux/arm/sys/ucontext.h uses this on ARM.
 #ifndef __arm__
diff --git a/libstdc++-v3/testsuite/17_intro/headers/c++2017/all_attributes.cc b/libstdc++-v3/testsuite/17_intro/headers/c++2017/all_attributes.cc
index a59fe1be5fa..4f8ba4d10ba 100644
--- a/libstdc++-v3/testsuite/17_intro/headers/c++2017/all_attributes.cc
+++ b/libstdc++-v3/testsuite/17_intro/headers/c++2017/all_attributes.cc
@@ -28,7 +28,11 @@
 # define visibility 1
 #endif
 #define no_unique_address 1
+#ifndef __s390__
+// kernel-headers <asm/types.h> uses __attribute__((packed,aligned(4))) on
+// S390.
 #define packed 1
+#endif
 #define pure 1
 // glibc's sysdeps/unix/sysv/linux/arm/sys/ucontext.h uses this on ARM.
 #ifndef __arm__
diff --git a/libstdc++-v3/testsuite/17_intro/headers/c++2020/all_attributes.cc b/libstdc++-v3/testsuite/17_intro/headers/c++2020/all_attributes.cc
index 0c54ab6421d..3de1488a737 100644
--- a/libstdc++-v3/testsuite/17_intro/headers/c++2020/all_attributes.cc
+++ b/libstdc++-v3/testsuite/17_intro/headers/c++2020/all_attributes.cc
@@ -27,7 +27,11 @@
 # define cold 1
 # define visibility 1
 #endif
+#ifndef __s390__
+// kernel-headers <asm/types.h> uses __attribute__((packed,aligned(4))) on
+// S390.
 #define packed 1
+#endif
 #define pure 1
 // glibc's sysdeps/unix/sysv/linux/arm/sys/ucontext.h uses this on ARM.
 #ifndef __arm__
diff --git a/libstdc++-v3/testsuite/17_intro/names.cc b/libstdc++-v3/testsuite/17_intro/names.cc
index 784da9a7352..9b0ffcb50b2 100644
--- a/libstdc++-v3/testsuite/17_intro/names.cc
+++ b/libstdc++-v3/testsuite/17_intro/names.cc
@@ -270,6 +270,12 @@
 #undef u
 #endif
 
+#if defined (__linux__) && defined (__s390__)
+// <sys/ucontext.h> defines fpreg_t::d and fpreg_t::f
+#undef d
+#undef f
+#endif
+
 #if defined (__linux__) && defined (__sparc__)
 #undef y
 #endif

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

only message in thread, other threads:[~2024-04-22 16:01 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2024-04-22 16:01 [gcc r14-10076] libstdc++: Workaround kernel-headers on s390x-linux Jakub Jelinek

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