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: static analysis problems #785

Merged
merged 4 commits into from
Oct 8, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions include/CLI/FormatterFwd.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,8 @@ class FormatterBase {
FormatterBase() = default;
FormatterBase(const FormatterBase &) = default;
FormatterBase(FormatterBase &&) = default;
FormatterBase &operator=(const FormatterBase &) = default;
cetius marked this conversation as resolved.
Show resolved Hide resolved
FormatterBase &operator=(FormatterBase &&) = default;

/// Adding a destructor in this form to work around bug in GCC 4.7
virtual ~FormatterBase() noexcept {} // NOLINT(modernize-use-equals-default)
Expand Down Expand Up @@ -118,6 +120,8 @@ class Formatter : public FormatterBase {
Formatter() = default;
Formatter(const Formatter &) = default;
Formatter(Formatter &&) = default;
Formatter &operator=(const Formatter &) = default;
cetius marked this conversation as resolved.
Show resolved Hide resolved
Formatter &operator=(Formatter &&) = default;

/// @name Overridables
///@{
Expand Down
2 changes: 1 addition & 1 deletion include/CLI/Validators.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -750,7 +750,7 @@ class AsNumberWithUnit : public Validator {

// transform function
func_ = [mapping, opts](std::string &input) -> std::string {
Number num;
Number num{};
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not sure this is necessary, but it's okay.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I understand that this is just a cosmetic change. I just wanted to hold the tool back from moaning.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If it's just a cosmetic change, I'd have no problem with it. I think it might zero initialize some types, which is technically wasteful, the will only be written to. But in the scope of parsing CLI code, it's totally acceptable.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yep. That was my take also.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I completely understand your point of view


detail::rtrim(input);
if(input.empty()) {
Expand Down