Skip to content

[libc] Remove #ifdef __cplusplus part from include/llvm-libc-macros/math-macros.h. #87864

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
Apr 8, 2024

Conversation

lntue
Copy link
Contributor

@lntue lntue commented Apr 6, 2024

Now with the proxy header hdr/math_macros.h, the header include/llvm-libc-macros/math-macros.h will not be included in overlay mode, and the extra definitions for __cplusplus mode is not needed any more.

@llvmbot
Copy link
Member

llvmbot commented Apr 6, 2024

@llvm/pr-subscribers-libc

Author: None (lntue)

Changes

Now with the proxy header hdr/math_macros.h, the header include/llvm-libc-macros/math-macros.h will not be included in overlay mode, and the extra definitions for __cplusplus mode is not needed any more.


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

1 Files Affected:

  • (modified) libc/include/llvm-libc-macros/math-macros.h (-24)
diff --git a/libc/include/llvm-libc-macros/math-macros.h b/libc/include/llvm-libc-macros/math-macros.h
index 1cbd1665d0cd2a..47838969d59aed 100644
--- a/libc/include/llvm-libc-macros/math-macros.h
+++ b/libc/include/llvm-libc-macros/math-macros.h
@@ -51,33 +51,9 @@
 #define math_errhandling (MATH_ERRNO | MATH_ERREXCEPT)
 #endif
 
-// These must be type-generic functions.  The C standard specifies them as
-// being macros rather than functions, in fact.  However, in C++ it's important
-// that there be function declarations that don't interfere with other uses of
-// the identifier, even in places with parentheses where a function-like macro
-// will be expanded (such as a function declaration in a C++ namespace).
-
 // TODO: Move generic functional math macros to a separate header file.
-#ifdef __cplusplus
-
-template <typename T> inline constexpr bool isfinite(T x) {
-  return __builtin_isfinite(x);
-}
-
-template <typename T> inline constexpr bool isinf(T x) {
-  return __builtin_isinf(x);
-}
-
-template <typename T> inline constexpr bool isnan(T x) {
-  return __builtin_isnan(x);
-}
-
-#else
-
 #define isfinite(x) __builtin_isfinite(x)
 #define isinf(x) __builtin_isinf(x)
 #define isnan(x) __builtin_isnan(x)
 
-#endif
-
 #endif // LLVM_LIBC_MACROS_MATH_MACROS_H

@lntue lntue merged commit 22b1f1b into llvm:main Apr 8, 2024
@lntue lntue deleted the math_macros branch April 8, 2024 23:26
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