summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorBram Moolenaar <Bram@vim.org>2022-06-05 22:05:19 +0100
committerBram Moolenaar <Bram@vim.org>2022-06-05 22:05:19 +0100
commit99c48fe9974b8d70ca33674658a3da722b0d6466 (patch)
treedffbad61a62ddf128e2c258fc24bd96c5ccaf4bb
parentde1d7343794a950bd624043901ce7b3caca3c49b (diff)
patch 8.2.5061: C89 requires signal handlers to return voidv8.2.5061
Problem: C89 requires signal handlers to return void. Solution: Drop RETSIGTYPE and hard-code a void return value.
-rwxr-xr-xsrc/auto/configure42
-rw-r--r--src/config.h.in6
-rw-r--r--src/configure.ac11
-rw-r--r--src/if_cscope.c3
-rw-r--r--src/os_mac.h2
-rw-r--r--src/os_unix.c93
-rw-r--r--src/os_vms_conf.h9
-rw-r--r--src/osdef1.h.in4
-rw-r--r--src/pty.c6
-rw-r--r--src/version.c2
10 files changed, 49 insertions, 129 deletions
diff --git a/src/auto/configure b/src/auto/configure
index 3aef2f13ee..3cb6e51fee 100755
--- a/src/auto/configure
+++ b/src/auto/configure
@@ -12412,48 +12412,6 @@ $as_echo "don't know" >&6; }
fi
-{ $as_echo "$as_me:${as_lineno-$LINENO}: checking return type of signal handlers" >&5
-$as_echo_n "checking return type of signal handlers... " >&6; }
-if ${ac_cv_type_signal+:} false; then :
- $as_echo_n "(cached) " >&6
-else
- cat confdefs.h - <<_ACEOF >conftest.$ac_ext
-/* end confdefs.h. */
-#include <sys/types.h>
-#include <signal.h>
-
-int
-main ()
-{
-return *(signal (0, 0)) (0) == 1;
- ;
- return 0;
-}
-_ACEOF
-if ac_fn_c_try_compile "$LINENO"; then :
- ac_cv_type_signal=int
-else
- ac_cv_type_signal=void
-fi
-rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
-fi
-{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_type_signal" >&5
-$as_echo "$ac_cv_type_signal" >&6; }
-
-cat >>confdefs.h <<_ACEOF
-#define RETSIGTYPE $ac_cv_type_signal
-_ACEOF
-
-
-
-if test $ac_cv_type_signal = void; then
- $as_echo "#define SIGRETURN return" >>confdefs.h
-
-else
- $as_echo "#define SIGRETURN return 0" >>confdefs.h
-
-fi
-
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for struct sigcontext" >&5
$as_echo_n "checking for struct sigcontext... " >&6; }
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
diff --git a/src/config.h.in b/src/config.h.in
index 1786f2ff96..5f0d6aef2a 100644
--- a/src/config.h.in
+++ b/src/config.h.in
@@ -132,12 +132,6 @@
#undef PTYRANGE0
#undef PTYRANGE1
-/* Define as the return type of signal handlers (int or void). */
-#undef RETSIGTYPE
-
-/* Define as the command at the end of signal handlers ("" or "return 0;"). */
-#undef SIGRETURN
-
/* Define if struct sigcontext is present */
#undef HAVE_SIGCONTEXT
diff --git a/src/configure.ac b/src/configure.ac
index 37a7c6882c..778d11a45e 100644
--- a/src/configure.ac
+++ b/src/configure.ac
@@ -3644,17 +3644,6 @@ fi
dnl Checks for library functions. ===================================
-dnl TODO: this generates an obsolete warning, would need to remove and replace
-dnl all RETSIGTYPE with "void" and SIGRETURN with "return".
-AC_TYPE_SIGNAL
-
-dnl find out what to use at the end of a signal function
-if test $ac_cv_type_signal = void; then
- AC_DEFINE(SIGRETURN, [return])
-else
- AC_DEFINE(SIGRETURN, [return 0])
-fi
-
dnl check if struct sigcontext is defined (used for SGI only)
AC_MSG_CHECKING(for struct sigcontext)
AC_COMPILE_IFELSE([AC_LANG_PROGRAM([
diff --git a/src/if_cscope.c b/src/if_cscope.c
index f373952dd8..5d24533016 100644
--- a/src/if_cscope.c
+++ b/src/if_cscope.c
@@ -2181,11 +2181,10 @@ cs_read_prompt(int i)
/*
* Used to catch and ignore SIGALRM below.
*/
- static RETSIGTYPE
+ static void
sig_handler SIGDEFARG(sigarg)
{
// do nothing
- SIGRETURN;
}
#endif
diff --git a/src/os_mac.h b/src/os_mac.h
index f6ed1216ca..646dff414c 100644
--- a/src/os_mac.h
+++ b/src/os_mac.h
@@ -250,8 +250,6 @@
#endif
#undef HAVE_AVAIL_MEM
#ifndef HAVE_CONFIG_H
-# define RETSIGTYPE void
-# define SIGRETURN return
//# define USE_SYSTEM // Output ship do debugger :(, but not compile
# define HAVE_SYS_WAIT_H 1 // Attempt
# define HAVE_TERMIOS_H 1
diff --git a/src/os_unix.c b/src/os_unix.c
index 28113fcb3b..b23adb710f 100644
--- a/src/os_unix.c
+++ b/src/os_unix.c
@@ -99,7 +99,7 @@ static int mch_gpm_process(void);
static int sysmouse_open(void);
static void sysmouse_close(void);
-static RETSIGTYPE sig_sysmouse SIGPROTOARG;
+static void sig_sysmouse SIGPROTOARG;
#endif
/*
@@ -171,33 +171,33 @@ static int do_xterm_trace(void);
static void handle_resize(void);
#if defined(SIGWINCH)
-static RETSIGTYPE sig_winch SIGPROTOARG;
+static void sig_winch SIGPROTOARG;
#endif
#if defined(SIGTSTP)
-static RETSIGTYPE sig_tstp SIGPROTOARG;
+static void sig_tstp SIGPROTOARG;
// volatile because it is used in signal handler sig_tstp() and sigcont_handler().
static volatile sig_atomic_t in_mch_suspend = FALSE;
#endif
#if defined(SIGINT)
-static RETSIGTYPE catch_sigint SIGPROTOARG;
+static void catch_sigint SIGPROTOARG;
#endif
#if defined(SIGUSR1)
-static RETSIGTYPE catch_sigusr1 SIGPROTOARG;
+static void catch_sigusr1 SIGPROTOARG;
#endif
#if defined(SIGPWR)
-static RETSIGTYPE catch_sigpwr SIGPROTOARG;
+static void catch_sigpwr SIGPROTOARG;
#endif
#if defined(SIGALRM) && defined(FEAT_X11) && !defined(FEAT_GUI_GTK)
# define SET_SIG_ALARM
-static RETSIGTYPE sig_alarm SIGPROTOARG;
+static void sig_alarm SIGPROTOARG;
// volatile because it is used in signal handler sig_alarm().
static volatile sig_atomic_t sig_alarm_called;
#endif
-static RETSIGTYPE deathtrap SIGPROTOARG;
+static void deathtrap SIGPROTOARG;
static void catch_int_signal(void);
static void set_signals(void);
-static void catch_signals(RETSIGTYPE (*func_deadly)(), RETSIGTYPE (*func_other)());
+static void catch_signals(void (*func_deadly)(), void (*func_other)());
#ifdef HAVE_SIGPROCMASK
# define SIGSET_DECL(set) sigset_t set;
# define BLOCK_SIGNALS(set) block_signals(set)
@@ -213,7 +213,7 @@ static int have_dollars(int, char_u **);
static int save_patterns(int num_pat, char_u **pat, int *num_file, char_u ***file);
#ifndef SIG_ERR
-# define SIG_ERR ((RETSIGTYPE (*)())-1)
+# define SIG_ERR ((void (*)())-1)
#endif
// volatile because it is used in signal handler sig_winch().
@@ -864,18 +864,17 @@ init_signal_stack(void)
* Let me try it with a few tricky defines from my own osdef.h (jw).
*/
#if defined(SIGWINCH)
- static RETSIGTYPE
+ static void
sig_winch SIGDEFARG(sigarg)
{
// this is not required on all systems, but it doesn't hurt anybody
- signal(SIGWINCH, (RETSIGTYPE (*)())sig_winch);
+ signal(SIGWINCH, (void (*)())sig_winch);
do_resize = TRUE;
- SIGRETURN;
}
#endif
#if defined(SIGTSTP)
- static RETSIGTYPE
+ static void
sig_tstp SIGDEFARG(sigarg)
{
// Second time we get called we actually need to suspend
@@ -890,47 +889,43 @@ sig_tstp SIGDEFARG(sigarg)
#if !defined(__ANDROID__) && !defined(__OpenBSD__) && !defined(__DragonFly__)
// This is not required on all systems. On some systems (at least Android,
// OpenBSD, and DragonFlyBSD) this breaks suspending with CTRL-Z.
- signal(SIGTSTP, (RETSIGTYPE (*)())sig_tstp);
+ signal(SIGTSTP, (void (*)())sig_tstp);
#endif
- SIGRETURN;
}
#endif
#if defined(SIGINT)
- static RETSIGTYPE
+ static void
catch_sigint SIGDEFARG(sigarg)
{
// this is not required on all systems, but it doesn't hurt anybody
- signal(SIGINT, (RETSIGTYPE (*)())catch_sigint);
+ signal(SIGINT, (void (*)())catch_sigint);
got_int = TRUE;
- SIGRETURN;
}
#endif
#if defined(SIGUSR1)
- static RETSIGTYPE
+ static void
catch_sigusr1 SIGDEFARG(sigarg)
{
// this is not required on all systems, but it doesn't hurt anybody
- signal(SIGUSR1, (RETSIGTYPE (*)())catch_sigusr1);
+ signal(SIGUSR1, (void (*)())catch_sigusr1);
got_sigusr1 = TRUE;
- SIGRETURN;
}
#endif
#if defined(SIGPWR)
- static RETSIGTYPE
+ static void
catch_sigpwr SIGDEFARG(sigarg)
{
// this is not required on all systems, but it doesn't hurt anybody
- signal(SIGPWR, (RETSIGTYPE (*)())catch_sigpwr);
+ signal(SIGPWR, (void (*)())catch_sigpwr);
/*
* I'm not sure we get the SIGPWR signal when the system is really going
* down or when the batteries are almost empty. Just preserve the swap
* files and don't exit, that can't do any harm.
*/
ml_sync_all(FALSE, FALSE);
- SIGRETURN;
}
#endif
@@ -938,12 +933,11 @@ catch_sigpwr SIGDEFARG(sigarg)
/*
* signal function for alarm().
*/
- static RETSIGTYPE
+ static void
sig_alarm SIGDEFARG(sigarg)
{
// doesn't do anything, just to break a system call
sig_alarm_called = TRUE;
- SIGRETURN;
}
#endif
@@ -1021,7 +1015,7 @@ mch_didjmp(void)
* NOTE: Avoid unsafe functions, such as allocating memory, they can result in
* a deadlock.
*/
- static RETSIGTYPE
+ static void
deathtrap SIGDEFARG(sigarg)
{
static int entered = 0; // count the number of times we got here.
@@ -1054,7 +1048,7 @@ deathtrap SIGDEFARG(sigarg)
// interrupt us. But in cooked mode we may also get SIGQUIT, e.g., when
// pressing CTRL-\, but we don't want Vim to exit then.
if (in_mch_delay && sigarg == SIGQUIT)
- SIGRETURN;
+ return;
# endif
// When SIGHUP, SIGQUIT, etc. are blocked: postpone the effect and return
@@ -1082,7 +1076,7 @@ deathtrap SIGDEFARG(sigarg)
# endif
)
&& !vim_handle_signal(sigarg))
- SIGRETURN;
+ return;
#endif
// Remember how often we have been called.
@@ -1181,8 +1175,6 @@ deathtrap SIGDEFARG(sigarg)
may_core_dump();
abort();
#endif
-
- SIGRETURN;
}
/*
@@ -1202,7 +1194,7 @@ after_sigcont(void)
}
#if defined(SIGCONT)
-static RETSIGTYPE sigcont_handler SIGPROTOARG;
+static void sigcont_handler SIGPROTOARG;
/*
* With multi-threading, suspending might not work immediately. Catch the
@@ -1216,12 +1208,12 @@ static RETSIGTYPE sigcont_handler SIGPROTOARG;
* volatile because it is used in signal handler sigcont_handler().
*/
static volatile sig_atomic_t sigcont_received;
-static RETSIGTYPE sigcont_handler SIGPROTOARG;
+static void sigcont_handler SIGPROTOARG;
/*
* signal handler for SIGCONT
*/
- static RETSIGTYPE
+ static void
sigcont_handler SIGDEFARG(sigarg)
{
if (in_mch_suspend)
@@ -1239,8 +1231,6 @@ sigcont_handler SIGDEFARG(sigarg)
cursor_on_force();
out_flush();
}
-
- SIGRETURN;
}
#endif
@@ -1392,7 +1382,7 @@ set_signals(void)
/*
* WINDOW CHANGE signal is handled with sig_winch().
*/
- signal(SIGWINCH, (RETSIGTYPE (*)())sig_winch);
+ signal(SIGWINCH, (void (*)())sig_winch);
#endif
#ifdef SIGTSTP
@@ -1404,7 +1394,7 @@ set_signals(void)
# ifdef FEAT_GUI
: gui.in_use || gui.starting ? SIG_DFL
# endif
- : (RETSIGTYPE (*)())sig_tstp);
+ : (void (*)())sig_tstp);
#endif
#if defined(SIGCONT)
signal(SIGCONT, sigcont_handler);
@@ -1424,7 +1414,7 @@ set_signals(void)
/*
* Call user's handler on SIGUSR1
*/
- signal(SIGUSR1, (RETSIGTYPE (*)())catch_sigusr1);
+ signal(SIGUSR1, (void (*)())catch_sigusr1);
#endif
/*
@@ -1439,7 +1429,7 @@ set_signals(void)
* Catch SIGPWR (power failure?) to preserve the swap files, so that no
* work will be lost.
*/
- signal(SIGPWR, (RETSIGTYPE (*)())catch_sigpwr);
+ signal(SIGPWR, (void (*)())catch_sigpwr);
#endif
/*
@@ -1463,7 +1453,7 @@ set_signals(void)
static void
catch_int_signal(void)
{
- signal(SIGINT, (RETSIGTYPE (*)())catch_sigint);
+ signal(SIGINT, (void (*)())catch_sigint);
}
#endif
@@ -1479,8 +1469,8 @@ reset_signals(void)
static void
catch_signals(
- RETSIGTYPE (*func_deadly)(),
- RETSIGTYPE (*func_other)())
+ void (*func_deadly)(),
+ void (*func_other)())
{
int i;
@@ -1932,7 +1922,7 @@ get_x11_windis(void)
if (x11_window != 0 && x11_display == NULL)
{
#ifdef SET_SIG_ALARM
- RETSIGTYPE (*sig_save)();
+ void (*sig_save)();
#endif
#ifdef ELAPSED_FUNC
elapsed_T start_tv;
@@ -1947,15 +1937,14 @@ get_x11_windis(void)
* the network connection is bad. Set an alarm timer to get out.
*/
sig_alarm_called = FALSE;
- sig_save = (RETSIGTYPE (*)())signal(SIGALRM,
- (RETSIGTYPE (*)())sig_alarm);
+ sig_save = (void (*)())signal(SIGALRM, (void (*)())sig_alarm);
alarm(2);
#endif
x11_display = XOpenDisplay(NULL);
#ifdef SET_SIG_ALARM
alarm(0);
- signal(SIGALRM, (RETSIGTYPE (*)())sig_save);
+ signal(SIGALRM, (void (*)())sig_save);
if (p_verbose > 0 && sig_alarm_called)
verb_msg(_("Opening the X display timed out"));
#endif
@@ -7267,7 +7256,7 @@ gpm_open(void)
// we are going to suspend or starting an external process
// so we shouldn't have problem with this
# ifdef SIGTSTP
- signal(SIGTSTP, restricted ? SIG_IGN : (RETSIGTYPE (*)())sig_tstp);
+ signal(SIGTSTP, restricted ? SIG_IGN : (void (*)())sig_tstp);
# endif
return 1; // succeed
}
@@ -7400,7 +7389,7 @@ sysmouse_open(void)
mouse.u.mode.signal = SIGUSR2;
if (ioctl(1, CONS_MOUSECTL, &mouse) != -1)
{
- signal(SIGUSR2, (RETSIGTYPE (*)())sig_sysmouse);
+ signal(SIGUSR2, (void (*)())sig_sysmouse);
mouse.operation = MOUSE_SHOW;
ioctl(1, CONS_MOUSECTL, &mouse);
return OK;
@@ -7427,7 +7416,7 @@ sysmouse_close(void)
/*
* Gets info from sysmouse and adds special keys to input buf.
*/
- static RETSIGTYPE
+ static void
sig_sysmouse SIGDEFARG(sigarg)
{
struct mouse_info mouse;
@@ -8357,7 +8346,7 @@ static int alarm_pending = FALSE;
/*
* Handle SIGALRM for a timeout.
*/
- static RETSIGTYPE
+ static void
set_flag SIGDEFARG(sigarg)
{
if (alarm_pending)
diff --git a/src/os_vms_conf.h b/src/os_vms_conf.h
index 64f5d6d43f..8a933b6972 100644
--- a/src/os_vms_conf.h
+++ b/src/os_vms_conf.h
@@ -65,18 +65,9 @@
// Define if you have the nanosleep() function.
// #undef HAVE_NANOSLEEP
-// Define if you can safely include both <sys/time.h> and <time.h>.
-#define TIME_WITH_SYS_TIME
-
// Define if you can safely include both <sys/time.h> and <sys/select.h>.
// #undef SYS_SELECT_WITH_SYS_TIME
-// Define as the return type of signal handlers (int or void).
-#define RETSIGTYPE void
-
-// Define as the command at the end of signal handlers ("" or "return 0;").
-#define SIGRETURN return
-
// Define if struct sigcontext is present
#define HAVE_SIGCONTEXT
diff --git a/src/osdef1.h.in b/src/osdef1.h.in
index 4fb3409c6d..e8204b0a6c 100644
--- a/src/osdef1.h.in
+++ b/src/osdef1.h.in
@@ -105,9 +105,9 @@ extern int waitpid(pid_t, int *, int);
extern int toupper(int);
extern int tolower(int);
-extern RETSIGTYPE (*signal(int, RETSIGTYPE (*func) SIGPROTOARG)) SIGPROTOARG;
+extern void (*signal(int, void (*func) SIGPROTOARG)) SIGPROTOARG;
#ifdef HAVE_SIGSET
-extern RETSIGTYPE (*sigset(int, RETSIGTYPE (*func) SIGPROTOARG)) SIGPROTOARG;
+extern void (*sigset(int, void (*func) SIGPROTOARG)) SIGPROTOARG;
#endif
#if defined(HAVE_SETJMP_H)
diff --git a/src/pty.c b/src/pty.c
index 4c4e9e2ead..7cd01aef45 100644
--- a/src/pty.c
+++ b/src/pty.c
@@ -188,7 +188,7 @@ mch_openpty(char **ttyn)
{
int f;
char *m;
- RETSIGTYPE (*sigcld) SIGPROTOARG;
+ void (*sigcld) SIGPROTOARG;
static char TtyName[32]; // used for opening a new pty-pair
if ((f = posix_openpt(O_RDWR | O_NOCTTY | O_EXTRA)) == -1)
@@ -259,7 +259,7 @@ mch_openpty(char **ttyn)
{
int f;
char *name;
- RETSIGTYPE (*sigcld) SIGPROTOARG;
+ void (*sigcld) SIGPROTOARG;
/*
* SIGCHLD set to SIG_DFL for _getpty() because it may fork() and
@@ -312,7 +312,7 @@ mch_openpty(char **ttyn)
{
int f;
char *m;
- RETSIGTYPE (*sigcld) SIGPROTOARG;
+ void (*sigcld) SIGPROTOARG;
// used for opening a new pty-pair:
static char TtyName[32];
diff --git a/src/version.c b/src/version.c
index a361f9ca91..074652ba4d 100644
--- a/src/version.c
+++ b/src/version.c
@@ -735,6 +735,8 @@ static char *(features[]) =
static int included_patches[] =
{ /* Add new patch number below this line */
/**/
+ 5061,
+/**/
5060,
/**/
5059,