-
Notifications
You must be signed in to change notification settings - Fork 14.3k
[libc][math] undef iscanonical
before defining it using LLVM_LIBC_FUNCTION
macro
#110865
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: Shourya Goel (Sh0g0-1758) ChangesIt appears that #110565 fails because the macro LLVM_LIBC_FUNCTION is not being recognized or expanded properly. This PR expands the macro and also removes the static_assert since conversion from bool to int is well defined in C/C++. Full diff: https://github.com/llvm/llvm-project/pull/110865.diff 5 Files Affected:
diff --git a/libc/src/math/generic/iscanonical.cpp b/libc/src/math/generic/iscanonical.cpp
index d67a6b87b3e506..69a95c719a85c9 100644
--- a/libc/src/math/generic/iscanonical.cpp
+++ b/libc/src/math/generic/iscanonical.cpp
@@ -13,9 +13,9 @@
namespace LIBC_NAMESPACE_DECL {
-LLVM_LIBC_FUNCTION(int, iscanonical, (double x)) {
+int iscanonical(double x) {
double temp;
- return static_cast<int>(fputil::canonicalize(temp, x) == 0);
+ return fputil::canonicalize(temp, x) == 0;
}
} // namespace LIBC_NAMESPACE_DECL
diff --git a/libc/src/math/generic/iscanonicalf.cpp b/libc/src/math/generic/iscanonicalf.cpp
index daa0708794d2f4..b27c0fd1fabf44 100644
--- a/libc/src/math/generic/iscanonicalf.cpp
+++ b/libc/src/math/generic/iscanonicalf.cpp
@@ -13,9 +13,9 @@
namespace LIBC_NAMESPACE_DECL {
-LLVM_LIBC_FUNCTION(int, iscanonicalf, (float x)) {
+int iscanonicalf(float x) {
float temp;
- return static_cast<int>(fputil::canonicalize(temp, x) == 0);
+ return fputil::canonicalize(temp, x) == 0;
}
} // namespace LIBC_NAMESPACE_DECL
diff --git a/libc/src/math/generic/iscanonicalf128.cpp b/libc/src/math/generic/iscanonicalf128.cpp
index 9be50050f8234c..ccd9b34411b2c4 100644
--- a/libc/src/math/generic/iscanonicalf128.cpp
+++ b/libc/src/math/generic/iscanonicalf128.cpp
@@ -13,9 +13,9 @@
namespace LIBC_NAMESPACE_DECL {
-LLVM_LIBC_FUNCTION(int, iscanonicalf128, (float128 x)) {
+int iscanonicalf128(float128 x) {
float128 temp;
- return static_cast<int>(fputil::canonicalize(temp, x) == 0);
+ return fputil::canonicalize(temp, x) == 0;
}
} // namespace LIBC_NAMESPACE_DECL
diff --git a/libc/src/math/generic/iscanonicalf16.cpp b/libc/src/math/generic/iscanonicalf16.cpp
index 4f7bb1a0050f51..236b6276295137 100644
--- a/libc/src/math/generic/iscanonicalf16.cpp
+++ b/libc/src/math/generic/iscanonicalf16.cpp
@@ -13,9 +13,9 @@
namespace LIBC_NAMESPACE_DECL {
-LLVM_LIBC_FUNCTION(int, iscanonicalf16, (float16 x)) {
+int iscanonicalf16(float16 x) {
float16 temp;
- return static_cast<int>(fputil::canonicalize(temp, x) == 0);
+ return fputil::canonicalize(temp, x) == 0;
}
} // namespace LIBC_NAMESPACE_DECL
diff --git a/libc/src/math/generic/iscanonicall.cpp b/libc/src/math/generic/iscanonicall.cpp
index 756c1f8fb4abfa..9aa28ecccf6a86 100644
--- a/libc/src/math/generic/iscanonicall.cpp
+++ b/libc/src/math/generic/iscanonicall.cpp
@@ -13,9 +13,9 @@
namespace LIBC_NAMESPACE_DECL {
-LLVM_LIBC_FUNCTION(int, iscanonicall, (long double x)) {
+int iscanonicall(long double x) {
long double temp;
- return static_cast<int>(fputil::canonicalize(temp, x) == 0);
+ return fputil::canonicalize(temp, x) == 0;
}
} // namespace LIBC_NAMESPACE_DECL
|
iscanonical
before defining it using LLVM_LIBC_FUNCTION
macro
Nit: removes the |
ah interesting find. Would be good to know more & get to the bottom of that. |
…FUNCTION` macro (llvm#110865) It appears that llvm#110565 fails because the macro definition of iscanonical is included somewhere. This PR ensures that the macro expands correctly and also removes the static_cast because implicit conversion from bool to int is defined in C++.
It appears that #110565 fails because the macro definition of iscanonical is included somewhere. This PR ensures that the macro expands correctly and also removes the static_cast because implicit conversion from bool to int is defined in C++.