Skip to content

Commit 4fbc03d

Browse files
authored
Merge pull request #4002 from reyoung/feature/remove_enforce_demagle
Remove enforce demangle
2 parents d34516f + dad5421 commit 4fbc03d

1 file changed

Lines changed: 1 addition & 18 deletions

File tree

paddle/platform/enforce.h

Lines changed: 1 addition & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -25,10 +25,6 @@ limitations under the License. */
2525
#include "paddle/string/printf.h"
2626
#include "paddle/string/to_string.h"
2727

28-
#ifdef __GNUC__
29-
#include <cxxabi.h> // for __cxa_demangle
30-
#endif
31-
3228
#ifndef PADDLE_ONLY_CPU
3329

3430
#include "paddle/platform/dynload/cublas.h"
@@ -46,19 +42,6 @@ limitations under the License. */
4642
namespace paddle {
4743
namespace platform {
4844

49-
namespace {
50-
#ifdef __GNUC__
51-
inline std::string demangle(std::string name) {
52-
int status = -4; // some arbitrary value to eliminate the compiler warning
53-
std::unique_ptr<char, void (*)(void*)> res{
54-
abi::__cxa_demangle(name.c_str(), NULL, NULL, &status), std::free};
55-
return (status == 0) ? res.get() : name;
56-
}
57-
#else
58-
inline std::string demangle(std::string name) { return name; }
59-
#endif
60-
}
61-
6245
struct EnforceNotMet : public std::exception {
6346
std::exception_ptr exp_;
6447
std::string err_str_;
@@ -79,7 +62,7 @@ struct EnforceNotMet : public std::exception {
7962
Dl_info info;
8063
for (int i = 0; i < size; ++i) {
8164
if (dladdr(call_stack[i], &info)) {
82-
auto demangled = demangle(info.dli_sname);
65+
auto demangled = info.dli_sname;
8366
auto addr_offset = static_cast<char*>(call_stack[i]) -
8467
static_cast<char*>(info.dli_saddr);
8568
sout << string::Sprintf("%-3d %*0p %s + %zd\n", i,

0 commit comments

Comments
 (0)