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

Add [[maybe_unused]] attribute to TfPyObjWrapperStub._stub #2206

Closed
wants to merge 1 commit into from

Conversation

dgovil
Copy link
Collaborator

@dgovil dgovil commented Jan 26, 2023

I'm trying to reduce a bunch of the warnings that take up the build logs (I build often...so any reduction really helps). TfPyObjWrapper is one of the heavy offenders in the logs, but _stub is necessary per #1716 , so this just says that _stub can be unused.

NOTE: This does require C++17, I'm just putting it up now so that it's logged for whenever that happens.

I also think this is something that should be applied to _schemaTokens in the API schemas too, as those are the other major offenders. But I can hit that up in a different PR if this one doesn't raise any concerns.

  • I have verified that all unit tests pass with the proposed changes
  • I have submitted a signed Contributor License Agreement

@dgovil dgovil changed the base branch from release to dev January 26, 2023 23:20
@sunyab
Copy link
Contributor

sunyab commented Jan 27, 2023

Filed as internal issue #USD-7925

@nvmkuruc
Copy link
Collaborator

Now that OpenUSD is on C++17, @dgovil do you think it's a good time to consider integrating this PR?

@dgovil
Copy link
Collaborator Author

dgovil commented Apr 26, 2024

Yep that would be great if we could. I just rebased on dev to resolve the conflicts that had accumulated.
I did also add -Wno-ignored-attributes for gcc, because unfortunately the situation is:

  1. MSVC and Clang warn for unused attributes, so this attribute quells them.
  2. GCC doesn't warn for it but then warns that the attribute does nothing as a result.

@nvmkuruc
Copy link
Collaborator

nvmkuruc commented Apr 26, 2024

That's a great catch for GCC. If there's architecture dependent behavior, would it be better to create a define in pxr/base/arch (ie. ARCH_MAYBE_UNUSED_PRIVATE_MEMBER) and set it to [[maybe_unused]] in the MSVC and Clang code paths and let it be empty for GCC?

@dgovil
Copy link
Collaborator Author

dgovil commented Apr 26, 2024

Ah you know what, I missed after rebasing that Pixar have already added ARCH_PRAGMA_UNUSED_PRIVATE_FIELD above that line. So I'll just close out this PR as unnecessary.

@dgovil dgovil closed this Apr 26, 2024
@nvmkuruc
Copy link
Collaborator

👍

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