Skip to content
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

[libc++] Remove dead code in legacy_debug_handler.cpp #68155

Merged

Conversation

ldionne
Copy link
Member

@ldionne ldionne commented Oct 3, 2023

We removed all traces of the legacy debug mode a while back, but we forgot to remove the actual .cpp file that implemented the legacy debug handler. The file is not referenced from anywhere so this is effectively a NFC.

We removed all traces of the legacy debug mode a while back, but we
forgot to remove the actual `.cpp` file that implemented the legacy
debug handler. The file is not referenced from anywhere so this is
effectively a NFC.
@ldionne ldionne requested a review from a team as a code owner October 3, 2023 20:16
@llvmbot llvmbot added the libc++ libc++ C++ Standard Library. Not GNU libstdc++. Not libc++abi. label Oct 3, 2023
@llvmbot
Copy link
Member

llvmbot commented Oct 3, 2023

@llvm/pr-subscribers-libcxx

Changes

We removed all traces of the legacy debug mode a while back, but we forgot to remove the actual .cpp file that implemented the legacy debug handler. The file is not referenced from anywhere so this is effectively a NFC.


Full diff: https://github.com/llvm/llvm-project/pull/68155.diff

2 Files Affected:

  • (removed) libcxx/src/legacy_debug_handler.cpp (-54)
  • (modified) libcxx/utils/data/ignore_format.txt (-1)
diff --git a/libcxx/src/legacy_debug_handler.cpp b/libcxx/src/legacy_debug_handler.cpp
deleted file mode 100644
index cb2025bfc9b6d7a..000000000000000
--- a/libcxx/src/legacy_debug_handler.cpp
+++ /dev/null
@@ -1,54 +0,0 @@
-//===----------------------------------------------------------------------===//
-//
-// 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 <__config>
-#include <cstdio>
-#include <cstdlib>
-#include <string>
-
-// This file defines the legacy default debug handler and related mechanisms
-// to set it. This is for backwards ABI compatibility with code that has been
-// using this debug handler previously.
-
-_LIBCPP_BEGIN_NAMESPACE_STD
-
-struct _LIBCPP_TEMPLATE_VIS __libcpp_debug_info {
-  _LIBCPP_EXPORTED_FROM_ABI string what() const;
-
-  const char* __file_;
-  int __line_;
-  const char* __pred_;
-  const char* __msg_;
-};
-
-std::string __libcpp_debug_info::what() const {
-  string msg = __file_;
-  msg += ":" + std::to_string(__line_) + ": _LIBCPP_ASSERT '";
-  msg += __pred_;
-  msg += "' failed. ";
-  msg += __msg_;
-  return msg;
-}
-
-_LIBCPP_NORETURN _LIBCPP_EXPORTED_FROM_ABI void __libcpp_abort_debug_function(__libcpp_debug_info const& info) {
-  std::fprintf(stderr, "%s\n", info.what().c_str());
-  std::abort();
-}
-
-typedef void (*__libcpp_debug_function_type)(__libcpp_debug_info const&);
-
-_LIBCPP_EXPORTED_FROM_ABI
-constinit __libcpp_debug_function_type __libcpp_debug_function = __libcpp_abort_debug_function;
-
-_LIBCPP_EXPORTED_FROM_ABI
-bool __libcpp_set_debug_function(__libcpp_debug_function_type __func) {
-  __libcpp_debug_function = __func;
-  return true;
-}
-
-_LIBCPP_END_NAMESPACE_STD
diff --git a/libcxx/utils/data/ignore_format.txt b/libcxx/utils/data/ignore_format.txt
index 34b647a3bd2123c..308bb5b78fd5a0e 100644
--- a/libcxx/utils/data/ignore_format.txt
+++ b/libcxx/utils/data/ignore_format.txt
@@ -524,7 +524,6 @@ libcxx/src/include/ryu/ryu.h
 libcxx/src/include/sso_allocator.h
 libcxx/src/ios.cpp
 libcxx/src/iostream.cpp
-libcxx/src/legacy_debug_handler.cpp
 libcxx/src/locale.cpp
 libcxx/src/memory.cpp
 libcxx/src/mutex.cpp

Copy link
Contributor

@philnik777 philnik777 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM assuming CI passes.

@var-const
Copy link
Member

LGTM.

@var-const var-const self-requested a review October 4, 2023 01:24
@ldionne
Copy link
Member Author

ldionne commented Oct 4, 2023

@huixie90 FYI jthread.detach.pass.cpp failed on Windows in this run: https://buildkite.com/llvm-project/libcxx-ci/builds/30468#018af72f-8d3e-4974-a817-43e4446dd7f7

It doesn't seem to fail reliably, but it would be a good idea to investigate.

@ldionne ldionne merged commit 2848125 into llvm:main Oct 4, 2023
@ldionne ldionne deleted the review/remove-legacy-debug-handler-dead-code branch October 4, 2023 15:38
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
libc++ libc++ C++ Standard Library. Not GNU libstdc++. Not libc++abi.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants