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

Modernization/updating c++ pass 1 #43

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
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
5 changes: 2 additions & 3 deletions .clang-tidy
Original file line number Diff line number Diff line change
Expand Up @@ -42,8 +42,8 @@ Checks: >-
-modernize-avoid-c-arrays,
-modernize-loop-convert,
-modernize-use-default-member-init,
-modernize-use-equals-default,
-modernize-use-equals-delete,
modernize-use-equals-default,
modernize-use-equals-delete,
-modernize-use-nullptr,
-modernize-use-override,
-performance-unnecessary-copy-initialization,
Expand All @@ -59,7 +59,6 @@ Checks: >-
-readability-named-parameter,
-readability-redundant-member-init,
-readability-redundant-string-init,

# All enabled checks shall be reported as error.
WarningsAsErrors: "*"

Expand Down
1 change: 1 addition & 0 deletions doc/dictionaries/names.txt
Original file line number Diff line number Diff line change
Expand Up @@ -108,6 +108,7 @@ Sadowski
Schmitt
SDSMAC
Sean
SeanAlling-DojoFive
segfault
Seitz
Sergeev
Expand Down
5 changes: 0 additions & 5 deletions srec_cat/arglex3.cc
Original file line number Diff line number Diff line change
Expand Up @@ -51,8 +51,3 @@ srec_cat_arglex3::srec_cat_arglex3(int argc, char **argv) :

table_set(table);
}


srec_cat_arglex3::~srec_cat_arglex3()
{
}
26 changes: 18 additions & 8 deletions srec_cat/arglex3.h
Original file line number Diff line number Diff line change
Expand Up @@ -46,28 +46,38 @@ class srec_cat_arglex3:
/**
* The destructor.
*/
virtual ~srec_cat_arglex3();
~srec_cat_arglex3() override = default;

/**
* The constructor.
*/
srec_cat_arglex3(int, char **);

private:
/**
* The default constructor. Do not use.
* The default constructor.
*/
srec_cat_arglex3();
srec_cat_arglex3() = delete;

/**
* The copy constructor. Do not use.
* The copy constructor.
*/
srec_cat_arglex3(const srec_cat_arglex3 &);
srec_cat_arglex3(const srec_cat_arglex3 &) = delete;

/**
* The assignment operator. Do not use.
* The assignment operator.
*/
srec_cat_arglex3 &operator=(const srec_cat_arglex3 &);
srec_cat_arglex3 &operator=(const srec_cat_arglex3 &) = delete;

/**
* The move constructor
*/
srec_cat_arglex3 ( srec_cat_arglex3 && ) = delete;

/**
* The move assignment operator
*/
srec_cat_arglex3& operator=(srec_cat_arglex3&&) = delete;

};

#endif // PROG_SREC_CAT_ARGLEX3_H
32 changes: 0 additions & 32 deletions srecord/adler16.cc
Original file line number Diff line number Diff line change
Expand Up @@ -18,38 +18,6 @@

#include <srecord/adler16.h>


srecord::adler16::~adler16()
{
}


srecord::adler16::adler16() :
sum_a(1),
sum_b(0)
{
}


srecord::adler16::adler16(const adler16 &rhs) :
sum_a(rhs.sum_a),
sum_b(rhs.sum_b)
{
}


srecord::adler16 &
srecord::adler16::operator=(const adler16 &rhs)
{
if (this != &rhs)
{
sum_a = rhs.sum_a;
sum_b = rhs.sum_b;
}
return *this;
}


unsigned short
srecord::adler16::get()
const
Expand Down
24 changes: 2 additions & 22 deletions srecord/adler16.h
Original file line number Diff line number Diff line change
Expand Up @@ -32,26 +32,6 @@ namespace srecord
class adler16
{
public:
/**
* The destructor.
*/
virtual ~adler16();

/**
* The default constructor.
*/
adler16();

/**
* The copy constructor.
*/
adler16(const adler16 &);

/**
* The assignment operator.
*/
adler16 &operator=(const adler16 &);

/**
* The get method is used to obtain the running value of the checksum.
*/
Expand All @@ -72,13 +52,13 @@ class adler16
* The sum_a instance variable is used to remember the sum of bytes
* scanned.
*/
unsigned char sum_a;
unsigned char sum_a{1};

/**
* The sum_b instance variable is used to remember the sum of the
* sum of bytes scanned.
*/
unsigned char sum_b;
unsigned char sum_b{0};
};

};
Expand Down
32 changes: 0 additions & 32 deletions srecord/adler32.cc
Original file line number Diff line number Diff line change
Expand Up @@ -18,38 +18,6 @@

#include <srecord/adler32.h>


srecord::adler32::~adler32()
{
}


srecord::adler32::adler32() :
sum_a(1),
sum_b(0)
{
}


srecord::adler32::adler32(const adler32 &rhs) :
sum_a(rhs.sum_a),
sum_b(rhs.sum_b)
{
}


