blob: 07a729eee69d4856fafa5136adb5f94d75ae8994 [file] [log] [blame]
Howard Hinnant3e519522010-05-11 19:42:16 +00001//===----------------------------------------------------------------------===//
2//
Chandler Carruth57b08b02019-01-19 10:56:40 +00003// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4// See https://llvm.org/LICENSE.txt for license information.
5// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
Howard Hinnant3e519522010-05-11 19:42:16 +00006//
7//===----------------------------------------------------------------------===//
8
9// test <signal.h>
10
11#include <signal.h>
12#include <type_traits>
13
Marshall Clow7fc6a552019-05-31 18:35:30 +000014#include "test_macros.h"
15
Howard Hinnant3e519522010-05-11 19:42:16 +000016#ifndef SIG_DFL
17#error SIG_DFL not defined
18#endif
19
20#ifndef SIG_ERR
21#error SIG_ERR not defined
22#endif
23
24#ifndef SIG_IGN
25#error SIG_IGN not defined
26#endif
27
28#ifndef SIGABRT
29#error SIGABRT not defined
30#endif
31
32#ifndef SIGFPE
33#error SIGFPE not defined
34#endif
35
36#ifndef SIGILL
37#error SIGILL not defined
38#endif
39
40#ifndef SIGINT
41#error SIGINT not defined
42#endif
43
44#ifndef SIGSEGV
45#error SIGSEGV not defined
46#endif
47
48#ifndef SIGTERM
49#error SIGTERM not defined
50#endif
51
JF Bastien2df59c52019-02-04 20:31:13 +000052int main(int, char**)
Howard Hinnant3e519522010-05-11 19:42:16 +000053{
Eric Fiselier203f6872015-07-18 22:51:51 +000054 sig_atomic_t sig; ((void)sig);
Howard Hinnant3e519522010-05-11 19:42:16 +000055 typedef void (*func)(int);
56 static_assert((std::is_same<decltype(signal(0, (func)0)), func>::value), "");
57 static_assert((std::is_same<decltype(raise(0)), int>::value), "");
JF Bastien2df59c52019-02-04 20:31:13 +000058
59 return 0;
Howard Hinnant3e519522010-05-11 19:42:16 +000060}