V3 [PATCH] Deprecate SIGSTKSZ/MINSIGSTKSZ with _SC_SIGSTKSZ_SOURCE

H.J. Lu hjl.tools@gmail.com
Mon Jan 25 13:56:19 GMT 2021


When _SC_SIGSTKSZ_SOURCE is defined, deprecate SIGSTKSZ and MINSIGSTKSZ:

tst-minsigstksz-5.c: In function ‘do_test’:
tst-minsigstksz-5.c:46:3: warning: ‘__MINSIGSTKSZ’ is deprecated: Use sysconf (_SC_MINSIGSTKSZ) instead of MINSIGSTKSZ [-Wdeprecated-declarations]
   46 |   void *stack_bottom = stack_buffer + (stack_buffer_size + MINSIGSTKSZ) / 2;
      |   ^~~~
In file included from ../signal/signal.h:315,
                 from ../include/signal.h:2,
                 from tst-minsigstksz-5.c:19:
../sysdeps/unix/sysv/linux/bits/sigstksz.h:35:1: note: declared here
   35 | __MINSIGSTKSZ (void)
      | ^~~~~~~~~~~~~
---
 sysdeps/unix/sysv/linux/Makefile        | 22 ++++++++++++++++++++++
 sysdeps/unix/sysv/linux/bits/sigstksz.h | 18 ++++++++++++++++--
 2 files changed, 38 insertions(+), 2 deletions(-)

diff --git a/sysdeps/unix/sysv/linux/Makefile b/sysdeps/unix/sysv/linux/Makefile
index 472eab700d..2df265fb03 100644
--- a/sysdeps/unix/sysv/linux/Makefile
+++ b/sysdeps/unix/sysv/linux/Makefile
@@ -49,6 +49,10 @@ CFLAGS-assert.c += -DFATAL_PREPARE_INCLUDE='<fatal-prepare.h>'
 CFLAGS-assert-perr.c += -DFATAL_PREPARE_INCLUDE='<fatal-prepare.h>'
 endif
 
+ifeq ($(subdir),debug)
+CFLAGS-tst-longjmp_chk2.c += -Wno-deprecated-declarations
+endif
+
 ifeq ($(subdir),malloc)
 CFLAGS-malloc.c += -DMORECORE_CLEARS=2
 endif
@@ -193,6 +197,8 @@ sysdep_routines += ntp_gettime ntp_gettimex
 endif
 
 ifeq ($(subdir),signal)
+CFLAGS-tst-minsigstksz-5.c += -Wno-deprecated-declarations
+
 tests-special += $(objpfx)tst-signal-numbers.out
 # Depending on signal.o* is a hack.  What we actually want is a dependency
 # on signal.h and everything it includes.  That's impractical to write
@@ -227,10 +233,18 @@ $(objpfx)tst-socket-consts.out: ../sysdeps/unix/sysv/linux/tst-socket-consts.py
 	< /dev/null > $@ 2>&1; $(evaluate-test)
 endif # $(subdir) == socket
 
+ifeq ($(subdir),string)
+CFLAGS-tst-xbzero-opt.c += -Wno-deprecated-declarations
+endif
+
 ifeq ($(subdir),sunrpc)
 sysdep_headers += nfs/nfs.h
 endif
 
+ifeq ($(subdir),support)
+CFLAGS-xsigstack.c += -Wno-deprecated-declarations
+endif
+
 ifeq ($(subdir),termios)
 sysdep_headers += termio.h
 endif
@@ -306,5 +320,13 @@ CFLAGS-gai.c += -DNEED_NETLINK
 endif
 
 ifeq ($(subdir),nptl)
+CFLAGS-tst-cancel20.c += -Wno-deprecated-declarations
+CFLAGS-tst-cancel21.c += -Wno-deprecated-declarations
+CFLAGS-tst-cancel20-static.c += -Wno-deprecated-declarations
+CFLAGS-tst-cancel21-static.c += -Wno-deprecated-declarations
+CFLAGS-tst-cancelx20.c += -Wno-deprecated-declarations
+CFLAGS-tst-cancelx21.c += -Wno-deprecated-declarations
+CFLAGS-tst-signal6.c += -Wno-deprecated-declarations
+
 tests += tst-align-clone tst-getpid1
 endif
diff --git a/sysdeps/unix/sysv/linux/bits/sigstksz.h b/sysdeps/unix/sysv/linux/bits/sigstksz.h
index 926508f2b4..a1a3849094 100644
--- a/sysdeps/unix/sysv/linux/bits/sigstksz.h
+++ b/sysdeps/unix/sysv/linux/bits/sigstksz.h
@@ -23,11 +23,25 @@
 #if defined __USE_SC_SIGSTKSZ && __USE_SC_SIGSTKSZ
 # include <unistd.h>
 
+__attribute_deprecated_msg__ ("Use sysconf (_SC_SIGSTKSZ) instead of SIGSTKSZ")
+__extern_always_inline long
+__SIGSTKSZ (void)
+{
+  return sysconf (_SC_SIGSTKSZ);
+}
+
+__attribute_deprecated_msg__ ("Use sysconf (_SC_MINSIGSTKSZ) instead of MINSIGSTKSZ")
+__extern_always_inline long
+__MINSIGSTKSZ (void)
+{
+  return sysconf (_SC_SIGSTKSZ);
+}
+
 /* Default stack size for a signal handler: sysconf (SC_SIGSTKSZ).  */
 # undef SIGSTKSZ
-# define SIGSTKSZ sysconf (_SC_SIGSTKSZ)
+# define SIGSTKSZ __SIGSTKSZ ()
 
 /* Minimum stack size for a signal handler: SIGSTKSZ.  */
 # undef MINSIGSTKSZ
-# define MINSIGSTKSZ SIGSTKSZ
+# define MINSIGSTKSZ __MINSIGSTKSZ ()
 #endif
-- 
2.29.2



More information about the Libc-alpha mailing list