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

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