[libc] [llvm] [libc] Move libc_errno.h to libc/src/__support and make LIBC_ERRNO_MODE_SYSTEM to be header-only. (PR #143187)

via llvm-commits llvm-commits at lists.llvm.org
Mon Jun 9 15:24:31 PDT 2025


================
@@ -0,0 +1,20 @@
+//===-- Common defines for sharing LLVM libc with LLVM projects -*- 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_SHARED_LIBC_COMMON_H
+#define LLVM_LIBC_SHARED_LIBC_COMMON_H
+
+// Use system errno.
+#undef LIBC_ERRNO_MODE
+#define LIBC_ERRNO_MODE LIBC_ERRNO_MODE_SYSTEM
----------------
lntue wrote:

It will be easier to enforce that in `libc/shared/libc_common.h`, basically just error out if `LIBC_ERRNO_MODE` is defined and not set as `LIBC_ERRNO_MODE_SYSTEM_INLINE`.  Once it is set as such, `src/__support/libc_errno.h` will not change it.

That's simpler than putting the enforcement in `src/__support/libc_errno.h`, because it needs some signal / macro definition from `libc/shared` folder anyway.

https://github.com/llvm/llvm-project/pull/143187


More information about the llvm-commits mailing list