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

Avoid conversion of SdfLayerRefPtr to SdfLayerHandle in pcp/cache.cpp #2643

Merged
merged 1 commit into from
Sep 19, 2023

Conversation

nvmkuruc
Copy link
Collaborator

@nvmkuruc nvmkuruc commented Sep 5, 2023

Description of Change(s)

The following warning was observed in GCC 11.

warning: loop variable ‘layer’ of type ‘const SdfLayerHandle&’ {aka ‘const pxrInternal_v0_23__pxrReserved__::TfWeakPtr<pxrInternal_v0_23__pxrReserved__::SdfLayer>&’} binds to a temporary constructed from type ‘const pxrInternal_v0_23__pxrReserved__::TfRefPtr<pxrInternal_v0_23__pxrReserved__::SdfLayer>’ [-Wrange-loop-construct]
 1232 |         for (const SdfLayerHandle& layer: layerStack->GetLayers()) {

GetLayers() returns a vector of SdfLayerRefPtrs. Iterating using a handle will trigger an implicit conversion to a temporary SdfLayerHandle. This PR uses auto to preserve the type of the vector contents and avoid any implicit conversions.

Fixes Issue(s)

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

@jesschimein
Copy link
Contributor

Filed as internal issue #USD-8647

@pixar-oss pixar-oss merged commit 1eb9b30 into PixarAnimationStudios:dev Sep 19, 2023
34 of 36 checks passed
@nvmkuruc nvmkuruc deleted the pcploopwarning branch December 29, 2023 03:14
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