From: Jonathan Wakely
Date: Mon, 15 Jan 2024 14:09:21 +0000 (+0000)
Subject: libstdc++: Enable most of for freestanding
X-Git-Tag: basepoints/gcc-16~5901
X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=1dde83f0ec313166fc91e6784a0ca2e3db46acee;p=thirdparty%2Fgcc.git
libstdc++: Enable most of for freestanding
This makes durations, time points and calendrical types available for
freestanding. The clocks and time zone utilities are disabled for
freestanding, as they require functions in the hosted lib.
Add support for a new macro _GLIBCXX_NO_FREESTANDING_CHRONO which can be
used to explicitly disable for freestanding.
libstdc++-v3/ChangeLog:
* doc/xml/manual/using.xml (_GLIBCXX_NO_FREESTANDING_CHRONO):
Document macro.
* doc/html/*: Regenerate.
* include/bits/chrono.h [_GLIBCXX_NO_FREESTANDING_CHRONO]:
Only include when this macro is defined.
[_GLIBCXX_HOSTED]: Only define clocks for hosted.
* include/bits/version.def (chrono_udls): Remove hosted=yes.
* include/bits/version.h: Regenerate.
* include/std/chrono [_GLIBCXX_HOSTED]: Only define clocks and
time zone utilities for hosted.
* testsuite/std/time/freestanding.cc: New test.
---
diff --git a/libstdc++-v3/doc/html/manual/using_macros.html b/libstdc++-v3/doc/html/manual/using_macros.html
index ae564692630..67623b5e2af 100644
--- a/libstdc++-v3/doc/html/manual/using_macros.html
+++ b/libstdc++-v3/doc/html/manual/using_macros.html
@@ -124,4 +124,11 @@
must be present on all vector operations or none, so this macro must
be defined to the same value for all translation units that create,
destroy, or modify vectors.
+
_GLIBCXX_NO_FREESTANDING_CHRONO
+ Undefined by default. When defined, the
+ <chrono>
header cannot
+ be used with -ffreestanding
.
+ When not defined, durations, time points, and calendar types are
+ available for freestanding, but the standard clocks and the time zone
+ database are not (because they require OS support).