[PATCH] D124255: [libc++] Make check_assertion.h use setjmp/longjmp instead of fork

John Brawn via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Fri Apr 22 05:59:31 PDT 2022


john.brawn created this revision.
john.brawn added reviewers: ldionne, Mordante, michaelplatings.
Herald added a project: All.
john.brawn requested review of this revision.
Herald added a project: libc++.
Herald added a subscriber: libcxx-commits.
Herald added a reviewer: libc++.

Currently check_assertion.h checks an assertion by forking and checking the exit code of the child process, but this means such tests don't work on targets where fork doesn't exist (e.g. bare metal targets).

Instead call setjmp just before we call the function we want to test, then longjmp out of __libcpp_assertion_handler with a return value indicating whether the assert happened as expected.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D124255

Files:
  libcxx/test/support/check_assertion.h
  libcxx/test/support/test.support/test_check_assertion.pass.cpp

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D124255.424453.patch
Type: text/x-patch
Size: 6465 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20220422/e307cb8e/attachment-0001.bin>


More information about the cfe-commits mailing list