diff --git a/Sources/Arch/include/Arch/defines.h b/Sources/Arch/include/Arch/defines.h index 561d27160..106d16618 100644 --- a/Sources/Arch/include/Arch/defines.h +++ b/Sources/Arch/include/Arch/defines.h @@ -79,9 +79,10 @@ # define ARCH_HAS_GNU_STL_EXTENSIONS #endif -// The current version of Apple clang does not support the thread_local -// keyword. -#if !(defined(ARCH_OS_DARWIN) && defined(ARCH_COMPILER_CLANG)) +// The current version of Apple clang does not support the thread_local keyword. +// WABI: always enabled thread_local, removed the all darwin platform disabling: +// !(defined(ARCH_OS_DARWIN) && defined(ARCH_COMPILER_CLANG)) +#if 1 # define ARCH_HAS_THREAD_LOCAL #endif diff --git a/Sources/Hd/sceneIndex.cpp b/Sources/Hd/sceneIndex.cpp index 790e3c29f..1dce37d26 100644 --- a/Sources/Hd/sceneIndex.cpp +++ b/Sources/Hd/sceneIndex.cpp @@ -187,7 +187,8 @@ std::string HdSceneIndexBase::GetDisplayName() const return _displayName; } - return ArchGetDemangled(typeid(*this).name()); + auto& thisType = (*this); + return ArchGetDemangled(typeid(thisType).name()); } void HdSceneIndexBase::SetDisplayName(const std::string &n) diff --git a/Sources/HdSt/materialXFilter.cpp b/Sources/HdSt/materialXFilter.cpp index ff7ecad99..6d874cf1e 100644 --- a/Sources/HdSt/materialXFilter.cpp +++ b/Sources/HdSt/materialXFilter.cpp @@ -605,7 +605,7 @@ static mx::NodePtr _AddStrippedSurfaceNode(mx::DocumentPtr mxDocument, auto const &hdConnectedNode = hdNetwork.nodes.at(hdConnectedPath); mx::NodePtr mxConnectedNode = _AddStrippedSurfaceNode( mxDocument, hdConnectedPath.GetName(), hdConnectedNode, hdNetwork); - mx::InputPtr mxInput = mxNode->addInput(mxInput->getName(), mxInput->getType()); + mx::InputPtr mxInput = mxNode->addInput(mxInputDef->getName(), mxInputDef->getType()); mxInput->setConnectedNode(mxConnectedNode); } // Add the connection as an input with each component set to 0.5 diff --git a/Sources/Sdf/fileFormat.cpp b/Sources/Sdf/fileFormat.cpp index 2db285235..f61bc168b 100644 --- a/Sources/Sdf/fileFormat.cpp +++ b/Sources/Sdf/fileFormat.cpp @@ -480,10 +480,12 @@ void SdfFileFormat::_SetLayerData(SdfLayer *layer, // to have the qualities the file format dictates, even if the // underlying data object type is the same. const SdfAbstractDataConstPtr oldData = _GetLayerData(*layer); + const auto& dataType = *get_pointer(data); + const auto& oldDataType = *get_pointer(oldData); const bool differentDataImpl = data->StreamsData() != oldData->StreamsData() || data->IsDetached() != oldData->IsDetached() || - !TfSafeTypeCompare(typeid(*get_pointer(data)), - typeid(*get_pointer(oldData))); + !TfSafeTypeCompare(typeid(dataType), + typeid(oldDataType)); if (differentDataImpl) { layer->_AdoptData(data); diff --git a/Sources/Sdf/include/Sdf/predicateProgram.h b/Sources/Sdf/include/Sdf/predicateProgram.h index 2e1cf32b9..ce3873837 100644 --- a/Sources/Sdf/include/Sdf/predicateProgram.h +++ b/Sources/Sdf/include/Sdf/predicateProgram.h @@ -217,7 +217,7 @@ SdfPredicateProgram SdfLinkPredicateExpression( if (!errs.empty()) { prog = {}; - TF_RUNTIME_ERROR(errs.c_str()); + TF_RUNTIME_ERROR("%s", errs.c_str()); } return prog; } diff --git a/Sources/Sdf/specType.cpp b/Sources/Sdf/specType.cpp index fbd586d61..6bc88608a 100644 --- a/Sources/Sdf/specType.cpp +++ b/Sources/Sdf/specType.cpp @@ -185,8 +185,9 @@ static bool _CanCast(const Sdf_SpecTypeInfo &specTypeInfo, TfType Sdf_SpecType::Cast(const SdfSpec &from, const std::type_info &to) { const Sdf_SpecTypeInfo &specTypeInfo = Sdf_SpecTypeInfo::GetInstance(); - - const TfType &schemaType = TfType::Find(typeid(from.GetSchema())); + + const auto& needle = from.GetSchema(); + const TfType &schemaType = TfType::Find(typeid(needle)); if (!TF_VERIFY(!schemaType.IsUnknown())) { return TfType(); } @@ -234,7 +235,8 @@ bool Sdf_SpecType::CanCast(const SdfSpec &from, const std::type_info &to) const SdfSpecType fromType = from.GetSpecType(); const TfType &toType = TfType::Find(to); - const TfType &fromSchemaType = TfType::Find(typeid(from.GetSchema())); + const auto& needle = from.GetSchema(); + const TfType &fromSchemaType = TfType::Find(typeid(needle)); TfBigRWMutex::ScopedLock lock(specTypeInfo.mutex, /*write=*/false); diff --git a/Sources/Tf/notice.cpp b/Sources/Tf/notice.cpp index 279d1b951..9fea3c6f1 100644 --- a/Sources/Tf/notice.cpp +++ b/Sources/Tf/notice.cpp @@ -62,7 +62,8 @@ size_t TfNotice::_Send(const TfWeakBase *s, { // Look up the notice type using the static type_info. // This is faster than TfType::Find(). - TfType noticeType = TfType::Find(typeid(*this)); + auto& thisType = (*this); + TfType noticeType = TfType::Find(typeid(thisType)); return Tf_NoticeRegistry::_GetInstance()._Send(*this, noticeType, s, senderUniqueId, senderType); } diff --git a/Sources/Usd/primDefinition.cpp b/Sources/Usd/primDefinition.cpp index 53715b1db..59ba8dd8c 100644 --- a/Sources/Usd/primDefinition.cpp +++ b/Sources/Usd/primDefinition.cpp @@ -350,7 +350,7 @@ SdfPropertySpecHandle UsdPrimDefinition::_FindOrCreatePropertySpecForComposition // we create a new layer for this prim definition to write its composed // properties. if (_composedPropertyLayer) { - if (destProp = _composedPropertyLayer->GetPropertyAtPath(primPath.AppendProperty(propName))) { + if ((destProp = _composedPropertyLayer->GetPropertyAtPath(primPath.AppendProperty(propName)))) { return destProp; } } diff --git a/Sources/UsdGeom/include/UsdGeom/hermiteCurves.h b/Sources/UsdGeom/include/UsdGeom/hermiteCurves.h index c7aa851b6..d2e887218 100644 --- a/Sources/UsdGeom/include/UsdGeom/hermiteCurves.h +++ b/Sources/UsdGeom/include/UsdGeom/hermiteCurves.h @@ -207,8 +207,10 @@ class UsdGeomHermiteCurves : public UsdGeomCurves { /// /// If points and tangents are not the same size, an empty container /// is created. - PointAndTangentArrays(const VtVec3fArray &points, const VtVec3fArray &tangents) - : _points(points), _tangents(tangents) + explicit PointAndTangentArrays(const VtVec3fArray &points, + const VtVec3fArray &tangents) + : _points(points), + _tangents(tangents) { if (_points.size() != _tangents.size()) { TF_RUNTIME_ERROR("Points and tangents must be the same size."); @@ -254,11 +256,11 @@ class UsdGeomHermiteCurves : public UsdGeomCurves { return _tangents; } - bool operator==(const PointAndTangentArrays &other) + bool operator==(const PointAndTangentArrays &other) const { return (GetPoints() == other.GetPoints()) && (GetTangents() == other.GetTangents()); } - bool operator!=(const PointAndTangentArrays &other) + bool operator!=(const PointAndTangentArrays &other) const { return !((*this) == other); } diff --git a/Sources/UsdImaging/include/UsdImaging/cylinderLightAdapter.h b/Sources/UsdImaging/include/UsdImaging/cylinderLightAdapter.h index c34a1cea0..9d5aea022 100644 --- a/Sources/UsdImaging/include/UsdImaging/cylinderLightAdapter.h +++ b/Sources/UsdImaging/include/UsdImaging/cylinderLightAdapter.h @@ -45,10 +45,10 @@ class UsdImagingCylinderLightAdapter : public UsdImagingLightAdapter { USDIMAGING_API virtual SdfPath Populate(UsdPrim const &prim, UsdImagingIndexProxy *index, - UsdImagingInstancerContext const *instancerContext = NULL); + UsdImagingInstancerContext const *instancerContext = NULL) override; USDIMAGING_API - virtual bool IsSupported(UsdImagingIndexProxy const *index) const; + virtual bool IsSupported(UsdImagingIndexProxy const *index) const override; protected: virtual void _RemovePrim(SdfPath const &cachePath, UsdImagingIndexProxy *index) final; diff --git a/Sources/UsdImaging/include/UsdImaging/portalLightAdapter.h b/Sources/UsdImaging/include/UsdImaging/portalLightAdapter.h index bb5a6e9d6..44a4af08c 100644 --- a/Sources/UsdImaging/include/UsdImaging/portalLightAdapter.h +++ b/Sources/UsdImaging/include/UsdImaging/portalLightAdapter.h @@ -33,10 +33,10 @@ class UsdImagingPortalLightAdapter : public UsdImagingLightAdapter { USDIMAGING_API virtual SdfPath Populate(UsdPrim const &prim, UsdImagingIndexProxy *index, - UsdImagingInstancerContext const *instancerContext = NULL); + UsdImagingInstancerContext const *instancerContext = NULL) override; USDIMAGING_API - virtual bool IsSupported(UsdImagingIndexProxy const *index) const; + virtual bool IsSupported(UsdImagingIndexProxy const *index) const override; // ---------------------------------------------------------------------- // /// \name Scene Index Support diff --git a/Sources/UsdImaging/include/UsdImaging/tetMeshAdapter.h b/Sources/UsdImaging/include/UsdImaging/tetMeshAdapter.h index a19ac9f91..c57ad92a7 100644 --- a/Sources/UsdImaging/include/UsdImaging/tetMeshAdapter.h +++ b/Sources/UsdImaging/include/UsdImaging/tetMeshAdapter.h @@ -73,7 +73,7 @@ class UsdImagingTetMeshAdapter : public UsdImagingGprimAdapter { void TrackVariability(UsdPrim const &prim, SdfPath const &cachePath, HdDirtyBits *timeVaryingBits, - UsdImagingInstancerContext const *instancerContext = nullptr) const; + UsdImagingInstancerContext const *instancerContext = nullptr) const override; // ---------------------------------------------------------------------- // /// \name Change Processing diff --git a/Sources/UsdImaging/indexProxy.cpp b/Sources/UsdImaging/indexProxy.cpp index 4db5aa513..c5b14698c 100644 --- a/Sources/UsdImaging/indexProxy.cpp +++ b/Sources/UsdImaging/indexProxy.cpp @@ -43,10 +43,11 @@ UsdImagingDelegate::_HdPrimInfo *UsdImagingIndexProxy::_AddHdPrimInfo( } } + auto& adapterToInsertType = *(adapterToInsert.get()); TF_DEBUG(USDIMAGING_CHANGES) .Msg("[Add HdPrim Info] <%s> adapter=%s\n", cachePath.GetText(), - TfType::GetCanonicalTypeName(typeid(*(adapterToInsert.get()))).c_str()); + TfType::GetCanonicalTypeName(typeid(adapterToInsertType)).c_str()); // Currently, we don't support more than one adapter dependency per usd // prim, but we could relax this restriction if it's useful. @@ -250,10 +251,11 @@ void UsdImagingIndexProxy::InsertInstancer(SdfPath const &cachePath, primInfo->dirtyBits = HdChangeTracker::AllDirty; _delegate->_dirtyCachePaths.insert(cachePath); + auto& adapterType = (*adapter); TF_DEBUG(USDIMAGING_INSTANCER) .Msg("[Instancer Inserted] %s, adapter = %s\n", cachePath.GetText(), - adapter ? TfType::GetCanonicalTypeName(typeid(*adapter)).c_str() : "none"); + adapter ? TfType::GetCanonicalTypeName(typeid(adapterType)).c_str() : "none"); _AddTask(cachePath); } diff --git a/Sources/UsdImaging/instanceAdapter.cpp b/Sources/UsdImaging/instanceAdapter.cpp index 6b2adfc8b..17f0afc39 100644 --- a/Sources/UsdImaging/instanceAdapter.cpp +++ b/Sources/UsdImaging/instanceAdapter.cpp @@ -335,12 +335,13 @@ SdfPath UsdImagingInstanceAdapter::_Populate(UsdPrim const &prim, protoPath = newProtoPath; } + auto& primAdapterType = (*primAdapter); TF_DEBUG(USDIMAGING_INSTANCER) .Msg("[Add Instance NI] <%s> %s (%s), adapter = %s\n", instancerPath.GetText(), protoPath.GetText(), iter->GetName().GetText(), - primAdapter ? TfType::GetCanonicalTypeName(typeid(*primAdapter)).c_str() : "none"); + primAdapter ? TfType::GetCanonicalTypeName(typeid(primAdapterType)).c_str() : "none"); } } diff --git a/Sources/UsdUtils/include/UsdUtils/assetLocalizationDelegate.h b/Sources/UsdUtils/include/UsdUtils/assetLocalizationDelegate.h index dd3b2ff9b..441679a2b 100644 --- a/Sources/UsdUtils/include/UsdUtils/assetLocalizationDelegate.h +++ b/Sources/UsdUtils/include/UsdUtils/assetLocalizationDelegate.h @@ -263,7 +263,7 @@ class UsdUtils_ReadOnlyLocalizationDelegate : public UsdUtils_LocalizationDelega virtual std::vector ProcessSublayers(const SdfLayerRefPtr &layer) override; virtual std::vector ProcessPayloads(const SdfLayerRefPtr &layer, - const SdfPrimSpecHandle &primSpec); + const SdfPrimSpecHandle &primSpec) override; virtual std::vector ProcessReferences(const SdfLayerRefPtr &layer, const SdfPrimSpecHandle &primSpec) override;