Rename all shadowed types and variables and enable Wshadow when in pedantic mode - #1965
Conversation
d1f3483 to
609c5fb
Compare
vitaut
left a comment
There was a problem hiding this comment.
Thanks for the PR. Mostly looks good but please fix CI build failures and address inline comments.
| ostream_params(T... params, int oflag) : ostream_params(params...) { | ||
| this->oflag = oflag; | ||
| ostream_params(T... params, int new_oflag) : ostream_params(params...) { | ||
| this->oflag = new_oflag; |
| template <typename ParseContext> | ||
| auto parse(ParseContext& ctx) -> decltype(ctx.begin()) { | ||
| return ctx.begin(); | ||
| auto parse(ParseContext& parse_ctx) -> decltype(parse_ctx.begin()) { |
There was a problem hiding this comment.
Let's keep argument names as is but rename the data member to parse_ctx since it has wider scope.
There was a problem hiding this comment.
Done - I'm glad you looked at that one, I had a feeling that the situation might be something like this but I didn't want to be too aggressive so I tried my best to keep the scope very local.
| } | ||
|
|
||
| typedef allocator_ref<std::allocator<char>> TestAllocator; | ||
| typedef allocator_ref<std::allocator<char>> StdAllocator; |
There was a problem hiding this comment.
Let's follow the naming conventions while at it:
using std_allocator = allocator_ref<std::allocator<char>>;187b3b0 to
9cc2342
Compare
|
A few more build failures: https://travis-ci.org/github/fmtlib/fmt/jobs/740386845 |
9cc2342 to
87b4d2a
Compare
|
I can't get this last set of errors to reproduce locally for reasons that are not clear to me, so there might be a bit of churn with using CI to find the errors. |
51fbcd4 to
40dab6e
Compare
|
Just in case anyone else encounters the issue of not being able to reproduce errors locally - the C++ standard seems to matter to at least GCC for whether or not |
| auto s = fmt::detail::bit_cast<uint32_pair>(uint64_t{42}); | ||
| EXPECT_EQ(fmt::detail::bit_cast<uint64_t>(s), 42ull); | ||
| s = fmt::detail::bit_cast<uint32_pair>(uint64_t(~0ull)); | ||
| s = fmt::detail::bit_cast<uint32_pair>(~0ull); |
There was a problem hiding this comment.
This looks unrelated and technically not correct.
There was a problem hiding this comment.
Whoops, sorry about that - fixed.
|
|
||
| // Parses a width argument id in the format { <digit> }. | ||
| constexpr auto parse(format_parse_context& ctx) { | ||
| auto parse(format_parse_context& ctx) { |
There was a problem hiding this comment.
Whoops, sorry about that - fixed
Problem: - All `-Wshadow` warnings are fixed but there is nothing stopping them from being reintroduced. Solution: - Fail pedantic builds on `-Wshadow` warnings. This allows CI to prevent reoccurrence of the warning. Notes: - Not enabling `-Wshadow` for gcc versions 4 or lower because the warning is much more aggressive there to the point that it's mostly just noise.
40dab6e to
82f6af4
Compare
|
@jgopel thank you for doing this. It was annoying my team for some time now :) |
|
Merged, thanks! |
I agree that my contributions are licensed under the {fmt} license, and agree to future changes to the licensing.