-
Notifications
You must be signed in to change notification settings - Fork 13.5k
[libc] Fix missing default value for errno config #100175
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
@llvm/pr-subscribers-libc Author: Joseph Huber (jhuber6) ChangesSummary: Full diff: https://github.com/llvm/llvm-project/pull/100175.diff 2 Files Affected:
diff --git a/libc/cmake/modules/LibcConfig.cmake b/libc/cmake/modules/LibcConfig.cmake
index 7a3e6066b3cc0..da166dd6cc3fc 100644
--- a/libc/cmake/modules/LibcConfig.cmake
+++ b/libc/cmake/modules/LibcConfig.cmake
@@ -113,7 +113,7 @@ function(load_libc_config config_file)
message(FATAL_ERROR ${json_error})
endif()
if(NOT DEFINED ${opt_name})
- message(FATAL_ERROR: " Option ${opt_name} defined in ${config_file} is invalid.")
+ message(FATAL_ERROR " Option ${opt_name} defined in ${config_file} is invalid.")
endif()
if(ARGN)
list(FIND ARGN ${opt_name} optname_exists)
diff --git a/libc/config/config.json b/libc/config/config.json
index 2005f4297bfc1..f134a0f41cf56 100644
--- a/libc/config/config.json
+++ b/libc/config/config.json
@@ -1,7 +1,7 @@
{
"errno": {
"LIBC_CONF_ERRNO_MODE": {
- "value": "",
+ "value": "LIBC_ERRNO_MODE_THREAD_LOCAL",
"doc": "The implementation used for errno, acceptable values are LIBC_ERRNO_MODE_UNDEFINED, LIBC_ERRNO_MODE_THREAD_LOCAL, LIBC_ERRNO_MODE_SHARED, LIBC_ERRNO_MODE_EXTERNAL, and LIBC_ERRNO_MODE_SYSTEM."
}
},
|
@@ -23,7 +25,8 @@ | |||
// fullbuild mode, effectively the same as `LIBC_ERRNO_MODE_EXTERNAL`. | |||
#define LIBC_ERRNO_MODE_SYSTEM 5 | |||
|
|||
#ifndef LIBC_ERRNO_MODE | |||
#if !defined(LIBC_ERRNO_MODE) || LIBC_ERRNO_MODE == LIBC_ERRNO_MODE_DEFAULT |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can you add LIBC_ERRNO_MODE_DEFAULT
to the #error
message below?
#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 | ||
#endif | ||
#endif // LIBC_ERRNO_MODE | ||
|
||
#if LIBC_ERRNO_MODE != LIBC_ERRNO_MODE_UNDEFINED && \ | ||
#if LIBC_ERRNO_MODE != LIBC_ERRNO_MODE_DEFAULT && \ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
add LIBC_ERRNO_MODE_DEFAULT
to L44 below.
Summary: The configs all need default values which targets then override. This one was an empty string which made the logic report an error. The only reason it wasn't a build failure was because of a stray `:`.
Summary: The configs all need default values which targets then override. This one was an empty string which made the logic report an error. The only reason it wasn't a build failure was because of a stray `:`.
Summary:
The configs all need default values which targets then override. This
one was an empty string which made the logic report an error. The only
reason it wasn't a build failure was because of a stray
:
.