This is a fairly straightforward style warning that Clang emits that should be a good first issue for someone wanting to get started with building and contributing to USD.
There are a few areas in USD that have an assignment within an if statement that clang recommends wrapping in parenthesis to avoid confusion between assignment or equality comparisons.
I am building with Clang 16 from Xcode 16 using python3 ./build_scripts/build_usd.py ~/Downloads/usd --build-variant debug --no-imaging -vvv but the warning is reproduced below
[1530/4632] Building CXX object pxr/usd/usd/CMakeFiles/usd.dir/primDefinition.cpp.o
/Users/dhruvgovil/Projects/usd/pxr/usd/usd/primDefinition.cpp:383:22: warning: using the result of an assignment as a condition without parentheses [-Wparentheses]
383 | if (destProp = _composedPropertyLayer->GetPropertyAtPath(
| ~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
384 | primPath.AppendProperty(propName))) {
| ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/Users/dhruvgovil/Projects/usd/pxr/usd/usd/primDefinition.cpp:383:22: note: place parentheses around the assignment to silence this warning
383 | if (destProp = _composedPropertyLayer->GetPropertyAtPath(
| ^
| (
384 | primPath.AppendProperty(propName))) {
|
| )
/Users/dhruvgovil/Projects/usd/pxr/usd/usd/primDefinition.cpp:383:22: note: use '==' to turn this assignment into an equality comparison
383 | if (destProp = _composedPropertyLayer->GetPropertyAtPath(
| ^
| ==
1 warning generated.
/Users/dhruvgovil/Projects/usd/pxr/usd/usd/primDefinition.cpp:383:22: warning: using the result of an assignment as a condition without parentheses [-Wparentheses]
383 | if (destProp = _composedPropertyLayer->GetPropertyAtPath(
| ~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
384 | primPath.AppendProperty(propName))) {
| ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/Users/dhruvgovil/Projects/usd/pxr/usd/usd/primDefinition.cpp:383:22: note: place parentheses around the assignment to silence this warning
383 | if (destProp = _composedPropertyLayer->GetPropertyAtPath(
| ^
| (
384 | primPath.AppendProperty(propName))) {
|
| )
/Users/dhruvgovil/Projects/usd/pxr/usd/usd/primDefinition.cpp:383:22: note: use '==' to turn this assignment into an equality comparison
383 | if (destProp = _composedPropertyLayer->GetPropertyAtPath(
| ^
| ==
1 warning generated.
Description of Issue
This is a fairly straightforward style warning that Clang emits that should be a good first issue for someone wanting to get started with building and contributing to USD.
There are a few areas in USD that have an assignment within an if statement that clang recommends wrapping in parenthesis to avoid confusion between assignment or equality comparisons.
I am building with Clang 16 from Xcode 16 using
python3 ./build_scripts/build_usd.py ~/Downloads/usd --build-variant debug --no-imaging -vvv
but the warning is reproduced below