diff options
author | Arsen Arsenović <arsen@aarsen.me> | 2023-04-04 19:25:09 +0200 |
---|---|---|
committer | Arsen Arsenović <arsen@aarsen.me> | 2023-04-05 18:45:14 +0200 |
commit | bff26ac162772313d3d9b8ce952b5a0846e26878 (patch) | |
tree | 754e0a573fd17701fe8a933277e8462063231908 | |
parent | 6f0d67b912900009bff5018bd58e17ea1db1de69 (diff) | |
download | gcc-bff26ac162772313d3d9b8ce952b5a0846e26878.zip gcc-bff26ac162772313d3d9b8ce952b5a0846e26878.tar.gz gcc-bff26ac162772313d3d9b8ce952b5a0846e26878.tar.bz2 |
libstdc++: Downgrade DEBUG to ASSERTIONS when !HOSTED
Supporting the debug mode in freestanding is a non-trivial job, so
instead, as a best-effort, enable assertions, which are light and easy.
libstdc++-v3/ChangeLog:
* include/bits/c++config: When __STDC_HOSTED__ is zero,
disable _GLIBCXX_DEBUG and, if it was set, enable
_GLIBCXX_ASSERTIONS.
* testsuite/lib/libstdc++.exp (check_v3_target_debug_mode):
Include <bits/c++config.h> when determining whether debug is
set, in order to inherit the logic from above
-rw-r--r-- | libstdc++-v3/include/bits/c++config | 7 | ||||
-rw-r--r-- | libstdc++-v3/testsuite/lib/libstdc++.exp | 1 |
2 files changed, 8 insertions, 0 deletions
diff --git a/libstdc++-v3/include/bits/c++config b/libstdc++-v3/include/bits/c++config index 71f2401..1389278 100644 --- a/libstdc++-v3/include/bits/c++config +++ b/libstdc++-v3/include/bits/c++config @@ -397,6 +397,13 @@ _GLIBCXX_END_NAMESPACE_VERSION # define _GLIBCXX_END_INLINE_ABI_NAMESPACE(X) } // inline namespace X #endif +// In the case that we don't have a hosted environment, we can't provide the +// debugging mode. Instead, we do our best and downgrade to assertions. +#if defined(_GLIBCXX_DEBUG) && !__STDC_HOSTED__ +#undef _GLIBCXX_DEBUG +#define _GLIBCXX_ASSERTIONS 1 +#endif + // Inline namespaces for special modes: debug, parallel. #if defined(_GLIBCXX_DEBUG) || defined(_GLIBCXX_PARALLEL) namespace std diff --git a/libstdc++-v3/testsuite/lib/libstdc++.exp b/libstdc++-v3/testsuite/lib/libstdc++.exp index 98512c9..490abd1 100644 --- a/libstdc++-v3/testsuite/lib/libstdc++.exp +++ b/libstdc++-v3/testsuite/lib/libstdc++.exp @@ -1007,6 +1007,7 @@ proc check_v3_target_debug_mode { } { global cxxflags return [check_v3_target_prop_cached et_debug_mode { set code " + #include <bits/c++config.h> #if ! defined _GLIBCXX_DEBUG # error no debug mode #endif |