From: Bruno Haible Date: Fri, 8 Jul 2011 00:08:15 +0000 (+0200) Subject: pthread_sigmask: Make declaration C++ safe. X-Git-Tag: v0.1~2161 X-Git-Url: http://erislabs.org.uk/gitweb/?a=commitdiff_plain;h=bfb5ec49acc21828edb68ebfe93b94c43b044200;p=gnulib.git pthread_sigmask: Make declaration C++ safe. * lib/signal.in.h: In two special conditions, just do an #include_next. (pthread_sigmask): Test HAVE_PTHREAD_SIGMASK, not REPLACE_PTHREAD_MASK. Invoke _GL_CXXALIAS_SYS and _GL_CXXALIASWARN. * m4/signal_h.m4 (gl_SIGNAL_H_DEFAULTS): Initialize HAVE_PTHREAD_SIGMASK, not REPLACE_PTHREAD_MASK. * m4/pthread_sigmask.m4 (gl_PTHREAD_SIGMASK): Set HAVE_PTHREAD_SIGMASK, not REPLACE_PTHREAD_MASK. * modules/signal (Makefile.am): Substitute HAVE_PTHREAD_SIGMASK, not REPLACE_PTHREAD_MASK. * modules/pthread_sigmask (Depends-on, configure.ac): Update condition. --- diff --git a/ChangeLog b/ChangeLog index 2f03121bb..b3fa05e1d 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,5 +1,19 @@ 2011-07-07 Bruno Haible + pthread_sigmask: Make declaration C++ safe. + * lib/signal.in.h: In two special conditions, just do an #include_next. + (pthread_sigmask): Test HAVE_PTHREAD_SIGMASK, not REPLACE_PTHREAD_MASK. + Invoke _GL_CXXALIAS_SYS and _GL_CXXALIASWARN. + * m4/signal_h.m4 (gl_SIGNAL_H_DEFAULTS): Initialize + HAVE_PTHREAD_SIGMASK, not REPLACE_PTHREAD_MASK. + * m4/pthread_sigmask.m4 (gl_PTHREAD_SIGMASK): Set HAVE_PTHREAD_SIGMASK, + not REPLACE_PTHREAD_MASK. + * modules/signal (Makefile.am): Substitute HAVE_PTHREAD_SIGMASK, + not REPLACE_PTHREAD_MASK. + * modules/pthread_sigmask (Depends-on, configure.ac): Update condition. + +2011-07-07 Bruno Haible + pthread_sigmask: Fix return value. * lib/signal.in.h (pthread_sigmask): Declare. Don't define as a macro. * lib/pthread_sigmask.c: New file. diff --git a/lib/signal.in.h b/lib/signal.in.h index 5049b1da0..6d1be8fb8 100644 --- a/lib/signal.in.h +++ b/lib/signal.in.h @@ -20,8 +20,17 @@ #endif @PRAGMA_COLUMNS@ -#if defined __need_sig_atomic_t || defined __need_sigset_t -/* Special invocation convention inside glibc header files. */ +#if defined __need_sig_atomic_t || defined __need_sigset_t || defined _GL_ALREADY_INCLUDING_SIGNAL_H || (defined _SIGNAL_H && !defined __SIZEOF_PTHREAD_MUTEX_T) +/* Special invocation convention: + - Inside glibc header files. + - On glibc systems we have a sequence of nested includes + -> -> . + In this situation, the functions are not yet declared, therefore we cannot + provide the C++ aliases. + - On glibc systems with GCC 4.3 we have a sequence of nested includes + -> -> -> . + In this situation, some of the functions are not yet declared, therefore + we cannot provide the C++ aliases. */ # @INCLUDE_NEXT@ @NEXT_SIGNAL_H@ @@ -30,6 +39,8 @@ #ifndef _@GUARD_PREFIX@_SIGNAL_H +#define _GL_ALREADY_INCLUDING_SIGNAL_H + /* Define pid_t, uid_t. Also, mingw defines sigset_t not in , but in . On Solaris 10, includes , which eventually includes @@ -39,6 +50,8 @@ /* The include_next requires a split double-inclusion guard. */ #@INCLUDE_NEXT@ @NEXT_SIGNAL_H@ +#undef _GL_ALREADY_INCLUDING_SIGNAL_H + #ifndef _@GUARD_PREFIX@_SIGNAL_H #define _@GUARD_PREFIX@_SIGNAL_H @@ -103,10 +116,13 @@ typedef void (*sighandler_t) (int); #if @GNULIB_PTHREAD_SIGMASK@ -# if @REPLACE_PTHREAD_SIGMASK@ +# if !@HAVE_PTHREAD_SIGMASK@ _GL_FUNCDECL_SYS (pthread_sigmask, int, (int how, const sigset_t *new_mask, sigset_t *old_mask)); # endif +_GL_CXXALIAS_SYS (pthread_sigmask, int, + (int how, const sigset_t *new_mask, sigset_t *old_mask)); +_GL_CXXALIASWARN (pthread_sigmask); #elif defined GNULIB_POSIXCHECK # undef pthread_sigmask # if HAVE_RAW_DECL_PTHREAD_SIGMASK diff --git a/m4/pthread_sigmask.m4 b/m4/pthread_sigmask.m4 index d25e2cc3e..aa2904a8b 100644 --- a/m4/pthread_sigmask.m4 +++ b/m4/pthread_sigmask.m4 @@ -1,4 +1,4 @@ -# pthread_sigmask.m4 serial 2 +# pthread_sigmask.m4 serial 3 dnl Copyright (C) 2011 Free Software Foundation, Inc. dnl This file is free software; the Free Software Foundation dnl gives unlimited permission to copy and/or distribute it, @@ -21,6 +21,6 @@ AC_DEFUN([gl_PTHREAD_SIGMASK], ]) if test $ac_cv_func_pthread_sigmask = no; then - REPLACE_PTHREAD_SIGMASK=1 + HAVE_PTHREAD_SIGMASK=0 fi ]) diff --git a/m4/signal_h.m4 b/m4/signal_h.m4 index 53972fba5..96270a911 100644 --- a/m4/signal_h.m4 +++ b/m4/signal_h.m4 @@ -1,4 +1,4 @@ -# signal_h.m4 serial 14 +# signal_h.m4 serial 15 dnl Copyright (C) 2007-2011 Free Software Foundation, Inc. dnl This file is free software; the Free Software Foundation dnl gives unlimited permission to copy and/or distribute it, @@ -64,6 +64,7 @@ AC_DEFUN([gl_SIGNAL_H_DEFAULTS], GNULIB_SIGACTION=0; AC_SUBST([GNULIB_SIGACTION]) dnl Assume proper GNU behavior unless another module says otherwise. HAVE_POSIX_SIGNALBLOCKING=1; AC_SUBST([HAVE_POSIX_SIGNALBLOCKING]) + HAVE_PTHREAD_SIGMASK=1; AC_SUBST([HAVE_PTHREAD_SIGMASK]) HAVE_SIGSET_T=1; AC_SUBST([HAVE_SIGSET_T]) HAVE_SIGINFO_T=1; AC_SUBST([HAVE_SIGINFO_T]) HAVE_SIGACTION=1; AC_SUBST([HAVE_SIGACTION]) @@ -72,5 +73,4 @@ AC_DEFUN([gl_SIGNAL_H_DEFAULTS], HAVE_TYPE_VOLATILE_SIG_ATOMIC_T=1; AC_SUBST([HAVE_TYPE_VOLATILE_SIG_ATOMIC_T]) HAVE_SIGHANDLER_T=1; AC_SUBST([HAVE_SIGHANDLER_T]) - REPLACE_PTHREAD_SIGMASK=0; AC_SUBST([REPLACE_PTHREAD_SIGMASK]) ]) diff --git a/modules/pthread_sigmask b/modules/pthread_sigmask index 59cce9379..f2a77a0ef 100644 --- a/modules/pthread_sigmask +++ b/modules/pthread_sigmask @@ -7,11 +7,11 @@ m4/pthread_sigmask.m4 Depends-on: signal -sigprocmask [test $REPLACE_PTHREAD_SIGMASK = 1] +sigprocmask [test $HAVE_PTHREAD_SIGMASK = 0] configure.ac: gl_PTHREAD_SIGMASK -if test $REPLACE_PTHREAD_SIGMASK = 1; then +if test $HAVE_PTHREAD_SIGMASK = 0; then AC_LIBOBJ([pthread_sigmask]) fi gl_SIGNAL_MODULE_INDICATOR([pthread_sigmask]) diff --git a/modules/signal b/modules/signal index 3b793c175..d84105bff 100644 --- a/modules/signal +++ b/modules/signal @@ -33,13 +33,13 @@ signal.h: signal.in.h $(top_builddir)/config.status $(CXXDEFS_H) $(ARG_NONNULL_H -e 's/@''GNULIB_SIGPROCMASK''@/$(GNULIB_SIGPROCMASK)/g' \ -e 's/@''GNULIB_SIGACTION''@/$(GNULIB_SIGACTION)/g' \ -e 's|@''HAVE_POSIX_SIGNALBLOCKING''@|$(HAVE_POSIX_SIGNALBLOCKING)|g' \ + -e 's|@''HAVE_PTHREAD_SIGMASK''@|$(HAVE_PTHREAD_SIGMASK)|g' \ -e 's|@''HAVE_SIGSET_T''@|$(HAVE_SIGSET_T)|g' \ -e 's|@''HAVE_SIGINFO_T''@|$(HAVE_SIGINFO_T)|g' \ -e 's|@''HAVE_SIGACTION''@|$(HAVE_SIGACTION)|g' \ -e 's|@''HAVE_STRUCT_SIGACTION_SA_SIGACTION''@|$(HAVE_STRUCT_SIGACTION_SA_SIGACTION)|g' \ -e 's|@''HAVE_TYPE_VOLATILE_SIG_ATOMIC_T''@|$(HAVE_TYPE_VOLATILE_SIG_ATOMIC_T)|g' \ -e 's|@''HAVE_SIGHANDLER_T''@|$(HAVE_SIGHANDLER_T)|g' \ - -e 's|@''REPLACE_PTHREAD_SIGMASK''@|$(REPLACE_PTHREAD_SIGMASK)|g' \ -e '/definitions of _GL_FUNCDECL_RPL/r $(CXXDEFS_H)' \ -e '/definition of _GL_ARG_NONNULL/r $(ARG_NONNULL_H)' \ -e '/definition of _GL_WARN_ON_USE/r $(WARN_ON_USE_H)' \