summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--libc/src/__support/StringUtil/tables/error_table.h21
-rw-r--r--libc/src/__support/StringUtil/tables/signal_table.h21
2 files changed, 28 insertions, 14 deletions
diff --git a/libc/src/__support/StringUtil/tables/error_table.h b/libc/src/__support/StringUtil/tables/error_table.h
index 78f58bc43d6a..5e8226e7d390 100644
--- a/libc/src/__support/StringUtil/tables/error_table.h
+++ b/libc/src/__support/StringUtil/tables/error_table.h
@@ -14,18 +14,25 @@
#include "posix_error_table.h"
#include "stdc_error_table.h"
-#ifdef __linux__
+#if defined(__linux__) || defined(__Fuchsia__)
+#define USE_LINUX_PLATFORM_ERRORS 1
+#else
+#define USE_LINUX_PLATFORM_ERRORS 0
+#endif
+
+#if USE_LINUX_PLATFORM_ERRORS
#include "linux/error_table.h"
#endif
namespace __llvm_libc::internal {
-#ifdef __linux__
-inline constexpr auto PLATFORM_ERRORS =
- STDC_ERRORS + POSIX_ERRORS + LINUX_ERRORS;
-#else
-inline constexpr auto PLATFORM_ERRORS = STDC_ERRORS;
-#endif
+inline constexpr auto PLATFORM_ERRORS = []() {
+ if constexpr (USE_LINUX_PLATFORM_ERRORS) {
+ return STDC_ERRORS + POSIX_ERRORS + LINUX_ERRORS;
+ } else {
+ return STDC_ERRORS;
+ }
+}();
} // namespace __llvm_libc::internal
diff --git a/libc/src/__support/StringUtil/tables/signal_table.h b/libc/src/__support/StringUtil/tables/signal_table.h
index b1b738abbac4..8ee8aa274813 100644
--- a/libc/src/__support/StringUtil/tables/signal_table.h
+++ b/libc/src/__support/StringUtil/tables/signal_table.h
@@ -14,18 +14,25 @@
#include "posix_signal_table.h"
#include "stdc_signal_table.h"
-#ifdef __linux__
+#if defined(__linux__) || defined(__Fuchsia__)
+#define USE_LINUX_PLATFORM_SIGNALS 1
+#else
+#define USE_LINUX_PLATFORM_SIGNALS 0
+#endif
+
+#if USE_LINUX_PLATFORM_SIGNALS
#include "linux/signal_table.h"
#endif
namespace __llvm_libc::internal {
-#ifdef __linux__
-inline constexpr auto PLATFORM_SIGNALS =
- STDC_SIGNALS + POSIX_SIGNALS + LINUX_SIGNALS;
-#else
-inline constexpr auto PLATFORM_SIGNALS = STDC_SIGNALS;
-#endif
+inline constexpr auto PLATFORM_SIGNALS = []() {
+ if constexpr (USE_LINUX_PLATFORM_SIGNALS) {
+ return STDC_SIGNALS + POSIX_SIGNALS + LINUX_SIGNALS;
+ } else {
+ return STDC_SIGNALS;
+ }
+}();
} // namespace __llvm_libc::internal