From 2f0fda7f8c3d5a83629c9aff5f79f946dc5fa592 Mon Sep 17 00:00:00 2001 From: Matt Kuruc Date: Tue, 5 Sep 2023 21:25:38 -0700 Subject: [PATCH] Replace `boost::any` with `std::any` in `pxr/base/tf` --- pxr/base/tf/diagnosticBase.h | 6 +++--- pxr/base/tf/diagnosticHelper.h | 12 ++++++++++-- pxr/base/tf/diagnosticMgr.cpp | 5 ++--- 3 files changed, 15 insertions(+), 8 deletions(-) diff --git a/pxr/base/tf/diagnosticBase.h b/pxr/base/tf/diagnosticBase.h index c14d416909..72014beb31 100644 --- a/pxr/base/tf/diagnosticBase.h +++ b/pxr/base/tf/diagnosticBase.h @@ -38,13 +38,13 @@ #include "pxr/base/arch/attributes.h" #include "pxr/base/arch/function.h" -#include +#include #include #include PXR_NAMESPACE_OPEN_SCOPE -typedef boost::any TfDiagnosticInfo; +typedef std::any TfDiagnosticInfo; class TfDiagnosticMgr; @@ -160,7 +160,7 @@ class TfDiagnosticBase { /// then GetInfo() returns NULL. template const T* GetInfo() const { - return boost::any_cast(&_info); + return std::any_cast(&_info); } /// Set the info object associated with this diagnostic message. diff --git a/pxr/base/tf/diagnosticHelper.h b/pxr/base/tf/diagnosticHelper.h index f4c6b1592a..b88e0de52f 100644 --- a/pxr/base/tf/diagnosticHelper.h +++ b/pxr/base/tf/diagnosticHelper.h @@ -27,17 +27,25 @@ #include "pxr/pxr.h" #include "pxr/base/tf/api.h" #include "pxr/base/arch/attributes.h" +#include "pxr/base/arch/defines.h" // XXX: This include is a hack to avoid build errors due to // incompatible macro definitions in pyport.h on macOS. #include -#include +#include #include +#if defined(ARCH_OS_LINUX) || defined(ARCH_OS_DARWIN) +// Include to provide _exit for tf/debugger.cpp and dependencies +// that were previously transiently getting this from boost. Follow up changes +// should more tightly scope this to just where it's needed in pxr. +#include +#endif + PXR_NAMESPACE_OPEN_SCOPE -typedef boost::any TfDiagnosticInfo; +typedef std::any TfDiagnosticInfo; class TfCallContext; enum TfDiagnosticType : int; class TfEnum; diff --git a/pxr/base/tf/diagnosticMgr.cpp b/pxr/base/tf/diagnosticMgr.cpp index e42acffd56..5e9e48dbb8 100644 --- a/pxr/base/tf/diagnosticMgr.cpp +++ b/pxr/base/tf/diagnosticMgr.cpp @@ -42,11 +42,10 @@ #include "pxr/base/arch/stackTrace.h" #include "pxr/base/arch/threads.h" -#include - #include #include +#include #include #include @@ -673,7 +672,7 @@ TfDiagnosticMgr::FormatDiagnostic(const TfEnum &code, #ifdef PXR_PYTHON_SUPPORT_ENABLED if (const TfPyExceptionState* exc = - boost::any_cast(&info)) { + std::any_cast(&info)) { output += TfStringPrintf("%s\n", exc->GetExceptionString().c_str()); } #endif // PXR_PYTHON_SUPPORT_ENABLED