Skip to content

Fix warnings reported by clang - #32

Merged
swatanabe merged 1 commit into
boostorg:developfrom
jeking3:fix-warn
Jan 3, 2018
Merged

Fix warnings reported by clang#32
swatanabe merged 1 commit into
boostorg:developfrom
jeking3:fix-warn

Conversation

@jeking3

@jeking3jeking3 commented Nov 3, 2017

Copy link
Copy Markdown
Contributor

In building Boost.Uuid I was getting the following warnings with clang:

clang-linux.compile.c++.without-pth ../../bin.v2/libs/uuid/test/test_random_generator.test/clang-gnu-linux-5.0.0/debug/threadapi-pthread/test_random_generator.o
In file included from test/test_random_generator.cpp:16:
In file included from ../../boost/random.hpp:60:
../../boost/random/binomial_distribution.hpp:407:9: error: anonymous types declared in an anonymous union are an extension [-Werror,-Wnested-anon-types]
struct {
^
In file included from test/test_random_generator.cpp:16:
In file included from ../../boost/random.hpp:63:
../../boost/random/discrete_distribution.hpp:95:60: error: unused parameter 'average' [-Werror,-Wunused-parameter]
static WeightType normalize(WeightType val, WeightType average)
^
../../boost/random/discrete_distribution.hpp:186:66: error: unused parameter 'weights' [-Werror,-Wunused-parameter]
static WeightType try_get_sum(const std::vector<WeightType>& weights)
^
In file included from test/test_random_generator.cpp:16:
In file included from ../../boost/random.hpp:72:
In file included from ../../boost/random/negative_binomial_distribution.hpp:21:
../../boost/random/poisson_distribution.hpp:338:9: error: anonymous types declared in an anonymous union are an extension [-Werror,-Wnested-anon-types]
struct {
^

This fixes#25

@swatanabe

swatanabe commented Nov 3, 2017 via email

Copy link
Copy Markdown
Collaborator

@jeking3

Copy link
Copy Markdown
ContributorAuthor

Okay, I started doing that, but I was touching many lines of code and I was concerned that the review comment would be to disable the warning instead, but I can do the other. I can comment out the variable name instead of removing it. I'll look at the third issue again.

@swatanabe

swatanabe commented Nov 3, 2017 via email

Copy link
Copy Markdown
Collaborator

@jeking3

Copy link
Copy Markdown
ContributorAuthor

Do you think the logic in try_get_sum is correct? It takes a vector of WeightType and returns 1 instead of summing them.

@swatanabe

swatanabe commented Nov 9, 2017 via email

Copy link
Copy Markdown
Collaborator

@jeking3jeking3 changed the title Fix or hide warnings reported by clangFix warnings reported by clangNov 9, 2017
@jeking3

Copy link
Copy Markdown
ContributorAuthor

This builds locally; I didn't run it through CI. Should really get the CI PR merged and then enable CI builds for all future pull requests...

@swatanabe

swatanabe commented Nov 9, 2017 via email

Copy link
Copy Markdown
Collaborator

@jeking3

Copy link
Copy Markdown
ContributorAuthor

Yes, I see what you mean. If you want me to do it that way that's fine. I forgot to remove the suppressions because I did the work off the branch and then merged it in.

@jeking3

Copy link
Copy Markdown
ContributorAuthor

I found a couple more extremely (100+ lines each) verbose warnings for unused variables that needed to be silenced while building this branch today.

@swatanabe
swatanabe merged commit 9c82aad into boostorg:developJan 3, 2018
Sign up for freeto 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.

2 participants

@jeking3@swatanabe