This is the mail archive of the cygwin mailing list for the Cygwin project.

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: ‘SIG_SETMASK’ and -std=c99

On 06/08/2017 18:16, Ken Brown wrote:
On 8/6/2017 10:51 AM, Marco Atzeri wrote:
On 06/08/2017 11:44, Achim Gratz wrote:
The "-std=c*" options are not meant to expose any symbols that are not
defined in the respective C standard.  You almost always want to use
"-std=gnu*" instead if you target POSIX-y systems.

formally you are right. However it seems that Cygwin is now
more stringent than Linux where this problem does not arise.

That's not what I see on Linux (Scientific Linux 7.2):

thanks Ken for the check.

I should have reported the full error

error: ‘SIG_SETMASK’ undeclared (first use in this function)
     #define HDsigsetjmp(J,N)  sigsetjmp(J,N)

from the macro definition in

It seems sigsetjmp is export anyway and using SIG_SETMASK

#ifdef __CYGWIN__
/* Per POSIX, siglongjmp has to be implemented as function.  Cygwin
   provides functions for both, siglongjmp and sigsetjmp since 2.2.0. */
extern void siglongjmp (sigjmp_buf, int) __attribute__ ((__noreturn__));
extern int sigsetjmp (sigjmp_buf, int);

#if defined(__GNUC__)

#define sigsetjmp(env, savemask) \
            __extension__ \
            ({ \
              sigjmp_buf *_sjbuf = &(env); \
              ((*_sjbuf)[_SAVEMASK] = savemask,\
__SIGMASK_FUNC (SIG_SETMASK, 0, (sigset_t *)((*_sjbuf) + _SIGMASK)),\
              setjmp (*_sjbuf)); \

#define siglongjmp(env, val) \
            __extension__ \
            ({ \
              sigjmp_buf *_sjbuf = &(env); \
              ((((*_sjbuf)[_SAVEMASK]) ? \
__SIGMASK_FUNC (SIG_SETMASK, (sigset_t *)((*_sjbuf) + _SIGMASK), 0)\
               : 0), \
               longjmp (*_sjbuf, val)); \

#else /* !__GNUC__ */

#define sigsetjmp(env, savemask) ((env)[_SAVEMASK] = savemask,\
__SIGMASK_FUNC (SIG_SETMASK, 0, (sigset_t *) ((env) + _SIGMASK)),\
               setjmp (env))

#define siglongjmp(env, val) ((((env)[_SAVEMASK])?\
__SIGMASK_FUNC (SIG_SETMASK, (sigset_t *) ((env) + _SIGMASK), 0):0),\
               longjmp (env, val))



hdf5 seems wrong to use sigsetjmp and C99 but Cygwin seems to
have a consistency issue.


Problem reports:
Unsubscribe info:

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]