Skip to content

Commit

Permalink
Merge pull request #41 from pavel-belikov/fix-uninitialized-values
Browse files Browse the repository at this point in the history
Fix uninitialized values
  • Loading branch information
Taylor C. Richberger committed Nov 12, 2017
2 parents 71b1110 + a0cb58a commit 3331ae4
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 12 deletions.
2 changes: 1 addition & 1 deletion .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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 -fuse-ld=gold'

- os: linux
addons:
Expand Down
22 changes: 11 additions & 11 deletions args.hxx
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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<std::tuple<std::string, std::string, unsigned>> GetDescription(const HelpParams &, const unsigned indentLevel) const override
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -2317,7 +2317,7 @@ namespace args
command.subparser = &parser;
}

Command::RaiiSubparser::RaiiSubparser(const Command &command_, const HelpParams &params_): command(command_), parser(command, params_)
Command::RaiiSubparser::RaiiSubparser(const Command &command_, const HelpParams &params_): command(command_), parser(command, params_), oldSubparser(command.subparser)
{
command.subparser = &parser;
}
Expand Down

0 comments on commit 3331ae4

Please sign in to comment.