Skip to contentSkip to conversation

openposix/20-1-buildonly, signal_h_23-1: Fix compiler errors on newer glibc

PATCH New Xiao Yang 2 participants 5 messages Dec 20, 2018 – Jan 21, 2019

lore
Share & tools
lore

Xiao Yang

author
#0 lore raw

PATCH 1/1 openposix/20-1-buildonly, signal_h_23-1: Fix compiler errors on newer glibc

Since glibc 2.26, the __USE_XOPEN2K8 macro defined by _POSIX_C_SOURCE = 200809L && _XOPEN_SOURCE = 700 resulted in the following compiler errors, because both sigstack structure and bsd_signal function are only declared if __USE_XOPEN_EXTENDED is
defined and __USE_XOPEN2K8 is not defined:
-------------------------------------------------------------------------------
20-1-buildonly.c:13:8: error: invalid use of undefined type ‘struct sigstack’
sp = t.ss_sp;
...
signal_h/23-1.c:15:13: error: ‘bsd_signal’ undeclared (first use in this function); did you mean ‘psignal’?
dummyvar = bsd_signal;
-------------------------------------------------------------------------------

We just use _POSIX_C_SOURCE = 200112L && _XOPEN_SOURCE = 600 to run these tests.

References:
https://sourceware.org/git/?p=glibc.git;a=commit;h=666c0c5efa6db73632a6894bf028fef9f3b60d71
https://sourceware.org/git/?p=glibc.git;a=commit;h=4c3992fc459322a7c712700ba3244fcb125163d7

---
 .../conformance/definitions/signal_h/20-1-buildonly.c              | 7 +++++++
 .../open_posix_testsuite/conformance/definitions/signal_h/23-1.c   | 7 +++++++
 2 files changed, 14 insertions(+)
testcases/open_posix_testsuite/conformance/definitions/signal_h/20-1-buildonly.c +7 -0
index 21d8cb4..fdb2fb8 100644
@@ -2,6 +2,13 @@
      Test the definition of sigstack.
    */
 
+#if _POSIX_C_SOURCE >= 200809L
+# undef _POSIX_C_SOURCE
+# undef _XOPEN_SOURCE
+# define _POSIX_C_SOURCE	200112L
+# define _XOPEN_SOURCE		600
+#endif
+
 #include <signal.h>
 
 struct sigstack this_type_should_exist, t;
testcases/open_posix_testsuite/conformance/definitions/signal_h/23-1.c +7 -0
index 9a4d200..4f22e07 100644
@@ -5,6 +5,13 @@
      is declared.
    */
 
+#if _POSIX_C_SOURCE >= 200809L
+# undef _POSIX_C_SOURCE
+# undef _XOPEN_SOURCE
+# define _POSIX_C_SOURCE	200112L
+# define _XOPEN_SOURCE		600
+#endif
+
 #include <signal.h>
 
 typedef void (*(*bsd_signal_test) (int, void (*)(int))) (int);
Signature · 1 line
1.8.3.1
author
#1 lore raw

PATCH 1/1 openposix/20-1-buildonly, signal_h_23-1: Fix compiler errors on newer glibc

Hi,

Ping. :-)

I also fix the wrong version of _POSIX_C_SOURCE in bsd_signal(3) manpage, as below:
https://git.kernel.org/pub/scm/docs/man-pages/man-pages.git/commit/?id=8eb09b1283be57333e7c6223080e7449479b7677

Best Regards,
Xiao Yang

Quoted 60 lines · Xiao Yang

Since glibc 2.26, the __USE_XOPEN2K8 macro defined by _POSIX_C_SOURCE = 200809L&& _XOPEN_SOURCE = 700 resulted in the following compiler errors, because both sigstack structure and bsd_signal function are only declared if __USE_XOPEN_EXTENDED is
defined and __USE_XOPEN2K8 is not defined:
-------------------------------------------------------------------------------
20-1-buildonly.c:13:8: error: invalid use of undefined type ‘struct sigstack’
sp = t.ss_sp;
...
signal_h/23-1.c:15:13: error: ‘bsd_signal’ undeclared (first use in this function); did you mean ‘psignal’?
dummyvar = bsd_signal;
-------------------------------------------------------------------------------

