diff --git a/CMakeLists.txt b/CMakeLists.txt index ad574a21..24b49266 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -55,6 +55,13 @@ if(CMAKE_PROJECT_NAME STREQUAL PROJECT_NAME) endif() else() target_compile_options(CLI11_warnings INTERFACE -Wall -Wextra -pedantic -Wshadow) + if(CMAKE_CXX_COMPILER_ID STREQUAL "GNU") + if(NOT CMAKE_CXX_COMPILER_VERSION VERSION_LESS 4.9) + # GCC 4.8 has a false positive + # Other compilers ignore this flag + target_compile_options(CLI11_warnings INTERFACE -Weffc++) + endif() + endif() if(CLI11_WARNINGS_AS_ERRORS) target_compile_options(CLI11_warnings INTERFACE -Werror) endif() diff --git a/include/CLI/App.hpp b/include/CLI/App.hpp index 704cd594..0bbc6e78 100644 --- a/include/CLI/App.hpp +++ b/include/CLI/App.hpp @@ -65,10 +65,10 @@ class App { ///@{ /// Subcommand name or program name (from parser if name is empty) - std::string name_; + std::string name_{}; /// Description of the current program/subcommand - std::string description_; + std::string description_{}; /// If true, allow extra arguments (ie, don't throw an error). INHERITABLE bool allow_extras_{false}; @@ -96,32 +96,32 @@ class App { bool immediate_callback_{false}; /// This is a function that runs prior to the start of parsing - std::function pre_parse_callback_; + std::function pre_parse_callback_{}; /// This is a function that runs when parsing has finished. - std::function parse_complete_callback_; + std::function parse_complete_callback_{}; /// This is a function that runs when all processing has completed - std::function final_callback_; + std::function final_callback_{}; ///@} /// @name Options ///@{ /// The default values for options, customizable and changeable INHERITABLE - OptionDefaults option_defaults_; + OptionDefaults option_defaults_{}; /// The list of options, stored locally - std::vector options_; + std::vector options_{}; ///@} /// @name Help ///@{ /// Footer to put after all options in the help output INHERITABLE - std::string footer_; + std::string footer_{}; /// This is a function that generates a footer to put after all other options in help output - std::function footer_callback_; + std::function footer_callback_{}; /// A pointer to the help flag if there is one INHERITABLE Option *help_ptr_{nullptr}; @@ -133,7 +133,7 @@ class App { std::shared_ptr formatter_{new Formatter()}; /// The error message printing function INHERITABLE - std::function failure_message_ = FailureMessage::simple; + std::function failure_message_{FailureMessage::simple}; ///@} /// @name Parsing @@ -144,35 +144,35 @@ class App { /// Pair of classifier, string for missing options. (extra detail is removed on returning from parse) /// /// This is faster and cleaner than storing just a list of strings and reparsing. This may contain the -- separator. - missing_t missing_; + missing_t missing_{}; /// This is a list of pointers to options with the original parse order - std::vector