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

Fix -Wshadow warning #35

Closed
wants to merge 51 commits into from
Closed

Conversation

jschueller
Copy link

@jschueller jschueller commented Jun 10, 2021

I'm seeing these:

/io/lib/src/Base/Func/openturns/exprtk.hpp: In member function ‘bool exprtk::symbol_table<T>::type_store<Type, RawType>::add(const string&, RawType&, bool)’:
/io/lib/src/Base/Func/openturns/exprtk.hpp:17325:71: error: declaration of ‘T& t’ shadows a parameter [-Werror=shadow]
17325 |                static inline std::pair<bool,variable_node_t*> make(T& t,const bool is_const = false)
      |                                                                    ~~~^
/io/lib/src/Base/Func/openturns/exprtk.hpp:17321:67: note: shadowed declaration is here
17321 |          inline bool add(const std::string& symbol_name, RawType& t, const bool is_const = false)
      |                                                          ~~~~~~~~~^
/io/lib/src/Base/Func/openturns/exprtk.hpp:17325:84: error: declaration of ‘const bool is_const’ shadows a parameter [-Werror=shadow]
17325 |                static inline std::pair<bool,variable_node_t*> make(T& t,const bool is_const = false)
      |                                                                         ~~~~~~~~~~~^~~~~~~~~~~~~~~~
/io/lib/src/Base/Func/openturns/exprtk.hpp:17321:81: note: shadowed declaration is here
17321 |          inline bool add(const std::string& symbol_name, RawType& t, const bool is_const = false)
      |                                                                      ~~~~~~~~~~~^~~~~~~~~~~~~~~~
/io/lib/src/Base/Func/openturns/exprtk.hpp:17331:82: error: declaration of ‘std::string& t’ shadows a parameter [-Werror=shadow]
17331 |                static inline std::pair<bool,stringvar_node_t*> make(std::string& t,const bool is_const = false)
      |                                                                     ~~~~~~~~~~~~~^
/io/lib/src/Base/Func/openturns/exprtk.hpp:17321:67: note: shadowed declaration is here
17321 |          inline bool add(const std::string& symbol_name, RawType& t, const bool is_const = false)
      |                                                          ~~~~~~~~~^
/io/lib/src/Base/Func/openturns/exprtk.hpp:17331:95: error: declaration of ‘const bool is_const’ shadows a parameter [-Werror=shadow]
17331 |                static inline std::pair<bool,stringvar_node_t*> make(std::string& t,const bool is_const = false)
      |                                                                                    ~~~~~~~~~~~^~~~~~~~~~~~~~~~
/io/lib/src/Base/Func/openturns/exprtk.hpp:17321:81: note: shadowed declaration is here
17321 |          inline bool add(const std::string& symbol_name, RawType& t, const bool is_const = false)
      |                                                                      ~~~~~~~~~~~^~~~~~~~~~~~~~~~
/io/lib/src/Base/Func/openturns/exprtk.hpp:17337:75: error: declaration of ‘exprtk::symbol_table<T>::function_t& t’ shadows a parameter [-Werror=shadow]
17337 |                static inline std::pair<bool,function_t*> make(function_t& t, const bool is_constant = false)
      |                                                               ~~~~~~~~~~~~^
/io/lib/src/Base/Func/openturns/exprtk.hpp:17321:67: note: shadowed declaration is here
17321 |          inline bool add(const std::string& symbol_name, RawType& t, const bool is_const = false)
      |                                                          ~~~~~~~~~^
/io/lib/src/Base/Func/openturns/exprtk.hpp:17342:89: error: declaration of ‘exprtk::symbol_table<T>::vararg_function_t& t’ shadows a parameter [-Werror=shadow]
17342 |                static inline std::pair<bool,vararg_function_t*> make(vararg_function_t& t, const bool is_const = false)
      |                                                                      ~~~~~~~~~~~~~~~~~~~^
/io/lib/src/Base/Func/openturns/exprtk.hpp:17321:67: note: shadowed declaration is here
17321 |          inline bool add(const std::string& symbol_name, RawType& t, const bool is_const = false)
      |                                                          ~~~~~~~~~^
/io/lib/src/Base/Func/openturns/exprtk.hpp:17342:103: error: declaration of ‘const bool is_const’ shadows a parameter [-Werror=shadow]
17342 |                static inline std::pair<bool,vararg_function_t*> make(vararg_function_t& t, const bool is_const = false)
      |                                                                                            ~~~~~~~~~~~^~~~~~~~~~~~~~~~
/io/lib/src/Base/Func/openturns/exprtk.hpp:17321:81: note: shadowed declaration is here
17321 |          inline bool add(const std::string& symbol_name, RawType& t, const bool is_const = false)
      |                                                                      ~~~~~~~~~~~^~~~~~~~~~~~~~~~
/io/lib/src/Base/Func/openturns/exprtk.hpp:17347:91: error: declaration of ‘exprtk::symbol_table<T>::generic_function_t& t’ shadows a parameter [-Werror=shadow]
17347 |                static inline std::pair<bool,generic_function_t*> make(generic_function_t& t, const bool is_constant = false)
      |                                                                       ~~~~~~~~~~~~~~~~~~~~^
/io/lib/src/Base/Func/openturns/exprtk.hpp:17321:67: note: shadowed declaration is here
17321 |          inline bool add(const std::string& symbol_name, RawType& t, const bool is_const = false)

ArashPartow and others added 21 commits October 18, 2016 13:17
@ArashPartow
Copy link
Owner

@jschueller which compiler are you using? (and version)

atm I'm using g++-10 with the following:

-pedantic-errors -Wall -Wextra -Werror -Wundef -Wunused-function -Wshadow -std=c++17 -Wint-in-bool-context

and do not see those shadow errors.

@jschueller
Copy link
Author

it was gcc 11

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
2 participants