From 4672ac4c3bd9572b36b54e0617b604e55c692ec2 Mon Sep 17 00:00:00 2001 From: Hamed Sabri Date: Tue, 11 Feb 2020 11:29:45 -0500 Subject: [PATCH 1/2] Fix MacOSX build in strict mode: Compiler: XCode 11.3.1 Error: format specifies type 'unsigned long long' but the argument has type 'int' [-Werror,-Wformat] TF_DEBUG(ALUSDMAYA_SELECTION).Msg("ProxyShapeSelection::TransformReference::decRef %" PRIu64 " %" PRIu64 " %" PRIu64 "\n", m_selected, m_refCount, m_required); --- .../AL/usdmaya/nodes/ProxyShapeSelection.cpp | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/plugin/al/lib/AL_USDMaya/AL/usdmaya/nodes/ProxyShapeSelection.cpp b/plugin/al/lib/AL_USDMaya/AL/usdmaya/nodes/ProxyShapeSelection.cpp index 2661bf2245..121bd4cf6c 100644 --- a/plugin/al/lib/AL_USDMaya/AL/usdmaya/nodes/ProxyShapeSelection.cpp +++ b/plugin/al/lib/AL_USDMaya/AL/usdmaya/nodes/ProxyShapeSelection.cpp @@ -252,7 +252,7 @@ void ProxyShape::printRefCounts() const //---------------------------------------------------------------------------------------------------------------------- inline bool ProxyShape::TransformReference::decRef(const TransformReason reason) { - TF_DEBUG(ALUSDMAYA_SELECTION).Msg("ProxyShapeSelection::TransformReference::decRef %" PRIu64 " %" PRIu64 " %" PRIu64 "\n", m_selected, m_refCount, m_required); + TF_DEBUG(ALUSDMAYA_SELECTION).Msg("ProxyShapeSelection::TransformReference::decRef %" PRIu32 " %" PRIu32 " %" PRIu32 "\n", m_selected, m_refCount, m_required); switch(reason) { case kSelection: assert(m_selected); --m_selected; break; @@ -263,14 +263,14 @@ inline bool ProxyShape::TransformReference::decRef(const TransformReason reason) break; } - TF_DEBUG(ALUSDMAYA_SELECTION).Msg("ProxyShapeSelection::TransformReference::decRefEnd %" PRIu64 " %" PRIu64 " %" PRIu64 "\n", m_selected, m_refCount, m_required); + TF_DEBUG(ALUSDMAYA_SELECTION).Msg("ProxyShapeSelection::TransformReference::decRefEnd %" PRIu32 " %" PRIu32 " %" PRIu32 "\n", m_selected, m_refCount, m_required); return !m_required && !m_selected && !m_refCount; } //---------------------------------------------------------------------------------------------------------------------- inline void ProxyShape::TransformReference::incRef(const TransformReason reason) { - TF_DEBUG(ALUSDMAYA_SELECTION).Msg("ProxyShapeSelection::TransformReference::incRef %" PRIu64 " %" PRIu64 " %" PRIu64 "\n", m_selected, m_refCount, m_required); + TF_DEBUG(ALUSDMAYA_SELECTION).Msg("ProxyShapeSelection::TransformReference::incRef %" PRIu32 " %" PRIu32 " %" PRIu32 "\n", m_selected, m_refCount, m_required); switch(reason) { case kSelection: ++m_selected; break; @@ -279,13 +279,13 @@ inline void ProxyShape::TransformReference::incRef(const TransformReason reason) default: assert(0); break; } - TF_DEBUG(ALUSDMAYA_SELECTION).Msg("ProxyShapeSelection::TransformReference::incRefEnd %" PRIu64 " %" PRIu64 " %" PRIu64 "\n", m_selected, m_refCount, m_required); + TF_DEBUG(ALUSDMAYA_SELECTION).Msg("ProxyShapeSelection::TransformReference::incRefEnd %" PRIu32 " %" PRIu32 " %" PRIu32 "\n", m_selected, m_refCount, m_required); } //---------------------------------------------------------------------------------------------------------------------- inline void ProxyShape::TransformReference::checkIncRef(const TransformReason reason) { - TF_DEBUG(ALUSDMAYA_SELECTION).Msg("ProxyShapeSelection::TransformReference::checkIncRef %" PRIu64 " %" PRIu64 " %" PRIu64 "\n", m_selected, m_refCount, m_required); + TF_DEBUG(ALUSDMAYA_SELECTION).Msg("ProxyShapeSelection::TransformReference::checkIncRef %" PRIu32 " %" PRIu32 " %" PRIu32 "\n", m_selected, m_refCount, m_required); switch(reason) { case kSelection: ++m_selectedTemp; break; @@ -296,7 +296,7 @@ inline void ProxyShape::TransformReference::checkIncRef(const TransformReason re //---------------------------------------------------------------------------------------------------------------------- inline bool ProxyShape::TransformReference::checkRef(const TransformReason reason) { - TF_DEBUG(ALUSDMAYA_SELECTION).Msg("ProxyShapeSelection::TransformReference::checkRef %" PRIu64 " : %" PRIu64 " %" PRIu64 " %" PRIu64 "\n", m_selectedTemp, m_selected, m_refCount, m_required); + TF_DEBUG(ALUSDMAYA_SELECTION).Msg("ProxyShapeSelection::TransformReference::checkRef %" PRIu32 " : %" PRIu32 " %" PRIu32 " %" PRIu32 "\n", m_selectedTemp, m_selected, m_refCount, m_required); uint32_t sl = m_selected; uint32_t rc = m_refCount; uint32_t rq = m_required; From 32eacf863c2b8973309798e984285ec2ade04c2c Mon Sep 17 00:00:00 2001 From: Hamed Sabri Date: Tue, 11 Feb 2020 14:48:34 -0500 Subject: [PATCH 2/2] This change makes it very explicit and clear about the types and avoid any compiler voodoo magics on different platforms: - The structure is still 8 bytes without the bit filed. uint16_t is 2 bytes * 4 = 8 bytes - The return types are now uint16_t (2 bytes) - And we can use PRIu16 specifier --- .../lib/AL_USDMaya/AL/usdmaya/nodes/ProxyShape.h | 14 +++++++------- .../AL/usdmaya/nodes/ProxyShapeSelection.cpp | 12 ++++++------ 2 files changed, 13 insertions(+), 13 deletions(-) diff --git a/plugin/al/lib/AL_USDMaya/AL/usdmaya/nodes/ProxyShape.h b/plugin/al/lib/AL_USDMaya/AL/usdmaya/nodes/ProxyShape.h index 7a978f82ca..03aee60ddd 100644 --- a/plugin/al/lib/AL_USDMaya/AL/usdmaya/nodes/ProxyShape.h +++ b/plugin/al/lib/AL_USDMaya/AL/usdmaya/nodes/ProxyShape.h @@ -952,9 +952,9 @@ class ProxyShape << m_selected << ":" << int(m_refCount) << std::endl; } - uint32_t selected() const { return m_selected; } - uint32_t required() const { return m_required; } - uint32_t refCount() const { return m_refCount; } + uint16_t selected() const { return m_selected; } + uint16_t required() const { return m_required; } + uint16_t refCount() const { return m_refCount; } void prepSelect() { m_selectedTemp = m_selected; } private: @@ -963,10 +963,10 @@ class ProxyShape // ref counting values struct { - uint64_t m_required:16; - uint64_t m_selectedTemp:16; - uint64_t m_selected:16; - uint64_t m_refCount:16; + uint16_t m_required; + uint16_t m_selectedTemp; + uint16_t m_selected; + uint16_t m_refCount; }; }; diff --git a/plugin/al/lib/AL_USDMaya/AL/usdmaya/nodes/ProxyShapeSelection.cpp b/plugin/al/lib/AL_USDMaya/AL/usdmaya/nodes/ProxyShapeSelection.cpp index 121bd4cf6c..41c1b2e335 100644 --- a/plugin/al/lib/AL_USDMaya/AL/usdmaya/nodes/ProxyShapeSelection.cpp +++ b/plugin/al/lib/AL_USDMaya/AL/usdmaya/nodes/ProxyShapeSelection.cpp @@ -252,7 +252,7 @@ void ProxyShape::printRefCounts() const //---------------------------------------------------------------------------------------------------------------------- inline bool ProxyShape::TransformReference::decRef(const TransformReason reason) { - TF_DEBUG(ALUSDMAYA_SELECTION).Msg("ProxyShapeSelection::TransformReference::decRef %" PRIu32 " %" PRIu32 " %" PRIu32 "\n", m_selected, m_refCount, m_required); + TF_DEBUG(ALUSDMAYA_SELECTION).Msg("ProxyShapeSelection::TransformReference::decRef %" PRIu16 " %" PRIu16 " %" PRIu16 "\n", m_selected, m_refCount, m_required); switch(reason) { case kSelection: assert(m_selected); --m_selected; break; @@ -263,14 +263,14 @@ inline bool ProxyShape::TransformReference::decRef(const TransformReason reason) break; } - TF_DEBUG(ALUSDMAYA_SELECTION).Msg("ProxyShapeSelection::TransformReference::decRefEnd %" PRIu32 " %" PRIu32 " %" PRIu32 "\n", m_selected, m_refCount, m_required); + TF_DEBUG(ALUSDMAYA_SELECTION).Msg("ProxyShapeSelection::TransformReference::decRefEnd %" PRIu16 " %" PRIu16 " %" PRIu16 "\n", m_selected, m_refCount, m_required); return !m_required && !m_selected && !m_refCount; } //---------------------------------------------------------------------------------------------------------------------- inline void ProxyShape::TransformReference::incRef(const TransformReason reason) { - TF_DEBUG(ALUSDMAYA_SELECTION).Msg("ProxyShapeSelection::TransformReference::incRef %" PRIu32 " %" PRIu32 " %" PRIu32 "\n", m_selected, m_refCount, m_required); + TF_DEBUG(ALUSDMAYA_SELECTION).Msg("ProxyShapeSelection::TransformReference::incRef %" PRIu16 " %" PRIu16 " %" PRIu16 "\n", m_selected, m_refCount, m_required); switch(reason) { case kSelection: ++m_selected; break; @@ -279,13 +279,13 @@ inline void ProxyShape::TransformReference::incRef(const TransformReason reason) default: assert(0); break; } - TF_DEBUG(ALUSDMAYA_SELECTION).Msg("ProxyShapeSelection::TransformReference::incRefEnd %" PRIu32 " %" PRIu32 " %" PRIu32 "\n", m_selected, m_refCount, m_required); + TF_DEBUG(ALUSDMAYA_SELECTION).Msg("ProxyShapeSelection::TransformReference::incRefEnd %" PRIu16 " %" PRIu16 " %" PRIu16 "\n", m_selected, m_refCount, m_required); } //---------------------------------------------------------------------------------------------------------------------- inline void ProxyShape::TransformReference::checkIncRef(const TransformReason reason) { - TF_DEBUG(ALUSDMAYA_SELECTION).Msg("ProxyShapeSelection::TransformReference::checkIncRef %" PRIu32 " %" PRIu32 " %" PRIu32 "\n", m_selected, m_refCount, m_required); + TF_DEBUG(ALUSDMAYA_SELECTION).Msg("ProxyShapeSelection::TransformReference::checkIncRef %" PRIu16 " %" PRIu16 " %" PRIu16 "\n", m_selected, m_refCount, m_required); switch(reason) { case kSelection: ++m_selectedTemp; break; @@ -296,7 +296,7 @@ inline void ProxyShape::TransformReference::checkIncRef(const TransformReason re //---------------------------------------------------------------------------------------------------------------------- inline bool ProxyShape::TransformReference::checkRef(const TransformReason reason) { - TF_DEBUG(ALUSDMAYA_SELECTION).Msg("ProxyShapeSelection::TransformReference::checkRef %" PRIu32 " : %" PRIu32 " %" PRIu32 " %" PRIu32 "\n", m_selectedTemp, m_selected, m_refCount, m_required); + TF_DEBUG(ALUSDMAYA_SELECTION).Msg("ProxyShapeSelection::TransformReference::checkRef %" PRIu16 " : %" PRIu16 " %" PRIu16 " %" PRIu16 "\n", m_selectedTemp, m_selected, m_refCount, m_required); uint32_t sl = m_selected; uint32_t rc = m_refCount; uint32_t rq = m_required;