[libc-commits] [libc] [libc] Remove `#ifdef __cplusplus` part from `include/llvm-libc-macros/math-macros.h`. (PR #87864)
via libc-commits
libc-commits at lists.llvm.org
Fri Apr 5 21:30:44 PDT 2024
https://github.com/lntue created https://github.com/llvm/llvm-project/pull/87864
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.
>From 63cf298ae68ee231f13a22d53461ac683517edde Mon Sep 17 00:00:00 2001
From: Tue Ly <lntue at google.com>
Date: Sat, 6 Apr 2024 00:26:31 -0400
Subject: [PATCH] [libc] Remove `#ifdef __cplusplus` part from
`include/llvm-libc-macros/math-macros.h`.
---
libc/include/llvm-libc-macros/math-macros.h | 24 ---------------------
1 file changed, 24 deletions(-)
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
More information about the libc-commits
mailing list