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: Static Functions that should be Static Inline #3324

Open
dgovil opened this issue Sep 28, 2024 · 1 comment
Open

Compiler Warnings: Static Functions that should be Static Inline #3324

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

Comments

@dgovil
Copy link
Collaborator

dgovil commented Sep 28, 2024

Description of Issue

There are several static functions that the compiler believes should be declared as static inline. These are reported from Apple Clang 16 bundled with Xcode 16, but should reproduce in other compilers with slight variations.

Most are found in pxr/base/vt/wrapArray.h with a few in usd/pxr/imaging/hdSt/unitTestHelper.h.
I think this would be a good first issue to get folks used to building USD and make contributions that will help provide cleaner outputs.

The warning is reproduced below:

[1065/4632] Building CXX object pxr/base/vt/CMakeFiles/vt.dir/wrapArray.cpp.o
In file included from /Users/dhruvgovil/Projects/usd/pxr/base/vt/wrapArray.cpp:10:
/Users/dhruvgovil/Projects/usd/pxr/base/vt/wrapArray.h:307:1: warning: 'static' function 'Vt_ComputeEffectiveRankAndLastDimSize' declared in header file should be declared 'static inline' [-Wunneeded-internal-declaration]
  307 | Vt_ComputeEffectiveRankAndLastDimSize(
      | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
1 warning generated.
In file included from /Users/dhruvgovil/Projects/usd/pxr/base/vt/wrapArray.cpp:10:
/Users/dhruvgovil/Projects/usd/pxr/base/vt/wrapArray.h:307:1: warning: 'static' function 'Vt_ComputeEffectiveRankAndLastDimSize' declared in header file should be declared 'static inline' [-Wunneeded-internal-declaration]
  307 | Vt_ComputeEffectiveRankAndLastDimSize(
      | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
1 warning generated.

[1337/4632] Building CXX object pxr/base/vt/CMakeFiles/vt.dir/arrayPyBuffer.cpp.o
In file included from /Users/dhruvgovil/Projects/usd/pxr/base/vt/arrayPyBuffer.cpp:15:
/Users/dhruvgovil/Projects/usd/pxr/base/vt/wrapArray.h:307:1: warning: 'static' function 'Vt_ComputeEffectiveRankAndLastDimSize' declared in header file should be declared 'static inline' [-Wunneeded-internal-declaration]
  307 | Vt_ComputeEffectiveRankAndLastDimSize(
      | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

In file included from /Users/dhruvgovil/Projects/usd/pxr/base/vt/arrayPyBuffer.cpp:15:
/Users/dhruvgovil/Projects/usd/pxr/base/vt/wrapArray.h:307:1: warning: 'static' function 'Vt_ComputeEffectiveRankAndLastDimSize' declared in header file should be declared 'static inline' [-Wunneeded-internal-declaration]
  307 | Vt_ComputeEffectiveRankAndLastDimSize(
      | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

[3719/4632] Building CXX object pxr/base/vt/CMakeFiles/_vt.dir/wrapArrayBase.cpp.o
In file included from /Users/dhruvgovil/Projects/usd/pxr/base/vt/wrapArrayBase.cpp:9:
/Users/dhruvgovil/Projects/usd/pxr/base/vt/wrapArray.h:307:1: warning: 'static' function 'Vt_ComputeEffectiveRankAndLastDimSize' declared in header file should be declared 'static inline' [-Wunneeded-internal-declaration]
  307 | Vt_ComputeEffectiveRankAndLastDimSize(
      | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
1 warning generated.
In file included from /Users/dhruvgovil/Projects/usd/pxr/base/vt/wrapArrayBase.cpp:9:
/Users/dhruvgovil/Projects/usd/pxr/base/vt/wrapArray.h:307:1: warning: 'static' function 'Vt_ComputeEffectiveRankAndLastDimSize' declared in header file should be declared 'static inline' [-Wunneeded-internal-declaration]
  307 | Vt_ComputeEffectiveRankAndLastDimSize(
      | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
1 warning generated.
[3779/4632] Building CXX object pxr/base/vt/CMakeFiles/_vt.dir/wrapValue.cpp.o
In file included from /Users/dhruvgovil/Projects/usd/pxr/base/vt/wrapValue.cpp:15:
/Users/dhruvgovil/Projects/usd/pxr/base/vt/wrapArray.h:307:1: warning: 'static' function 'Vt_ComputeEffectiveRankAndLastDimSize' declared in header file should be declared 'static inline' [-Wunneeded-internal-declaration]
  307 | Vt_ComputeEffectiveRankAndLastDimSize(
      | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
1 warning generated.
In file included from /Users/dhruvgovil/Projects/usd/pxr/base/vt/wrapValue.cpp:15:
/Users/dhruvgovil/Projects/usd/pxr/base/vt/wrapArray.h:307:1: warning: 'static' function 'Vt_ComputeEffectiveRankAndLastDimSize' declared in header file should be declared 'static inline' [-Wunneeded-internal-declaration]
  307 | Vt_ComputeEffectiveRankAndLastDimSize(
      | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
1 warning generated.
[3783/4632] Building CXX object pxr/usd/sdf/CMakeFiles/_sdf.dir/wrapAssetPath.cpp.o
In file included from /Users/dhruvgovil/Projects/usd/pxr/usd/sdf/wrapAssetPath.cpp:13:
/Users/dhruvgovil/Projects/usd/pxr/base/vt/wrapArray.h:307:1: warning: 'static' function 'Vt_ComputeEffectiveRankAndLastDimSize' declared in header file should be declared 'static inline' [-Wunneeded-internal-declaration]
  307 | Vt_ComputeEffectiveRankAndLastDimSize(
      | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
1 warning generated.
In file included from /Users/dhruvgovil/Projects/usd/pxr/usd/sdf/wrapAssetPath.cpp:13:
/Users/dhruvgovil/Projects/usd/pxr/base/vt/wrapArray.h:307:1: warning: 'static' function 'Vt_ComputeEffectiveRankAndLastDimSize' declared in header file should be declared 'static inline' [-Wunneeded-internal-declaration]
  307 | Vt_ComputeEffectiveRankAndLastDimSize(
      | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
1 warning generated.
[3810/4632] Building CXX object pxr/usd/sdf/CMakeFiles/_sdf.dir/wrapTimeCode.cpp.o
In file included from /Users/dhruvgovil/Projects/usd/pxr/usd/sdf/wrapTimeCode.cpp:13:
/Users/dhruvgovil/Projects/usd/pxr/base/vt/wrapArray.h:307:1: warning: 'static' function 'Vt_ComputeEffectiveRankAndLastDimSize' declared in header file should be declared 'static inline' [-Wunneeded-internal-declaration]
  307 | Vt_ComputeEffectiveRankAndLastDimSize(
      | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
1 warning generated.
In file included from /Users/dhruvgovil/Projects/usd/pxr/usd/sdf/wrapTimeCode.cpp:13:
/Users/dhruvgovil/Projects/usd/pxr/base/vt/wrapArray.h:307:1: warning: 'static' function 'Vt_ComputeEffectiveRankAndLastDimSize' declared in header file should be declared 'static inline' [-Wunneeded-internal-declaration]
  307 | Vt_ComputeEffectiveRankAndLastDimSize(
      | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
1 warning generated.

[4292/4632] Building CXX object pxr/imaging/hdSt/CMakeFiles/testHdStQualifiers.dir/testenv/testHdStQualifiers.cpp.o
In file included from /Users/dhruvgovil/Projects/usd/pxr/imaging/hdSt/testenv/testHdStQualifiers.cpp:17:
/Users/dhruvgovil/Projects/usd/pxr/imaging/hdSt/unitTestHelper.h:215:1: warning: 'static' function '_ToHd' declared in header file should be declared 'static inline' [-Wunneeded-internal-declaration]
  215 | _ToHd(const GfCamera::Projection projection)
      | ^~~~~
1 warning generated.
In file included from /Users/dhruvgovil/Projects/usd/pxr/imaging/hdSt/testenv/testHdStQualifiers.cpp:17:
/Users/dhruvgovil/Projects/usd/pxr/imaging/hdSt/unitTestHelper.h:215:1: warning: 'static' function '_ToHd' declared in header file should be declared 'static inline' [-Wunneeded-internal-declaration]
  215 | _ToHd(const GfCamera::Projection projection)
      | ^~~~~
1 warning generated.
@dgovil dgovil added the good first issue Indicates a good issue for first-time contributors label Sep 28, 2024
@jesschimein
Copy link

Filed as internal issue #USD-10208

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