Clarify of sig_atomic_t usage (got from Mutt).

Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
This commit is contained in:
Andrew Borodin 2012-10-31 11:33:50 +04:00
parent 82bb9c39da
commit 1d3132c08f
6 changed files with 39 additions and 5 deletions

View File

@ -186,6 +186,40 @@ AC_TYPE_UID_T
AC_STRUCT_ST_BLOCKS AC_STRUCT_ST_BLOCKS
AC_CHECK_MEMBERS([struct stat.st_blksize, struct stat.st_rdev]) AC_CHECK_MEMBERS([struct stat.st_blksize, struct stat.st_rdev])
AH_TEMPLATE([sig_atomic_t],
[/* Define to `int' if <signal.h> doesn't define.])
AH_TEMPLATE([SIG_ATOMIC_VOLATILE_T],
[Some systems declare sig_atomic_t as volatile, some others -- no.
This define will have value `sig_atomic_t' or
`volatile sig_atomic_t' accordingly.])
AC_MSG_CHECKING(for sig_atomic_t in signal.h)
AC_EGREP_HEADER(sig_atomic_t,signal.h,
[
ac_cv_type_sig_atomic_t=yes;
AC_EGREP_HEADER(volatile.*sig_atomic_t,
signal.h,
[
is_sig_atomic_t_volatile=yes;
AC_MSG_RESULT([yes, volatile])
],
[
is_sig_atomic_t_volatile=no;
AC_MSG_RESULT([yes, non volatile])
])
],
[
AC_MSG_RESULT(no)
AC_CHECK_TYPE(sig_atomic_t, int)
is_sig_atomic_t_volatile=no
])
if test $is_sig_atomic_t_volatile = 'yes'
then
AC_DEFINE(SIG_ATOMIC_VOLATILE_T, sig_atomic_t)
else
AC_DEFINE(SIG_ATOMIC_VOLATILE_T, [volatile sig_atomic_t])
fi
dnl ############################################################################ dnl ############################################################################
dnl Check for functions dnl Check for functions

View File

@ -265,7 +265,7 @@ typedef struct
gboolean alternate_plus_minus; gboolean alternate_plus_minus;
/* Set if the window has changed it's size */ /* Set if the window has changed it's size */
volatile sig_atomic_t winch_flag; SIG_ATOMIC_VOLATILE_T winch_flag;
} tty; } tty;
struct struct

View File

@ -62,7 +62,7 @@ int mc_tty_frm[MC_TTY_FRM_MAX];
/*** file scope variables ************************************************************************/ /*** file scope variables ************************************************************************/
static volatile sig_atomic_t got_interrupt = 0; static SIG_ATOMIC_VOLATILE_T got_interrupt = 0;
/*** file scope functions ************************************************************************/ /*** file scope functions ************************************************************************/
/* --------------------------------------------------------------------------------------------- */ /* --------------------------------------------------------------------------------------------- */

View File

@ -36,7 +36,7 @@
/*** global variables ****************************************************************************/ /*** global variables ****************************************************************************/
volatile sig_atomic_t got_sigpipe = 0; SIG_ATOMIC_VOLATILE_T got_sigpipe = 0;
/*** file scope macro definitions ****************************************************************/ /*** file scope macro definitions ****************************************************************/

View File

@ -16,7 +16,7 @@
/*** global variables defined in .c file *********************************************************/ /*** global variables defined in .c file *********************************************************/
extern volatile sig_atomic_t got_sigpipe; extern SIG_ATOMIC_VOLATILE_T got_sigpipe;
/*** declarations of public functions ************************************************************/ /*** declarations of public functions ************************************************************/

View File

@ -319,7 +319,7 @@ toggle_panels (void)
vfs_path_t **new_dir_p; vfs_path_t **new_dir_p;
#endif /* ENABLE_SUBSHELL */ #endif /* ENABLE_SUBSHELL */
volatile sig_atomic_t was_sigwinch = 0; SIG_ATOMIC_VOLATILE_T was_sigwinch = 0;
channels_down (); channels_down ();
disable_mouse (); disable_mouse ();