Skip to content

[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

Merged
merged 1 commit into from
Jul 23, 2024
Merged

Conversation

jhuber6
Copy link
Contributor

@jhuber6 jhuber6 commented Jul 23, 2024

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 :.

@llvmbot
Copy link
Member

llvmbot commented Jul 23, 2024

@llvm/pr-subscribers-libc

Author: Joseph Huber (jhuber6)

Changes

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 :.


Full diff: https://github.com/llvm/llvm-project/pull/100175.diff

2 Files Affected:

  • (modified) libc/cmake/modules/LibcConfig.cmake (+1-1)
  • (modified) libc/config/config.json (+1-1)
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
Copy link
Contributor

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 && \
Copy link
Contributor

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 `:`.
@jhuber6 jhuber6 merged commit 14e20ee into llvm:main Jul 23, 2024
4 of 5 checks passed
yuxuanchen1997 pushed a commit that referenced this pull request Jul 25, 2024
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 `:`.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants