Skip to content

raise warning level #71

Closed
Closed

Description

@dirk-thomas

I have create a raise_warning_level branch on various repositories to raise the warning level. For now it includes: -Wall -Wextra Please check the changes in those branches. I would like to avoid creating separate PRs for all of those.

The CI build is happy with the stricter settings: http://ci.ros2.org/job/ros2_batch_ci_linux/58/

Activity

  1. added
    enhancement
    in review
    on Jul 20, 2015
  2. self-assigned this
    on Jul 20, 2015
  3. wjwwood commented on Jul 21, 2015

    @wjwwood
    Member

    Ok, lgtm.

    I'm not sure I would have added -Wextra, since the most prominent changes throughout are about the unused parameters which are imo false positives since it is supposed to be detecting unintentionally unused parameters, but in all of these cases the parameters are intentionally unused because they're generated code or part of an interface. Since the compiler cannot know our intention I think it's a bad check to have. Also, avoiding this warning led you to make lots of extra conditional code in our generators to avoid that, making it harder to read and understand, of which I'm not really a fan. Did you consider just doing something like (void)unused_parameter; // Intentionally unused. in the function body instead? That all being said, you can go ahead with merging, it's not worth the effort to update all the branches at this point.

    Also you should really open pull requests, since its basically impossible to connect the comments I made on the commits to this issue. But failing that you should at least link to the comparisons rather then making each of us figure out which commits were different from master.

  4. dirk-thomas commented on Jul 21, 2015

    @dirk-thomas
    MemberAuthor

    I disagree with your opinion that the unused parameter check is not helpful. A very good example is actually in one of the patches (ros2/rmw_connext@81ffa77#diff-becdf01440f1757df19f4775b534e066R820) where I actually fixed a significant bug in the code which I only discovered because of the new warning.

    I will update the commits to keep the variable if it is part of an API which should be documented in the future. In those cases I will use the (void)var line as suggested. In cases where the variable name is not part of an API I will keep it with the name removed.

    I will create PRs for those branches. I just consider them to be a significant overhead in this case but I can stick to that in the future.

  5. wjwwood commented on Jul 21, 2015

    @wjwwood
    Member

    Ok, that's a good point, we can leave the -Wextra.

  6. wjwwood commented on Jul 21, 2015

    @wjwwood
    Member

    AFAICT, ros2/rmw_connext@81ffa77#diff-becdf01440f1757df19f4775b534e066R820 is not an unused parameter warning. Maybe I should more specifically say, -Wextra is probably fine, but maybe it should be accompanied by -Wno-unused-parameter or whatever the disabling flag is.

  7. dirk-thomas commented on Jul 21, 2015

    @dirk-thomas
    MemberAuthor

    The warning was in fact an unused variable since the variable allocated above was never used but instead a new allocation was done.

  8. dirk-thomas commented on Jul 21, 2015

    @dirk-thomas
    MemberAuthor

    Anyway I created the 10 PRs. @ all: Please review them.

  9. wjwwood commented on Jul 21, 2015

    @wjwwood
    Member

    So, there is no warning level distinction between an unused variable and an unused parameter? I'm pretty sure clang distinguishes between the two, but I'd have to double check.

    Whatever, -Wextra is fine.

  10. wjwwood commented on Jul 21, 2015

    @wjwwood
    Member

    +1 to all of them.

  11. removed
    in review
    on Jul 21, 2015
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

enhancement

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions