[libc-commits] [libc] [libc] Add printf error handling (PR #162876)
Michael Jones via libc-commits
libc-commits at lists.llvm.org
Fri Oct 10 10:42:09 PDT 2025
================
@@ -132,14 +144,6 @@ template <typename T> LIBC_INLINE constexpr TypeDesc type_desc_from_type() {
// This is the value to be returned by conversions when no error has occurred.
constexpr int WRITE_OK = 0;
-// These are the printf return values for when an error has occurred. They are
-// all negative, and should be distinct.
-constexpr int FILE_WRITE_ERROR = -1;
-constexpr int FILE_STATUS_ERROR = -2;
-constexpr int NULLPTR_WRITE_ERROR = -3;
-constexpr int INT_CONVERSION_ERROR = -4;
-constexpr int FIXED_POINT_CONVERSION_ERROR = -5;
-constexpr int ALLOCATION_ERROR = -6;
----------------
michaelrj-google wrote:
I'd prefer to use our own internal error numbers until we get to the entrypoint because the list of errno macros that are available depends on the platform. Specifically the C standard only defines 3: `EDOM`, `ERANGE`, and `EILSEQ`. Other error values like `ENOMEM` and `EINVAL` are actually from posix and might not be available on all platforms.
https://github.com/llvm/llvm-project/pull/162876
More information about the libc-commits
mailing list