46c3bbc3b5e5daeebf2d5b15be44efa540b939f8
[platform/upstream/diffutils.git] / gnulib-tests / test-signal.c
1 /* -*- buffer-read-only: t -*- vi: set ro: */
2 /* DO NOT EDIT! GENERATED AUTOMATICALLY! */
3 /* Test of <signal.h> substitute.
4    Copyright (C) 2009-2011 Free Software Foundation, Inc.
5
6    This program is free software: you can redistribute it and/or modify
7    it under the terms of the GNU General Public License as published by
8    the Free Software Foundation; either version 3 of the License, or
9    (at your option) any later version.
10
11    This program is distributed in the hope that it will be useful,
12    but WITHOUT ANY WARRANTY; without even the implied warranty of
13    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
14    GNU General Public License for more details.
15
16    You should have received a copy of the GNU General Public License
17    along with this program.  If not, see <http://www.gnu.org/licenses/>.  */
18
19 /* Written by Eric Blake <ebb9@byu.net>, 2009.  */
20
21 #include <config.h>
22
23 #include <signal.h>
24
25 /* Check for required types.  */
26 struct
27 {
28   size_t a;
29   uid_t b;
30   volatile sig_atomic_t c;
31   sigset_t d;
32   pid_t e;
33 #if 0
34   /* Not guaranteed by gnulib.  */
35   pthread_t f;
36   struct timespec g;
37 #endif
38 } s;
39
40 /* Check that NSIG is defined.  */
41 int nsig = NSIG;
42
43 int
44 main (void)
45 {
46   switch (0)
47     {
48       /* The following are guaranteed by C.  */
49     case 0:
50     case SIGABRT:
51     case SIGFPE:
52     case SIGILL:
53     case SIGINT:
54     case SIGSEGV:
55     case SIGTERM:
56       /* The following is guaranteed by gnulib.  */
57 #if GNULIB_SIGPIPE || defined SIGPIPE
58     case SIGPIPE:
59 #endif
60       /* Ensure no conflict with other standardized names.  */
61 #ifdef SIGALRM
62     case SIGALRM:
63 #endif
64       /* On Haiku, SIGBUS is mistakenly equal to SIGSEGV.  */
65 #if defined SIGBUS && SIGBUS != SIGSEGV
66     case SIGBUS:
67 #endif
68 #ifdef SIGCHLD
69     case SIGCHLD:
70 #endif
71 #ifdef SIGCONT
72     case SIGCONT:
73 #endif
74 #ifdef SIGHUP
75     case SIGHUP:
76 #endif
77 #ifdef SIGKILL
78     case SIGKILL:
79 #endif
80 #ifdef SIGQUIT
81     case SIGQUIT:
82 #endif
83 #ifdef SIGSTOP
84     case SIGSTOP:
85 #endif
86 #ifdef SIGTSTP
87     case SIGTSTP:
88 #endif
89 #ifdef SIGTTIN
90     case SIGTTIN:
91 #endif
92 #ifdef SIGTTOU
93     case SIGTTOU:
94 #endif
95 #ifdef SIGUSR1
96     case SIGUSR1:
97 #endif
98 #ifdef SIGUSR2
99     case SIGUSR2:
100 #endif
101 #ifdef SIGSYS
102     case SIGSYS:
103 #endif
104 #ifdef SIGTRAP
105     case SIGTRAP:
106 #endif
107 #ifdef SIGURG
108     case SIGURG:
109 #endif
110 #ifdef SIGVTALRM
111     case SIGVTALRM:
112 #endif
113 #ifdef SIGXCPU
114     case SIGXCPU:
115 #endif
116 #ifdef SIGXFSZ
117     case SIGXFSZ:
118 #endif
119       /* SIGRTMIN and SIGRTMAX need not be compile-time constants.  */
120 #if 0
121 # ifdef SIGRTMIN
122     case SIGRTMIN:
123 # endif
124 # ifdef SIGRTMAX
125     case SIGRTMAX:
126 # endif
127 #endif
128       ;
129     }
130   return s.a + s.b + s.c + s.e;
131 }