summaryrefslogtreecommitdiff
path: root/libc/src/__support/StringUtil/error_to_string.cpp
AgeCommit message (Collapse)Author
2025-09-05[libc] Use anonymous namespace for file-local symbols (#157202)Roland McGrath
A namespace like LIBC_NAMESPACE::internal should only ever be defined if it's providing global symbols declared in headers. These StringUtil implementations were defining global namespaced symbols for their file-local helper code, which they should not.
2024-09-19[libc] Add printf strerror conversion (%m) (#105891)Michael Jones
This patch adds the %m conversion to printf, which prints the strerror(errno). Explanation of why is below, this patch also updates the docs, tests, and build system to accomodate this. The standard for syslog in posix specifies it uses the same format as printf, but adds %m which prints the error message string for the current value of errno. For ease of implementation, it's standard practice for libc implementers to just add %m to printf instead of creating a separate parser for syslog.
2024-07-12[libc] Migrate to using LIBC_NAMESPACE_DECL for namespace declaration (#98597)Petr Hosek
This is a part of #97655.
2024-07-12Revert "[libc] Migrate to using LIBC_NAMESPACE_DECL for namespace ↵Mehdi Amini
declaration" (#98593) Reverts llvm/llvm-project#98075 bots are broken
2024-07-11[libc] Migrate to using LIBC_NAMESPACE_DECL for namespace declaration (#98075)Petr Hosek
This is a part of #97655.
2023-09-26[libc] Mass replace enclosing namespace (#67032)Guillaume Chatelet
This is step 4 of https://discourse.llvm.org/t/rfc-customizable-namespace-to-allow-testing-the-libc-when-the-system-libc-is-also-llvms-libc/73079
2023-08-09[libc] Better IntegerToString APIGuillaume Chatelet
This patch is an alternative to D155902. It provides the following benefits: - No buffer manual allocation and error handling for the general case - More flexible API : width specifier, sign and prefix handling - Simpler code The more flexible API removes the need for manually tweaking the buffer afterwards, and so prevents relying on implementation details of IntegerToString. Reviewed By: michaelrj, jhuber6 Differential Revision: https://reviews.llvm.org/D156981
2023-08-08Revert "[libc] Better IntegerToString API"Guillaume Chatelet
This reverts commit 910cc05aae85a6b31e2a2ed87d3dd46db46fce04.
2023-08-08[libc] Better IntegerToString APIGuillaume Chatelet
This patch is an alternative to D155902. It provides the following benefits: - No buffer manual allocation and error handling for the general case - More flexible API : width specifier, sign and prefix handling - Simpler code The more flexible API removes the need for manually tweaking the buffer afterwards, and so prevents relying on implementation details of IntegerToString. Reviewed By: michaelrj, jhuber6 Differential Revision: https://reviews.llvm.org/D156981
2023-05-25[libc] Add macro LIBC_THREAD_LOCAL.Siva Chandra Reddy
It resolves to thread_local on all platform except for the GPUs on which it resolves to nothing. The use of thread_local in the source code has been replaced with the new macro. Reviewed By: jhuber6 Differential Revision: https://reviews.llvm.org/D151486
2023-05-25[libc] Rearrange error and signal tables.Siva Chandra Reddy
This is largely a cosmetic change done with a few goals: 1. Reduce the conditionals in picking the correct set of tables for the platform. 2. Avoid exposing, for example Linux errors, when building for non-Linux platforms. This also prevents build failures when Linux errors are not defined on the target non-Linux platform. 3. Some "_table" suffixes have been removed to avoid repeated occurance of "table" like "tables/linux_error_table.h". Reviewed By: michaelrj Differential Revision: https://reviews.llvm.org/D151367
2023-05-08[libc][NFC] Simplify string-table generation internals.Siva Chandra Reddy
Reviewed By: michaelrj Differential Revision: https://reviews.llvm.org/D150088
2023-04-18[libc] move strerror and strsignal to OS msg mapsMichael Jones
Other OSes may have different mappings from error number to message. This creates a system to allow new platforms to define their own mappings. Reviewed By: sivachandra Differential Revision: https://reviews.llvm.org/D147967
2023-03-03[libc] move stdlib and stdio to new errno patternMichael Jones
Fixes https://github.com/llvm/llvm-project/issues/61071 Reviewed By: sivachandra Differential Revision: https://reviews.llvm.org/D145191
2022-10-07[libc] add strsignal and refactor message mappingMichael Jones
The logic for strsignal and strerror is very similar, so I've moved them both to use a shared utility (MessageMapper) for the basic functionality. Reviewed By: sivachandra Differential Revision: https://reviews.llvm.org/D135322