From d66983861a66b1eb9ff6d08b57a9cdd8e2a35932 Mon Sep 17 00:00:00 2001 From: Alex Brachet Date: Thu, 17 Feb 2022 17:21:55 +0000 Subject: [libc] Add exit and atexit MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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 --- libc/test/src/stdlib/_Exit_test.cpp | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'libc/test/src/stdlib/_Exit_test.cpp') 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); } -- cgit v1.2.3