[1/1] Fixed fast_float build error in NEWLIB

Message ID 20220118085711.1514-1-shihua@iscas.ac.cn
State New
Headers
Series [1/1] Fixed fast_float build error in NEWLIB |

Commit Message

Liao Shihua Jan. 18, 2022, 8:57 a.m. UTC
  From: LiaoShihua <shihua@iscas.ac.cn>

When I built riscv-gcc with newlib, it will be terminated with message "fatal error: endian.h: No such file or directory".
So, fixed it in fast_float.h.

libstdc++-v3\ChangeLog:

        * src/c++17/fast_float/fast_float.h (defined):fast_float.h will include <machine/endian.h> with using newlib

---
 libstdc++-v3/src/c++17/fast_float/fast_float.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
  

Comments

Jonathan Wakely Jan. 18, 2022, 10:25 a.m. UTC | #1
On Tue, 18 Jan 2022 at 09:05, LiaoShihua wrote:

>
> When I built riscv-gcc with newlib, it will be terminated with message
> "fatal error: endian.h: No such file or directory".
> So, fixed it in fast_float.h.
>

> libstdc++-v3\ChangeLog:
>

N.B. you need to use a forward slash here, not backslash.

>
>         * src/c++17/fast_float/fast_float.h (defined):fast_float.h will
> include <machine/endian.h> with using newlib
>

(defined) is not the right component name here.

But I fixed it differently anyway, see PR 104080.
  

Patch

diff --git a/libstdc++-v3/src/c++17/fast_float/fast_float.h b/libstdc++-v3/src/c++17/fast_float/fast_float.h
index 97d28940944..0308f7b35af 100644
--- a/libstdc++-v3/src/c++17/fast_float/fast_float.h
+++ b/libstdc++-v3/src/c++17/fast_float/fast_float.h
@@ -131,7 +131,7 @@  from_chars_result from_chars_advanced(const char *first, const char *last,
 #ifdef _WIN32
 #define FASTFLOAT_IS_BIG_ENDIAN 0
 #else
-#if defined(__APPLE__) || defined(__FreeBSD__)
+#if defined(__APPLE__) || defined(__FreeBSD__) || defined(__NEWLIB__)
 #include <machine/endian.h>
 #elif defined(sun) || defined(__sun)
 #include <sys/byteorder.h>