We just use _POSIX_C_SOURCE = 200112L&& _XOPEN_SOURCE = 600 to run these tests.

References:
https://sourceware.org/git/?p=glibc.git;a=commit;h=666c0c5efa6db73632a6894bf028fef9f3b60d71
https://sourceware.org/git/?p=glibc.git;a=commit;h=4c3992fc459322a7c712700ba3244fcb125163d7

---
  .../conformance/definitions/signal_h/20-1-buildonly.c              | 7 +++++++
  .../open_posix_testsuite/conformance/definitions/signal_h/23-1.c   | 7 +++++++
  2 files changed, 14 insertions(+)
testcases/open_posix_testsuite/conformance/definitions/signal_h/20-1-buildonly.c +7 -0
index 21d8cb4..fdb2fb8 100644
@@ -2,6 +2,13 @@
       Test the definition of sigstack.
     */
 
+#if _POSIX_C_SOURCE>= 200809L
+# undef _POSIX_C_SOURCE
+# undef _XOPEN_SOURCE
+# define _POSIX_C_SOURCE	200112L
+# define _XOPEN_SOURCE		600
+#endif
+
  #include<signal.h>
 
  struct sigstack this_type_should_exist, t;
testcases/open_posix_testsuite/conformance/definitions/signal_h/23-1.c +7 -0
index 9a4d200..4f22e07 100644
@@ -5,6 +5,13 @@
       is declared.
     */
 
+#if _POSIX_C_SOURCE>= 200809L
+# undef _POSIX_C_SOURCE
+# undef _XOPEN_SOURCE
+# define _POSIX_C_SOURCE	200112L
+# define _XOPEN_SOURCE		600
+#endif
+
  #include<signal.h>
 
  typedef void (*(*bsd_signal_test) (int, void (*)(int))) (int);
author
#2 lore raw

PATCH v2 1/1 openposix/20-1-buildonly: Remove test for sigstack structure

Since glibc 2.26, the __USE_XOPEN2K8 macro defined by default _POSIX_C_SOURCE = 200809L
&& _XOPEN_SOURCE = 700 in CFLAGS triggered the following compiler errors, because both sigstack structure and bsd_signal function are only declared if __USE_XOPEN_EXTENDED is defined and __USE_XOPEN2K8 is not defined:
-------------------------------------------------------------------------------
20-1-buildonly.c:13:8: error: invalid use of undefined type 'struct sigstack'
sp = t.ss_sp;
...
signal_h/23-1.c:15:13: error: 'bsd_signal' undeclared (first use in this function); did you mean 'psignal'?
dummyvar = bsd_signal;
-------------------------------------------------------------------------------

signal_h/23-1.c has been removed by commit d256a97, so just remove obsolete signal_h/20-1-buildonly.c as well.

References:
https://sourceware.org/git/?p=glibc.git;a=commit;h=666c0c5efa6db73632a6894bf028fef9f3b60d71
https://sourceware.org/git/?p=glibc.git;a=commit;h=4c3992fc459322a7c712700ba3244fcb125163d7

---
 .../conformance/definitions/signal_h/20-1-buildonly.c   | 17 -----------------
 1 file changed, 17 deletions(-)
 delete mode 100644 testcases/open_posix_testsuite/conformance/definitions/signal_h/20-1-buildonly.c
testcases/open_posix_testsuite/conformance/definitions/signal_h/20-1-buildonly.c deleted +0 -17
deleted file mode 100644
index 21d8cb4..0000000
@@ -1,17 +0,0 @@
-  /*
-     Test the definition of sigstack.
-   */
-
-#include <signal.h>
-
-struct sigstack this_type_should_exist, t;
-int onstack;
-void *sp;
-
-int dummyfcn(void)
-{
-	sp = t.ss_sp;
-	onstack = t.ss_onstack;
-
-	return 0;
-}
Signature · 1 line
1.8.3.1
#3 lore raw

PATCH v2 1/1 openposix/20-1-buildonly: Remove test for sigstack structure

LGTM!
-Enji

Quoted 51 lines · Xiao Yang

