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(traffic_light_occlusion_predictor): fix cppcheck warnings of functionStatic #8258

Conversation

taisa1
Copy link
Contributor

@taisa1 taisa1 commented Jul 30, 2024

Description

This is a fix based on cppcheck warning functionStatic.

perception/autoware_traffic_light_occlusion_predictor/src/occlusion_predictor.hpp:78:8: performance: inconclusive: Technically the member function 'autoware::traffic_light::CloudOcclusionPredictor::sampleTrafficLightRoi' can be static (but you may consider moving to unnamed namespace). [functionStatic]
perception/autoware_traffic_light_occlusion_predictor/src/occlusion_predictor.hpp:83:8: performance: inconclusive: Technically the member function 'autoware::traffic_light::CloudOcclusionPredictor::calcRoiVector3D' can be static (but you may consider moving to unnamed namespace). [functionStatic]

Related links

How was this PR tested?

Only checked if build succeeded.

Notes for reviewers

None.

Interface changes

None.

Effects on system behavior

None.

@github-actions github-actions bot added the component:perception Advanced sensor data processing and environment understanding. (auto-assigned) label Jul 30, 2024
Copy link

github-actions bot commented Jul 30, 2024

Thank you for contributing to the Autoware project!

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

Please ensure:

@atsushi421 atsushi421 added the tag:run-build-and-test-differential Mark to enable build-and-test-differential workflow. (used-by-ci) label Jul 30, 2024
Copy link

codecov bot commented Jul 30, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 29.28%. Comparing base (2705a63) to head (fb7047b).
Report is 11 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #8258      +/-   ##
==========================================
- Coverage   29.29%   29.28%   -0.02%     
==========================================
  Files        1609     1609              
  Lines      119415   119420       +5     
  Branches    51481    51487       +6     
==========================================
- Hits        34988    34969      -19     
- Misses      75118    75168      +50     
+ Partials     9309     9283      -26     
Flag Coverage Δ *Carryforward flag
differential 0.00% <ø> (?)
total 29.28% <ø> (-0.02%) ⬇️ Carriedforward from 2705a63

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

@taisa1 taisa1 marked this pull request as ready for review July 30, 2024 10:15
Copy link
Contributor

@miursh miursh left a comment

Choose a reason for hiding this comment

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

@taisa1
For my understanding, could you please explain what is the advantages of adding static to the functions?

@taisa1
Copy link
Contributor Author

taisa1 commented Aug 6, 2024

@miursh
Adding static keyword makes it clear that the function does not modify the state of the class object.
In terms of performance, I think there is a slight improvement (by reducing overhead) or no difference.

@miursh
Copy link
Contributor

miursh commented Aug 6, 2024

@taisa1
Thanks!
If a function does not modify the class object, I thought using the const modifier would be appropriate.
However, does using static imply that the function neither modifies nor even accesses the class object at all?

@taisa1
Copy link
Contributor Author

taisa1 commented Aug 6, 2024

@miursh
Yes, static functions are not bound to any objects, so the static keyword ensures they do not access non-static members (sorry for the insufficient explanation)

Copy link
Contributor

@miursh miursh left a comment

Choose a reason for hiding this comment

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

Thank you for your explanation.
LGTM

@veqcc veqcc merged commit 2c4e953 into autowarefoundation:main Aug 13, 2024
29 of 30 checks passed
kyoichi-sugahara pushed a commit to kyoichi-sugahara/autoware.universe that referenced this pull request Aug 13, 2024
…tionStatic (autowarefoundation#8258)

fix: deal with functionStatic warnings

Signed-off-by: taisa1 <[email protected]>
esteve pushed a commit to esteve/autoware.universe that referenced this pull request Aug 13, 2024
…tionStatic (autowarefoundation#8258)

fix: deal with functionStatic warnings

Signed-off-by: taisa1 <[email protected]>
xtk8532704 pushed a commit to tier4/autoware.universe that referenced this pull request Aug 15, 2024
…tionStatic (autowarefoundation#8258)

fix: deal with functionStatic warnings

Signed-off-by: taisa1 <[email protected]>
Signed-off-by: xtk8532704 <[email protected]>
mbharatheesha pushed a commit to nobleo/autoware.universe that referenced this pull request Aug 16, 2024
…tionStatic (autowarefoundation#8258)

fix: deal with functionStatic warnings

Signed-off-by: taisa1 <[email protected]>
Signed-off-by: Mukunda Bharatheesha <[email protected]>
mbharatheesha pushed a commit to nobleo/autoware.universe that referenced this pull request Aug 16, 2024
…tionStatic (autowarefoundation#8258)

fix: deal with functionStatic warnings

Signed-off-by: taisa1 <[email protected]>
@taisa1 taisa1 deleted the fix_function_static_traffic_light_occlusion_predictor branch August 27, 2024 05:26
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
component:perception Advanced sensor data processing and environment understanding. (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.

4 participants