Howard Hinnant | 3e51952 | 2010-05-11 19:42:16 +0000 | [diff] [blame] | 1 | //===----------------------------------------------------------------------===// |
| 2 | // |
Chandler Carruth | 57b08b0 | 2019-01-19 10:56:40 +0000 | [diff] [blame] | 3 | // 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 Hinnant | 3e51952 | 2010-05-11 19:42:16 +0000 | [diff] [blame] | 6 | // |
| 7 | //===----------------------------------------------------------------------===// |
| 8 | |
| 9 | // test <signal.h> |
| 10 | |
| 11 | #include <signal.h> |
| 12 | #include <type_traits> |
| 13 | |
Marshall Clow | 7fc6a55 | 2019-05-31 18:35:30 +0000 | [diff] [blame] | 14 | #include "test_macros.h" |
| 15 | |
Howard Hinnant | 3e51952 | 2010-05-11 19:42:16 +0000 | [diff] [blame] | 16 | #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 Bastien | 2df59c5 | 2019-02-04 20:31:13 +0000 | [diff] [blame] | 52 | int main(int, char**) |
Howard Hinnant | 3e51952 | 2010-05-11 19:42:16 +0000 | [diff] [blame] | 53 | { |
Eric Fiselier | 203f687 | 2015-07-18 22:51:51 +0000 | [diff] [blame] | 54 | sig_atomic_t sig; ((void)sig); |
Howard Hinnant | 3e51952 | 2010-05-11 19:42:16 +0000 | [diff] [blame] | 55 | 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 Bastien | 2df59c5 | 2019-02-04 20:31:13 +0000 | [diff] [blame] | 58 | |
| 59 | return 0; |
Howard Hinnant | 3e51952 | 2010-05-11 19:42:16 +0000 | [diff] [blame] | 60 | } |