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

fix(autoware_mpc_lateral_controller): fix bugprone-misplaced-widening-cast #9224

Merged
merged 2 commits into from
Nov 12, 2024

Conversation

kobayu858
Copy link
Contributor

Description

This is a fix based on clang-tidy bugprone-misplaced-widening-cast error.

/home/emb4/autoware/autoware/src/universe/autoware.universe/control/autoware_mpc_lateral_controller/src/lowpass_filter.cpp:128:16: error: either cast from 'int' to 'size_t' (aka 'unsigned long') is ineffective, or there is loss of precision before the conversion [bugprone-misplaced-widening-cast,-warnings-as-errors]
      tmp += u[static_cast<size_t>(i + j)];
               ^

Related links

Parent Issue:

  • Link

How was this PR tested?

Notes for reviewers

None.

Interface changes

None.

Effects on system behavior

None.

@kobayu858
Copy link
Contributor Author

Other errors also exist, but they are not corrected at this time because of their low severity.

@github-actions github-actions bot added the component:control Vehicle control algorithms and mechanisms. (auto-assigned) label Nov 1, 2024
Copy link

github-actions bot commented Nov 1, 2024

Thank you for contributing to the Autoware project!

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

Please ensure:

@kobayu858 kobayu858 added the tag:run-build-and-test-differential Mark to enable build-and-test-differential workflow. (used-by-ci) label Nov 1, 2024
@kobayu858 kobayu858 requested a review from veqcc November 1, 2024 08:45
@veqcc
Copy link
Contributor

veqcc commented Nov 1, 2024

@kobayu858
Your change seems to be incorrect. Please check again.

Copy link

codecov bot commented Nov 1, 2024

Codecov Report

Attention: Patch coverage is 75.00000% with 1 line in your changes missing coverage. Please review.

Project coverage is 28.92%. Comparing base (458f3d9) to head (53c0525).
Report is 66 commits behind head on main.

Files with missing lines Patch % Lines
...ware_mpc_lateral_controller/src/lowpass_filter.cpp 75.00% 0 Missing and 1 partial ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main    #9224      +/-   ##
==========================================
- Coverage   28.92%   28.92%   -0.01%     
==========================================
  Files        1324     1324              
  Lines      102572   102584      +12     
  Branches    39795    39796       +1     
==========================================
  Hits        29673    29673              
- Misses      70027    70037      +10     
- Partials     2872     2874       +2     
Flag Coverage Δ *Carryforward flag
differential 33.43% <75.00%> (?)
total 28.92% <ø> (-0.01%) ⬇️ Carriedforward from 1d1b72b

*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.

@kobayu858 kobayu858 marked this pull request as draft November 1, 2024 08:58
@kobayu858
Copy link
Contributor Author

@veqcc
I forgot that it is a negative value. Thank you for pointing that out.

@kobayu858 kobayu858 marked this pull request as ready for review November 1, 2024 09:59
@kobayu858
Copy link
Contributor Author

The index is now calculated first to make sure it does not exceed the range before casting.

@kobayu858
Copy link
Contributor Author

@TakaHoribe @takayuki5168
Please confirm the PR. Thank you very much.

@kobayu858 kobayu858 merged commit a2280ec into autowarefoundation:main Nov 12, 2024
32 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
component:control Vehicle control algorithms and mechanisms. (auto-assigned) tag: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.

3 participants