bug-gnulib
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: _GL_CXXALIAS_SYS (raise, int, (int sig)); in signal.h may give compl


From: Tatsuro MATSUOKA
Subject: Re: _GL_CXXALIAS_SYS (raise, int, (int sig)); in signal.h may give complie error in C++ source.
Date: Wed, 28 Sep 2011 13:44:33 +0900 (JST)

Hello

I have pulled the latest gnulib component. I am trying to build octave.
Compile error which comes from _GL_CXXALIAS_SYS (raise, int, (int sig)); in
signal.in.h seem to be disappeared.

Thank you for your immediate correction.

Regards

Tatsuro

--- Bruno Haible  wrote:

> Hi,
> 
> Tatsuro MATSUOKA wrote:
> > In the bug tracker octave, in which gnulib components are used,
> > _GL_CXXALIAS_SYS (raise, int, (int sig)); in signal.h seems to give
> compile
> > error.
> > 
> > https://savannah.gnu.org/bugs/?34378
> > 
> > John W. Eaton said in comment #3 in the above tracker that
> > 
> > *********************************************
> > I'm fairly sure this is a bug in gnulib, so needs to be fixed
> there. There
> > shouldn't be two 
> > 
> > _GL_CXXALIAS_SYS (raise, int, (int sig));
> > 
> > lines in the libgnu/signal.h file
> 
> Thanks for the report. Yes, obviously this a mistake that I
> introduced on
> 2011-09-23. This patch fixes it:
> 
> 
> 2011-09-26  Bruno Haible  <address@hidden>
> 
>       raise: Fix double declaration with modules 'sigprocmask' and
> 'sigpipe'.
>       * lib/signal.in.h (GNULIB_defined_signal_blocking): New macro.
>       (raise): Remove older, duplicated declaration.
>       (_gl_raise_SIGPIPE): New declaration.
>       * lib/sigprocmask.c (_gl_raise_SIGPIPE): New function.
>       (rpl_raise): Remove function.
>       * lib/raise.c (rpl_raise, raise): Merge into a single function.
> Handle
>       a gnulib-defined SIGPIPE here.
>       * m4/raise.m4 (gl_FUNC_RAISE): Set REPLACE_RAISE also if the module
>       'sigprocmask' has detected missing signal-blocking and the module
>       'sigpipe' is enabled.
>       Reported by Tatsuro MATSUOKA <address@hidden>.
> 
> --- lib/raise.c.orig  Wed Sep 28 00:43:41 2011
> +++ lib/raise.c       Tue Sep 27 22:15:23 2011
> @@ -50,24 +50,30 @@
>  
>    return result;
>  }
> -#  define raise raise_nothrow
> +# else
> +#  define raise_nothrow raise
>  # endif
>  
> -int
> -rpl_raise (int sig)
> -{
> -  return raise_nothrow (sig);
> -}
> -
>  #else
>  /* An old Unix platform.  */
>  
>  # include <unistd.h>
>  
> +# define rpl_raise raise
> +
> +#endif
> +
>  int
> -raise (int sig)
> +rpl_raise (int sig)
>  {
> -  return kill (getpid (), sig);
> -}
> +#if GNULIB_defined_signal_blocking && GNULIB_defined_SIGPIPE
> +  if (sig == SIGPIPE)
> +    return _gl_raise_SIGPIPE ();
> +#endif
>  
> +#if HAVE_RAISE
> +  return raise_nothrow (sig);
> +#else
> +  return kill (getpid (), sig);
>  #endif
> +}
> --- lib/signal.in.h.orig      Wed Sep 28 00:43:42 2011
> +++ lib/signal.in.h   Tue Sep 27 22:09:27 2011
> @@ -178,6 +178,10 @@
>  #if @GNULIB_SIGPROCMASK@
>  # if address@hidden@
>  
> +#  ifndef GNULIB_defined_signal_blocking
> +#   define GNULIB_defined_signal_blocking 1
> +#  endif
> +
>  /* Maximum signal number + 1.  */
>  #  ifndef NSIG
>  #   define NSIG 32
> @@ -303,18 +307,10 @@
>  # endif
>  _GL_CXXALIASWARN (signal);
>  
> -/* Raise signal SIG.  */
>  # if address@hidden@ && GNULIB_defined_SIGPIPE
> -#  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
> -#   undef raise
> -#   define raise rpl_raise
> -#  endif
> -_GL_FUNCDECL_RPL (raise, int, (int sig));
> -_GL_CXXALIAS_RPL (raise, int, (int sig));
> -# else
> -_GL_CXXALIAS_SYS (raise, int, (int sig));
> +/* Raise signal SIGPIPE.  */
> +_GL_EXTERN_C int _gl_raise_SIGPIPE (void);
>  # endif
> -_GL_CXXALIASWARN (raise);
>  
>  #elif defined GNULIB_POSIXCHECK
>  # undef sigaddset
> --- lib/sigprocmask.c.orig    Wed Sep 28 00:43:42 2011
> +++ lib/sigprocmask.c Tue Sep 27 21:54:35 2011
> @@ -330,27 +330,19 @@
>  }
>  
>  #if GNULIB_defined_SIGPIPE
> -/* Raise the signal SIG.  */
> +/* Raise the signal SIGPIPE.  */
>  int
> -rpl_raise (int sig)
> -# undef raise
> +_gl_raise_SIGPIPE (void)
>  {
> -  switch (sig)
> +  if (blocked_set & (1U << SIGPIPE))
> +    pending_array[SIGPIPE] = 1;
> +  else
>      {
> -    case SIGPIPE:
> -      if (blocked_set & (1U << sig))
> -        pending_array[sig] = 1;
> -      else
> -        {
> -          handler_t handler = SIGPIPE_handler;
> -          if (handler == SIG_DFL)
> -            exit (128 + SIGPIPE);
> -          else if (handler != SIG_IGN)
> -            (*handler) (sig);
> -        }
> -      return 0;
> -    default: /* System defined signal */
> -      return raise (sig);
> +      handler_t handler = SIGPIPE_handler;
> +      if (handler == SIG_DFL)
> +        exit (128 + SIGPIPE);
> +      else if (handler != SIG_IGN)
> +        (*handler) (SIGPIPE);
>      }
>  }
>  #endif
> --- m4/raise.m4.orig  Wed Sep 28 00:43:42 2011
> +++ m4/raise.m4       Tue Sep 27 22:03:30 2011
> @@ -1,4 +1,4 @@
> -# raise.m4 serial 1
> +# raise.m4 serial 2
>  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,
> @@ -16,6 +16,17 @@
>      if test $HAVE_MSVC_INVALID_PARAMETER_HANDLER = 1; then
>        REPLACE_RAISE=1
>      fi
> +    m4_ifdef([gl_SIGNALBLOCKING], [
> +      gl_SIGNALBLOCKING
> +      if test $HAVE_POSIX_SIGNALBLOCKING = 0; then
> +        m4_ifdef([gl_SIGNAL_SIGPIPE], [
> +          gl_SIGNAL_SIGPIPE
> +          if test $gl_cv_header_signal_h_SIGPIPE != yes; then
> +            REPLACE_RAISE=1
> +          fi
> +        ], [:])
> +      fi
> +    ])
>    fi
>  ])
>  
> 
> -- 
> In memoriam Paul Eppstein
> <http://de.wikipedia.org/wiki/Paul_Eppstein>
> 




reply via email to

[Prev in Thread] Current Thread [Next in Thread]