diff --git a/libc/src/__support/StringUtil/CMakeLists.txt b/libc/src/__support/StringUtil/CMakeLists.txt --- a/libc/src/__support/StringUtil/CMakeLists.txt +++ b/libc/src/__support/StringUtil/CMakeLists.txt @@ -3,6 +3,7 @@ HDRS message_mapper.h DEPENDS + libc.src.__support.CPP.array libc.src.__support.CPP.string_view libc.src.__support.CPP.optional ) @@ -10,6 +11,30 @@ # The table maps depend on message_mapper. add_subdirectory(tables) +add_header_library( + platform_errors + HDRS + platform_errors.h + DEPENDS + # To avoid complicated conditionals, we will unconditionally add dependency + # on all platform errors which are included in platform_error_table.h. + # Ultimately, only the relevent error table will be used. + .tables.linux_platform_errors + .tables.minimal_platform_errors +) + +add_header_library( + platform_signals + HDRS + platform_signals.h + DEPENDS + # To avoid complicated conditionals, we will unconditionally add dependency + # on all platform signals which are included in platform_signal_table.h. + # Ultimately, only the relevent signal table will be used. + .tables.linux_platform_signals + .tables.minimal_platform_signals +) + add_object_library( error_to_string HDRS @@ -18,12 +43,11 @@ error_to_string.cpp DEPENDS .message_mapper - libc.src.errno.errno + .platform_errors libc.src.__support.CPP.span libc.src.__support.CPP.string_view libc.src.__support.CPP.stringstream libc.src.__support.integer_to_string - libc.src.__support.StringUtil.tables.error_table ) add_object_library( @@ -34,10 +58,10 @@ signal_to_string.cpp DEPENDS .message_mapper + .platform_signals libc.include.signal libc.src.__support.CPP.span libc.src.__support.CPP.string_view libc.src.__support.CPP.stringstream libc.src.__support.integer_to_string - libc.src.__support.StringUtil.tables.signal_table ) diff --git a/libc/src/__support/StringUtil/error_to_string.cpp b/libc/src/__support/StringUtil/error_to_string.cpp --- a/libc/src/__support/StringUtil/error_to_string.cpp +++ b/libc/src/__support/StringUtil/error_to_string.cpp @@ -6,19 +6,15 @@ // //===----------------------------------------------------------------------===// -#include "src/__support/StringUtil/error_to_string.h" +#include "error_to_string.h" +#include "platform_errors.h" -#include "src/errno/libc_errno.h" // For error macros - -#include "src/__support/CPP/array.h" #include "src/__support/CPP/span.h" #include "src/__support/CPP/string_view.h" #include "src/__support/CPP/stringstream.h" #include "src/__support/StringUtil/message_mapper.h" #include "src/__support/integer_to_string.h" -#include "src/__support/StringUtil/tables/error_table.h" - #include namespace __llvm_libc { diff --git a/libc/src/__support/StringUtil/message_mapper.h b/libc/src/__support/StringUtil/message_mapper.h --- a/libc/src/__support/StringUtil/message_mapper.h +++ b/libc/src/__support/StringUtil/message_mapper.h @@ -15,7 +15,6 @@ #include namespace __llvm_libc { -namespace internal { struct MsgMapping { int num; @@ -99,7 +98,6 @@ return res; } -} // namespace internal } // namespace __llvm_libc #endif // LLVM_LIBC_SRC_SUPPORT_STRING_UTIL_MESSAGE_MAPPER_H diff --git a/libc/src/__support/StringUtil/platform_errors.h b/libc/src/__support/StringUtil/platform_errors.h new file mode 100644 --- /dev/null +++ b/libc/src/__support/StringUtil/platform_errors.h @@ -0,0 +1,18 @@ +//===-- The error table for the current platform ----------------*- C++ -*-===// +// +// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. +// See https://llvm.org/LICENSE.txt for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception +// +//===----------------------------------------------------------------------===// + +#ifndef LLVM_LIBC_SRC_SUPPORT_STRING_UTIL_PLATFORM_ERROR_TABLE_H +#define LLVM_LIBC_SRC_SUPPORT_STRING_UTIL_PLATFORM_ERROR_TABLE_H + +#if defined(__linux__) || defined(__Fuchsia__) +#include "tables/linux_platform_errors.h" +#else +#include "tables/minimal_platform_errors.h" +#endif + +#endif // LLVM_LIBC_SRC_SUPPORT_STRING_UTIL_PLATFORM_ERROR_TABLE_H diff --git a/libc/src/__support/StringUtil/platform_signals.h b/libc/src/__support/StringUtil/platform_signals.h new file mode 100644 --- /dev/null +++ b/libc/src/__support/StringUtil/platform_signals.h @@ -0,0 +1,18 @@ +//===-- The signal table for the current platform ---------------*- C++ -*-===// +// +// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. +// See https://llvm.org/LICENSE.txt for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception +// +//===----------------------------------------------------------------------===// + +#ifndef LLVM_LIBC_SRC_SUPPORT_STRING_UTIL_PLATFORM_SIGNAL_TABLE_H +#define LLVM_LIBC_SRC_SUPPORT_STRING_UTIL_PLATFORM_SIGNAL_TABLE_H + +#if defined(__linux__) || defined(__Fuchsia__) +#include "tables/linux_platform_signals.h" +#else +#include "tables/minimal_platform_signals.h" +#endif + +#endif // LLVM_LIBC_SRC_SUPPORT_STRING_UTIL_PLATFORM_SIGNAL_TABLE_H diff --git a/libc/src/__support/StringUtil/signal_to_string.cpp b/libc/src/__support/StringUtil/signal_to_string.cpp --- a/libc/src/__support/StringUtil/signal_to_string.cpp +++ b/libc/src/__support/StringUtil/signal_to_string.cpp @@ -6,13 +6,13 @@ // //===----------------------------------------------------------------------===// -#include "src/__support/StringUtil/signal_to_string.h" +#include "signal_to_string.h" +#include "platform_signals.h" #include "src/__support/CPP/span.h" #include "src/__support/CPP/string_view.h" #include "src/__support/CPP/stringstream.h" #include "src/__support/StringUtil/message_mapper.h" -#include "src/__support/StringUtil/tables/signal_table.h" #include "src/__support/integer_to_string.h" #include diff --git a/libc/src/__support/StringUtil/tables/CMakeLists.txt b/libc/src/__support/StringUtil/tables/CMakeLists.txt --- a/libc/src/__support/StringUtil/tables/CMakeLists.txt +++ b/libc/src/__support/StringUtil/tables/CMakeLists.txt @@ -1,35 +1,89 @@ -if(EXISTS ${CMAKE_CURRENT_SOURCE_DIR}/${LIBC_TARGET_OS}) - add_subdirectory(${LIBC_TARGET_OS}) -endif() +add_header_library( + stdc_errors + HDRS + stdc_errors.h + DEPENDS + libc.include.errno + libc.src.__support.StringUtil.message_mapper +) -set(error_to_string_platform_dep "") -if(TARGET libc.src.__support.StringUtil.tables.${LIBC_TARGET_OS}.error_table) - set(error_to_string_platform_dep - libc.src.__support.StringUtil.tables.${LIBC_TARGET_OS}.error_table) -endif() +add_header_library( + posix_errors + HDRS + posix_errors.h + DEPENDS + libc.include.errno + libc.src.__support.StringUtil.message_mapper +) add_header_library( - error_table + linux_extension_errors HDRS - error_table.h - stdc_error_table.h - posix_error_table.h + linux_extension_errors.h DEPENDS - ${error_to_string_platform_dep} + libc.include.errno + libc.src.__support.StringUtil.message_mapper ) -set(signal_to_string_platform_dep "") -if(TARGET libc.src.__support.StringUtil.tables.${LIBC_TARGET_OS}.signal_table) - set(signal_to_string_platform_dep - libc.src.__support.StringUtil.tables.${LIBC_TARGET_OS}.signal_table) -endif() +add_header_library( + linux_platform_errors + HDRS + linux_platform_errors + DEPENDS + .linux_extension_errors + .posix_errors + .stdc_errors +) + +add_header_library( + minimal_platform_errors + HDRS + minimal_platform_errors + DEPENDS + .stdc_errors +) + +add_header_library( + stdc_signals + HDRS + stdc_signals.h + DEPENDS + libc.include.signal + libc.src.__support.StringUtil.message_mapper +) + +add_header_library( + posix_signals + HDRS + posix_signals.h + DEPENDS + libc.include.signal + libc.src.__support.StringUtil.message_mapper +) + +add_header_library( + linux_extension_signals + HDRS + linux_extension_signals.h + DEPENDS + libc.include.signal + libc.src.__support.StringUtil.message_mapper +) + +add_header_library( + linux_platform_signals + HDRS + linux_platform_signals + DEPENDS + .linux_extension_signals + .posix_signals + .stdc_signals +) add_header_library( - signal_table + minimal_platform_signals HDRS - signal_table.h - stdc_signal_table.h - posix_signal_table.h + minimal_platform_signals DEPENDS - ${signal_to_string_platform_dep} + .stdc_signals ) diff --git a/libc/src/__support/StringUtil/tables/error_table.h b/libc/src/__support/StringUtil/tables/error_table.h deleted file mode 100644 --- a/libc/src/__support/StringUtil/tables/error_table.h +++ /dev/null @@ -1,39 +0,0 @@ -//===-- Map from error numbers to strings -----------------------*- C++ -*-===// -// -// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. -// See https://llvm.org/LICENSE.txt for license information. -// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception -// -//===----------------------------------------------------------------------===// - -#ifndef LLVM_LIBC_SRC_SUPPORT_STRING_UTIL_TABLES_ERROR_TABLE_H -#define LLVM_LIBC_SRC_SUPPORT_STRING_UTIL_TABLES_ERROR_TABLE_H - -#include "src/__support/StringUtil/message_mapper.h" - -#include "posix_error_table.h" -#include "stdc_error_table.h" - -#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 { - -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 - -#endif // LLVM_LIBC_SRC_SUPPORT_STRING_UTIL_TABLES_ERROR_TABLE_H diff --git a/libc/src/__support/StringUtil/tables/linux/CMakeLists.txt b/libc/src/__support/StringUtil/tables/linux/CMakeLists.txt deleted file mode 100644 --- a/libc/src/__support/StringUtil/tables/linux/CMakeLists.txt +++ /dev/null @@ -1,17 +0,0 @@ -add_header_library( - error_table - HDRS - error_table.h - DEPENDS - libc.src.__support.StringUtil.message_mapper - libc.src.errno.errno -) - -add_header_library( - signal_table - HDRS - signal_table.h - DEPENDS - libc.src.__support.StringUtil.message_mapper - libc.include.signal -) diff --git a/libc/src/__support/StringUtil/tables/linux/error_table.h b/libc/src/__support/StringUtil/tables/linux_extension_errors.h rename from libc/src/__support/StringUtil/tables/linux/error_table.h rename to libc/src/__support/StringUtil/tables/linux_extension_errors.h --- a/libc/src/__support/StringUtil/tables/linux/error_table.h +++ b/libc/src/__support/StringUtil/tables/linux_extension_errors.h @@ -1,4 +1,4 @@ -//===-- Map from error numbers to strings on linux --------------*- C++ -*-===// +//===-- Map of Linux extension error numbers to strings ---------*- C++ -*-===// // // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. // See https://llvm.org/LICENSE.txt for license information. @@ -6,15 +6,14 @@ // //===----------------------------------------------------------------------===// -#ifndef LLVM_LIBC_SRC_SUPPORT_STRING_UTIL_TABLES_LINUX_ERROR_TABLE_H -#define LLVM_LIBC_SRC_SUPPORT_STRING_UTIL_TABLES_LINUX_ERROR_TABLE_H +#ifndef LLVM_LIBC_SRC_SUPPORT_STRING_UTIL_TABLES_LINUX_EXTENSION_ERRORS_H +#define LLVM_LIBC_SRC_SUPPORT_STRING_UTIL_TABLES_LINUX_EXTENSION_ERRORS_H -#include "src/errno/libc_errno.h" // For error macros - -#include "src/__support/CPP/array.h" #include "src/__support/StringUtil/message_mapper.h" -namespace __llvm_libc::internal { +#include // For error macros + +namespace __llvm_libc { constexpr MsgTable<52> LINUX_ERRORS = { MsgMapping(ENOTBLK, "Block device required"), @@ -71,6 +70,6 @@ MsgMapping(EHWPOISON, "Memory page has hardware error"), }; -} // namespace __llvm_libc::internal +} // namespace __llvm_libc -#endif // LLVM_LIBC_SRC_SUPPORT_STRING_UTIL_TABLES_LINUX_ERROR_TABLE_H +#endif // LLVM_LIBC_SRC_SUPPORT_STRING_UTIL_TABLES_LINUX_EXTENSION_ERRORS_H diff --git a/libc/src/__support/StringUtil/tables/linux/signal_table.h b/libc/src/__support/StringUtil/tables/linux_extension_signals.h rename from libc/src/__support/StringUtil/tables/linux/signal_table.h rename to libc/src/__support/StringUtil/tables/linux_extension_signals.h --- a/libc/src/__support/StringUtil/tables/linux/signal_table.h +++ b/libc/src/__support/StringUtil/tables/linux_extension_signals.h @@ -1,4 +1,4 @@ -//===-- Map from signal numbers to strings on linux -------------*- C++ -*-===// +//===-- Map of Linux extension signal numbers to strings --------*- C++ -*-===// // // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. // See https://llvm.org/LICENSE.txt for license information. @@ -6,14 +6,14 @@ // //===----------------------------------------------------------------------===// -#ifndef LLVM_LIBC_SRC_SUPPORT_STRING_UTIL_TABLES_LINUX_SIGNAL_TABLE_H -#define LLVM_LIBC_SRC_SUPPORT_STRING_UTIL_TABLES_LINUX_SIGNAL_TABLE_H - -#include +#ifndef LLVM_LIBC_SRC_SUPPORT_STRING_UTIL_TABLES_LINUX_EXTENSION_SIGNALS_H +#define LLVM_LIBC_SRC_SUPPORT_STRING_UTIL_TABLES_LINUX_EXTENSION_SIGNALS_H #include "src/__support/StringUtil/message_mapper.h" -namespace __llvm_libc::internal { +#include // For signal numbers + +namespace __llvm_libc { // The array being larger than necessary isn't a problem. The MsgMappings will // be set to their default state which maps 0 to an empty string. This will get @@ -28,6 +28,6 @@ #endif }; -} // namespace __llvm_libc::internal +} // namespace __llvm_libc -#endif // LLVM_LIBC_SRC_SUPPORT_STRING_UTIL_TABLES_LINUX_SIGNAL_TABLE_H +#endif // LLVM_LIBC_SRC_SUPPORT_STRING_UTIL_TABLES_LINUX_EXTENSION_SIGNALS_H diff --git a/libc/src/__support/StringUtil/tables/linux_platform_errors.h b/libc/src/__support/StringUtil/tables/linux_platform_errors.h new file mode 100644 --- /dev/null +++ b/libc/src/__support/StringUtil/tables/linux_platform_errors.h @@ -0,0 +1,23 @@ +//===-- Map of error numbers to strings for the Linux platform --*- C++ -*-===// +// +// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. +// See https://llvm.org/LICENSE.txt for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception +// +//===----------------------------------------------------------------------===// + +#ifndef LLVM_LIBC_SRC_SUPPORT_STRING_UTIL_TABLES_LINUX_PLATFORM_ERRORS_H +#define LLVM_LIBC_SRC_SUPPORT_STRING_UTIL_TABLES_LINUX_PLATFORM_ERRORS_H + +#include "linux_extension_errors.h" +#include "posix_errors.h" +#include "stdc_errors.h" + +namespace __llvm_libc { + +inline constexpr auto PLATFORM_ERRORS = + STDC_ERRORS + POSIX_ERRORS + LINUX_ERRORS; + +} // namespace __llvm_libc + +#endif // LLVM_LIBC_SRC_SUPPORT_STRING_UTIL_TABLES_LINUX_PLATFORM_ERRORS_H diff --git a/libc/src/__support/StringUtil/tables/linux_platform_signals.h b/libc/src/__support/StringUtil/tables/linux_platform_signals.h new file mode 100644 --- /dev/null +++ b/libc/src/__support/StringUtil/tables/linux_platform_signals.h @@ -0,0 +1,23 @@ +//===-- Map of error numbers to strings for the Linux platform --*- C++ -*-===// +// +// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. +// See https://llvm.org/LICENSE.txt for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception +// +//===----------------------------------------------------------------------===// + +#ifndef LLVM_LIBC_SRC_SUPPORT_STRING_UTIL_TABLES_LINUX_PLATFORM_SIGNALS_H +#define LLVM_LIBC_SRC_SUPPORT_STRING_UTIL_TABLES_LINUX_PLATFORM_SIGNALS_H + +#include "linux_extension_signals.h" +#include "posix_signals.h" +#include "stdc_signals.h" + +namespace __llvm_libc { + +inline constexpr auto PLATFORM_SIGNALS = + STDC_SIGNALS + POSIX_SIGNALS + LINUX_SIGNALS; + +} // namespace __llvm_libc + +#endif // LLVM_LIBC_SRC_SUPPORT_STRING_UTIL_TABLES_LINUX_PLATFORM_SIGNALS_H diff --git a/libc/src/__support/StringUtil/tables/minimal_platform_errors.h b/libc/src/__support/StringUtil/tables/minimal_platform_errors.h new file mode 100644 --- /dev/null +++ b/libc/src/__support/StringUtil/tables/minimal_platform_errors.h @@ -0,0 +1,20 @@ +//===-- Map of error numbers to strings for a stdc platform -----*- C++ -*-===// +// +// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. +// See https://llvm.org/LICENSE.txt for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception +// +//===----------------------------------------------------------------------===// + +#ifndef LLVM_LIBC_SRC_SUPPORT_STRING_UTIL_TABLES_MINIMAL_PLATFORM_ERRORS_H +#define LLVM_LIBC_SRC_SUPPORT_STRING_UTIL_TABLES_MINIMAL_PLATFORM_ERRORS_H + +#include "stdc_errors.h" + +namespace __llvm_libc { + +inline constexpr auto PLATFORM_ERRORS = STDC_ERRORS; + +} // namespace __llvm_libc + +#endif // LLVM_LIBC_SRC_SUPPORT_STRING_UTIL_TABLES_MINIMAL_PLATFORM_ERRORS_H diff --git a/libc/src/__support/StringUtil/tables/minimal_platform_signals.h b/libc/src/__support/StringUtil/tables/minimal_platform_signals.h new file mode 100644 --- /dev/null +++ b/libc/src/__support/StringUtil/tables/minimal_platform_signals.h @@ -0,0 +1,20 @@ +//===-- Map of error numbers to strings for a stdc platform -----*- C++ -*-===// +// +// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. +// See https://llvm.org/LICENSE.txt for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception +// +//===----------------------------------------------------------------------===// + +#ifndef LLVM_LIBC_SRC_SUPPORT_STRING_UTIL_TABLES_MINIMAL_PLATFORM_SIGNALS_H +#define LLVM_LIBC_SRC_SUPPORT_STRING_UTIL_TABLES_MINIMAL_PLATFORM_SIGNALS_H + +#include "stdc_signals.h" + +namespace __llvm_libc { + +inline constexpr auto PLATFORM_SIGNALS = STDC_SIGNALS; + +} // namespace __llvm_libc + +#endif // LLVM_LIBC_SRC_SUPPORT_STRING_UTIL_TABLES_MINIMAL_PLATFORM_SIGNALS_H diff --git a/libc/src/__support/StringUtil/tables/posix_error_table.h b/libc/src/__support/StringUtil/tables/posix_errors.h rename from libc/src/__support/StringUtil/tables/posix_error_table.h rename to libc/src/__support/StringUtil/tables/posix_errors.h --- a/libc/src/__support/StringUtil/tables/posix_error_table.h +++ b/libc/src/__support/StringUtil/tables/posix_errors.h @@ -1,4 +1,4 @@ -//===-- Map from error numbers to strings in posix --------------*- C++ -*-===// +//===-- Map of POSIX error numbers to strings -------------------*- C++ -*-===// // // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. // See https://llvm.org/LICENSE.txt for license information. @@ -6,15 +6,14 @@ // //===----------------------------------------------------------------------===// -#ifndef LLVM_LIBC_SRC_SUPPORT_STRING_UTIL_TABLES_POSIX_ERROR_TABLE_H -#define LLVM_LIBC_SRC_SUPPORT_STRING_UTIL_TABLES_POSIX_ERROR_TABLE_H +#ifndef LLVM_LIBC_SRC_SUPPORT_STRING_UTIL_TABLES_POSIX_ERRORS_H +#define LLVM_LIBC_SRC_SUPPORT_STRING_UTIL_TABLES_POSIX_ERRORS_H -#include "src/errno/libc_errno.h" // For error macros - -#include "src/__support/CPP/array.h" #include "src/__support/StringUtil/message_mapper.h" -namespace __llvm_libc::internal { +#include // For error macros + +namespace __llvm_libc { inline constexpr MsgTable<76> POSIX_ERRORS = { MsgMapping(EPERM, "Operation not permitted"), @@ -95,6 +94,6 @@ MsgMapping(ENOTRECOVERABLE, "State not recoverable"), }; -} // namespace __llvm_libc::internal +} // namespace __llvm_libc -#endif // LLVM_LIBC_SRC_SUPPORT_STRING_UTIL_TABLES_POSIX_ERROR_TABLE_H +#endif // LLVM_LIBC_SRC_SUPPORT_STRING_UTIL_TABLES_POSIX_ERRORS_H diff --git a/libc/src/__support/StringUtil/tables/posix_signal_table.h b/libc/src/__support/StringUtil/tables/posix_signals.h rename from libc/src/__support/StringUtil/tables/posix_signal_table.h rename to libc/src/__support/StringUtil/tables/posix_signals.h --- a/libc/src/__support/StringUtil/tables/posix_signal_table.h +++ b/libc/src/__support/StringUtil/tables/posix_signals.h @@ -1,4 +1,4 @@ -//===-- Map from signal numbers to strings in posix -------------*- C++ -*-===// +//===-- Map of POSIX signal numbers to strings ------------------*- C++ -*-===// // // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. // See https://llvm.org/LICENSE.txt for license information. @@ -6,15 +6,15 @@ // //===----------------------------------------------------------------------===// -#ifndef LLVM_LIBC_SRC_SUPPORT_STRING_UTIL_TABLES_POSIX_SIGNAL_TABLE_H -#define LLVM_LIBC_SRC_SUPPORT_STRING_UTIL_TABLES_POSIX_SIGNAL_TABLE_H - -#include +#ifndef LLVM_LIBC_SRC_SUPPORT_STRING_UTIL_TABLES_POSIX_SIGNALS_H +#define LLVM_LIBC_SRC_SUPPORT_STRING_UTIL_TABLES_POSIX_SIGNALS_H #include "src/__support/CPP/array.h" #include "src/__support/StringUtil/message_mapper.h" -namespace __llvm_libc::internal { +#include // For signal numbers + +namespace __llvm_libc { inline constexpr MsgTable<22> POSIX_SIGNALS = { MsgMapping(SIGHUP, "Hangup"), @@ -41,6 +41,6 @@ MsgMapping(SIGSYS, "Bad system call"), }; -} // namespace __llvm_libc::internal +} // namespace __llvm_libc -#endif // LLVM_LIBC_SRC_SUPPORT_STRING_UTIL_TABLES_POSIX_SIGNAL_TABLE_H +#endif // LLVM_LIBC_SRC_SUPPORT_STRING_UTIL_TABLES_POSIX_SIGNALS_H diff --git a/libc/src/__support/StringUtil/tables/stdc_error_table.h b/libc/src/__support/StringUtil/tables/stdc_errors.h rename from libc/src/__support/StringUtil/tables/stdc_error_table.h rename to libc/src/__support/StringUtil/tables/stdc_errors.h --- a/libc/src/__support/StringUtil/tables/stdc_error_table.h +++ b/libc/src/__support/StringUtil/tables/stdc_errors.h @@ -1,4 +1,4 @@ -//===-- Map from error numbers to strings in the c std ----------*- C++ -*-===// +//===-- Map of C standard error numbers to strings --------------*- C++ -*-===// // // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. // See https://llvm.org/LICENSE.txt for license information. @@ -6,14 +6,14 @@ // //===----------------------------------------------------------------------===// -#ifndef LLVM_LIBC_SRC_SUPPORT_STRING_UTIL_TABLES_STDC_ERROR_TABLE_H -#define LLVM_LIBC_SRC_SUPPORT_STRING_UTIL_TABLES_STDC_ERROR_TABLE_H - -#include "src/errno/libc_errno.h" // For error macros +#ifndef LLVM_LIBC_SRC_SUPPORT_STRING_UTIL_TABLES_STDC_ERRORS_H +#define LLVM_LIBC_SRC_SUPPORT_STRING_UTIL_TABLES_STDC_ERRORS_H #include "src/__support/StringUtil/message_mapper.h" -namespace __llvm_libc::internal { +#include // For error macros + +namespace __llvm_libc { inline constexpr const MsgTable<4> STDC_ERRORS = { MsgMapping(0, "Success"), @@ -22,6 +22,6 @@ MsgMapping(EILSEQ, "Invalid or incomplete multibyte or wide character"), }; -} // namespace __llvm_libc::internal +} // namespace __llvm_libc -#endif // LLVM_LIBC_SRC_SUPPORT_STRING_UTIL_TABLES_LINUX_ERROR_TABLE_H +#endif // LLVM_LIBC_SRC_SUPPORT_STRING_UTIL_TABLES_LINUX_ERRORS_H diff --git a/libc/src/__support/StringUtil/tables/stdc_signal_table.h b/libc/src/__support/StringUtil/tables/stdc_signals.h rename from libc/src/__support/StringUtil/tables/stdc_signal_table.h rename to libc/src/__support/StringUtil/tables/stdc_signals.h --- a/libc/src/__support/StringUtil/tables/stdc_signal_table.h +++ b/libc/src/__support/StringUtil/tables/stdc_signals.h @@ -1,4 +1,4 @@ -//===-- Map from signal numbers to strings in the c std ---------*- C++ -*-===// +//===-- Map of C standard signal numbers to strings -------------*- C++ -*-===// // // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. // See https://llvm.org/LICENSE.txt for license information. @@ -6,14 +6,14 @@ // //===----------------------------------------------------------------------===// -#ifndef LLVM_LIBC_SRC_SUPPORT_STRING_UTIL_TABLES_STDC_SIGNAL_TABLE_H -#define LLVM_LIBC_SRC_SUPPORT_STRING_UTIL_TABLES_STDC_SIGNAL_TABLE_H +#ifndef LLVM_LIBC_SRC_SUPPORT_STRING_UTIL_TABLES_STDC_SIGNALS_H +#define LLVM_LIBC_SRC_SUPPORT_STRING_UTIL_TABLES_STDC_SIGNALS_H -#include +#include // For signal numbers #include "src/__support/StringUtil/message_mapper.h" -namespace __llvm_libc::internal { +namespace __llvm_libc { inline constexpr const MsgTable<6> STDC_SIGNALS = { MsgMapping(SIGINT, "Interrupt"), @@ -24,6 +24,6 @@ MsgMapping(SIGTERM, "Terminated"), }; -} // namespace __llvm_libc::internal +} // namespace __llvm_libc -#endif // LLVM_LIBC_SRC_SUPPORT_STRING_UTIL_TABLES_LINUX_SIGNAL_TABLE_H +#endif // LLVM_LIBC_SRC_SUPPORT_STRING_UTIL_TABLES_LINUX_SIGNALS_H