From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 2181) id 647A2385843A; Tue, 4 Oct 2022 14:07:04 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 647A2385843A DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1664892424; bh=wxIOnvwLa59w/NJa3Fnxg8+JJTgmNqzTgf3MkiXLQoI=; h=From:To:Subject:Date:From; b=O8wEddikSu9bdkf1xGle5/cM/PBKX0TiJsBnwy12kpkQtTzEF33MkqB1OkDKMoCtR bO0b1cloVEtCXflBSHUasAA3Mg84CskZtjlfk8ZyyUDVsrwh9GfEKWugbIDGPvmg8/ TGbEd+QeD23QT1/3mrwrSw53HMR/1Tqccm04s4w8= MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Type: text/plain; charset="utf-8" From: Jonathan Wakely To: gcc-cvs@gcc.gnu.org, libstdc++-cvs@gcc.gnu.org Subject: [gcc r13-3059] libstdc++: Make work freestanding [PR107134] X-Act-Checkin: gcc X-Git-Author: Jonathan Wakely X-Git-Refname: refs/heads/master X-Git-Oldrev: 7d8189882fc89f6f410fc9bcf0f8226787316f83 X-Git-Newrev: 7cdab65f3d770345903023f357b6ca96bc85a002 Message-Id: <20221004140704.647A2385843A@sourceware.org> Date: Tue, 4 Oct 2022 14:07:04 +0000 (GMT) List-Id: https://gcc.gnu.org/g:7cdab65f3d770345903023f357b6ca96bc85a002 commit r13-3059-g7cdab65f3d770345903023f357b6ca96bc85a002 Author: Jonathan Wakely Date: Mon Oct 3 21:49:27 2022 +0100 libstdc++: Make work freestanding [PR107134] When gcc/config.gcc defines use_gcc_stdin=wrap, GCC's tries to use libc's unless -ffreestanding is used. When libstdc++ is configured --disable-hosted-libstdcxx we want to work even without -ffreestanding being given. This is a kluge to make it include GCC's directly even without -ffreestanding. libstdc++-v3/ChangeLog: PR libstdc++/107134 * include/c_global/cstdint [!_GLIBCXX_HOSTED]: Include directly. Diff: --- libstdc++-v3/include/c_global/cstdint | 59 +++++++++++++++++++++++++++++++++-- 1 file changed, 57 insertions(+), 2 deletions(-) diff --git a/libstdc++-v3/include/c_global/cstdint b/libstdc++-v3/include/c_global/cstdint index 4490d06f099..4b9df45a9ee 100644 --- a/libstdc++-v3/include/c_global/cstdint +++ b/libstdc++-v3/include/c_global/cstdint @@ -37,7 +37,11 @@ #include -#if _GLIBCXX_HAVE_STDINT_H +#if ! _GLIBCXX_HOSTED && __has_include() +// For --disable-hosted-libstdcxx we want GCC's own stdint-gcc.h header +// even when -ffreestanding isn't used. +# include +#elif __has_include() # include #endif @@ -80,9 +84,60 @@ namespace std using ::uintmax_t; using ::uintptr_t; #else // !_GLIBCXX_USE_C99_STDINT_TR1 - // Define the minimum needed for , etc. + using intmax_t = __INTMAX_TYPE__; using uintmax_t = __UINTMAX_TYPE__; + +#ifdef __INT8_TYPE__ + using int8_t = __INT8_TYPE__; +#endif +#ifdef __INT16_TYPE__ + using int16_t = __INT16_TYPE__; +#endif +#ifdef __INT32_TYPE__ + using int32_t = __INT32_TYPE__; +#endif +#ifdef __INT64_TYPE__ + using int64_t = __INT64_TYPE__; +#endif + + using int_least8_t = __INT_LEAST8_TYPE__; + using int_least16_t = __INT_LEAST16_TYPE__; + using int_least32_t = __INT_LEAST32_TYPE__; + using int_least64_t = __INT_LEAST64_TYPE__; + using int_fast8_t = __INT_FAST8_TYPE__; + using int_fast16_t = __INT_FAST16_TYPE__; + using int_fast32_t = __INT_FAST32_TYPE__; + using int_fast64_t = __INT_FAST64_TYPE__; + +#ifdef __INTPTR_TYPE__ + using intptr_t = __INTPTR_TYPE__; +#endif + +#ifdef __UINT8_TYPE__ + using uint8_t = __UINT8_TYPE__; +#endif +#ifdef __UINT16_TYPE__ + using uint16_t = __UINT16_TYPE__; +#endif +#ifdef __UINT32_TYPE__ + using uint32_t = __UINT32_TYPE__; +#endif +#ifdef __UINT64_TYPE__ + using uint64_t = __UINT64_TYPE__; +#endif + using uint_least8_t = __UINT_LEAST8_TYPE__; + using uint_least16_t = __UINT_LEAST16_TYPE__; + using uint_least32_t = __UINT_LEAST32_TYPE__; + using uint_least64_t = __UINT_LEAST64_TYPE__; + using uint_fast8_t = __UINT_FAST8_TYPE__; + using uint_fast16_t = __UINT_FAST16_TYPE__; + using uint_fast32_t = __UINT_FAST32_TYPE__; + using uint_fast64_t = __UINT_FAST64_TYPE__; +#ifdef __UINTPTR_TYPE__ + using uintptr_t = __UINTPTR_TYPE__; +#endif + #endif // _GLIBCXX_USE_C99_STDINT_TR1 } // namespace std