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

-Wunused-parameter warnings #19

Closed
wojdyr opened this issue Mar 7, 2017 · 3 comments
Closed

-Wunused-parameter warnings #19

wojdyr opened this issue Mar 7, 2017 · 3 comments

Comments

@wojdyr
Copy link

wojdyr commented Mar 7, 2017

A small request from me.
It'd be nice if args.hxx didn't generate warnings about unused parameters.

Ideally, it'd also avoid -Wshadow warnings, but this option is probably not that popular.

$ g++-6 -Wall -Wextra test.cxx -I.
In file included from test.cxx:16:0:
./args.hxx: In member function ‘virtual std::tuple<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > > args::Base::GetDescription(const string&, const string&, const string&, const string&) const’:
./args.hxx:400:92: warning: unused parameter ‘shortPrefix’ [-Wunused-parameter]
             virtual std::tuple<std::string, std::string> GetDescription(const std::string &shortPrefix, const std::string &longPrefix, const std::string &shortSeparator, const std::string &longSeparator) const
                                                                                            ^~~~~~~~~~~
./args.hxx:400:124: warning: unused parameter ‘longPrefix’ [-Wunused-parameter]
             virtual std::tuple<std::string, std::string> GetDescription(const std::string &shortPrefix, const std::string &longPrefix, const std::string &shortSeparator, const std::string &longSeparator) const
                                                                                                                            ^~~~~~~~~~
./args.hxx:400:155: warning: unused parameter ‘shortSeparator’ [-Wunused-parameter]
             virtual std::tuple<std::string, std::string> GetDescription(const std::string &shortPrefix, const std::string &longPrefix, const std::string &shortSeparator, const std::string &longSeparator) const
                                                                                                                                                           ^~~~~~~~~~~~~~
./args.hxx:400:190: warning: unused parameter ‘longSeparator’ [-Wunused-parameter]
  virtual std::tuple<std::string, std::string> GetDescription(const std::string &shortPrefix, const std::string &longPrefix, const std::string &shortSeparator, const std::string &longSeparator) const
                                                                                                                                                                                   ^~~~~~~~~~~~~
./args.hxx: In member function ‘virtual std::tuple<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > > args::NamedBase::GetDescription(const string&, const string&, const string&, const string&) const’:
./args.hxx:436:92: warning: unused parameter ‘shortPrefix’ [-Wunused-parameter]
             virtual std::tuple<std::string, std::string> GetDescription(const std::string &shortPrefix, const std::string &longPrefi, const std::string &shortSeparator, const std::string &longSeparator) const override
                                                                                            ^~~~~~~~~~~
./args.hxx:436:124: warning: unused parameter ‘longPrefi’ [-Wunused-parameter]
             virtual std::tuple<std::string, std::string> GetDescription(const std::string &shortPrefix, const std::string &longPrefi, const std::string &shortSeparator, const std::string &longSeparator) const override
                                                                                                                            ^~~~~~~~~
./args.hxx:436:154: warning: unused parameter ‘shortSeparator’ [-Wunused-parameter]
             virtual std::tuple<std::string, std::string> GetDescription(const std::string &shortPrefix, const std::string &longPrefi, const std::string &shortSeparator, const std::string &longSeparator) const override
                                                                                                                                                          ^~~~~~~~~~~~~~
./args.hxx:436:189: warning: unused parameter ‘longSeparator’ [-Wunused-parameter]
   virtual std::tuple<std::string, std::string> GetDescription(const std::string &shortPrefix, const std::string &longPrefi, const std::string &shortSeparator, const std::string &longSeparator) const override
                                                                                                                                                                                   ^~~~~~~~~~~~~
./args.hxx: In member function ‘virtual std::tuple<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > > args::FlagBase::GetDescription(const string&, const string&, const string&, const string&) const’:
./args.hxx:516:155: warning: unused parameter ‘shortSeparator’ [-Wunused-parameter]
             virtual std::tuple<std::string, std::string> GetDescription(const std::string &shortPrefix, const std::string &longPrefix, const std::string &shortSeparator, const std::string &longSeparator) const override
                                                                                                                                                           ^~~~~~~~~~~~~~
