]> granicus.if.org Git - vim/commitdiff
patch 8.2.5061: C89 requires signal handlers to return void v8.2.5061
authorBram Moolenaar <Bram@vim.org>
Sun, 5 Jun 2022 21:05:19 +0000 (22:05 +0100)
committerBram Moolenaar <Bram@vim.org>
Sun, 5 Jun 2022 21:05:19 +0000 (22:05 +0100)
Problem:    C89 requires signal handlers to return void.
Solution:   Drop RETSIGTYPE and hard-code a void return value.

src/auto/configure
src/config.h.in
src/configure.ac
src/if_cscope.c
src/os_mac.h
src/os_unix.c
src/os_vms_conf.h
src/osdef1.h.in
src/pty.c
src/version.c

index 3aef2f13ee6b26e37b3400b9bf306a591bba813a..3cb6e51fee93135998430f4bea21e9bc5388e0cd 100755 (executable)
@@ -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
index 1786f2ff96da29f502125555f9454c5466ec81aa..5f0d6aef2ac6edd3b6e665bfea74f42e24402666 100644 (file)
 #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
 
index 37a7c6882ce304c43861867af18861e0e24e1f41..778d11a45e6fb32f20609d0d8ecedee1edf28add 100644 (file)
@@ -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([
index f373952dd890f3f838402a98cc2aa18e50d83e14..5d24533016d17caf33d0dd687c4277dd670e8637 100644 (file)
@@ -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
 
index f6ed1216cabfecde2a440c58916157a3acb98930..646dff414c9252e5f3b2fe62263f229deebb09aa 100644 (file)
 #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
index 28113fcb3b40649049e2464dd720773728c8dbf4..b23adb710f69e8e2227d11ea48e849c912b9f96d 100644 (file)
@@ -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)
index 64f5d6d43fead2473e5263596186d5f9b9f5ae7e..8a933b69721124f8a3f5f13ba25b270884526181 100644 (file)
 // 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
 
index 4fb3409c6d91bb0c4931e3b19dbbc0c7f1b02760..e8204b0a6c48a09a0666798f041ed65499d1dc88 100644 (file)
@@ -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)
index 4c4e9e2eada786a2eb0f0dc32d2cbb6f19bb4615..7cd01aef4593ac1ed6ea394bccdc09da773c674a 100644 (file)
--- 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];
 
index a361f9ca91a76040398c58d8b1e38884750519d9..074652ba4d5e905c3afaa461cefab3edc8fd9dda 100644 (file)
@@ -734,6 +734,8 @@ static char *(features[]) =
 
 static int included_patches[] =
 {   /* Add new patch number below this line */
+/**/
+    5061,
 /**/
     5060,
 /**/