From 9502f19b08d7dbe2c38675fc76362198cbfe675c Mon Sep 17 00:00:00 2001 From: Pavel Belikov Date: Fri, 10 Nov 2017 20:07:57 +0300 Subject: fix unitialized values --- args.hxx | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/args.hxx b/args.hxx index 6ec4ab0..3458d97 100644 --- a/args.hxx +++ b/args.hxx @@ -532,18 +532,18 @@ namespace args class Base { private: - Options options; + Options options = {}; protected: - bool matched; + bool matched = false; const std::string help; #ifdef ARGS_NOEXCEPT /// Only for ARGS_NOEXCEPT - mutable Error error; + mutable Error error = Error::None; #endif public: - Base(const std::string &help_, Options options_ = {}) : options(options_), matched(false), help(help_) {} + Base(const std::string &help_, Options options_ = {}) : options(options_), help(help_) {} virtual ~Base() {} Options GetOptions() const noexcept @@ -655,10 +655,10 @@ namespace args { protected: const std::string name; - bool kickout; + bool kickout = false; public: - NamedBase(const std::string &name_, const std::string &help_, Options options_ = {}) : Base(help_, options_), name(name_), kickout(false) {} + NamedBase(const std::string &name_, const std::string &help_, Options options_ = {}) : Base(help_, options_), name(name_) {} virtual ~NamedBase() {} virtual std::vector> GetDescription(const HelpParams &, const unsigned indentLevel) const override @@ -1723,10 +1723,10 @@ namespace args std::string terminator; - bool allowJoinedShortValue; - bool allowJoinedLongValue; - bool allowSeparateShortValue; - bool allowSeparateLongValue; + bool allowJoinedShortValue = true; + bool allowJoinedLongValue = true; + bool allowSeparateShortValue = true; + bool allowSeparateLongValue = true; protected: enum class OptionType -- cgit v1.2.1 From e5e1c98b2ce2a627abe6fd4efb31af220b615a85 Mon Sep 17 00:00:00 2001 From: Pavel Belikov Date: Fri, 10 Nov 2017 20:19:09 +0300 Subject: add asan and ubsan to travis ci --- .travis.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.travis.yml b/.travis.yml index b793be5..4d1d5b6 100644 --- a/.travis.yml +++ b/.travis.yml @@ -42,7 +42,7 @@ matrix: apt: sources: ['ubuntu-toolchain-r-test'] packages: ['g++-6'] - env: COMPILER=g++-6 CONFIG=Debug + env: COMPILER=g++-6 CONFIG=Debug FLAGS='-fsanitize=address,undefined -fno-sanitize-recover=all' - os: linux addons: -- cgit v1.2.1 From acb6ca3cbb52ded669b14bce2957f8bf64a21c50 Mon Sep 17 00:00:00 2001 From: Pavel Belikov Date: Fri, 10 Nov 2017 20:30:54 +0300 Subject: fix -fuse-ld=gold for travis ci --- .travis.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.travis.yml b/.travis.yml index 4d1d5b6..d4892fe 100644 --- a/.travis.yml +++ b/.travis.yml @@ -42,7 +42,7 @@ matrix: apt: sources: ['ubuntu-toolchain-r-test'] packages: ['g++-6'] - env: COMPILER=g++-6 CONFIG=Debug FLAGS='-fsanitize=address,undefined -fno-sanitize-recover=all' + env: COMPILER=g++-6 CONFIG=Debug FLAGS='-fsanitize=address,undefined -fno-sanitize-recover=all -fuse-ld=gold' - os: linux addons: -- cgit v1.2.1 From a0cb58a47478f703131933018e8a0849bf45d671 Mon Sep 17 00:00:00 2001 From: Pavel Belikov Date: Fri, 10 Nov 2017 21:02:35 +0300 Subject: fix uninitialized RaiiSubparser::oldSubparser --- args.hxx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/args.hxx b/args.hxx index 3458d97..8839253 100644 --- a/args.hxx +++ b/args.hxx @@ -2317,7 +2317,7 @@ namespace args command.subparser = &parser; } - Command::RaiiSubparser::RaiiSubparser(const Command &command_, const HelpParams ¶ms_): command(command_), parser(command, params_) + Command::RaiiSubparser::RaiiSubparser(const Command &command_, const HelpParams ¶ms_): command(command_), parser(command, params_), oldSubparser(command.subparser) { command.subparser = &parser; } -- cgit v1.2.1