Blame gettext-tools/gnulib-tests/test-signal-h.c

Packit Bot 06c835
/* Test of <signal.h> substitute.
Packit Bot 06c835
   Copyright (C) 2009-2015 Free Software Foundation, Inc.
Packit Bot 06c835
Packit Bot 06c835
   This program is free software: you can redistribute it and/or modify
Packit Bot 06c835
   it under the terms of the GNU General Public License as published by
Packit Bot 06c835
   the Free Software Foundation; either version 3 of the License, or
Packit Bot 06c835
   (at your option) any later version.
Packit Bot 06c835
Packit Bot 06c835
   This program is distributed in the hope that it will be useful,
Packit Bot 06c835
   but WITHOUT ANY WARRANTY; without even the implied warranty of
Packit Bot 06c835
   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
Packit Bot 06c835
   GNU General Public License for more details.
Packit Bot 06c835
Packit Bot 06c835
   You should have received a copy of the GNU General Public License
Packit Bot 06c835
   along with this program.  If not, see <http://www.gnu.org/licenses/>.  */
Packit Bot 06c835
Packit Bot 06c835
/* Written by Eric Blake <ebb9@byu.net>, 2009.  */
Packit Bot 06c835
Packit Bot 06c835
#include <config.h>
Packit Bot 06c835
Packit Bot 06c835
#include <signal.h>
Packit Bot 06c835
Packit Bot 06c835
/* Check for required types.  */
Packit Bot 06c835
struct
Packit Bot 06c835
{
Packit Bot 06c835
  size_t a;
Packit Bot 06c835
  uid_t b;
Packit Bot 06c835
  volatile sig_atomic_t c;
Packit Bot 06c835
  sigset_t d;
Packit Bot 06c835
  pid_t e;
Packit Bot 06c835
#if 0
Packit Bot 06c835
  /* Not guaranteed by gnulib.  */
Packit Bot 06c835
  pthread_t f;
Packit Bot 06c835
  struct timespec g;
Packit Bot 06c835
#endif
Packit Bot 06c835
} s;
Packit Bot 06c835
Packit Bot 06c835
/* Check that NSIG is defined.  */
Packit Bot 06c835
int nsig = NSIG;
Packit Bot 06c835
Packit Bot 06c835
int
Packit Bot 06c835
main (void)
Packit Bot 06c835
{
Packit Bot 06c835
  switch (0)
Packit Bot 06c835
    {
Packit Bot 06c835
      /* The following are guaranteed by C.  */
Packit Bot 06c835
    case 0:
Packit Bot 06c835
    case SIGABRT:
Packit Bot 06c835
    case SIGFPE:
Packit Bot 06c835
    case SIGILL:
Packit Bot 06c835
    case SIGINT:
Packit Bot 06c835
    case SIGSEGV:
Packit Bot 06c835
    case SIGTERM:
Packit Bot 06c835
      /* The following is guaranteed by gnulib.  */
Packit Bot 06c835
#if GNULIB_SIGPIPE || defined SIGPIPE
Packit Bot 06c835
    case SIGPIPE:
Packit Bot 06c835
#endif
Packit Bot 06c835
      /* Ensure no conflict with other standardized names.  */
Packit Bot 06c835
#ifdef SIGALRM
Packit Bot 06c835
    case SIGALRM:
Packit Bot 06c835
#endif
Packit Bot 06c835
      /* On Haiku, SIGBUS is mistakenly equal to SIGSEGV.  */
Packit Bot 06c835
#if defined SIGBUS && SIGBUS != SIGSEGV
Packit Bot 06c835
    case SIGBUS:
Packit Bot 06c835
#endif
Packit Bot 06c835
#ifdef SIGCHLD
Packit Bot 06c835
    case SIGCHLD:
Packit Bot 06c835
#endif
Packit Bot 06c835
#ifdef SIGCONT
Packit Bot 06c835
    case SIGCONT:
Packit Bot 06c835
#endif
Packit Bot 06c835
#ifdef SIGHUP
Packit Bot 06c835
    case SIGHUP:
Packit Bot 06c835
#endif
Packit Bot 06c835
#ifdef SIGKILL
Packit Bot 06c835
    case SIGKILL:
Packit Bot 06c835
#endif
Packit Bot 06c835
#ifdef SIGQUIT
Packit Bot 06c835
    case SIGQUIT:
Packit Bot 06c835
#endif
Packit Bot 06c835
#ifdef SIGSTOP
Packit Bot 06c835
    case SIGSTOP:
Packit Bot 06c835
#endif
Packit Bot 06c835
#ifdef SIGTSTP
Packit Bot 06c835
    case SIGTSTP:
Packit Bot 06c835
#endif
Packit Bot 06c835
#ifdef SIGTTIN
Packit Bot 06c835
    case SIGTTIN:
Packit Bot 06c835
#endif
Packit Bot 06c835
#ifdef SIGTTOU
Packit Bot 06c835
    case SIGTTOU:
Packit Bot 06c835
#endif
Packit Bot 06c835
#ifdef SIGUSR1
Packit Bot 06c835
    case SIGUSR1:
Packit Bot 06c835
#endif
Packit Bot 06c835
#ifdef SIGUSR2
Packit Bot 06c835
    case SIGUSR2:
Packit Bot 06c835
#endif
Packit Bot 06c835
#ifdef SIGSYS
Packit Bot 06c835
    case SIGSYS:
Packit Bot 06c835
#endif
Packit Bot 06c835
#ifdef SIGTRAP
Packit Bot 06c835
    case SIGTRAP:
Packit Bot 06c835
#endif
Packit Bot 06c835
#ifdef SIGURG
Packit Bot 06c835
    case SIGURG:
Packit Bot 06c835
#endif
Packit Bot 06c835
#ifdef SIGVTALRM
Packit Bot 06c835
    case SIGVTALRM:
Packit Bot 06c835
#endif
Packit Bot 06c835
#ifdef SIGXCPU
Packit Bot 06c835
    case SIGXCPU:
Packit Bot 06c835
#endif
Packit Bot 06c835
#ifdef SIGXFSZ
Packit Bot 06c835
    case SIGXFSZ:
Packit Bot 06c835
#endif
Packit Bot 06c835
      /* SIGRTMIN and SIGRTMAX need not be compile-time constants.  */
Packit Bot 06c835
#if 0
Packit Bot 06c835
# ifdef SIGRTMIN
Packit Bot 06c835
    case SIGRTMIN:
Packit Bot 06c835
# endif
Packit Bot 06c835
# ifdef SIGRTMAX
Packit Bot 06c835
    case SIGRTMAX:
Packit Bot 06c835
# endif
Packit Bot 06c835
#endif
Packit Bot 06c835
      ;
Packit Bot 06c835
    }
Packit Bot 06c835
  return s.a + s.b + s.c + s.e;
Packit Bot 06c835
}