./args.hxx:516:190: warning: unused parameter ‘longSeparator’ [-Wunused-parameter]
  virtual std::tuple<std::string, std::string> GetDescription(const std::string &shortPrefix, const std::string &longPrefix, const std::string &shortSeparator, const std::string &longSeparator) const override
                                                                                                                                                                                   ^~~~~~~~~~~~~
./args.hxx: In static member function ‘static bool args::Group::Validators::DontCare(const args::Group&)’:
./args.hxx:636:51: warning: unused parameter ‘group’ [-Wunused-parameter]
                 static bool DontCare(const Group &group)
                                                   ^~~~~
./args.hxx: In static member function ‘static bool args::Group::Validators::CareTooMuch(const args::Group&)’:
./args.hxx:641:54: warning: unused parameter ‘group’ [-Wunused-parameter]
                 static bool CareTooMuch(const Group &group)
                                                      ^~~~~
In file included from test.cxx:16:0:
./args.hxx: In member function ‘bool args::ValueReader<std::__cxx11::basic_string<char> >::operator()(const string&, const string&, std::__cxx11::string&)’:
./args.hxx:1567:44: warning: unused parameter ‘name’ [-Wunused-parameter]
         bool operator()(const std::string &name, const std::string &value, std::string &destination)
                                            ^~~~
test.cxx: In member function ‘void DoublesReader::operator()(const string&, const string&, std::tuple<double, double>&)’:
test.cxx:297:40: warning: unused parameter ‘name’ [-Wunused-parameter]
     void operator()(const std::string &name, const std::string &value, std::tuple<double, double> &destination)
                                        ^~~~
test.cxx: In member function ‘void ToLowerReader::operator()(const string&, const string&, std::__cxx11::string&)’:
test.cxx:424:40: warning: unused parameter ‘name’ [-Wunused-parameter]
     void operator()(const std::string &name, const std::string &value, std::string &destination)
                                        ^~~~
In file included from test.cxx:576:0:
./args.hxx: In member function ‘virtual std::tuple<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > > argstest::Base::GetDescription(const string&, const string&, const string&, const string&) const’:
./args.hxx:400:92: warning: unused parameter ‘shortPrefix’ [-Wunused-parameter]
             virtual std::tuple<std::string, std::string> GetDescription(const std::string &shortPrefix, const std::string &longPrefix, const std::string &shortSeparator, const std::string &longSeparator) const
                                                                                            ^~~~~~~~~~~
./args.hxx:400:124: warning: unused parameter ‘longPrefix’ [-Wunused-parameter]
             virtual std::tuple<std::string, std::string> GetDescription(const std::string &shortPrefix, const std::string &longPrefix, const std::string &shortSeparator, const std::string &longSeparator) const
                                                                                                                            ^~~~~~~~~~
./args.hxx:400:155: warning: unused parameter ‘shortSeparator’ [-Wunused-parameter]
             virtual std::tuple<std::string, std::string> GetDescription(const std::string &shortPrefix, const std::string &longPrefix, const std::string &shortSeparator, const std::string &longSeparator) const
                                                                                                                                                           ^~~~~~~~~~~~~~
./args.hxx:400:190: warning: unused parameter ‘longSeparator’ [-Wunused-parameter]
  virtual std::tuple<std::string, std::string> GetDescription(const std::string &shortPrefix, const std::string &longPrefix, const std::string &shortSeparator, const std::string &longSeparator) const
                                                                                                                                                                                   ^~~~~~~~~~~~~
./args.hxx: In member function ‘virtual std::tuple<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > > argstest::NamedBase::GetDescription(const string&, const string&, const string&, const string&) const’:
./args.hxx:436:92: warning: unused parameter ‘shortPrefix’ [-Wunused-parameter]
             virtual std::tuple<std::string, std::string> GetDescription(const std::string &shortPrefix, const std::string &longPrefi, const std::string &shortSeparator, const std::string &longSeparator) const override
                                                                                            ^~~~~~~~~~~
