PixarAnimationStudios / OpenUSD

Universal Scene Description
http://www.openusd.org
Other
6.03k stars 1.2k forks source link

Compiler Warnings: Unused Private Fields #3337

Open dgovil opened 1 day ago

dgovil commented 1 day ago

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.
jesschimein commented 14 hours ago

Filed as internal issue #USD-10234