Skip to content

[libc] Temporary math macros fix #87681

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 2 commits into from
Apr 4, 2024

Conversation

michaelrj-google
Copy link
Contributor

@michaelrj-google michaelrj-google commented Apr 4, 2024

Downstream's having some issues due to math-macros.h issues. These will
be fixed properly soon.

See #87683 for tracking this tech debt.

@llvmbot llvmbot added libc bazel "Peripheral" support tier build system: utils/bazel labels Apr 4, 2024
@llvmbot
Copy link
Member

llvmbot commented Apr 4, 2024

@llvm/pr-subscribers-libc

Author: Michael Jones (michaelrj-google)

Changes

Downstream's having some issues due to math-macros.h issues. These will
be fixed properly soon.


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

2 Files Affected:

  • (modified) libc/include/llvm-libc-macros/math-macros.h (+9)
  • (modified) utils/bazel/llvm-project-overlay/libc/BUILD.bazel (+1-2)
diff --git a/libc/include/llvm-libc-macros/math-macros.h b/libc/include/llvm-libc-macros/math-macros.h
index 1497e32044e975..99fb3dbf0a9b4e 100644
--- a/libc/include/llvm-libc-macros/math-macros.h
+++ b/libc/include/llvm-libc-macros/math-macros.h
@@ -9,6 +9,9 @@
 #ifndef LLVM_LIBC_MACROS_MATH_MACROS_H
 #define LLVM_LIBC_MACROS_MATH_MACROS_H
 
+// TODO: Remove this. This is a temporary fix for a downstream problem.
+#ifdef LLVM_LIBC_FULLBUILD
+
 #include "limits-macros.h"
 
 #define FP_NAN 0
@@ -79,4 +82,10 @@ template <typename T> inline constexpr bool isnan(T x) {
 
 #endif
 
+#else
+
+#include <math.h>
+
+#endif // LLVM_LIBC_FULLBUILD
+
 #endif // LLVM_LIBC_MACROS_MATH_MACROS_H
diff --git a/utils/bazel/llvm-project-overlay/libc/BUILD.bazel b/utils/bazel/llvm-project-overlay/libc/BUILD.bazel
index 9dfe4c48184e3e..c06253b19558c8 100644
--- a/utils/bazel/llvm-project-overlay/libc/BUILD.bazel
+++ b/utils/bazel/llvm-project-overlay/libc/BUILD.bazel
@@ -68,7 +68,6 @@ libc_support_library(
     name = "llvm_libc_macros_math_macros",
     hdrs = ["include/llvm-libc-macros/math-macros.h"],
     deps = [":llvm_libc_macros_limits_macros"],
-    defines = ["__FP_LOGBNAN_MIN"],
 )
 
 libc_support_library(
@@ -1000,8 +999,8 @@ libc_support_library(
 
 libc_support_library(
     name = "__support_osutil_quick_exit",
-    hdrs = ["src/__support/OSUtil/quick_exit.h"],
     srcs = ["src/__support/OSUtil/linux/quick_exit.cpp"],
+    hdrs = ["src/__support/OSUtil/quick_exit.h"],
     deps = [
         ":__support_osutil_syscall",
     ],

Copy link
Member

@nickdesaulniers nickdesaulniers left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please link to #87683 in the comment and commit message. Please wait for @lntue 's feedback before landing.

@nickdesaulniers nickdesaulniers requested a review from lntue April 4, 2024 19:00
@@ -9,6 +9,9 @@
#ifndef LLVM_LIBC_MACROS_MATH_MACROS_H
#define LLVM_LIBC_MACROS_MATH_MACROS_H

// TODO: Remove this. This is a temporary fix for a downstream problem.
#ifdef LLVM_LIBC_FULLBUILD
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 change the flag to LIBC_FULL_BUILD and add the change to libc/cmake/modules/LLVMLibCCompileOptionRules.cmake in https://github.com/llvm/llvm-project/pull/87598/files#diff-25513d7d596301fa3039e5ad6bab76159cd5bd330a5890773e10cf5507045ca0

After this, if there is any regression on the full build bots, I will fix it forward.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

oh, right, we don't define LIBC_FULL_BUILD yet until (#87598, #87017)

Downstream's having some issues due to math-macros.h issues. These will
be fixed properly soon.

See llvm#87683 for tracking this tech debt.
@michaelrj-google
Copy link
Contributor Author

I will land this after the presubmits finish.

@michaelrj-google michaelrj-google merged commit 5264c22 into llvm:main Apr 4, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bazel "Peripheral" support tier build system: utils/bazel libc
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants