From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 2181) id CCA723857832; Tue, 13 Apr 2021 17:52:13 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org CCA723857832 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 r10-9703] libstdc++: Fix to work freestanding [PR 100060] X-Act-Checkin: gcc X-Git-Author: Jonathan Wakely X-Git-Refname: refs/heads/releases/gcc-10 X-Git-Oldrev: cac0f0e24d853c8893f4c71f1eca260d431afc85 X-Git-Newrev: d83dace65b97112320042c7f4941b64ef339799d Message-Id: <20210413175213.CCA723857832@sourceware.org> Date: Tue, 13 Apr 2021 17:52:13 +0000 (GMT) X-BeenThere: gcc-cvs@gcc.gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Gcc-cvs mailing list List-Unsubscribe: , List-Archive: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 13 Apr 2021 17:52:13 -0000 https://gcc.gnu.org/g:d83dace65b97112320042c7f4941b64ef339799d commit r10-9703-gd83dace65b97112320042c7f4941b64ef339799d Author: Jonathan Wakely Date: Tue Apr 13 16:55:37 2021 +0100 libstdc++: Fix to work freestanding [PR 100060] libstdc++-v3/ChangeLog: PR libstdc++/100060 * include/std/bit: Only include for hosted build, use otherwise. (cherry picked from commit 474cb5a0a404c5de7c1cd21aac8b1b7e7ce95d9b) Diff: --- libstdc++-v3/include/std/bit | 18 +++++++++++++++++- 1 file changed, 17 insertions(+), 1 deletion(-) diff --git a/libstdc++-v3/include/std/bit b/libstdc++-v3/include/std/bit index f22ee528555..2b24f0d450b 100644 --- a/libstdc++-v3/include/std/bit +++ b/libstdc++-v3/include/std/bit @@ -34,7 +34,23 @@ #if __cplusplus >= 201402L #include -#include + +#if _GLIBCXX_HOSTED +# include +#else +# include +/// @cond undocumented +namespace __gnu_cxx +{ + template + struct __int_traits + { + static constexpr int __digits = std::numeric_limits<_Tp>::digits; + static constexpr _Tp __max = std::numeric_limits<_Tp>::max(); + }; +} +/// @endcond +#endif namespace std _GLIBCXX_VISIBILITY(default) {