From 0f7bada2806630bf01fa09fda319283283c7c8a1 Mon Sep 17 00:00:00 2001 From: Job Hernandez Date: Mon, 4 Nov 2024 17:05:12 -0800 Subject: [PATCH 1/2] add _Exit declaration --- libc/hdr/func/_Exit.h | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/libc/hdr/func/_Exit.h b/libc/hdr/func/_Exit.h index e024a651a50bc..b8160e9af3e4e 100644 --- a/libc/hdr/func/_Exit.h +++ b/libc/hdr/func/_Exit.h @@ -10,8 +10,7 @@ #define LLVM_LIBC_HDR_FUNC_EXIT_H #ifdef LIBC_FULL_BUILD -// We will use the `_Exit` declaration from our generated stdlib.h -#include +extern "C" [[noreturn]] void _Exit(int) noexcept; #else // Overlay mode From 30e2cba1b5099cbe7ea63381e71dc4d4882a4cdf Mon Sep 17 00:00:00 2001 From: Job Hernandez Date: Wed, 6 Nov 2024 16:27:00 -0800 Subject: [PATCH 2/2] address review --- libc/hdr/func/CMakeLists.txt | 10 ---------- libc/hdr/func/_Exit.h | 21 --------------------- libc/test/src/stdlib/CMakeLists.txt | 3 +-- libc/test/src/stdlib/at_quick_exit_test.cpp | 3 +-- libc/test/src/stdlib/atexit_test.cpp | 3 +-- 5 files changed, 3 insertions(+), 37 deletions(-) delete mode 100644 libc/hdr/func/_Exit.h diff --git a/libc/hdr/func/CMakeLists.txt b/libc/hdr/func/CMakeLists.txt index 714b7ec9b4880..608bab5ae1e95 100644 --- a/libc/hdr/func/CMakeLists.txt +++ b/libc/hdr/func/CMakeLists.txt @@ -40,13 +40,3 @@ add_proxy_header_library( FULL_BUILD_DEPENDS libc.include.stdlib ) - -add_proxy_header_library( - _Exit - HDRS - _Exit.h - DEPENDS - libc.hdr.stdlib_overlay - FULL_BUILD_DEPENDS - libc.include.stdlib -) diff --git a/libc/hdr/func/_Exit.h b/libc/hdr/func/_Exit.h deleted file mode 100644 index b8160e9af3e4e..0000000000000 --- a/libc/hdr/func/_Exit.h +++ /dev/null @@ -1,21 +0,0 @@ -//===-- Definition of the _Exit proxy -------------------------------------===// -// -// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. -// See https://llvm.org/LICENSE.txt for license information. -// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception -// -//===----------------------------------------------------------------------===// - -#ifndef LLVM_LIBC_HDR_FUNC_EXIT_H -#define LLVM_LIBC_HDR_FUNC_EXIT_H - -#ifdef LIBC_FULL_BUILD -extern "C" [[noreturn]] void _Exit(int) noexcept; - -#else // Overlay mode - -#include "hdr/stdlib_overlay.h" - -#endif - -#endif // LLVM_LIBC_HDR_EXIT_H diff --git a/libc/test/src/stdlib/CMakeLists.txt b/libc/test/src/stdlib/CMakeLists.txt index 4ea894cf48724..ff6034e43e9f6 100644 --- a/libc/test/src/stdlib/CMakeLists.txt +++ b/libc/test/src/stdlib/CMakeLists.txt @@ -382,7 +382,6 @@ if(LLVM_LIBC_FULL_BUILD) SRCS atexit_test.cpp DEPENDS - libc.hdr.func._Exit libc.src.stdlib._Exit libc.src.stdlib.exit libc.src.stdlib.atexit @@ -398,7 +397,7 @@ if(LLVM_LIBC_FULL_BUILD) SRCS at_quick_exit_test.cpp DEPENDS - libc.hdr.func._Exit + libc.src.stdlib._Exit libc.src.stdlib.quick_exit libc.src.stdlib.at_quick_exit libc.src.__support.CPP.array diff --git a/libc/test/src/stdlib/at_quick_exit_test.cpp b/libc/test/src/stdlib/at_quick_exit_test.cpp index 8049fe58d29bd..1ed5a83a61b8d 100644 --- a/libc/test/src/stdlib/at_quick_exit_test.cpp +++ b/libc/test/src/stdlib/at_quick_exit_test.cpp @@ -6,7 +6,6 @@ // //===----------------------------------------------------------------------===// -#include "hdr/func/_Exit.h" #include "src/__support/CPP/array.h" #include "src/__support/CPP/utility.h" #include "src/stdlib/at_quick_exit.h" @@ -34,7 +33,7 @@ TEST(LlvmLibcAtQuickExit, Basic) { TEST(LlvmLibcAtQuickExit, AtQuickExitCallsSysExit) { auto test = [] { - LIBC_NAMESPACE::at_quick_exit(+[] { _Exit(1); }); + LIBC_NAMESPACE::at_quick_exit(+[] { LIBC_NAMESPACE::_Exit(1); }); LIBC_NAMESPACE::quick_exit(0); }; EXPECT_EXITS(test, 1); diff --git a/libc/test/src/stdlib/atexit_test.cpp b/libc/test/src/stdlib/atexit_test.cpp index 9e19423f73086..24f8b0451f363 100644 --- a/libc/test/src/stdlib/atexit_test.cpp +++ b/libc/test/src/stdlib/atexit_test.cpp @@ -6,7 +6,6 @@ // //===----------------------------------------------------------------------===// -#include "hdr/func/_Exit.h" #include "src/__support/CPP/array.h" #include "src/__support/CPP/utility.h" #include "src/stdlib/atexit.h" @@ -34,7 +33,7 @@ TEST(LlvmLibcAtExit, Basic) { TEST(LlvmLibcAtExit, AtExitCallsSysExit) { auto test = [] { - LIBC_NAMESPACE::atexit(+[] { _Exit(1); }); + LIBC_NAMESPACE::atexit(+[] { LIBC_NAMESPACE::_Exit(1); }); LIBC_NAMESPACE::exit(0); }; EXPECT_EXITS(test, 1);