diff options
| author | Alex Brachet <abrachet@google.com> | 2022-02-17 17:21:55 +0000 |
|---|---|---|
| committer | Alex Brachet <abrachet@google.com> | 2022-02-17 17:21:55 +0000 |
| commit | d66983861a66b1eb9ff6d08b57a9cdd8e2a35932 (patch) | |
| tree | 99a1b0375d97a6230a65224ac6fa75147417dcd5 /libc/test/src/stdlib/_Exit_test.cpp | |
| parent | f374c8ddf2dd4920190cac0ea81e18a74040ddda (diff) | |
[libc] Add exit and atexit
Often atexit is implemented using __cxa_atexit. I have not implemented __cxa_atexit here because it potentially requires more discussion. It is unique for llvm-libc (I think) that it is an exported symbol that wouldn’t be defined in any spec file because it doesn’t have a header. Implementing it will be trivial given what is here already, but I figured it would be more contentious so it can be implemented later.
Reviewed By: lntue
Differential Revision: https://reviews.llvm.org/D119512
Diffstat (limited to 'libc/test/src/stdlib/_Exit_test.cpp')
| -rw-r--r-- | libc/test/src/stdlib/_Exit_test.cpp | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/libc/test/src/stdlib/_Exit_test.cpp b/libc/test/src/stdlib/_Exit_test.cpp index 03d5ffcc2236..a07034dbf310 100644 --- a/libc/test/src/stdlib/_Exit_test.cpp +++ b/libc/test/src/stdlib/_Exit_test.cpp @@ -8,9 +8,13 @@ #include "include/stdlib.h" #include "src/stdlib/_Exit.h" +#include "src/stdlib/exit.h" #include "utils/UnitTest/Test.h" TEST(LlvmLibcStdlib, _Exit) { EXPECT_EXITS([] { __llvm_libc::_Exit(1); }, 1); EXPECT_EXITS([] { __llvm_libc::_Exit(65); }, 65); + + EXPECT_EXITS([] { __llvm_libc::exit(1); }, 1); + EXPECT_EXITS([] { __llvm_libc::exit(65); }, 65); } |
