csignal.pass.cpp 1.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061
  1. //===----------------------------------------------------------------------===//
  2. //
  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
  6. //
  7. //===----------------------------------------------------------------------===//
  8. // test <csignal>
  9. #include <csignal>
  10. #include <type_traits>
  11. #include "test_macros.h"
  12. #ifndef SIG_DFL
  13. #error SIG_DFL not defined
  14. #endif
  15. #ifndef SIG_ERR
  16. #error SIG_ERR not defined
  17. #endif
  18. #ifndef SIG_IGN
  19. #error SIG_IGN not defined
  20. #endif
  21. #ifndef SIGABRT
  22. #error SIGABRT not defined
  23. #endif
  24. #ifndef SIGFPE
  25. #error SIGFPE not defined
  26. #endif
  27. #ifndef SIGILL
  28. #error SIGILL not defined
  29. #endif
  30. #ifndef SIGINT
  31. #error SIGINT not defined
  32. #endif
  33. #ifndef SIGSEGV
  34. #error SIGSEGV not defined
  35. #endif
  36. #ifndef SIGTERM
  37. #error SIGTERM not defined
  38. #endif
  39. int main(int, char**)
  40. {
  41. std::sig_atomic_t sig = 0;
  42. ((void)sig);
  43. typedef void (*func)(int);
  44. static_assert((std::is_same<decltype(std::signal(0, (func)0)), func>::value), "");
  45. static_assert((std::is_same<decltype(std::raise(0)), int>::value), "");
  46. return 0;
  47. }