Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix MacOSX build in strict mode: #275

Merged
merged 2 commits into from
Feb 13, 2020
Merged

Conversation

HamedSabri-adsk
Copy link
Contributor

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);
.....

Hi @murphyeoin,
I am trying to understand some of the logics in ProxyShape.h related to this issue:
So we have a bit field struct that is a size of 8bytes (16 bits * 4)

    // ref counting values
    struct
    {
      uint64_t m_required:16; 
      uint64_t m_selectedTemp:16;
      uint64_t m_selected:16;
      uint64_t m_refCount:16;
    };

but then we have these getters that return them as 4 bytes. Is there a reason for that? couldn't we return them as uint16_t.

   uint32_t selected() const { return m_selected; }
   uint32_t required() const { return m_required; }
   uint32_t refCount() const { return m_refCount; }

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);
…d 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
@kxl-adsk kxl-adsk removed the request for review from murphyeoin February 13, 2020 09:16
@kxl-adsk kxl-adsk merged commit 64ce918 into dev Feb 13, 2020
@kxl-adsk kxl-adsk deleted the sabrih/fix_macos_format_error branch February 13, 2020 09:51
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants