Skip to content

fix(autoware_downsample_filters): fix bugprone-narrowing-conversions warnings#937

Open
NorahXiong wants to merge 2 commits intoautowarefoundation:mainfrom
NorahXiong:fix_bugprone-narrowing-conversions/autoware_downsample_filters
Open

fix(autoware_downsample_filters): fix bugprone-narrowing-conversions warnings#937
NorahXiong wants to merge 2 commits intoautowarefoundation:mainfrom
NorahXiong:fix_bugprone-narrowing-conversions/autoware_downsample_filters

Conversation

@NorahXiong
Copy link
Contributor

Description

Step 2 of #774 (comment): Remove the exception from the .clang-tidy-ci list.

Related links

Parent Issue:
#774

How was this PR tested?

No clang-tidy error appears in CI.

Notes for reviewers

None.

Interface changes

None.

Effects on system behavior

None.

…warnings

Signed-off-by: NorahXiong <norah.xiong@autocore.ai>
@github-actions
Copy link

github-actions bot commented Mar 13, 2026

Thank you for contributing to the Autoware project!

🚧 If your pull request is in progress, switch it to draft mode.

Please ensure:

@NorahXiong NorahXiong added the run:build-and-test-differential Mark to enable build-and-test-differential workflow. (used-by-ci) label Mar 13, 2026
@NorahXiong NorahXiong requested review from mitsudome-r and xmfcx March 13, 2026 05:26
@codecov
Copy link

codecov bot commented Mar 13, 2026

Codecov Report

❌ Patch coverage is 0% with 10 lines in your changes missing coverage. Please review.
✅ Project coverage is 50.41%. Comparing base (97f2715) to head (24740ac).

Files with missing lines Patch % Lines
...ple_filter/faster_voxel_grid_downsample_filter.cpp 0.00% 7 Missing ⚠️
...ample_filter/voxel_grid_downsample_filter_node.cpp 0.00% 3 Missing ⚠️
Additional details and impacted files
@@           Coverage Diff           @@
##             main     #937   +/-   ##
=======================================
  Coverage   50.41%   50.41%           
=======================================
  Files         367      367           
  Lines       22987    22987           
  Branches    10200    10200           
=======================================
  Hits        11588    11588           
  Misses      10281    10281           
  Partials     1118     1118           
Flag Coverage Δ *Carryforward flag
daily-humble 50.69% <ø> (+0.02%) ⬆️ Carriedforward from 97f2715
daily-jazzy 50.18% <ø> (+0.02%) ⬆️ Carriedforward from 97f2715
differential-humble 0.00% <0.00%> (?)
differential-jazzy 0.00% <0.00%> (?)
total 50.44% <ø> (+0.02%) ⬆️ Carriedforward from 97f2715
total-humble 50.69% <ø> (+0.02%) ⬆️ Carriedforward from 97f2715
total-jazzy 50.18% <ø> (+0.02%) ⬆️ Carriedforward from 97f2715

*This pull request uses carry forward flags. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

Copy link
Contributor

@sasakisasaki sasakisasaki left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@NorahXiong Thank you for your contribution. I have a quick question.

Comment on lines +38 to +40
voxel_size_x_(static_cast<float>(declare_parameter<double>("voxel_size_x"))),
voxel_size_y_(static_cast<float>(declare_parameter<double>("voxel_size_y"))),
voxel_size_z_(static_cast<float>(declare_parameter<double>("voxel_size_z"))),
Copy link
Contributor

@sasakisasaki sasakisasaki Mar 17, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If we do not apply this fix, does the clang-tidy show error?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes. All fixes are due to clang-tidy check errors.

clang-tidy-18 -export-fixes /tmp/tmpkxq6xsd4/tmpur9c7ali.yaml -extra-arg-before=-Wno-unknown-warning-option -p=build/ --config-file=src/core/autoware_core/.clang-tidy-ci /autoware/src/core/autoware_core/sensing/autoware_downsample_filters/src/voxel_grid_downsample_filter/faster_voxel_grid_downsample_filter.cpp
/autoware/src/core/autoware_core/sensing/autoware_downsample_filters/src/voxel_grid_downsample_filter/faster_voxel_grid_downsample_filter.cpp:43:15: error: narrowing conversion from 'offset_type' (aka 'unsigned int') to signed type 'int' is implementation-defined [bugprone-narrowing-conversions,-warnings-as-errors]
43 | x_offset
= input->fields[pcl::getFieldIndex(*input, "x")].offset;
| ^
/autoware/src/core/autoware_core/sensing/autoware_downsample_filters/src/voxel_grid_downsample_filter/faster_voxel_grid_downsample_filter.cpp:44:15: error: narrowing conversion from 'offset_type' (aka 'unsigned int') to signed type 'int' is implementation-defined [bugprone-narrowing-conversions,-warnings-as-errors]
44 | y_offset
= input->fields[pcl::getFieldIndex(*input, "y")].offset;
| ^
/autoware/src/core/autoware_core/sensing/autoware_downsample_filters/src/voxel_grid_downsample_filter/faster_voxel_grid_downsample_filter.cpp:45:15: error: narrowing conversion from 'offset_type' (aka 'unsigned int') to signed type 'int' is implementation-defined [bugprone-narrowing-conversions,-warnings-as-errors]
45 | z_offset
= input->fields[pcl::getFieldIndex(*input, "z")].offset;
| ^
/autoware/src/core/autoware_core/sensing/autoware_downsample_filters/src/voxel_grid_downsample_filter/faster_voxel_grid_downsample_filter.cpp:58:25: error: narrowing conversion from 'offset_type' (aka 'unsigned int') to signed type 'int' is implementation-defined [bugprone-narrowing-conversions,-warnings-as-errors]
58 | intensity_offset
= input->fields[intensity_index_].offset;
| ^
/autoware/src/core/autoware_core/sensing/autoware_downsample_filters/src/voxel_grid_downsample_filter/faster_voxel_grid_downsample_filter.cpp:170:83: error: narrowing conversion from 'int' to 'float' [bugprone-narrowing-conversions,-warnings-as-errors]
170 | int ijk0 = static_cast(std::floor(point[0] * inverse_voxel_size_[0]) - min_voxel[0]);
| ^
/autoware/src/core/autoware_core/sensing/autoware_downsample_filters/src/voxel_grid_downsample_filter/faster_voxel_grid_downsample_filter.cpp:171:83: error: narrowing conversion from 'int' to 'float' [bugprone-narrowing-conversions,-warnings-as-errors]
171 | int ijk1 = static_cast(std::floor(point[1] * inverse_voxel_size_[1]) - min_voxel[1]);
| ^
/autoware/src/core/autoware_core/sensing/autoware_downsample_filters/src/voxel_grid_downsample_filter/faster_voxel_grid_downsample_filter.cpp:172:83: error: narrowing conversion from 'int' to 'float' [bugprone-narrowing-conversions,-warnings-as-errors]
172 | int ijk2 = static_cast(std::floor(point[2] * inverse_voxel_size_[2]) - min_voxel[2]);
| ^
7 warnings treated as errors

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

run:build-and-test-differential Mark to enable build-and-test-differential workflow. (used-by-ci)

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants