[libcxx-commits] [PATCH] D153302: [libc++] Guard terminate_successful with TEST_HAS_NO_EXCEPTIONS
Louis Dionne via Phabricator via libcxx-commits
libcxx-commits at lists.llvm.org
Mon Jun 19 11:48:23 PDT 2023
ldionne created this revision.
Herald added a project: All.
ldionne requested review of this revision.
Herald added a project: libc++.
Herald added a subscriber: libcxx-commits.
Herald added a reviewer: libc++.
This one is a bit twisted. Some platforms don't have support for
exiting in a clean manner, so they don't provide std::exit(). As
a result, defining `terminate_successful()` on those platforms won't
work, and the PSTL tests that rely on `terminate_successful()` also
won't work.
However, we don't have a notion of "no clean termination" in libc++,
so we can't properly guard this. Since embedded platforms that don't
support clean termination usually also don't enable exceptions, we
don't need to be able to run those `terminate_successful` PSTL tests,
and guarding the definition of `terminate_successful` with
TEST_HAS_NO_EXCEPTIONS works pretty well.
This is kind of a hack for the lack of having a concept of "no clean
termination" in the library and in the test suite.
Repository:
rG LLVM Github Monorepo
https://reviews.llvm.org/D153302
Files:
libcxx/test/support/test_execution_policies.h
Index: libcxx/test/support/test_execution_policies.h
===================================================================
--- libcxx/test/support/test_execution_policies.h
+++ libcxx/test/support/test_execution_policies.h
@@ -58,6 +58,8 @@
}
};
+#ifndef TEST_HAS_NO_EXCEPTIONS
[[noreturn]] inline void terminate_successful() { std::exit(0); }
+#endif
#endif // TEST_SUPPORT_TEST_EXECUTION_POLICIES
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D153302.532728.patch
Type: text/x-patch
Size: 407 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/libcxx-commits/attachments/20230619/a7305ee5/attachment.bin>
More information about the libcxx-commits
mailing list