-
-
Notifications
You must be signed in to change notification settings - Fork 340
silence shadowed variable warnings #593
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. Weβll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
please make a PR from dev into dev
| std::get<I>(lhs) = std::move(std::get<I>(rhs)); | ||
| internal::static_if<std::integral_constant<bool, N != I + 1>{}>([](auto &lhs, auto &rhs) { | ||
| move_tuple_impl<N, I + 1>(lhs, rhs); | ||
| internal::static_if<std::integral_constant<bool, N != I + 1>{}>([](auto &l, auto &r) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I thought that shadowing in lambdas does not exist cause outer lhs and rhs do not cross with inner lhs and rhs
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It is a warning in GCC with -Wshadow and in Clang with -Wshadow-all.
It is possible that these warnings are false positives, but they are warnings nonetheless.
It is also possible that a future contributor carelessly adds a & to the lambda capture and then ignores the warnings :)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I have made the requested changes. I'm also happy to report that all tests pass with the dev branch :)
I hope the fixes can be backported to a tagged release soon, I would like to use a tagged release if possible.
|
Please write changes in sources in |
|
I have run the amalgamation script, but it produced much more changes than I expected. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I've forgot to commit sqlite_orm.h. Please commit it too and then this PR can be merged
| return static_cast<char>(std::toupper(static_cast<int>(c))); | ||
| }); | ||
| static std::array<journal_mode, 6> all = { | ||
| static std::array<journal_mode, 6> all = {{ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
why?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Because it is a compile error with GCC under the stricter modes I am using.
std::array does not have a constructor that takes an init-list. C++ standard suggests that the second braces can be elided, but the 'official' way is to use two sets of braces.
See https://stackoverflow.com/questions/8192185/using-stdarray-with-initialization-lists
|
I have run the amalgamation script, but it produced more changes than I expected and doesn't compile. [EDIT] |
|
@undisputed-seraphim merged. Thank you! |
This PR aims to get rid of all shadowed variable warnings that occur in GCC during compilation.
Let me know if you would like me to change the naming of some of the changes I proposed.
[EDIT]
It seems that 2 or 3 of the unit tests are failing. It is clearly linked to the shadowed variable names being renamed and the shadowed variables being uncovered now.
I don't really have the willpower to track down exact failing functions, I would appreciate it if anyone can point out to me the offending changes.