summaryrefslogtreecommitdiff
path: root/proto.h
diff options
context:
space:
mode:
authorDavid Mitchell <davem@iabyn.com>2019-11-11 10:46:56 +0000
committerDavid Mitchell <davem@iabyn.com>2019-11-18 09:34:40 +0000
commit5e7940ceb0d598dfa2aefdcdbda1f1dd8caa6bfd (patch)
treebba6083512c9b38309f000f789e1721c66e0a7e5 /proto.h
parente7124897b9f4ae403795f9db247a331b6da9751e (diff)
downloadperl-5e7940ceb0d598dfa2aefdcdbda1f1dd8caa6bfd.tar.gz
add PERL_USE_3ARG_SIGHANDLER macro
There are a bunch of places in core that do #if defined(HAS_SIGACTION) && defined(SA_SIGINFO) to decide whether the C signal handler function should be declared with, and called with, 1 arg or 3 args. This commit just adds #if defined(HAS_SIGACTION) && defined(SA_SIGINFO) # define PERL_USE_3ARG_SIGHANDLER #endif Then uses the new macro in all other places rather than checking HAS_SIGACTION and SA_SIGINFO. Thus there is no functional change; it just makes the code more readable. However, it turns out that all is not well with core's use of 1-arg versus 3-arg, and the few commits will fix this.
Diffstat (limited to 'proto.h')
-rw-r--r--proto.h24
1 files changed, 12 insertions, 12 deletions
diff --git a/proto.h b/proto.h
index c3cd7c871d..8c3018f3cf 100644
--- a/proto.h
+++ b/proto.h
@@ -4094,12 +4094,6 @@ STATIC const char* S_my_nl_langinfo(const int item, bool toggle);
#define PERL_ARGS_ASSERT_MY_NL_LANGINFO
# endif
#endif
-#if !(defined(HAS_SIGACTION) && defined(SA_SIGINFO))
-PERL_CALLCONV Signal_t Perl_csighandler(int sig);
-#define PERL_ARGS_ASSERT_CSIGHANDLER
-PERL_CALLCONV Signal_t Perl_sighandler(int sig);
-#define PERL_ARGS_ASSERT_SIGHANDLER
-#endif
#if !(defined(PERL_DEFAULT_DO_EXEC3_IMPLEMENTATION))
PERL_CALLCONV bool Perl_do_exec(pTHX_ const char* cmd);
#define PERL_ARGS_ASSERT_DO_EXEC \
@@ -4112,6 +4106,12 @@ PERL_CALLCONV void* Perl_my_cxt_init(pTHX_ int *indexp, size_t size);
assert(indexp)
# endif
#endif
+#if !(defined(PERL_USE_3ARG_SIGHANDLER))
+PERL_CALLCONV Signal_t Perl_csighandler(int sig);
+#define PERL_ARGS_ASSERT_CSIGHANDLER
+PERL_CALLCONV Signal_t Perl_sighandler(int sig);
+#define PERL_ARGS_ASSERT_SIGHANDLER
+#endif
#if !(defined(_MSC_VER))
PERL_CALLCONV_NO_RET int Perl_magic_regdatum_set(pTHX_ SV* sv, MAGIC* mg)
__attribute__noreturn__;
@@ -4564,12 +4564,6 @@ PERL_CALLCONV int Perl_PerlProc_pipe_cloexec(pTHX_ int *pipefd)
assert(pipefd)
#endif
-#if defined(HAS_SIGACTION) && defined(SA_SIGINFO)
-PERL_CALLCONV Signal_t Perl_csighandler(int sig, Siginfo_t *info, void *uap);
-#define PERL_ARGS_ASSERT_CSIGHANDLER
-PERL_CALLCONV Signal_t Perl_sighandler(int sig, Siginfo_t *info, void *uap);
-#define PERL_ARGS_ASSERT_SIGHANDLER
-#endif
#if defined(HAS_SOCKET)
PERL_CALLCONV int Perl_PerlSock_accept_cloexec(pTHX_ int listenfd, struct sockaddr *addr, Sock_size_t *addrlen)
__attribute__warn_unused_result__;
@@ -6441,6 +6435,12 @@ PERL_CALLCONV Malloc_t Perl_mem_log_realloc(const UV n, const UV typesize, const
STATIC void S_pidgone(pTHX_ Pid_t pid, int status);
#define PERL_ARGS_ASSERT_PIDGONE
#endif
+#if defined(PERL_USE_3ARG_SIGHANDLER)
+PERL_CALLCONV Signal_t Perl_csighandler(int sig, Siginfo_t *info, void *uap);
+#define PERL_ARGS_ASSERT_CSIGHANDLER
+PERL_CALLCONV Signal_t Perl_sighandler(int sig, Siginfo_t *info, void *uap);
+#define PERL_ARGS_ASSERT_SIGHANDLER
+#endif
#if defined(UNLINK_ALL_VERSIONS)
PERL_CALLCONV I32 Perl_unlnk(pTHX_ const char* f);
#define PERL_ARGS_ASSERT_UNLNK \