xref: /llvm-project/libc/src/__support/StringUtil/tables/signal_table.h (revision 5ff3ff33ff930e4ec49da7910612d8a41eb068cb)
1 //===-- Map from signal numbers to strings ----------------------*- C++ -*-===//
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 
9 #ifndef LLVM_LIBC_SRC___SUPPORT_STRINGUTIL_TABLES_SIGNAL_TABLE_H
10 #define LLVM_LIBC_SRC___SUPPORT_STRINGUTIL_TABLES_SIGNAL_TABLE_H
11 
12 #include "src/__support/StringUtil/message_mapper.h"
13 
14 #include "posix_signals.h"
15 #include "src/__support/macros/config.h"
16 #include "stdc_signals.h"
17 
18 #if defined(__linux__) || defined(__Fuchsia__)
19 #define USE_LINUX_PLATFORM_SIGNALS 1
20 #else
21 #define USE_LINUX_PLATFORM_SIGNALS 0
22 #endif
23 
24 #if USE_LINUX_PLATFORM_SIGNALS
25 #include "linux_extension_signals.h"
26 #endif
27 
28 namespace LIBC_NAMESPACE_DECL {
29 namespace internal {
30 
31 LIBC_INLINE_VAR constexpr auto PLATFORM_SIGNALS = []() {
32   if constexpr (USE_LINUX_PLATFORM_SIGNALS) {
33     return STDC_SIGNALS + POSIX_SIGNALS + LINUX_SIGNALS;
34   } else {
35     return STDC_SIGNALS;
36   }
37 }();
38 
39 } // namespace internal
40 } // namespace LIBC_NAMESPACE_DECL
41 
42 #endif // LLVM_LIBC_SRC___SUPPORT_STRINGUTIL_TABLES_SIGNAL_TABLE_H
43