Skip to content

Commit

Permalink
Deprecate c++ demangling. (#1800)
Browse files Browse the repository at this point in the history
Signed-off-by: furby™ <[email protected]>
  • Loading branch information
furby-tm authored Oct 2, 2024
1 parent e1f3791 commit 987d00a
Showing 1 changed file with 3 additions and 29 deletions.
32 changes: 3 additions & 29 deletions src/opentimelineio/stringUtils.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2,30 +2,9 @@
// Copyright Contributors to the OpenTimelineIO project

#include "opentimelineio/serializableObject.h"
#if defined(__GNUC__) || defined(__clang__)
# include <cstdlib>
# include <cxxabi.h>
# include <memory>
#else
# include <typeinfo>
#endif

namespace {
#if defined(__GNUC__) || defined(__clang__)
std::string
cxxabi_type_name_for_error_mesage(const char* name)
{
int status = -4; // some arbitrary value to eliminate the compiler warning

std::unique_ptr<char, void (*)(void*)> res{
abi::__cxa_demangle(name, NULL, NULL, &status),
std::free
};

return (status == 0) ? res.get() : name;
}
#endif
} // namespace
#include <cstdlib>
#include <memory>
#include <typeinfo>

namespace opentimelineio { namespace OPENTIMELINEIO_VERSION {

Expand All @@ -41,12 +20,7 @@ type_name_for_error_message(std::type_info const& t)
return "None";
}

#if defined(__GNUC__) || defined(__clang__)
return ::cxxabi_type_name_for_error_mesage(t.name());
#else
// On Windows std::type_info.name() returns a human readable string.
return t.name();
#endif
}

std::string
Expand Down

0 comments on commit 987d00a

Please sign in to comment.