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