Since glibc 2.26, the __USE_XOPEN2K8 macro defined by default _POSIX_C_SOURCE = 200809L
&& _XOPEN_SOURCE = 700 in CFLAGS triggered the following compiler errors, because both sigstack structure and bsd_signal function are only declared if __USE_XOPEN_EXTENDED is defined and __USE_XOPEN2K8 is not defined:
-------------------------------------------------------------------------------
20-1-buildonly.c:13:8: error: invalid use of undefined type 'struct sigstack'
sp = t.ss_sp;
...
signal_h/23-1.c:15:13: error: 'bsd_signal' undeclared (first use in this function); did you mean 'psignal'?
dummyvar = bsd_signal;
-------------------------------------------------------------------------------

signal_h/23-1.c has been removed by commit d256a97, so just remove obsolete signal_h/20-1-buildonly.c as well.

References:
https://sourceware.org/git/?p=glibc.git;a=commit;h=666c0c5efa6db73632a6894bf028fef9f3b60d71
https://sourceware.org/git/?p=glibc.git;a=commit;h=4c3992fc459322a7c712700ba3244fcb125163d7

---
.../conformance/definitions/signal_h/20-1-buildonly.c | 17 -----------------

1 file changed, 17 deletions(-)

delete mode 100644 testcases/open_posix_testsuite/conformance/definitions/signal_h/20-1-buildonly.c

testcases/open_posix_testsuite/conformance/definitions/signal_h/20-1-buildonly.c deleted +0 -18
deleted file mode 100644
index 21d8cb4..0000000
@@ -1,17 +0,0 @@
-  /*
-     Test the definition of sigstack.
-   */
-
-#include <signal.h>
-
-struct sigstack this_type_should_exist, t;
-int onstack;
-void *sp;
-
-int dummyfcn(void)
-{
-	sp = t.ss_sp;
-	onstack = t.ss_onstack;
-
-	return 0;
-}
--
Quoted 4 lines

1.8.3.1

-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 833 bytes
Desc: Message signed with OpenPGP
URL: <http://lists.linux.it/pipermail/ltp/attachments/20190120/4bb8e77a/attachment.sig>

author
#4 lore raw

PATCH v2 1/1 openposix/20-1-buildonly: Remove test for sigstack structure

Quoted 2 lines · Enji Cooper

LGTM!
-Enji

Hi Enji,

Pushed, thanks. :-)

Best Regards,
Xiao Yang

Quoted 55 lines
Quoted 55 lines · Xiao Yang

Since glibc 2.26, the __USE_XOPEN2K8 macro defined by default _POSIX_C_SOURCE = 200809L
&& _XOPEN_SOURCE = 700 in CFLAGS triggered the following compiler errors, because both sigstack structure and bsd_signal function are only declared if __USE_XOPEN_EXTENDED is defined and __USE_XOPEN2K8 is not defined:
-------------------------------------------------------------------------------
20-1-buildonly.c:13:8: error: invalid use of undefined type 'struct sigstack'
sp = t.ss_sp;
...
signal_h/23-1.c:15:13: error: 'bsd_signal' undeclared (first use in this function); did you mean 'psignal'?
dummyvar = bsd_signal;
-------------------------------------------------------------------------------

signal_h/23-1.c has been removed by commit d256a97, so just remove obsolete signal_h/20-1-buildonly.c as well.

References:
https://sourceware.org/git/?p=glibc.git;a=commit;h=666c0c5efa6db73632a6894bf028fef9f3b60d71
https://sourceware.org/git/?p=glibc.git;a=commit;h=4c3992fc459322a7c712700ba3244fcb125163d7

---
.../conformance/definitions/signal_h/20-1-buildonly.c | 17 -----------------

1 file changed, 17 deletions(-)

delete mode 100644 testcases/open_posix_testsuite/conformance/definitions/signal_h/20-1-buildonly.c

testcases/open_posix_testsuite/conformance/definitions/signal_h/20-1-buildonly.c deleted +0 -18
deleted file mode 100644
index 21d8cb4..0000000
@@ -1,17 +0,0 @@
-  /*
-     Test the definition of sigstack.
-   */
-
-#include<signal.h>
-
-struct sigstack this_type_should_exist, t;
-int onstack;
-void *sp;
-
-int dummyfcn(void)
-{
-	sp = t.ss_sp;
-	onstack = t.ss_onstack;
-
-	return 0;
-}
--

1.8.3.1