diff options
author | Jonathan Wakely <jwakely@redhat.com> | 2022-09-15 21:02:32 +0100 |
---|---|---|
committer | Jonathan Wakely <jwakely@redhat.com> | 2022-09-16 21:47:19 +0100 |
commit | cf0fded5d837bad590eb091d8a3dc4898872560f (patch) | |
tree | 5432be9bb4658aa077cc28353c9ff271a82de82b /libstdc++-v3/include/c_global | |
parent | 7f4c37099a9f2415e00e94379c1206b3e9185c52 (diff) | |
download | gcc-cf0fded5d837bad590eb091d8a3dc4898872560f.zip gcc-cf0fded5d837bad590eb091d8a3dc4898872560f.tar.gz gcc-cf0fded5d837bad590eb091d8a3dc4898872560f.tar.bz2 |
libstdc++: Add preprocessor conditions for freestanding [PR106953]
This adds checks for _GLIBCXX_HOSTED to a number of headers which are
not currently installed for freestanding, but need to be for P1642R11
support. For example, <iterator> needs to be installed for C++23
freestanding mode, but without stream iterators and streambuf iterators.
Similarly, <memory> needs to be installed, but without std::allocator
and std::shared_ptr. This change disables the non-freestanding parts of
those headers.
libstdc++-v3/ChangeLog:
PR libstdc++/106953
* include/backward/auto_ptr.h [!_GLIBCXX_HOSTED]: Do not define
shared_ptr members.
* include/bits/alloc_traits.h [!_GLIBCXX_HOSTED]: Do not declare
std::allocator_traits<std::allocator<T>> specializations for
freestanding.
* include/bits/memoryfwd.h [!_GLIBCXX_HOSTED] (allocator): Do
not declare for freestanding.
* include/bits/stl_algo.h [!_GLIBCXX_HOSTED] (stable_partition):
Do not define for freestanding.
[!_GLIBCXX_HOSTED] (merge, stable_sort): Do not use temporary
buffers for freestanding.
* include/bits/stl_algobase.h [!_GLIBCXX_HOSTED]: Do not declare
streambuf iterators and overloaded algorithms using them.
* include/bits/stl_uninitialized.h [!_GLIBCXX_HOSTED]: Do not
define specialized overloads for std::allocator.
* include/bits/unique_ptr.h [!_GLIBCXX_HOSTED] (make_unique)
(make_unique_for_overwrite, operator<<): Do not define for
freestanding.
* include/c_global/cstdlib [!_GLIBCXX_HOSTED] (_Exit): Declare.
Use _GLIBCXX_NOTHROW instead of throw().
* include/debug/assertions.h [!_GLIBCXX_HOSTED]: Ignore
_GLIBCXX_DEBUG for freestanding.
* include/debug/debug.h [!_GLIBCXX_DEBUG]: Likewise.
* include/std/bit [!_GLIBCXX_HOSTED]: Do not use the custom
__int_traits if <ext/numeric_traits.h> is available.
* include/std/functional [!_GLIBCXX_HOSTED]: Do not include
headers that aren't valid for freestanding.
(boyer_moore_searcher, boyer_moore_horspool_searcher): Do not
define for freestanding.
* include/std/iterator [!_GLIBCXX_HOSTED]: Do not include
headers that aren't valid for freestanding.
* include/std/memory [!_GLIBCXX_HOSTED]: Likewise.
* include/std/ranges [!_GLIBCXX_HOSTED] (istream_view): Do not
define for freestanding.
(views::__detail::__is_basic_string_view) [!_GLIBCXX_HOSTED]:
Do not define partial specialization for freestanding.
Diffstat (limited to 'libstdc++-v3/include/c_global')
-rw-r--r-- | libstdc++-v3/include/c_global/cstdlib | 24 |
1 files changed, 14 insertions, 10 deletions
diff --git a/libstdc++-v3/include/c_global/cstdlib b/libstdc++-v3/include/c_global/cstdlib index 8a832af..0f7362e 100644 --- a/libstdc++-v3/include/c_global/cstdlib +++ b/libstdc++-v3/include/c_global/cstdlib @@ -51,19 +51,23 @@ #define EXIT_SUCCESS 0 #define EXIT_FAILURE 1 +#define NULL __null namespace std { - extern "C" void abort(void) throw () _GLIBCXX_NORETURN; - extern "C" int atexit(void (*)(void)) throw (); - extern "C" void exit(int) throw () _GLIBCXX_NORETURN; + extern "C" void abort(void) _GLIBCXX_NOTHROW _GLIBCXX_NORETURN; + extern "C" int atexit(void (*)(void)) _GLIBCXX_NOTHROW; + extern "C" void exit(int) _GLIBCXX_NOTHROW _GLIBCXX_NORETURN; #if __cplusplus >= 201103L # ifdef _GLIBCXX_HAVE_AT_QUICK_EXIT - extern "C" int at_quick_exit(void (*)(void)) throw (); + extern "C" int at_quick_exit(void (*)(void)) _GLIBCXX_NOTHROW; # endif # ifdef _GLIBCXX_HAVE_QUICK_EXIT - extern "C" void quick_exit(int) throw() _GLIBCXX_NORETURN; + extern "C" void quick_exit(int) _GLIBCXX_NOTHROW_GLIBCXX_NORETURN; # endif +#if _GLIBCXX_USE_C99_STDLIB + extern "C" void _Exit(int) _GLIBCXX_NOTHROW _GLIBCXX_NORETURN; +#endif #endif } // namespace std @@ -174,7 +178,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION #ifndef __CORRECT_ISO_CPP_STDLIB_H_PROTO inline ldiv_t - div(long __i, long __j) { return ldiv(__i, __j); } + div(long __i, long __j) _GLIBCXX_NOTHROW { return ldiv(__i, __j); } #endif @@ -200,7 +204,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION using ::lldiv_t; #endif #if _GLIBCXX_USE_C99_CHECK || _GLIBCXX_USE_C99_DYNAMIC - extern "C" void (_Exit)(int) throw () _GLIBCXX_NORETURN; + extern "C" void (_Exit)(int) _GLIBCXX_NOTHROW _GLIBCXX_NORETURN; #endif #if !_GLIBCXX_USE_C99_DYNAMIC using ::_Exit; @@ -217,11 +221,11 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION #endif #if _GLIBCXX_USE_C99_LONG_LONG_CHECK || _GLIBCXX_USE_C99_LONG_LONG_DYNAMIC - extern "C" long long int (atoll)(const char *) throw (); + extern "C" long long int (atoll)(const char *) _GLIBCXX_NOTHROW; extern "C" long long int - (strtoll)(const char * __restrict, char ** __restrict, int) throw (); + (strtoll)(const char * __restrict, char ** __restrict, int) _GLIBCXX_NOTHROW; extern "C" unsigned long long int - (strtoull)(const char * __restrict, char ** __restrict, int) throw (); + (strtoull)(const char * __restrict, char ** __restrict, int) _GLIBCXX_NOTHROW; #endif #if !_GLIBCXX_USE_C99_LONG_LONG_DYNAMIC using ::atoll; |