[libc-commits] [libc] [llvm] [libc]Add proxy header hdr/float-macros.h (PR #88674)

via libc-commits libc-commits at lists.llvm.org
Mon May 6 06:04:04 PDT 2024


================
@@ -9,163 +9,206 @@
 #ifndef LLVM_LIBC_MACROS_FLOAT_MACROS_H
 #define LLVM_LIBC_MACROS_FLOAT_MACROS_H
 
-// Suppress `#include_next is a language extension` warnings.
-#ifdef __clang__
-#pragma clang diagnostic push
-#pragma clang diagnostic ignored "-Wgnu-include-next"
-#pragma clang diagnostic ignored "-Winclude-next-absolute-path"
-#else // gcc
-#pragma GCC system_header
-#endif //__clang__
-
-#include_next <float.h>
-
-#ifdef __clang__
-#pragma clang diagnostic pop
-#endif //__clang__
-
-#ifndef FLT_RADIX
+#ifdef __FLT_RADIX__
 #define FLT_RADIX __FLT_RADIX__
+#else 
+#define FLT_RADIX 2
 #endif // FLT_RADIX
 
-#ifndef FLT_EVAL_METHOD
+#ifdef FLT_EVAL_METHOD
 #define FLT_EVAL_METHOD __FLT_EVAL_METHOD__
 #endif // FLT_EVAL_METHOD
 
-#ifndef DECIMAL_DIG
+#ifdef DECIMAL_DIG
 #define DECIMAL_DIG __DECIMAL_DIG__
+#else 
+#define DECIMAL_DIG 10
 #endif // DECIMAL_DIG
 
-#ifndef FLT_DECIMAL_DIG
+#ifdef FLT_DECIMAL_DIG 
 #define FLT_DECIMAL_DIG __FLT_DECIMAL_DIG__
+#else 
+#define FLT_DECIMAL_DIG 6
 #endif // FLT_DECIMAL_DIG
 
-#ifndef DBL_DECIMAL_DIG
+#ifdef DBL_DECIMAL_DIG
 #define DBL_DECIMAL_DIG __DBL_DECIMAL_DIG__
+#else 
+#define DBL_DECIMAL_DIG 10
 #endif // DBL_DECIMAL_DIG
 
-#ifndef LDBL_DECIMAL_DIG
+#ifdef LDBL_DECIMAL_DIG
 #define LDBL_DECIMAL_DIG __LDBL_DECIMAL_DIG__
+#else 
+#define LDBL_DECIMAL_DIG 10
 #endif // LDBL_DECIMAL_DIG
 
-#ifndef FLT_DIG
+#ifdef FLT_DIG
 #define FLT_DIG __FLT_DIG__
+#else 
+#define FLT_DIG 6
 #endif // FLT_DIG
 
-#ifndef DBL_DIG
+#ifdef DBL_DIG
 #define DBL_DIG __DBL_DIG__
+#else 
+#define DBL_DIG 10
 #endif // DBL_DIG
 
-#ifndef LDBL_DIG
+#ifdef LDBL_DIG
 #define LDBL_DIG __LDBL_DIG__
+#else 
+#define LDBL_DIG 10
 #endif // LDBL_DIG
 
-#ifndef FLT_MANT_DIG
+#ifdef FLT_MANT_DIG
 #define FLT_MANT_DIG __FLT_MANT_DIG__
+#else 
+#define FLT_MANT_DIG 24
 #endif // FLT_MANT_DIG
 
-#ifndef DBL_MANT_DIG
+#ifdef DBL_MANT_DIG
 #define DBL_MANT_DIG __DBL_MANT_DIG__
+#else 
+#define DBL_MANT_DIG 53
 #endif // DBL_MANT_DIG
 
-#ifndef LDBL_MANT_DIG
+#ifdef LDBL_MANT_DIG
 #define LDBL_MANT_DIG __LDBL_MANT_DIG__
+#else 
+#define LDBL_MANT_DIG 113
 #endif // LDBL_MANT_DIG
 
-#ifndef FLT_MIN
+#ifdef FLT_MIN
 #define FLT_MIN __FLT_MIN__
+#else 
+#define FLT_MIN 1E-37
 #endif // FLT_MIN
 
-#ifndef DBL_MIN
+#ifdef DBL_MIN
 #define DBL_MIN __DBL_MIN__
+#else 
+#define DBL_MIN 1E-37
 #endif // DBL_MIN
 
-#ifndef LDBL_MIN
+#ifdef LDBL_MIN
 #define LDBL_MIN __LDBL_MIN__
+#else 
+#define LDBL_MIN 1E-37  
----------------
lntue wrote:

This value will depend on CPU architecture + OS.

https://github.com/llvm/llvm-project/pull/88674


More information about the libc-commits mailing list