Skip to content

Resolve unused variable warning#1558

Merged
EduPonz merged 2 commits intoeProsima:2.0.xfrom
brawner:brawner/unused-variable-warning
Nov 7, 2020
Merged

Resolve unused variable warning#1558
EduPonz merged 2 commits intoeProsima:2.0.xfrom
brawner:brawner/unused-variable-warning

Conversation

@brawner
Copy link
Copy Markdown
Contributor

@brawner brawner commented Nov 6, 2020

#1555 introduced this unused variable. It doesn' look like the code needs to refer to the pair itself, so I thought it best to just remove the iterator variable.

Signed-off-by: Stephen Brawner brawner@gmail.com

Signed-off-by: Stephen Brawner <brawner@gmail.com>

// Add Participant
auto wit = writers_.insert(std::make_pair(guid_aux, dei));
writers_.insert(std::make_pair(guid_aux, dei));
Copy link
Copy Markdown

@EduPonz EduPonz Nov 6, 2020

Choose a reason for hiding this comment

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

That's a tricky one, as the variable is indeed used in line 2346, which is a logInfo message that is not compiled unless INTERNAL_DEBUG is set or CMAKE_BUILD_TYPE is set to Debug. Our CI builds with INTERNAL_DEBUG to verify that all logInfo are correct, and thus we don't get the warning. The best is probably to remove the iterator (as you did), as well as the part of the log that uses it.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

What do you think about just putting in a static_cast<void>, like my most recent commit? It suppresses the warning, but still works for the log?

@EduPonz EduPonz added the skip-ci Automatically pass CI label Nov 6, 2020
Signed-off-by: Stephen Brawner <brawner@gmail.com>
@EduPonz EduPonz merged commit 969bdfa into eProsima:2.0.x Nov 7, 2020
@EduPonz
Copy link
Copy Markdown

EduPonz commented Nov 7, 2020

I've added this to #1533 . Thanks @brawner for the catch!

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

Labels

skip-ci Automatically pass CI

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants