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 1463d550b0
commit a341971441
5 changed files with 38 additions and 4 deletions

View File

@ -208,6 +208,40 @@ AC_TYPE_MODE_T
AC_TYPE_PID_T AC_TYPE_PID_T
AC_TYPE_UID_T AC_TYPE_UID_T
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
AC_FUNC_STRCOLL AC_FUNC_STRCOLL
mc_AC_GET_FS_INFO mc_AC_GET_FS_INFO

View File

@ -261,7 +261,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 ************************************************************/