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

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