[libc-commits] [libc] c980cc0 - [libc] Remove _Exit proxy func header and use LIBC_NAMESPACE::_Exit in tests (#114904)

via libc-commits libc-commits at lists.llvm.org
Thu Nov 7 09:10:26 PST 2024


Author: Job Henandez Lara
Date: 2024-11-07T09:10:22-08:00
New Revision: c980cc086989a5910c4e6321063e805f767a3b90

URL: https://github.com/llvm/llvm-project/commit/c980cc086989a5910c4e6321063e805f767a3b90
DIFF: https://github.com/llvm/llvm-project/commit/c980cc086989a5910c4e6321063e805f767a3b90.diff

LOG: [libc] Remove _Exit proxy func header and use LIBC_NAMESPACE::_Exit in tests (#114904)

This improves/fixes this pr
https://github.com/llvm/llvm-project/pull/114718. In this PR we removed
the _Exit proxy func because it was not needed. Instead we used
`LIBC_NAMESPACE::_Exit`

Added: 
    

Modified: 
    libc/hdr/func/CMakeLists.txt
    libc/test/src/stdlib/CMakeLists.txt
    libc/test/src/stdlib/at_quick_exit_test.cpp
    libc/test/src/stdlib/atexit_test.cpp

Removed: 
    libc/hdr/func/_Exit.h


################################################################################
diff  --git a/libc/hdr/func/CMakeLists.txt b/libc/hdr/func/CMakeLists.txt
index 714b7ec9b48809..608bab5ae1e95d 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 e024a651a50bcf..00000000000000
--- a/libc/hdr/func/_Exit.h
+++ /dev/null
@@ -1,22 +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
-// We will use the `_Exit` declaration from our generated stdlib.h
-#include <stdlib.h>
-
-#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 4ea894cf48724d..ff6034e43e9f6a 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 8049fe58d29bd3..1ed5a83a61b8d0 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 9e19423f730860..24f8b0451f3636 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);


        


More information about the libc-commits mailing list