From 681122bc238158c85ad5834a0dfad417780fdf39 Mon Sep 17 00:00:00 2001 From: yanghuatao Date: Wed, 24 Apr 2024 00:59:53 +0800 Subject: [PATCH] toolchain/ghs: Fix green hills toolchain build Vela MIN_MANT error "stdio/lib_dtoa_engine.c", line 102: error #166: invalid floating constant if (x < MIN_MANT) ^ "stdio/lib_dtoa_engine.c", line 102: warning #1626-D: concatenation with "(" in macro "PASTE" does not create a valid token if (x < MIN_MANT) ^ "stdio/lib_dtoa_engine.c", line 102: error #109: expression preceding parentheses of apparent call must have (pointer-to-) function type if (x < MIN_MANT) ^ "stdio/lib_dtoa_engine.c", line 107: error #166: invalid floating constant if (y < MAX_MANT) ^ "stdio/lib_dtoa_engine.c", line 107: warning #1626-D: concatenation with "(" in macro "PASTE" does not create a valid token if (y < MAX_MANT) ^ "stdio/lib_dtoa_engine.c", line 107: error #109: expression preceding parentheses of apparent call must have (pointer-to-) function type if (y < MAX_MANT) ^ "stdio/lib_dtoa_engine.c", line 119: error #166: invalid floating constant if (y >= MIN_MANT) ^ "stdio/lib_dtoa_engine.c", line 119: warning #1626-D: concatenation with "(" in macro "PASTE" does not create a valid token if (y >= MIN_MANT) ^ "stdio/lib_dtoa_engine.c", line 119: error #109: expression preceding parentheses of apparent call must have (pointer-to-) function type if (y >= MIN_MANT) ^ "stdio/lib_dtoa_engine.c", line 144: error #166: invalid floating constant if (x >= MAX_MANT) ^ "stdio/lib_dtoa_engine.c", line 144: warning #1626-D: concatenation with "(" in macro "PASTE" does not create a valid token if (x >= MAX_MANT) ^ "stdio/lib_dtoa_engine.c", line 144: error #109: expression preceding parentheses of apparent call must have (pointer-to-) function type if (x >= MAX_MANT) ^ "stdio/lib_dtoa_engine.c", line 153: error #166: invalid floating constant uint64_t decimal = MIN_MANT_INT; ^ "stdio/lib_dtoa_engine.c", line 153: warning #1626-D: concatenation with "(" in macro "PASTE" does not create a valid token uint64_t decimal = MIN_MANT_INT; ^ "stdio/lib_dtoa_engine.c", line 153: error #109: expression preceding parentheses of apparent call must have (pointer-to-) function type uint64_t decimal = MIN_MANT_INT; Signed-off-by: yanghuatao --- libs/libc/stdio/lib_dtoa_engine.c | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/libs/libc/stdio/lib_dtoa_engine.c b/libs/libc/stdio/lib_dtoa_engine.c index 4bc8884f91908..76ccb7dbf8757 100644 --- a/libs/libc/stdio/lib_dtoa_engine.c +++ b/libs/libc/stdio/lib_dtoa_engine.c @@ -51,6 +51,20 @@ * by pasting the value of DBL_DIG onto '1e' to */ +/* Green hills #define DBL_DIG (6) or #define DBL_DIG (15) + * we need remove "()" here + */ + +#if DBL_DIG == 6 +# undef DBL_DIG +# define DBL_DIG 6 +#endif + +#if DBL_DIG == 15 +# undef DBL_DIG +# define DBL_DIG 15 +#endif + #define PASTE(a) 1e##a #define SUBSTITUTE(a) PASTE(a) #define MIN_MANT (SUBSTITUTE(DBL_DIG))