If there are other structs in toposorted_structs before strct, they were written with the methods of strct instead of their own. This commit fixes that.
This commit also fixes the check against out.types.cxx that should prevent duplicate definitions. I didn't encounter any such issues, but I still think that it makes sense to fix it.
Both issues were introduced in commit 5439fa195bbece443d261d40bf08d77012d44e58.
Example
I encountered this issue with the following bridge module:
Note how both the NavSatStatus and NavSatFix structs are assigned the NavSatFix methods. This bug leads to a compile error in the generated .cc file:
bindings.cc:37786:29: error: out-of-line definition of 'const_sensor_msgs_NavSatStatus_STATUS_NO_FIX' does not match any declaration in 'sensor_msgs::NavSatStatus'
::std::int8_t NavSatStatus::const_sensor_msgs_NavSatStatus_STATUS_NO_FIX() const noexcept {
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
After applying this PR, the generated code is correct:
If there are other structs in
toposorted_structs
beforestrct
, they were written with the methods ofstrct
instead of their own. This commit fixes that.This commit also fixes the check against
out.types.cxx
that should prevent duplicate definitions. I didn't encounter any such issues, but I still think that it makes sense to fix it.Both issues were introduced in commit 5439fa195bbece443d261d40bf08d77012d44e58.
Example
I encountered this issue with the following bridge module:
The code generated by
cxx
was:Note how both the
NavSatStatus
andNavSatFix
structs are assigned theNavSatFix
methods. This bug leads to a compile error in the generated.cc
file:After applying this PR, the generated code is correct: