Assume sigaction::sa_handler always takes "int"

This is the standard and there doesn't seem to be any contemporary
systems where this is not the case. The configure check for it was
originally added in 101c20d554 (attempting to fix sa_handler signature
for IRIX, 2000-04-01), but IRIX is not supported/doesn't exist any
longer, so don't waste time on checking for this.

The real motivation for this change is that the test failed in CMake
builds, showing just

-- Performing Test wxTYPE_SA_HANDLER_IS_INT - Failed

in the log and then resulting in -fpermissive warnings when assigning
wxFatalSignalHandler to sa_handler and it's simpler to just remove the
check than to debug it.

See #23664.
This commit is contained in:
Vadim Zeitlin 2023-06-23 01:23:27 +02:00
parent 4cd8869218
commit f072544bd5
9 changed files with 6402 additions and 7860 deletions

View file

@ -200,23 +200,6 @@ if(UNIX)
endif()
endif()
if(wxUSE_ON_FATAL_EXCEPTION)
wx_check_cxx_source_compiles(
"return 0; }
extern void testSigHandler(int) { };
int foo() {
struct sigaction sa;
sa.sa_handler = testSigHandler;"
wxTYPE_SA_HANDLER_IS_INT
signal.h
)
if(wxTYPE_SA_HANDLER_IS_INT)
set(wxTYPE_SA_HANDLER int)
else()
set(wxTYPE_SA_HANDLER void)
endif()
endif()
# backtrace() and backtrace_symbols() for wxStackWalker
if(wxUSE_STACKWALKER)
wx_check_cxx_source_compiles("

View file

@ -791,9 +791,6 @@
/* The type of statvfs(2) argument */
#cmakedefine WX_STATFS_T @WX_STATFS_T@
/* The signal handler prototype */
#define wxTYPE_SA_HANDLER @wxTYPE_SA_HANDLER@
/* gettimeofday() usually takes 2 arguments, but some really old systems might
* have only one, in which case define WX_GETTIMEOFDAY_NO_TZ */
#cmakedefine WX_GETTIMEOFDAY_NO_TZ 1

14209
configure vendored

File diff suppressed because it is too large Load diff

View file

@ -3890,28 +3890,6 @@ if test "$wxUSE_ON_FATAL_EXCEPTION" = "yes" -a "$wxUSE_UNIX" = "yes"; then
AC_MSG_WARN([No POSIX signal functions on this system, wxApp::OnFatalException will not be called])
wxUSE_ON_FATAL_EXCEPTION=no
fi
if test "$wxUSE_ON_FATAL_EXCEPTION" = "yes"; then
AC_CACHE_CHECK([for sa_handler type], wx_cv_type_sa_handler,
[
dnl C compiler happily compiles the code even if there is type mismatch
AC_LANG_PUSH(C++)
AC_TRY_COMPILE([#include <signal.h>],
[
extern void testSigHandler(int);
struct sigaction sa;
sa.sa_handler = testSigHandler;
], [
wx_cv_type_sa_handler=int
], [
wx_cv_type_sa_handler=void
])
AC_LANG_POP()
])
AC_DEFINE_UNQUOTED(wxTYPE_SA_HANDLER, $wx_cv_type_sa_handler)
fi
fi
dnl backtrace() and backtrace_symbols() for wxStackWalker

View file

@ -51,8 +51,6 @@
#define wxSIZE_T_IS_UINT 1
#define wxWCHAR_T_IS_REAL_TYPE 1
#define wxTYPE_SA_HANDLER int
#define wxUSE_SELECT_DISPATCHER 1
#ifdef HAVE_PTHREAD_CANCEL

View file

@ -31,7 +31,6 @@
#define WX_SOCKLEN_T socklen_t
#define SOCKOPTLEN_T socklen_t
#define WX_STATFS_T struct statfs
#define wxTYPE_SA_HANDLER int
#define WX_GMTOFF_IN_TM 1
#define HAVE_PW_GECOS 1
#define HAVE_DLOPEN 1

View file

@ -790,9 +790,6 @@
/* The type of statvfs(2) argument */
#undef WX_STATFS_T
/* The signal handler prototype */
#undef wxTYPE_SA_HANDLER
/* gettimeofday() usually takes 2 arguments, but some really old systems might
* have only one, in which case define WX_GETTIMEOFDAY_NO_TZ */
#undef WX_GETTIMEOFDAY_NO_TZ

View file

@ -864,9 +864,6 @@ typedef pid_t GPid;
/* The type of statvfs(2) argument */
#undef WX_STATFS_T
/* The signal handler prototype */
#define wxTYPE_SA_HANDLER int
/* gettimeofday() usually takes 2 arguments, but some really old systems might
* have only one, in which case define WX_GETTIMEOFDAY_NO_TZ */
#undef WX_GETTIMEOFDAY_NO_TZ

View file

@ -1470,7 +1470,7 @@ bool wxUnsetEnv(const wxString& variable)
#include <signal.h>
extern "C" {
static void wxFatalSignalHandler(wxTYPE_SA_HANDLER)
static void wxFatalSignalHandler(int WXUNUSED(signal))
{
if ( wxTheApp )
{