ansi-c++-opt: Provide option --enable-c++/--disable-c++ when possible.
[gnulib.git] / tests / test-signal.c
1 /* Test of <signal.h> substitute.
2    Copyright (C) 2009, 2010 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 int
39 main (void)
40 {
41   switch (0)
42     {
43       /* The following are guaranteed by C.  */
44     case 0:
45     case SIGABRT:
46     case SIGFPE:
47     case SIGILL:
48     case SIGINT:
49     case SIGSEGV:
50     case SIGTERM:
51       /* The following is guaranteed by gnulib.  */
52 #if GNULIB_SIGPIPE || defined SIGPIPE
53     case SIGPIPE:
54 #endif
55       /* Ensure no conflict with other standardized names.  */
56 #ifdef SIGALRM
57     case SIGALRM:
58 #endif
59 #ifdef SIGBUS
60     case SIGBUS:
61 #endif
62 #ifdef SIGCHLD
63     case SIGCHLD:
64 #endif
65 #ifdef SIGCONT
66     case SIGCONT:
67 #endif
68 #ifdef SIGHUP
69     case SIGHUP:
70 #endif
71 #ifdef SIGKILL
72     case SIGKILL:
73 #endif
74 #ifdef SIGQUIT
75     case SIGQUIT:
76 #endif
77 #ifdef SIGSTOP
78     case SIGSTOP:
79 #endif
80 #ifdef SIGTSTP
81     case SIGTSTP:
82 #endif
83 #ifdef SIGTTIN
84     case SIGTTIN:
85 #endif
86 #ifdef SIGTTOU
87     case SIGTTOU:
88 #endif
89 #ifdef SIGUSR1
90     case SIGUSR1:
91 #endif
92 #ifdef SIGUSR2
93     case SIGUSR2:
94 #endif
95 #ifdef SIGSYS
96     case SIGSYS:
97 #endif
98 #ifdef SIGTRAP
99     case SIGTRAP:
100 #endif
101 #ifdef SIGURG
102     case SIGURG:
103 #endif
104 #ifdef SIGVTALRM
105     case SIGVTALRM:
106 #endif
107 #ifdef SIGXCPU
108     case SIGXCPU:
109 #endif
110 #ifdef SIGXFSZ
111     case SIGXFSZ:
112 #endif
113       /* SIGRTMIN and SIGRTMAX need not be compile-time constants.  */
114 #if 0
115 # ifdef SIGRTMIN
116     case SIGRTMIN:
117 # endif
118 # ifdef SIGRTMAX
119     case SIGRTMAX:
120 # endif
121 #endif
122       ;
123     }
124   return s.a + s.b + s.c + s.e;
125 }