[libc] Remove LIBC_ERRNO_MODE_SYSTEM mode. (#153077)
Use LIBC_ERRNO_MODE_SYSTEM_INLINE instead as the default for the "public packaging" (i.e. release mode) of an overlay build. The Bazel build has already switched to use it by default in 5ccc734fa0355f971f8f515457a0bece33ab6642. This should be a safe change, as LIBC_ERRNO_MODE_SYSTEM_INLINE works a drop-in (but simpler) LIBC_ERRNO_MODE_SYSTEM replacement. Remove the associated code paths and config settings. Fixes issue #143454.
This commit is contained in:
parent
db96363c0a
commit
04081caa09
@ -2,7 +2,7 @@
|
||||
"errno": {
|
||||
"LIBC_CONF_ERRNO_MODE": {
|
||||
"value": "LIBC_ERRNO_MODE_DEFAULT",
|
||||
"doc": "The implementation used for errno, acceptable values are LIBC_ERRNO_MODE_DEFAULT, LIBC_ERRNO_MODE_UNDEFINED, LIBC_ERRNO_MODE_THREAD_LOCAL, LIBC_ERRNO_MODE_SHARED, LIBC_ERRNO_MODE_EXTERNAL, LIBC_ERRNO_MODE_SYSTEM, and LIBC_ERRNO_MODE_SYSTEM_INLINE."
|
||||
"doc": "The implementation used for errno, acceptable values are LIBC_ERRNO_MODE_DEFAULT, LIBC_ERRNO_MODE_UNDEFINED, LIBC_ERRNO_MODE_THREAD_LOCAL, LIBC_ERRNO_MODE_SHARED, LIBC_ERRNO_MODE_EXTERNAL, and LIBC_ERRNO_MODE_SYSTEM_INLINE."
|
||||
}
|
||||
},
|
||||
"threads": {
|
||||
|
@ -29,7 +29,7 @@ to learn about the defaults for your platform and target.
|
||||
- ``LIBC_CONF_ENABLE_STRONG_STACK_PROTECTOR``: Enable -fstack-protector-strong to defend against stack smashing attack.
|
||||
- ``LIBC_CONF_KEEP_FRAME_POINTER``: Keep frame pointer in functions for better debugging experience.
|
||||
* **"errno" options**
|
||||
- ``LIBC_CONF_ERRNO_MODE``: The implementation used for errno, acceptable values are LIBC_ERRNO_MODE_DEFAULT, LIBC_ERRNO_MODE_UNDEFINED, LIBC_ERRNO_MODE_THREAD_LOCAL, LIBC_ERRNO_MODE_SHARED, LIBC_ERRNO_MODE_EXTERNAL, LIBC_ERRNO_MODE_SYSTEM, and LIBC_ERRNO_MODE_SYSTEM_INLINE.
|
||||
- ``LIBC_CONF_ERRNO_MODE``: The implementation used for errno, acceptable values are LIBC_ERRNO_MODE_DEFAULT, LIBC_ERRNO_MODE_UNDEFINED, LIBC_ERRNO_MODE_THREAD_LOCAL, LIBC_ERRNO_MODE_SHARED, LIBC_ERRNO_MODE_EXTERNAL, and LIBC_ERRNO_MODE_SYSTEM_INLINE.
|
||||
* **"general" options**
|
||||
- ``LIBC_ADD_NULL_CHECKS``: Add nullptr checks in the library's implementations to some functions for which passing nullptr is undefined behavior.
|
||||
* **"math" options**
|
||||
|
@ -37,18 +37,11 @@
|
||||
// libc doesn't maintain any internal state, instead the embedder must define
|
||||
// `int *__llvm_libc_errno(void);` C function.
|
||||
#define LIBC_ERRNO_MODE_EXTERNAL 4
|
||||
// libc uses system `<errno.h>` `errno` macro directly in the overlay mode; in
|
||||
// fullbuild mode, effectively the same as `LIBC_ERRNO_MODE_EXTERNAL`.
|
||||
// In this mode, the public C++ symbol `LIBC_NAMESPACE::libc_errno ` is still
|
||||
// exported and get redirected to the system `errno` inside its implementation.
|
||||
|
||||
// TODO: Investigate deprecating LIBC_ERRNO_MODE_SYSTEM in favor of
|
||||
// LIBC_ERRNO_MODE_SYSTEM_INLINE.
|
||||
// https://github.com/llvm/llvm-project/issues/143454
|
||||
#define LIBC_ERRNO_MODE_SYSTEM 5
|
||||
// DEPRECATED: #define LIBC_ERRNO_MODE_SYSTEM 5
|
||||
// In this mode, the libc_errno is simply a macro resolved to `errno` from the
|
||||
// system header <errno.h>. There is no need to link against the
|
||||
// `libc.src.errno.errno` object.
|
||||
// `libc.src.errno.errno` object, and public C++ symbol
|
||||
// `LIBC_NAMESPACE::libc_errno` doesn't exist.
|
||||
#define LIBC_ERRNO_MODE_SYSTEM_INLINE 6
|
||||
|
||||
#if !defined(LIBC_ERRNO_MODE) || LIBC_ERRNO_MODE == LIBC_ERRNO_MODE_DEFAULT
|
||||
@ -56,7 +49,7 @@
|
||||
#if defined(LIBC_FULL_BUILD) || !defined(LIBC_COPT_PUBLIC_PACKAGING)
|
||||
#define LIBC_ERRNO_MODE LIBC_ERRNO_MODE_THREAD_LOCAL
|
||||
#else
|
||||
#define LIBC_ERRNO_MODE LIBC_ERRNO_MODE_SYSTEM
|
||||
#define LIBC_ERRNO_MODE LIBC_ERRNO_MODE_SYSTEM_INLINE
|
||||
#endif
|
||||
#endif // LIBC_ERRNO_MODE
|
||||
|
||||
@ -65,7 +58,6 @@
|
||||
LIBC_ERRNO_MODE != LIBC_ERRNO_MODE_THREAD_LOCAL && \
|
||||
LIBC_ERRNO_MODE != LIBC_ERRNO_MODE_SHARED && \
|
||||
LIBC_ERRNO_MODE != LIBC_ERRNO_MODE_EXTERNAL && \
|
||||
LIBC_ERRNO_MODE != LIBC_ERRNO_MODE_SYSTEM && \
|
||||
LIBC_ERRNO_MODE != LIBC_ERRNO_MODE_SYSTEM_INLINE
|
||||
#error LIBC_ERRNO_MODE must be one of the following values: \
|
||||
LIBC_ERRNO_MODE_DEFAULT, \
|
||||
@ -73,7 +65,6 @@ LIBC_ERRNO_MODE_UNDEFINED, \
|
||||
LIBC_ERRNO_MODE_THREAD_LOCAL, \
|
||||
LIBC_ERRNO_MODE_SHARED, \
|
||||
LIBC_ERRNO_MODE_EXTERNAL, \
|
||||
LIBC_ERRNO_MODE_SYSTEM, \
|
||||
LIBC_ERRNO_MODE_SYSTEM_INLINE.
|
||||
#endif
|
||||
|
||||
|
@ -46,11 +46,6 @@ Errno::operator int() { return shared_errno; }
|
||||
void Errno::operator=(int a) { *__llvm_libc_errno() = a; }
|
||||
Errno::operator int() { return *__llvm_libc_errno(); }
|
||||
|
||||
#elif LIBC_ERRNO_MODE == LIBC_ERRNO_MODE_SYSTEM
|
||||
|
||||
void Errno::operator=(int a) { errno = a; }
|
||||
Errno::operator int() { return errno; }
|
||||
|
||||
#endif
|
||||
|
||||
// Define the global `libc_errno` instance.
|
||||
|
Loading…
x
Reference in New Issue
Block a user