[libc-commits] [PATCH] D150026: [libc] Use Linux errno and signal strings for Fuchsia
Roland McGrath via Phabricator via libc-commits
libc-commits at lists.llvm.org
Sun May 7 17:22:39 PDT 2023
This revision was automatically updated to reflect the committed changes.
Closed by commit rG46b76a54e16a: [libc] Use Linux errno and signal strings for Fuchsia (authored by mcgrathr).
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D150026/new/
https://reviews.llvm.org/D150026
Files:
libc/src/__support/StringUtil/tables/error_table.h
libc/src/__support/StringUtil/tables/signal_table.h
Index: libc/src/__support/StringUtil/tables/signal_table.h
===================================================================
--- libc/src/__support/StringUtil/tables/signal_table.h
+++ 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
Index: libc/src/__support/StringUtil/tables/error_table.h
===================================================================
--- libc/src/__support/StringUtil/tables/error_table.h
+++ 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
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D150026.520224.patch
Type: text/x-patch
Size: 2027 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/libc-commits/attachments/20230508/38e92d84/attachment.bin>
More information about the libc-commits
mailing list