Skip to content
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

Merged
merged 2 commits into from
Jan 13, 2019

Conversation

phlptp
Copy link
Collaborator

@phlptp phlptp commented Jan 12, 2019

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.

…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.
include/CLI/Formatter.hpp Outdated Show resolved Hide resolved
@@ -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
Copy link
Collaborator Author

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

Copy link
Collaborator

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
Copy link

codecov bot commented Jan 13, 2019

Codecov Report

Merging #191 into master will not change coverage.
The diff coverage is 100%.

Impacted file tree graph

@@          Coverage Diff          @@
##           master   #191   +/-   ##
=====================================
  Coverage     100%   100%           
=====================================
  Files          12     12           
  Lines        1889   1888    -1     
=====================================
- Hits         1889   1888    -1
Impacted Files Coverage Δ
include/CLI/StringTools.hpp 100% <ø> (ø) ⬆️
include/CLI/Option.hpp 100% <100%> (ø) ⬆️
include/CLI/App.hpp 100% <100%> (ø) ⬆️
include/CLI/Formatter.hpp 100% <100%> (ø) ⬆️
include/CLI/Error.hpp 100% <100%> (ø) ⬆️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 66fedad...9ce8379. Read the comment docs.

@codecov
Copy link

codecov bot commented Jan 13, 2019

Codecov Report

Merging #191 into master will not change coverage.
The diff coverage is 100%.

Impacted file tree graph

@@          Coverage Diff          @@
##           master   #191   +/-   ##
=====================================
  Coverage     100%   100%           
=====================================
  Files          12     12           
  Lines        1889   1888    -1     
=====================================
- Hits         1889   1888    -1
Impacted Files Coverage Δ
include/CLI/StringTools.hpp 100% <ø> (ø) ⬆️
include/CLI/Option.hpp 100% <100%> (ø) ⬆️
include/CLI/App.hpp 100% <100%> (ø) ⬆️
include/CLI/Formatter.hpp 100% <100%> (ø) ⬆️
include/CLI/Error.hpp 100% <100%> (ø) ⬆️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 66fedad...31514fc. Read the comment docs.

@henryiii
Copy link
Collaborator

henryiii commented Jan 13, 2019

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!

@henryiii henryiii merged commit 663d93c into CLIUtils:master Jan 13, 2019
@phlptp
Copy link
Collaborator Author

phlptp commented Jan 13, 2019

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.
Thanks.

@phlptp phlptp deleted the Clear_Wshadow_warnings branch January 13, 2019 14:32
@henryiii henryiii added this to the v1.7 milestone Feb 9, 2019
Sign up for free to 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