-
Notifications
You must be signed in to change notification settings - Fork 14.3k
[libc] added quick_exit function #93620
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
Show all changes
6 commits
Select commit
Hold shift + click to select a range
9a9d89e
[libc] added quick_exit function
RoseZhang03 50a883e
addressed comments for formatting and unecessary testing/dependencies
RoseZhang03 7644b4c
fixed order of includes
RoseZhang03 58066dd
fixed noreturn and no_stack_protector brackets and other formatting …
RoseZhang03 0d82212
fixed more formatting
RoseZhang03 70817fe
updated BUILD.bazel file: quick_exit changed to exit
RoseZhang03 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2,7 +2,7 @@ add_object_library( | |
baremetal_util | ||
SRCS | ||
io.cpp | ||
quick_exit.cpp | ||
exit.cpp | ||
HDRS | ||
io.h | ||
DEPENDS | ||
|
12 changes: 6 additions & 6 deletions
12
...__support/OSUtil/baremetal/quick_exit.cpp → libc/src/__support/OSUtil/baremetal/exit.cpp
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,18 +1,18 @@ | ||
//===----- Baremetal implementation of a quick exit function ----*- C++ -*-===// | ||
//===-------- Baremetal implementation of an exit function ------*- C++ -*-===// | ||
// | ||
// 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 | ||
// | ||
//===----------------------------------------------------------------------===// | ||
|
||
#include "src/__support/OSUtil/quick_exit.h" | ||
#include "src/__support/OSUtil/exit.h" | ||
|
||
// This is intended to be provided by the vendor. | ||
extern "C" [[noreturn]] void __llvm_libc_quick_exit(int status); | ||
extern "C" [[noreturn]] void __llvm_libc_exit(int status); | ||
|
||
namespace LIBC_NAMESPACE { | ||
namespace LIBC_NAMESPACE::internal { | ||
|
||
[[noreturn]] void quick_exit(int status) { __llvm_libc_quick_exit(status); } | ||
[[noreturn]] void exit(int status) { __llvm_libc_exit(status); } | ||
|
||
} // namespace LIBC_NAMESPACE | ||
} // namespace LIBC_NAMESPACE::internal |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
//===------------ Implementation of an exit function ------------*- C++ -*-===// | ||
// | ||
// 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_SRC___SUPPORT_OSUTIL_EXIT_H | ||
#define LLVM_LIBC_SRC___SUPPORT_OSUTIL_EXIT_H | ||
|
||
namespace LIBC_NAMESPACE::internal { | ||
|
||
[[noreturn]] void exit(int status); | ||
|
||
} | ||
|
||
#endif // LLVM_LIBC_SRC___SUPPORT_OSUTIL_EXIT_H |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,7 @@ | ||
add_object_library( | ||
gpu_util | ||
SRCS | ||
quick_exit.cpp | ||
exit.cpp | ||
io.cpp | ||
HDRS | ||
io.h | ||
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
//===-- Implementation of quick_exit --------------------------------------===// | ||
// | ||
// 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 | ||
// | ||
//===----------------------------------------------------------------------===// | ||
|
||
#include "src/stdlib/quick_exit.h" | ||
#include "src/__support/OSUtil/exit.h" | ||
#include "src/__support/common.h" | ||
|
||
// extern "C" void __cxa_finalize(void *); | ||
|
||
namespace LIBC_NAMESPACE { | ||
|
||
[[noreturn]] LLVM_LIBC_FUNCTION(void, quick_exit, (int status)) { | ||
// __cxa_finalize(nullptr); | ||
internal::exit(status); | ||
} | ||
|
||
} // namespace LIBC_NAMESPACE |
10 changes: 5 additions & 5 deletions
10
libc/src/__support/OSUtil/quick_exit.h → libc/src/stdlib/quick_exit.h
RoseZhang03 marked this conversation as resolved.
Show resolved
Hide resolved
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,18 +1,18 @@ | ||
//===---------- Implementation of a quick exit function ---------*- C++ -*-===// | ||
//===-- Implementation header for quick_exit --------------------*- C++ -*-===// | ||
// | ||
// 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_SRC___SUPPORT_OSUTIL_QUICK_EXIT_H | ||
#define LLVM_LIBC_SRC___SUPPORT_OSUTIL_QUICK_EXIT_H | ||
#ifndef LLVM_LIBC_SRC_STDLIB_QUICK_EXIT_H | ||
#define LLVM_LIBC_SRC_STDLIB_QUICK_EXIT_H | ||
|
||
namespace LIBC_NAMESPACE { | ||
|
||
[[noreturn]] void quick_exit(int status); | ||
|
||
} | ||
} // namespace LIBC_NAMESPACE | ||
|
||
#endif // LLVM_LIBC_SRC___SUPPORT_OSUTIL_QUICK_EXIT_H | ||
#endif // LLVM_LIBC_SRC_STDLIB_QUICK_EXIT_H |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
//===-- Unittests for quick_exit ------------------------------------------===// | ||
// | ||
// 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 | ||
// | ||
//===----------------------------------------------------------------------===// | ||
|
||
#include "src/stdlib/exit.h" | ||
#include "src/stdlib/quick_exit.h" | ||
#include "test/UnitTest/Test.h" | ||
|
||
TEST(LlvmLibcStdlib, quick_exit) { | ||
EXPECT_EXITS([] { LIBC_NAMESPACE::quick_exit(1); }, 1); | ||
EXPECT_EXITS([] { LIBC_NAMESPACE::quick_exit(65); }, 65); | ||
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.