Skip to content

Commit

Permalink
toolchain/ghs: Fix green hills toolchain build Vela MIN_MANT error
Browse files Browse the repository at this point in the history
"stdio/lib_dtoa_engine.c", line 102: error #166: invalid floating constant
        if (x < MIN_MANT)
                ^

"stdio/lib_dtoa_engine.c", line 102: warning apache#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 apache#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 apache#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 apache#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 apache#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 <[email protected]>
  • Loading branch information
yanghuatao authored and anchao committed Aug 19, 2024
1 parent 2ae4ea3 commit 681122b
Showing 1 changed file with 14 additions and 0 deletions.
14 changes: 14 additions & 0 deletions libs/libc/stdio/lib_dtoa_engine.c
Original file line number Diff line number Diff line change
Expand Up @@ -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))
Expand Down

0 comments on commit 681122b

Please sign in to comment.