Skip to content

Use -Wpedantic - #189

Merged
mikaelarguedas merged 5 commits into
masterfrom
pedantic
Feb 28, 2017
Merged

mikaelarguedas merged 5 commits into
masterfrom
pedantic

Conversation

@mikaelarguedas

@mikaelarguedas mikaelarguedas commented Feb 10, 2017 •

Copy link
Copy Markdown
Member

for (auto received : received_messages) {
if (!received) {
for (auto received_msg : received_messages) {
if (!received_msg) {

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Was this a warning?

@mikaelarguedas mikaelarguedas Feb 28, 2017 •

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

Actually I think that was not a pedantic warning but a windows warning when I was trying less permissive flags. I think it's because it is shadowing the variable of the same name defined line 39

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Sounds good to me.

});

rcl_wait_set_t wait_set = rcl_get_zero_initialized_wait_set();
wait_set = rcl_get_zero_initialized_wait_set();

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Would it be better/possible to narrow the scope above to avoid the shadowing (I assume that was the issue here)?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

very good point. fixed in d444705

EXPECT_EQ(0, strcmp(rcl_subscription_get_topic_name(&subscription), topic_name));

rcl_wait_set_t wait_set = rcl_get_zero_initialized_wait_set();
rcl_wait_set_t wait_set_connection = rcl_get_zero_initialized_wait_set();

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Why adding _connection to this variable? How is the wait set related to a "connection"?

Instead the block could be wrapped in a local scope to avoid the colliding variable name.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

You're right it's better to just wrap it in a local scope, which is what @wjwwood suggested initially I think.

Fixed in ffce07c

@mikaelarguedas
mikaelarguedas merged commit 3005b6d into master Feb 28, 2017
@mikaelarguedas
mikaelarguedas deleted the pedantic branch February 28, 2017 05:12
@mikaelarguedas mikaelarguedas removed the in progress Actively being worked on (Kanban column) label Feb 28, 2017
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