./args.hxx:436:124: warning: unused parameter ‘longPrefi’ [-Wunused-parameter]
             virtual std::tuple<std::string, std::string> GetDescription(const std::string &shortPrefix, const std::string &longPrefi, const std::string &shortSeparator, const std::string &longSeparator) const override
                                                                                                                            ^~~~~~~~~
./args.hxx:436:154: warning: unused parameter ‘shortSeparator’ [-Wunused-parameter]
             virtual std::tuple<std::string, std::string> GetDescription(const std::string &shortPrefix, const std::string &longPrefi, const std::string &shortSeparator, const std::string &longSeparator) const override
                                                                                                                                                          ^~~~~~~~~~~~~~
./args.hxx:436:189: warning: unused parameter ‘longSeparator’ [-Wunused-parameter]
   virtual std::tuple<std::string, std::string> GetDescription(const std::string &shortPrefix, const std::string &longPrefi, const std::string &shortSeparator, const std::string &longSeparator) const override
                                                                                                                                                                                   ^~~~~~~~~~~~~
./args.hxx: In member function ‘virtual std::tuple<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > > argstest::FlagBase::GetDescription(const string&, const string&, const string&, const string&) const’:
./args.hxx:516:155: warning: unused parameter ‘shortSeparator’ [-Wunused-parameter]
             virtual std::tuple<std::string, std::string> GetDescription(const std::string &shortPrefix, const std::string &longPrefix, const std::string &shortSeparator, const std::string &longSeparator) const override
                                                                                                                                                           ^~~~~~~~~~~~~~
./args.hxx:516:190: warning: unused parameter ‘longSeparator’ [-Wunused-parameter]
  virtual std::tuple<std::string, std::string> GetDescription(const std::string &shortPrefix, const std::string &longPrefix, const std::string &shortSeparator, const std::string &longSeparator) const override
                                                                                                                                                                                   ^~~~~~~~~~~~~
./args.hxx: In static member function ‘static bool argstest::Group::Validators::DontCare(const argstest::Group&)’:
./args.hxx:636:51: warning: unused parameter ‘group’ [-Wunused-parameter]
                 static bool DontCare(const Group &group)
                                                   ^~~~~
./args.hxx: In static member function ‘static bool argstest::Group::Validators::CareTooMuch(const argstest::Group&)’:
./args.hxx:641:54: warning: unused parameter ‘group’ [-Wunused-parameter]
                 static bool CareTooMuch(const Group &group)
                                                      ^~~~~
In file included from test.cxx:576:0:
./args.hxx: In member function ‘bool argstest::ValueReader<std::__cxx11::basic_string<char> >::operator()(const string&, const string&, std::__cxx11::string&)’:
./args.hxx:1567:44: warning: unused parameter ‘name’ [-Wunused-parameter]
         bool operator()(const std::string &name, const std::string &value, std::string &destination)
                                            ^~~~
./args.hxx: In instantiation of ‘bool argstest::ValueReader<T>::operator()(const string&, const string&, T&) [with T = int; std::__cxx11::string = std::__cxx11::basic_string<char>]’:
./args.hxx:1600:21:   required from ‘void argstest::ValueFlag<T, Reader>::ParseValue(const string&) [with T = int; Reader = argstest::ValueReader<int>; std::__cxx11::string = std::__cxx11::basic_string<char>]’
test.cxx:635:1:   required from here
./args.hxx:1540:45: warning: unused parameter ‘name’ [-Wunused-parameter]
         bool operator ()(const std::string &name, const std::string &value, T &destination)
@netw0rkf10w
Copy link

+1 from me.

@tjmapley
Copy link

tjmapley commented Apr 6, 2021

No longer an issue?
"g++-6 -Wall -Wextra test.cxx -I." did not produce the warnings that occurred for @wojdyr in 2017.

@Taywee
Copy link
Owner

Taywee commented Apr 7, 2021

Looks like this was addressed by Pavel Belikov on 2017-11-06. Not sure if that was specifically in response to this issue or not.

@Taywee Taywee closed this as completed Apr 7, 2021
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

No branches or pull requests

4 participants