Skip to content

Commit

Permalink
patch 8.2.5061: C89 requires signal handlers to return void
Browse files Browse the repository at this point in the history
Problem:    C89 requires signal handlers to return void.
Solution:   Drop RETSIGTYPE and hard-code a void return value.
  • Loading branch information
brammool committed Jun 5, 2022
1 parent de1d734 commit 99c48fe
Show file tree
Hide file tree
Showing 10 changed files with 49 additions and 129 deletions.
42 changes: 0 additions & 42 deletions src/auto/configure
Expand Up @@ -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
Expand Down
6 changes: 0 additions & 6 deletions src/config.h.in
Expand Up @@ -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

Expand Down
11 changes: 0 additions & 11 deletions src/configure.ac
Expand Up @@ -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([
Expand Down
3 changes: 1 addition & 2 deletions src/if_cscope.c
Expand Up @@ -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

Expand Down
2 changes: 0 additions & 2 deletions src/os_mac.h
Expand Up @@ -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
Expand Down

0 comments on commit 99c48fe

Please sign in to comment.