-
Notifications
You must be signed in to change notification settings - Fork 349
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
Clear up Wshadow warnings from gcc 4.9 #191
Conversation
…able names with the same name as a member function. Also a few spelling fixes and adding some std::move around some of the arguments when appropriate.
@@ -15,19 +15,25 @@ | |||
#if defined(CLI11_CPP17) && __has_include(<optional>) && \ | |||
!defined(CLI11_STD_OPTIONAL) | |||
#define CLI11_STD_OPTIONAL 1 | |||
#elif !defined(CLI11_STD_OPTIONAL) | |||
#define CLI11_STD_OPTIONAL 0 |
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 was getting a bunch of warnings about undefined symbols when this is used in #if XXXX statements
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 was supposed to be checked in ifdef
, but it was checked in an if
just below, so this is probably best. The main user interaction with these is optionally defining 1 or 0 before including, and if they do define 0, it would have been inconsistent before this patch, so I like it.
Codecov Report
@@ Coverage Diff @@
## master #191 +/- ##
=====================================
Coverage 100% 100%
=====================================
Files 12 12
Lines 1889 1888 -1
=====================================
- Hits 1889 1888 -1
Continue to review full report at Codecov.
|
Codecov Report
@@ Coverage Diff @@
## master #191 +/- ##
=====================================
Coverage 100% 100%
=====================================
Files 12 12
Lines 1889 1888 -1
=====================================
- Hits 1889 1888 -1
Continue to review full report at Codecov.
|
I'm surprised there were still warnings, I worked through them at one point, though I do think newer compilers are more forgiving for the case were you set a parameter directly to a member, where it's logically more acceptable to match the names. Thank you! |
I think newer compilers realized that in nearly all cases having a local variable name the same as a function name really couldn't conflict so they don't warn on that any more. But gcc 4.9 is still in pretty common use yet. |
I ran some integration tests with some of our applications ended up with a couple hundred warnings from CLI11. We are not at the point in that application of Zero warnings but that was a bit too much to use.
The warnings were on gcc 4.9 which seems to be a little pickier, particularly about Wshadow warning.
See Travis build starting line 1166
This pull request will clear up the warnings from GCC 4.9. It also adds a few lines of documentation, one or two spelling issues, and adds a few std::move assignments in some member functions where they might be useful. I didn't thoroughly look for such places but came across a few obvious ones when fixing the Wshadow warnings.