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

Compiler Warnings: Unused Private Fields #3337

Open
dgovil opened this issue Oct 2, 2024 · 1 comment
Open

Compiler Warnings: Unused Private Fields #3337

dgovil opened this issue Oct 2, 2024 · 1 comment
Labels
good first issue Indicates a good issue for first-time contributors

Comments

@dgovil
Copy link
Collaborator

dgovil commented Oct 2, 2024

Description of Issue

There are several private fields that the compiler believes are not used. I am not sure if this is always true, so maybe they need to just be marked as [[maybe_unused]] but I think its a good task for someone to get used to building OpenUSD and contributing to the repository.

I am building with Clang 16 from Xcode 16 with python3 ./build_scripts/build_usd.py ~/Downloads/usd --build-variant debug --no-imaging -vvv but this should reproduce with other compilers. The warnings are reproduced below:


[2462/4632] Building CXX object pxr/imaging/hgiGL/CMakeFiles/hgiGL.dir/scopedStateHolder.cpp.o
In file included from /Users/dhruvgovil/Projects/usd/pxr/imaging/hgiGL/scopedStateHolder.cpp:9:
/Users/dhruvgovil/Projects/usd/pxr/imaging/hgiGL/scopedStateHolder.h:61:13: warning: private field '_restoreStencilPass' is not used [-Wunused-private-field]
   61 |     int32_t _restoreStencilPass[2];
      |             ^
1 warning generated.
In file included from /Users/dhruvgovil/Projects/usd/pxr/imaging/hgiGL/scopedStateHolder.cpp:9:
/Users/dhruvgovil/Projects/usd/pxr/imaging/hgiGL/scopedStateHolder.h:61:13: warning: private field '_restoreStencilPass' is not used [-Wunused-private-field]
   61 |     int32_t _restoreStencilPass[2];
      |             ^
1 warning generated.

[3031/4632] Building CXX object pxr/usdImaging/usdImaging/CMakeFiles/usdImaging.dir/dataSourceRelationship.cpp.o
In file included from /Users/dhruvgovil/Projects/usd/pxr/usdImaging/usdImaging/dataSourceRelationship.cpp:7:
/Users/dhruvgovil/Projects/usd/pxr/usdImaging/usdImaging/dataSourceRelationship.h:58:46: warning: private field '_stageGlobals' is not used [-Wunused-private-field]
   58 |     const UsdImagingDataSourceStageGlobals & _stageGlobals;
      |                                              ^
1 warning generated.
In file included from /Users/dhruvgovil/Projects/usd/pxr/usdImaging/usdImaging/dataSourceRelationship.cpp:7:
/Users/dhruvgovil/Projects/usd/pxr/usdImaging/usdImaging/dataSourceRelationship.h:58:46: warning: private field '_stageGlobals' is not used [-Wunused-private-field]
   58 |     const UsdImagingDataSourceStageGlobals & _stageGlobals;
      |                                              ^
1 warning generated.
[3040/4632] Building CXX object pxr/usdImaging/usdImaging/CMakeFiles/usdImaging.dir/dataSourceRenderPrims.cpp.o
/Users/dhruvgovil/Projects/usd/pxr/usdImaging/usdImaging/dataSourceRenderPrims.cpp:135:46: warning: private field '_stageGlobals' is not used [-Wunused-private-field]
  135 |     const UsdImagingDataSourceStageGlobals & _stageGlobals;
      |                                              ^
1 warning generated.
/Users/dhruvgovil/Projects/usd/pxr/usdImaging/usdImaging/dataSourceRenderPrims.cpp:135:46: warning: private field '_stageGlobals' is not used [-Wunused-private-field]
  135 |     const UsdImagingDataSourceStageGlobals & _stageGlobals;
      |                                              ^
1 warning generated.
[3047/4632] Building CXX object pxr/usdImaging/usdImaging/CMakeFiles/usdImaging.dir/dataSourceMaterial.cpp.o
/Users/dhruvgovil/Projects/usd/pxr/usdImaging/usdImaging/dataSourceMaterial.cpp:292:45: warning: private field '_stageGlobals' is not used [-Wunused-private-field]
  292 |     const UsdImagingDataSourceStageGlobals &_stageGlobals;
      |                                             ^
1 warning generated.
/Users/dhruvgovil/Projects/usd/pxr/usdImaging/usdImaging/dataSourceMaterial.cpp:292:45: warning: private field '_stageGlobals' is not used [-Wunused-private-field]
  292 |     const UsdImagingDataSourceStageGlobals &_stageGlobals;
      |                                             ^
1 warning generated.
[3049/4632] Building CXX object pxr/usdImaging/usdImaging/CMakeFiles/usdImaging.dir/dataSourceVolume.cpp.o
In file included from /Users/dhruvgovil/Projects/usd/pxr/usdImaging/usdImaging/dataSourceVolume.cpp:7:
/Users/dhruvgovil/Projects/usd/pxr/usdImaging/usdImaging/dataSourceVolume.h:41:45: warning: private field '_stageGlobals' is not used [-Wunused-private-field]
   41 |     const UsdImagingDataSourceStageGlobals &_stageGlobals;
      |                                             ^
1 warning generated.
In file included from /Users/dhruvgovil/Projects/usd/pxr/usdImaging/usdImaging/dataSourceVolume.cpp:7:
/Users/dhruvgovil/Projects/usd/pxr/usdImaging/usdImaging/dataSourceVolume.h:41:45: warning: private field '_stageGlobals' is not used [-Wunused-private-field]
   41 |     const UsdImagingDataSourceStageGlobals &_stageGlobals;
      |                                             ^
1 warning generated.
[3052/4632] Building CXX object pxr/usdImaging/usdImaging/CMakeFiles/usdImaging.dir/dataSourcePrim.cpp.o
In file included from /Users/dhruvgovil/Projects/usd/pxr/usdImaging/usdImaging/dataSourcePrim.cpp:7:
/Users/dhruvgovil/Projects/usd/pxr/usdImaging/usdImaging/dataSourcePrim.h:97:45: warning: private field '_stageGlobals' is not used [-Wunused-private-field]
   97 |     const UsdImagingDataSourceStageGlobals &_stageGlobals;
      |                                             ^
/Users/dhruvgovil/Projects/usd/pxr/usdImaging/usdImaging/dataSourcePrim.h:275:45: warning: private field '_stageGlobals' is not used [-Wunused-private-field]
  275 |     const UsdImagingDataSourceStageGlobals &_stageGlobals;
      |                                             ^
2 warnings generated.
In file included from /Users/dhruvgovil/Projects/usd/pxr/usdImaging/usdImaging/dataSourcePrim.cpp:7:
/Users/dhruvgovil/Projects/usd/pxr/usdImaging/usdImaging/dataSourcePrim.h:97:45: warning: private field '_stageGlobals' is not used [-Wunused-private-field]
   97 |     const UsdImagingDataSourceStageGlobals &_stageGlobals;
      |                                             ^
/Users/dhruvgovil/Projects/usd/pxr/usdImaging/usdImaging/dataSourcePrim.h:275:45: warning: private field '_stageGlobals' is not used [-Wunused-private-field]
  275 |     const UsdImagingDataSourceStageGlobals &_stageGlobals;
      |                                             ^
2 warnings generated.
@dgovil dgovil added the good first issue Indicates a good issue for first-time contributors label Oct 2, 2024
@jesschimein
Copy link

Filed as internal issue #USD-10234

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
good first issue Indicates a good issue for first-time contributors
Projects
None yet
Development

No branches or pull requests

2 participants