This is an archive of the discontinued LLVM Phabricator instance.

[libc++] Guard terminate_successful with TEST_HAS_NO_EXCEPTIONS
ClosedPublic

Authored by ldionne on Jun 19 2023, 11:48 AM.

Details

Summary

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.

Diff Detail

Event Timeline

ldionne created this revision.Jun 19 2023, 11:48 AM
Herald added a project: Restricted Project. · View Herald TranscriptJun 19 2023, 11:48 AM
ldionne requested review of this revision.Jun 19 2023, 11:48 AM
Herald added a project: Restricted Project. · View Herald TranscriptJun 19 2023, 11:48 AM
Herald added a reviewer: Restricted Project. · View Herald Transcript
philnik accepted this revision.Jun 20 2023, 2:18 PM
philnik added a subscriber: philnik.

I'm not a huge fan, but I also don't really see a nice way of solving this.

This revision is now accepted and ready to land.Jun 20 2023, 2:18 PM