From 02802fafcf6e11ea3f998f685035ffe568dfddeb Mon Sep 17 00:00:00 2001 From: Florian Weimer Date: Mon, 25 May 2020 18:32:28 +0200 Subject: signal: Deprecate additional legacy signal handling functions This needs a few test adjustments: In some cases, sigignore was used for convenience (replaced with xsignal with SIG_IGN). Tests for the deprecated functions need to disable -Wdeprecated-declarations, and for the sigmask deprecation, -Wno-error. Reviewed-by: Adhemerval Zanella --- nptl/Makefile | 7 +++++++ nptl/tst-cancel4.c | 7 +++++++ nptl/tst-exec1.c | 7 ++----- nptl/tst-exec2.c | 7 ++----- nptl/tst-exec3.c | 7 ++----- nptl/tst-exec4.c | 8 ++------ nptl/tst-exec5.c | 6 +----- 7 files changed, 23 insertions(+), 26 deletions(-) (limited to 'nptl') diff --git a/nptl/Makefile b/nptl/Makefile index e5686b20ac..587b241367 100644 --- a/nptl/Makefile +++ b/nptl/Makefile @@ -510,6 +510,13 @@ endif # function frequently to get a thread-specific handle. CFLAGS-pthread_self.os += -fomit-frame-pointer +# The sigmask macro is deprecated and triggers are compiler warning +# which cannot be suppressed (as of GCC 9). +CFLAGS-tst-cancel4.c += -Wno-error +CFLAGS-tst-cancel5.c += -Wno-error +CFLAGS-tst-cancelx4.c += -Wno-error +CFLAGS-tst-cancelx5.c += -Wno-error + # Run the cancellation and cleanup tests also for the modern, exception-based # implementation. For this we have to pass the -fexceptions parameter. CFLAGS-tst-cancelx2.c += -fexceptions diff --git a/nptl/tst-cancel4.c b/nptl/tst-cancel4.c index 652668537a..be7a48e253 100644 --- a/nptl/tst-cancel4.c +++ b/nptl/tst-cancel4.c @@ -39,6 +39,7 @@ #include #include #include +#include /* Since STREAMS are not supported in the standard Linux kernel and @@ -527,7 +528,13 @@ tf_sigpause (void *arg) pthread_cleanup_push (cl, NULL); + /* This tests the deprecated sigpause and sigmask functions. The + file is compiled with -Wno-errno so that the sigmask deprecation + warning is not fatal. */ + DIAG_PUSH_NEEDS_COMMENT; + DIAG_IGNORE_NEEDS_COMMENT (4.9, "-Wdeprecated-declarations"); sigpause (sigmask (SIGINT)); + DIAG_POP_NEEDS_COMMENT; pthread_cleanup_pop (0); diff --git a/nptl/tst-exec1.c b/nptl/tst-exec1.c index e1a5baa41f..892107d4c7 100644 --- a/nptl/tst-exec1.c +++ b/nptl/tst-exec1.c @@ -27,6 +27,7 @@ #include #include #include +#include static void * @@ -56,11 +57,7 @@ do_test (void) } /* Not interested in knowing when the pipe is closed. */ - if (sigignore (SIGPIPE) != 0) - { - puts ("sigignore failed"); - exit (1); - } + xsignal (SIGPIPE, SIG_IGN); posix_spawn_file_actions_t a; if (posix_spawn_file_actions_init (&a) != 0) diff --git a/nptl/tst-exec2.c b/nptl/tst-exec2.c index 3d3fb430bf..f57903da1e 100644 --- a/nptl/tst-exec2.c +++ b/nptl/tst-exec2.c @@ -27,6 +27,7 @@ #include #include #include +#include static void * @@ -56,11 +57,7 @@ do_test (void) } /* Not interested in knowing when the pipe is closed. */ - if (sigignore (SIGPIPE) != 0) - { - puts ("sigignore failed"); - exit (1); - } + xsignal (SIGPIPE, SIG_IGN); pid_t pid = fork (); if (pid == -1) diff --git a/nptl/tst-exec3.c b/nptl/tst-exec3.c index 8a018e916e..b849d3aef7 100644 --- a/nptl/tst-exec3.c +++ b/nptl/tst-exec3.c @@ -27,6 +27,7 @@ #include #include #include +#include static void * @@ -50,11 +51,7 @@ do_test (void) } /* Not interested in knowing when the pipe is closed. */ - if (sigignore (SIGPIPE) != 0) - { - puts ("sigignore failed"); - exit (1); - } + xsignal (SIGPIPE, SIG_IGN); pid_t pid = fork (); if (pid == -1) diff --git a/nptl/tst-exec4.c b/nptl/tst-exec4.c index cf5998219b..2f32389f41 100644 --- a/nptl/tst-exec4.c +++ b/nptl/tst-exec4.c @@ -22,17 +22,13 @@ #include #include #include - +#include static void * tf (void *arg) { /* Ignore SIGUSR1 and block SIGUSR2. */ - if (sigignore (SIGUSR1) != 0) - { - puts ("sigignore failed"); - exit (1); - } + xsignal (SIGUSR1, SIG_IGN); sigset_t ss; sigemptyset (&ss); diff --git a/nptl/tst-exec5.c b/nptl/tst-exec5.c index 02628931c8..c77f856263 100644 --- a/nptl/tst-exec5.c +++ b/nptl/tst-exec5.c @@ -86,11 +86,7 @@ do_test (void) } /* Not interested in knowing when the pipe is closed. */ - if (sigignore (SIGPIPE) != 0) - { - puts ("error: sigignore failed"); - exit (1); - } + xsignal (SIGPIPE, SIG_IGN); /* To synchronize with the thread. */ if (pthread_barrier_init (&b, NULL, 2) != 0) -- cgit v1.2.3-70-g09d2