srecord::adler32 &
srecord::adler32::operator=(const adler32 &rhs)
{
if (this != &rhs)
{
sum_a = rhs.sum_a;
sum_b = rhs.sum_b;
}
return *this;
}


unsigned long
srecord::adler32::get()
const
Expand Down
24 changes: 2 additions & 22 deletions srecord/adler32.h
Original file line number Diff line number Diff line change
Expand Up @@ -34,26 +34,6 @@ namespace srecord
class adler32
{
public:
/**
* The destructor.
*/
virtual ~adler32();

/**
* The default constructor.
*/
adler32();

/**
* The copy constructor.
*/
adler32(const adler32 &);

/**
* The assignment operator.
*/
adler32 &operator=(const adler32 &);

/**
* The get method is used to obtain the running value of the
* checksum.
Expand All @@ -75,13 +55,13 @@ class adler32
* The sum_a instance variable is used to remember the sum of bytes
* scanned.
*/
unsigned short sum_a;
unsigned short sum_a{1};

/**
* The sum_b instance variable is used to remember the sum of the
* sum of bytes scanned.
*/
unsigned short sum_b;
unsigned short sum_b{0};
};

};
Expand Down
11 changes: 2 additions & 9 deletions srecord/arglex.cc
Original file line number Diff line number Diff line change
Expand Up @@ -49,15 +49,13 @@ static const srecord::arglex::table_ty default_table[] =
};


srecord::arglex::arglex() :
usage_tail_(0)
srecord::arglex::arglex()
{
table_set(default_table);
}


srecord::arglex::arglex(int ac, char **av) :
usage_tail_(0)
srecord::arglex::arglex(int ac, char **av)
{
progname_set(av[0]);
for (int j = 1; j < ac; ++j)
Expand Down Expand Up @@ -131,11 +129,6 @@ srecord::arglex::read_arguments_file(const char *filename)
}


srecord::arglex::~arglex()
{
}


void
srecord::arglex::table_set(const table_ty *tp)
{
Expand Down
52 changes: 31 additions & 21 deletions srecord/arglex.h
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,33 @@ class arglex
/**
* The destructor.
*/
virtual ~arglex();
virtual ~arglex() = default;

/**
* The default constructor.
*/
arglex();

/**
* The copy constructor.
*/
arglex(arglex &) = default;

/**
* The move constructor
*/
arglex ( arglex && ) = default;

/**
* The move assignment operator
*/
arglex& operator=(arglex&&) = default;

/**
* The normal constructor. The argv and argv should be those
* passed to main(). Not manipulation is required.
*/
arglex(int argc, char **argv);

/**
* The "normal" command line tokens common to all programs.
Expand Down Expand Up @@ -169,7 +195,7 @@ class arglex
* The token instance variable tracks the current token in the
* parse sequence.
*/
int token;
int token{};

/**
* The value_string_ instance variable tracks the value of the
Expand All @@ -182,7 +208,7 @@ class arglex
* of the current command line argument. Usually zero unless
* the current command line argument is a number.
*/
long value_number_;
long value_number_{};

/**
* The table_ptr_vec_t type is used to declare the 'tables'
Expand Down Expand Up @@ -215,22 +241,6 @@ class arglex
void table_set(const table_ty *);

public:
/**
* The default constructor.
*/
arglex();

/**
* The copy constructor.
*/
arglex(arglex &);

/**
* The normal constructor. The argv and argv should be those
* passed to main(). Not manipulation is required.
*/
arglex(int argc, char **argv);

/**
* The token_cur method is used to get the type of the current
* token.
Expand Down Expand Up @@ -288,7 +298,7 @@ class arglex
/**
* The help method is used to print a help message.
*/
void help(const char * = 0) const;
void help(const char * = nullptr) const;

/**
* The version method is used to print a version message.
Expand Down Expand Up @@ -326,7 +336,7 @@ class arglex
* the command line printed by the 'usage' method.
* Defaults to the empty string.
*/
mutable const char *usage_tail_;
mutable const char *usage_tail_{nullptr};

/**
* The usage_tail_get method is used to get the tail end of
Expand Down
12 changes: 1 addition & 11 deletions srecord/arglex/tool.cc
Original file line number Diff line number Diff line change
Expand Up @@ -24,12 +24,7 @@


srecord::arglex_tool::arglex_tool(int argc, char **argv) :
arglex(argc, argv),
stdin_used(false),
stdout_used(false),
issue_sequence_warnings(-1),
redundant_bytes(srecord::defcon_warning),
contradictory_bytes(srecord::defcon_fatal_error)
arglex(argc, argv)
{
static const table_ty table[] =
{
Expand Down Expand Up @@ -255,11 +250,6 @@ srecord::arglex_tool::arglex_tool(int argc, char **argv) :
}


srecord::arglex_tool::~arglex_tool()
{
}


bool
srecord::arglex_tool::can_get_number()
const
Expand Down
Loading