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: Implicit Type and Value conversions #3339

Open
dgovil opened this issue Oct 2, 2024 · 3 comments
Open

Compiler Warnings: Implicit Type and Value conversions #3339

dgovil opened this issue Oct 2, 2024 · 3 comments
Labels
good first issue Indicates a good issue for first-time contributors help wanted Indicates an issue where help and/or a pull request from the community would be very welcome

Comments

@dgovil
Copy link
Collaborator

dgovil commented Oct 2, 2024

Description of Issue

A few tests have issues with implicit type conversions. These seem benign but would be useful if someone could correct them and verify that they work as expected. It's a good first issue for someone new to USD to help contribute to USD and get used to the testing frameworks.

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:



[4166/4632] Building CXX object pxr/imaging/hd/CMakeFiles/testHdSortedIdsPerf.dir/testenv/testHdSortedIdsPerf.cpp.o
/Users/dhruvgovil/Projects/usd/pxr/imaging/hd/testenv/testHdSortedIdsPerf.cpp:48:32: warning: implicit conversion from 'const size_t' (aka 'const unsigned long') to 'result_type' (aka 'unsigned int') changes value from 5109223000 to 814255704 [-Wconstant-conversion]
   48 |         std::mt19937 randomGen(seed);
      |                      ~~~~~~~~~ ^~~~
/Users/dhruvgovil/Projects/usd/pxr/imaging/hd/testenv/testHdSortedIdsPerf.cpp:266:26: warning: implicit conversion from 'long' to 'result_type' (aka 'unsigned int') changes value from 5109223000 to 814255704 [-Wconstant-conversion]
  266 |         std::mt19937 gen(5109223000);
      |                      ~~~ ^~~~~~~~~~

4 warnings generated.
/Users/dhruvgovil/Projects/usd/pxr/imaging/hd/testenv/testHdSortedIdsPerf.cpp:48:32: warning: implicit conversion from 'const size_t' (aka 'const unsigned long') to 'result_type' (aka 'unsigned int') changes value from 5109223000 to 814255704 [-Wconstant-conversion]
   48 |         std::mt19937 randomGen(seed);
      |                      ~~~~~~~~~ ^~~~
/Users/dhruvgovil/Projects/usd/pxr/imaging/hd/testenv/testHdSortedIdsPerf.cpp:266:26: warning: implicit conversion from 'long' to 'result_type' (aka 'unsigned int') changes value from 5109223000 to 814255704 [-Wconstant-conversion]
  266 |         std::mt19937 gen(5109223000);
      |                      ~~~ ^~~~~~~~~~

@dgovil dgovil added the good first issue Indicates a good issue for first-time contributors label Oct 2, 2024
@jesschimein
Copy link
Collaborator

Filed as internal issue #USD-10236

@pixar-oss pixar-oss added the help wanted Indicates an issue where help and/or a pull request from the community would be very welcome label Oct 24, 2024
@brtmax
Copy link

brtmax commented Feb 1, 2025

Hi, is this issue still available? I'd like to try and work on it!

@dgovil
Copy link
Collaborator Author

dgovil commented Feb 1, 2025

That would be great. I don't believe anyone else has claimed it thus far. Thank you!

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 help wanted Indicates an issue where help and/or a pull request from the community would be very welcome
Projects
None yet
Development

No branches or pull requests

4 participants