This is an archive of the discontinued LLVM Phabricator instance.

[libc++] Implement terminate(), unexpected() and uncaught_exceptions() on Windows
ClosedPublic

Authored by EricWF on Jan 6 2017, 10:05 PM.

Details

Summary

This patch implements the following functions on Windows by forwarding to the MSVCRT:

  • get_terminate()
  • set_terminate()
  • terminate()
  • set_unexpected()
  • get_unexpected()
  • unexpected()
  • uncaught_exception()
  • uncaught_exceptions()

Diff Detail

Event Timeline

EricWF updated this revision to Diff 83509.Jan 6 2017, 10:05 PM
EricWF retitled this revision from to [libc++] Implement terminate(), unexpected() and uncaught_exceptions() on Windows.
EricWF updated this object.
EricWF added reviewers: compnerd, smeenai, rnk, majnemer.
EricWF added a subscriber: cfe-commits.
smeenai accepted this revision.Jan 6 2017, 10:31 PM
smeenai edited edge metadata.

Hooray for Microsoft for putting all these in msvcrt (their C runtime library) instead of msvcprt (their C++ runtime library), I guess :p

src/exception.cpp
53

MSDN says "unexpected is not used in the current C++ exception-handling implementation", which is maybe not the most desirable thing in the world, but I guess this is going away in C++17 anyway :D

139

Yay undocumented APIs (at least as far as I can see).

This revision is now accepted and ready to land.Jan 6 2017, 10:31 PM
EricWF marked an inline comment as done.Jan 7 2017, 2:14 AM

Hooray for Microsoft for putting all these in msvcrt (their C runtime library) instead of msvcprt (their C++ runtime library), I guess :p

Although Boo to eh.h for being in the same directory as the MSVC STL headers. If possible I would like to be able to compile libc++ without
adding that directory to the include paths.

src/exception.cpp
53

Actually unexpected() has gone away in C++17 since C++17 removes "dynamic exception specifications" (ie void foo() throw(int, ...)). Therefore I suspect the doc is referring to that.

However I suspect are still used when clang-cl targets C++14 or newer.

139

Undocumented API for sure. Unfortunately libc++ is going to have to rely on a number of undocumented API's because Microsoft doesn't provide documentation for porting an STL to Windows.

EricWF closed this revision.Jan 7 2017, 2:15 AM
EricWF marked an inline comment as done.