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

iox-#2011 Solve a warning when building in Release mode. #2298

Merged

Conversation

clalancette
Copy link
Contributor

@clalancette clalancette commented Jun 4, 2024

When building the iceoryx_hoofs package from the release_2.0 branch in Release mode (-DCMAKE_BUILD_TYPE=Release), with gcc 13, we get warnings like the following:

In file included from /home/ubuntu/rolling_ws/src/eclipse-iceoryx/iceoryx/iceoryx_posh/source/popo/subscriber_options.cpp:17:
In constructor ‘iox::popo::SubscriberOptions::SubscriberOptions(iox::popo::SubscriberOptions&&)’,
    inlined from ‘bool iox::cxx::variant<Types>::emplace_at_index(CTorArguments&& ...) [with long unsigned int TypeIndex = 0; CTorArguments = {iox::popo::SubscriberOptions}; Types = {iox::popo::SubscriberOptions, iox::cxx::Serialization::Error}]’ at /home/ubuntu/rolling_ws/install/iceoryx_hoofs/include/iceoryx/v2.0.6/iceoryx_hoofs/internal/cxx/variant.inl:174:5,
    inlined from ‘constexpr iox::cxx::variant<Types>::variant(const iox::cxx::in_place_index<N>&, CTorArguments&& ...) [with long unsigned int N = 0; CTorArguments = {iox::popo::SubscriberOptions}; Types = {iox::popo::SubscriberOptions, iox::cxx::Serialization::Error}]’ at /home/ubuntu/rolling_ws/install/iceoryx_hoofs/include/iceoryx/v2.0.6/iceoryx_hoofs/internal/cxx/variant.inl:42:24,
    inlined from ‘iox::cxx::expected<ValueType, ErrorType>::expected(iox::cxx::success<ValueType>&&) [with ValueType = iox::popo::SubscriberOptions; ErrorType = iox::cxx::Serialization::Error]’ at /home/ubuntu/rolling_ws/install/iceoryx_hoofs/include/iceoryx/v2.0.6/iceoryx_hoofs/internal/cxx/expected.inl:93:7,
    inlined from ‘static iox::cxx::expected<iox::popo::SubscriberOptions, iox::cxx::Serialization::Error> iox::popo::SubscriberOptions::deserialize(const iox::cxx::Serialization&)’ at /home/ubuntu/rolling_ws/src/eclipse-iceoryx/iceoryx/iceoryx_posh/source/popo/subscriber_options.cpp:56:61:
/home/ubuntu/rolling_ws/src/eclipse-iceoryx/iceoryx/iceoryx_posh/include/iceoryx_posh/popo/subscriber_options.hpp:32:8: warning: ‘queueFullPolicy’ may be used uninitialized [-Wmaybe-uninitialized]
   32 | struct SubscriberOptions
      |        ^~~~~~~~~~~~~~~~~
/home/ubuntu/rolling_ws/src/eclipse-iceoryx/iceoryx/iceoryx_posh/source/popo/subscriber_options.cpp: In static member function ‘static iox::cxx::expected<iox::popo::SubscriberOptions, iox::cxx::Serialization::Error> iox::popo::SubscriberOptions::deserialize(const iox::cxx::Serialization&)’:
/home/ubuntu/rolling_ws/src/eclipse-iceoryx/iceoryx/iceoryx_posh/source/popo/subscriber_options.cpp:40:23: note: ‘queueFullPolicy’ was declared here
   40 |     QueueFullPolicyUT queueFullPolicy;
      |       

This change avoids the warning by just always assigning a zero. However, this isn't really a serious attempt at a fix, but more of a way to start a discussion. I noticed that the main branch compiles without warnings, but does not have this zero in place. That said, I do not understand the mechanism that is being used there, so I'm having trouble tracking down the difference between the main branch and this one. Any thoughts on the "correct" way to fix this?

(skipping the rest of the checklist for now until we decide what to do here)

Notes for Reviewer

Pre-Review Checklist for the PR Author

  1. Code follows the coding style of CONTRIBUTING.md
  2. Tests follow the best practice for testing
  3. Changelog updated in the unreleased section including API breaking changes
  4. Branch follows the naming format (iox-123-this-is-a-branch)
  5. Commits messages are according to this guideline
  6. Update the PR title
    • Follow the same conventions as for commit messages
    • Link to the relevant issue
  7. Relevant issues are linked
  8. Add sensible notes for the reviewer
  9. All checks have passed (except task-list-completed)
  10. Assign PR to reviewer

Checklist for the PR Reviewer

  • Consider a second reviewer for complex new features or larger refactorings
  • Commits are properly organized and messages are according to the guideline
  • Code according to our coding style and naming conventions
  • Unit tests have been written for new behavior
  • Public API changes are documented via doxygen
  • Copyright owner are updated in the changed files
  • All touched (C/C++) source code files from iceoryx_hoofs have been added to ./clang-tidy-diff-scans.txt
  • PR title describes the changes

Post-review Checklist for the PR Author

  1. All open points are addressed and tracked via issues

References

Copy link

codecov bot commented Jun 4, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 78.47%. Comparing base (434ee45) to head (a4a1157).
Report is 3 commits behind head on release_2.0.

Additional details and impacted files

Impacted file tree graph

@@               Coverage Diff               @@
##           release_2.0    #2298      +/-   ##
===============================================
- Coverage        78.49%   78.47%   -0.03%     
===============================================
  Files              370      370              
  Lines            14217    14219       +2     
  Branches          2060     2060              
===============================================
- Hits             11160    11158       -2     
- Misses            2372     2377       +5     
+ Partials           685      684       -1     
Flag Coverage Δ
unittests 77.70% <100.00%> (-0.02%) ⬇️
unittests_timing 15.12% <0.00%> (-0.03%) ⬇️

Flags with carried forward coverage won't be shown. Click here to find out more.

Files Coverage Δ
iceoryx_posh/source/popo/publisher_options.cpp 100.00% <100.00%> (ø)
iceoryx_posh/source/popo/subscriber_options.cpp 93.75% <100.00%> (+0.41%) ⬆️

... and 3 files with indirect coverage changes

@elBoberido
Copy link
Member

Once again, thanks for fixing the warnings. Could you please add iox-#210 to the commit message ... and push ;)

Signed-off-by: Chris Lalancette <clalancette@gmail.com>
@clalancette
Copy link
Contributor Author

Once again, thanks for fixing the warnings. Could you please add iox-#210 to the commit message ... and push ;)

Sorry for the delay here. I've now done that.

@clalancette clalancette changed the title Solve a warning when building in Release mode. iox-#2011 Solve a warning when building in Release mode. Jun 11, 2024
@elfenpiff elfenpiff merged commit ebdf387 into eclipse-iceoryx:release_2.0 Jun 11, 2024
14 checks passed
@clalancette clalancette deleted the clalancette/solve-warning branch June 12, 2024 12:34
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants