fix(LibCarla): eliminate compiler warnings#9587
fix(LibCarla): eliminate compiler warnings#9587youtalk wants to merge 5 commits intocarla-simulator:ue5-devfrom
Conversation
- Fix deep copies in range-for loops (auto const → const auto&) - Remove pessimizing std::move() on return statements - Fix signed/unsigned implicit conversions with size_t/static_cast - Add static_cast for double-to-float narrowing - Replace C-style casts with static_cast/reinterpret_cast - Annotate unused parameters with /*name*/ comment syntax - Fix misleading indentation - Remove unused variables and lambda captures - Fix third-party headers (namespace pollution, bitfield sign, duplicate macros) Reference: ue4-dev commit d179041
|
Thanks for opening this pull request! The maintainers of this repository would appreciate it if you would update our CHANGELOG.md based on your changes. |
There was a problem hiding this comment.
Pull request overview
Eliminates compiler warnings across LibCarla (and some bundled third-party headers) to achieve cleaner builds, primarily by fixing signed/unsigned conversions, narrowing conversions, unnecessary moves/copies, and C-style casts.
Changes:
- Replaces C-style casts with
static_cast/reinterpret_cast, and addresses narrowing + signed/unsigned conversion warnings in core and test code. - Cleans up third-party headers (namespace pollution, duplicate macros, bitfield signedness) and adjusts indexing to use
size_twhere applicable. - Removes/annotates unused parameters, variables, and lambda parameters to silence warnings.
Reviewed changes
Copilot reviewed 21 out of 21 changed files in this pull request and generated 5 comments.
Show a summary per file
| File | Description |
|---|---|
| LibCarla/source/third-party/simplify/Simplify.h | Cleans up macros/casts/indexing and removes duplicated macro definition to reduce warnings. |
| LibCarla/source/third-party/marchingcube/Triangulation.h | Adds size_t casts for safe indexing into edgeVertIndices. |
| LibCarla/source/third-party/marchingcube/MeshReconstruction.h | Removes using namespace pollution and re-scopes definitions into MeshReconstruction. |
| LibCarla/source/third-party/marchingcube/Cube.h | Fixes bitfield signedness and loop index type to remove warnings. |
| LibCarla/source/test/server/test_benchmark_streaming.cpp | Replaces C-style cast with static_cast for std::max. |
| LibCarla/source/test/client/test_opendrive.cpp | Fixes double-to-float narrowing warning in timing code. |
| LibCarla/source/test/client/test_image.cpp | Fixes implicit int-to-float conversion in depth reconstruction. |
| LibCarla/source/carla/road/element/Geometry.cpp | Fixes integer-to-double division warning in delta_p computation. |
| LibCarla/source/carla/road/MeshFactory.cpp | Fixes signed/unsigned and narrowing conversions for mesh generation and UVs. |
| LibCarla/source/carla/road/MapBuilder.cpp | Fixes narrowing conversions and signed multiplication in transforms/positions. |
| LibCarla/source/carla/road/Map.cpp | Removes pessimizing moves, fixes indexing types, and silences unused parameter/variable warnings. |
| LibCarla/source/carla/road/Deformation.h | Fixes narrowing conversions and float/double literal mismatches. |
| LibCarla/source/carla/multigpu/secondary.cpp | Silences unused lambda param warnings and fixes size cast warnings. |
| LibCarla/source/carla/multigpu/router.cpp | Replaces C-style casts with reinterpret_cast for buffer header creation. |
| LibCarla/source/carla/multigpu/primaryCommands.cpp | Replaces C-style casts with reinterpret_cast/const_cast for buffer creation and removes unused response variables. |
| LibCarla/source/carla/multigpu/primary.cpp | Silences unused lambda param warnings and fixes size cast warnings. |
| LibCarla/source/carla/geom/Simplification.cpp | Fixes implicit float-to-int conversion for simplify_mesh argument. |
| LibCarla/source/carla/geom/Mesh.cpp | Fixes signed/unsigned warnings around vertex-link indexing calculations. |
| LibCarla/source/carla/client/detail/Simulator.cpp | Fixes signed/unsigned and underflow risk when iterating backwards over a string. |
| LibCarla/source/carla/Exception.h | Silences unused source_location parameter warning. |
| CHANGELOG.md | Documents the warning cleanup change at a high level. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
|
Thank you, @youtalk, for the code review. I will try to resolve these issues as soon as possible. |
|
@JesusAnaya @jorge-kabuto Since the purpose of these PRs ware to simply port from |
|
@youtalk I made some comments and suggestions. 👋 |
Co-authored-by: Jesus Armando Anaya <jesus@armandoanaya.com>
Co-authored-by: Jesus Armando Anaya <jesus@armandoanaya.com>
Co-authored-by: Jesus Armando Anaya <jesus@armandoanaya.com>
|
@JesusAnaya Thank you for your review. I've reflected all of them. Please do it again and approve if it's okay. |
Description
Eliminate compiler warnings across LibCarla to achieve clean builds.
Based on ue4-dev commit d179041, this PR fixes compiler warnings across 20 files including:
auto const→const auto&)static_cast/reinterpret_cast/*name*/)Files skipped (already fixed or N/A in ue5-dev):
FIleTransfer.cpp— Renamed toFileTransfer.cppand rewritten withstd::filesystemGeoReferenceParser.cpp— Completely different implementationGeometryParser.cpp,RoadParser.cpp— Already fixedALSM.cpp,LocalizationStage.cpp—large_vehiclesmember doesn't existtest_geom.cpp— Quaternion test doesn't existFixes #9583 (partial — PR #0d)
Where has this been tested?
Possible Drawbacks
Pure code quality improvements with no behavioral changes. Some third-party header fixes may need to be re-applied if those headers are regenerated.
This change is