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

[WIP] Clang tidy fixes #26

Draft
wants to merge 38 commits into
base: master
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
38 commits
Select commit Hold shift + click to select a range
f344cb4
run-clang-tidy-14 -header-filter='.*' -checks='-*,modernize-deprecate…
jtxa Nov 4, 2022
fb1d2f6
run-clang-tidy-14 -header-filter='.*' -checks='-*,modernize-loop-conv…
jtxa Nov 4, 2022
972be9d
run-clang-tidy-14 -header-filter='.*' -checks='-*,modernize-make-shar…
jtxa Nov 4, 2022
9b16abe
run-clang-tidy-14 -header-filter='.*' -checks='-*,modernize-pass-by-v…
jtxa Nov 4, 2022
750cd87
run-clang-tidy-14 -header-filter='.*' -checks='-*,modernize-raw-strin…
jtxa Nov 4, 2022
9512632
run-clang-tidy-14 -header-filter='.*' -checks='-*,modernize-redundant…
jtxa Nov 4, 2022
336f952
run-clang-tidy-14 -header-filter='.*' -checks='-*,modernize-return-br…
jtxa Nov 4, 2022
349e58e
run-clang-tidy-14 -header-filter='.*' -checks='-*,modernize-use-auto'…
jtxa Nov 4, 2022
179ecda
run-clang-tidy-14 -header-filter='.*' -checks='-*,modernize-use-bool-…
jtxa Nov 4, 2022
31eb1ab
run-clang-tidy-14 -header-filter='.*' -checks='-*,modernize-use-defau…
jtxa Nov 4, 2022
401ba08
run-clang-tidy-14 -header-filter='.*' -checks='-*,modernize-use-empla…
jtxa Nov 4, 2022
28fc767
run-clang-tidy-14 -header-filter='.*' -checks='-*,modernize-use-equal…
jtxa Nov 4, 2022
e32564a
run-clang-tidy-14 -header-filter='.*' -checks='-*,modernize-use-equal…
jtxa Nov 4, 2022
4fb9385
run-clang-tidy-14 -header-filter='.*' -checks='-*,modernize-use-nullp…
jtxa Nov 4, 2022
3dfd4a8
run-clang-tidy-14 -header-filter='.*' -checks='-*,modernize-use-overr…
jtxa Nov 4, 2022
d8e85e1
run-clang-tidy-14 -header-filter='.*' -checks='-*,modernize-use-trail…
jtxa Nov 4, 2022
d24047e
run-clang-tidy-14 -header-filter='.*' -checks='-*,modernize-use-using…
jtxa Nov 4, 2022
c779dfe
run-clang-tidy-14 -header-filter='.*' -checks='-*,readability-braces-…
jtxa Nov 4, 2022
00d8402
run-clang-tidy-14 -header-filter='.*' -checks='-*,readability-contain…
jtxa Nov 4, 2022
2bcce15
run-clang-tidy-14 -header-filter='.*' -checks='-*,readability-convert…
jtxa Nov 4, 2022
ad21807
run-clang-tidy-14 -header-filter='.*' -checks='-*,readability-delete-…
jtxa Nov 4, 2022
a357987
run-clang-tidy-14 -header-filter='.*' -checks='-*,readability-duplica…
jtxa Nov 4, 2022
e191cfc
run-clang-tidy-14 -header-filter='.*' -checks='-*,readability-else-af…
jtxa Nov 4, 2022
0d6d563
run-clang-tidy-14 -header-filter='.*' -checks='-*,readability-implici…
jtxa Nov 4, 2022
4b9ff66
run-clang-tidy-14 -header-filter='.*' -checks='-*,readability-inconsi…
jtxa Nov 4, 2022
c1446da
run-clang-tidy-14 -header-filter='.*' -checks='-*,readability-isolate…
jtxa Nov 4, 2022
064d0a7
run-clang-tidy-14 -header-filter='.*' -checks='-*,readability-make-me…
jtxa Nov 4, 2022
5097c14
run-clang-tidy-14 -header-filter='.*' -checks='-*,readability-non-con…
jtxa Nov 4, 2022
d210633
run-clang-tidy-14 -header-filter='.*' -checks='-*,readability-qualifi…
jtxa Nov 4, 2022
22c4976
run-clang-tidy-14 -header-filter='.*' -checks='-*,readability-redunda…
jtxa Nov 4, 2022
316863f
run-clang-tidy-14 -header-filter='.*' -checks='-*,readability-redunda…
jtxa Nov 4, 2022
af05228
run-clang-tidy-14 -header-filter='.*' -checks='-*,readability-redunda…
jtxa Nov 4, 2022
86cbbeb
run-clang-tidy-14 -header-filter='.*' -checks='-*,readability-static-…
jtxa Nov 4, 2022
f5e2b87
run-clang-tidy-14 -header-filter='.*' -checks='-*,readability-upperca…
jtxa Nov 4, 2022
aa0b538
run-clang-tidy-14 -header-filter='.*' -checks='-*,bugprone-implicit-w…
jtxa Nov 4, 2022
8822210
run-clang-tidy-14 -header-filter='.*' -checks='-*,bugprone-macro-pare…
jtxa Nov 4, 2022
e4eb0d1
run-clang-tidy-14 -header-filter='.*' -checks='-*,cppcoreguidelines-i…
jtxa Nov 5, 2022
98055fc
run-clang-tidy-14 -header-filter='.*' -checks='-*,cppcoreguidelines-p…
jtxa Nov 5, 2022
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
6 changes: 3 additions & 3 deletions srecord/arglex.cc
Original file line number Diff line number Diff line change
Expand Up @@ -277,7 +277,7 @@ srecord::arglex::compare(const char *formal, const char *actual) -> bool
static auto
is_a_number(const char *s, long &n) -> int
{
int sign;
int sign = 0;
sierrafoxtrot marked this conversation as resolved.
Show resolved Hide resolved

n = 0;
switch (*s)
Expand Down Expand Up @@ -439,9 +439,9 @@ deprecated_warning(const char *deprecated_name, const char *preferred_name)
auto
srecord::arglex::token_next() -> int
{
const table_ty *tp;
const table_ty *tp = nullptr;
const table_ty *hit[20];
int nhit;
int nhit = 0;

std::string arg;
if (!pushback.empty())
Expand Down
2 changes: 1 addition & 1 deletion srecord/arglex/tool/get_number.cc
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ auto
srecord::arglex_tool::get_number(const char *caption) -> unsigned long
{
unsigned long value = 0;
unsigned long multiple;
unsigned long multiple = 0;
interval over;

switch (token_cur())
Expand Down
44 changes: 22 additions & 22 deletions srecord/arglex/tool/input.cc
Original file line number Diff line number Diff line change
Expand Up @@ -533,7 +533,7 @@ srecord::arglex_tool::get_input() -> srecord::input::pointer
const char *name = token_name();
endian_t end = get_endian_by_token();
token_next();
unsigned long address;
unsigned long address = 0;
get_address(name, address);
ifp =
input_filter_message_adler16::create
Expand All @@ -551,7 +551,7 @@ srecord::arglex_tool::get_input() -> srecord::input::pointer
const char *name = token_name();
endian_t end = get_endian_by_token();
token_next();
unsigned long address;
unsigned long address = 0;
get_address(name, address);
ifp =
input_filter_message_adler32::create
Expand Down Expand Up @@ -598,9 +598,9 @@ srecord::arglex_tool::get_input() -> srecord::input::pointer
const char *name = token_name();
endian_t end = get_endian_by_token();
token_next();
unsigned long address;
int nbytes;
int width;
unsigned long address = 0;
int nbytes = 0;
int width = 0;
get_address_nbytes_width(name, address, nbytes, width);
ifp =
input_filter_checksum_bitnot::create
Expand All @@ -620,9 +620,9 @@ srecord::arglex_tool::get_input() -> srecord::input::pointer
const char *name = token_name();
endian_t end = get_endian_by_token();
token_next();
unsigned long address;
int nbytes;
int width;
unsigned long address = 0;
int nbytes = 0;
int width = 0;
get_address_nbytes_width(name, address, nbytes, width);
ifp =
input_filter_checksum_negative::create
Expand All @@ -642,9 +642,9 @@ srecord::arglex_tool::get_input() -> srecord::input::pointer
const char *name = token_name();
endian_t end = get_endian_by_token();
token_next();
unsigned long address;
int nbytes;
int width;
unsigned long address = 0;
int nbytes = 0;
int width = 0;
get_address_nbytes_width(name, address, nbytes, width);
ifp =
input_filter_checksum_positive::create
Expand All @@ -664,7 +664,7 @@ srecord::arglex_tool::get_input() -> srecord::input::pointer
endian_t end = get_endian_by_token();
const char *name = token_name();
token_next();
unsigned long address;
unsigned long address = 0;
get_address(name, address);
ifp =
input_filter_message_crc16::create(ifp, address, end);
Expand All @@ -677,7 +677,7 @@ srecord::arglex_tool::get_input() -> srecord::input::pointer
const char *name = token_name();
endian_t end = get_endian_by_token();
token_next();
unsigned long address;
unsigned long address = 0;
get_address(name, address);
ifp = input_filter_message_crc32::create(ifp, address, end);
}
Expand Down Expand Up @@ -732,7 +732,7 @@ srecord::arglex_tool::get_input() -> srecord::input::pointer
const char *name = token_name();
endian_t end = get_endian_by_token();
token_next();
unsigned long address;
unsigned long address = 0;
get_address(name, address);
ifp =
input_filter_message_fletcher16::create
Expand All @@ -750,7 +750,7 @@ srecord::arglex_tool::get_input() -> srecord::input::pointer
const char *name = token_name();
endian_t end = get_endian_by_token();
token_next();
unsigned long address;
unsigned long address = 0;
get_address(name, address);
ifp =
input_filter_message_fletcher32::create
Expand Down Expand Up @@ -810,9 +810,9 @@ srecord::arglex_tool::get_input() -> srecord::input::pointer
endian_t end = get_endian_by_token();
bool inclusive = get_inclusive_by_token();
token_next();
unsigned long address;
int nbytes;
int width;
unsigned long address = 0;
int nbytes = 0;
int width = 0;
get_address_nbytes_width(name, address, nbytes, width);
ifp =
input_filter_interval_length::create
Expand All @@ -836,8 +836,8 @@ srecord::arglex_tool::get_input() -> srecord::input::pointer
endian_t end = get_endian_by_token();
bool inclusive = get_inclusive_by_token();
token_next();
unsigned long address;
int nbytes;
unsigned long address = 0;
int nbytes = 0;
get_address_and_nbytes(name, address, nbytes);
ifp =
input_filter_interval_maximum::create
Expand All @@ -860,8 +860,8 @@ srecord::arglex_tool::get_input() -> srecord::input::pointer
endian_t end = get_endian_by_token();
bool inclusive = get_inclusive_by_token();
token_next();
unsigned long address;
int nbytes;
unsigned long address = 0;
int nbytes = 0;
get_address_and_nbytes(name, address, nbytes);
ifp =
input_filter_interval_minimum::create
Expand Down
4 changes: 2 additions & 2 deletions srecord/fletcher16.cc
Original file line number Diff line number Diff line change
Expand Up @@ -159,8 +159,8 @@ srecord::fletcher16::get()
// bytes of eeprom. (Note: 0xFF in final byte (f1 or f2) is
// equivalent to 0x00 due to modulo 255 arithmetic.)
//
unsigned char f2;
unsigned char f1;
unsigned char f2 = 0;
unsigned char f1 = 0;
if (end == endian_big)
{
f1 = answer >> 8;
Expand Down
2 changes: 1 addition & 1 deletion srecord/input/file/aomf.cc
Original file line number Diff line number Diff line change
Expand Up @@ -189,7 +189,7 @@ srecord::input_file_aomf::read(srecord::record &record) -> bool
{
for (;;)
{
unsigned char c;
unsigned char c = 0;
switch (state)
{
case expecting_header:
Expand Down
4 changes: 2 additions & 2 deletions srecord/input/file/fastload.cc
Original file line number Diff line number Diff line change
Expand Up @@ -164,12 +164,12 @@ srecord::input_file_fastload::expect_white_space()
auto
srecord::input_file_fastload::read_inner(srecord::record &record) -> bool
{
unsigned long n;
unsigned long n = 0;
unsigned char data[srecord::record::max_data_length];
unsigned long data_address = address;
srecord::record::type_t type;
int data_length = 0;
unsigned char the_byte;
unsigned char the_byte = 0;
for (;;)
{
switch (peek_char())
Expand Down
2 changes: 1 addition & 1 deletion srecord/input/file/formatted_binary.cc
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ srecord::input_file_formatted_binary::read(record &result) -> bool
if (!header_seen)
{
// Skip leading NULs
int c;
int c = 0;
for (;;)
{
c = get_char();
Expand Down
30 changes: 15 additions & 15 deletions srecord/input/file/hp64k.cc
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ srecord::input_file_hp64k::command_line(arglex_tool *cmdln)
auto
srecord::input_file_hp64k::read_u16be(uint16_t *dest) -> bool
{
uint16_t tmp;
uint16_t tmp = 0;
int c = get_char();
if (c < 0) {
return false;
Expand All @@ -99,11 +99,11 @@ srecord::input_file_hp64k::read_u16be(uint16_t *dest) -> bool
auto
srecord::input_file_hp64k::read_datarec(record &result) -> bool
{
uint16_t recsize;
uint16_t datasize;
uint16_t load_l;
uint16_t load_h;
size_t tmp_addr;
uint16_t recsize = 0;
uint16_t datasize = 0;
uint16_t load_l = 0;
uint16_t load_h = 0;
size_t tmp_addr = 0;

if (!read_u16be(&recsize))
{
Expand Down Expand Up @@ -134,7 +134,7 @@ srecord::input_file_hp64k::read_datarec(record &result) -> bool
}
tmp_addr = (load_h << 16) | load_l;

unsigned cnt;
unsigned cnt = 0;
uint8_t buf[256];
for (cnt = 0; cnt < datasize; cnt++)
{
Expand Down Expand Up @@ -162,7 +162,7 @@ srecord::input_file_hp64k::read_datarec(record &result) -> bool
auto
srecord::input_file_hp64k::read_hdr(record &result) -> bool
{
uint16_t magic;
uint16_t magic = 0;
if (!read_u16be(&magic))
{
return false;
Expand All @@ -173,7 +173,7 @@ srecord::input_file_hp64k::read_hdr(record &result) -> bool
return false;
}

unsigned cnt;
unsigned cnt = 0;
unsigned len = HP64_HDRLEN; //initial value assume full buffer.
uint8_t hdr[HP64_HDRLEN + 1];

Expand All @@ -200,12 +200,12 @@ srecord::input_file_hp64k::read_hdr(record &result) -> bool
auto
srecord::input_file_hp64k::read_pir(record &result) -> bool
{
uint16_t pirlen;
uint16_t width;
uint16_t base;
uint16_t xfer_l;
uint16_t xfer_h;
uint32_t xfer;
uint16_t pirlen = 0;
uint16_t width = 0;
uint16_t base = 0;
uint16_t xfer_l = 0;
uint16_t xfer_h = 0;
uint32_t xfer = 0;

if (!read_u16be(&pirlen))
{
Expand Down
2 changes: 1 addition & 1 deletion srecord/input/file/ppb.cc
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ srecord::input_file_ppb::create(const std::string &filename) -> srecord::input_f
auto
srecord::input_file_ppb::get_packet() -> bool
{
int c;
int c = 0;

enum { SOH = 1 }; // Start of header marks beginning of record

Expand Down
4 changes: 2 additions & 2 deletions srecord/input/file/spectrum.cc
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ srecord::input_file_spectrum::create(const std::string &a_file_name) -> srecord:
auto
srecord::input_file_spectrum::get_decimal() -> int
{
int c;
int c = 0;
for (;;)
{
c = get_char();
Expand Down Expand Up @@ -93,7 +93,7 @@ is_binary_digit(int c) -> bool
auto
srecord::input_file_spectrum::get_binary() -> int
{
int c;
int c = 0;
for (;;)
{
c = get_char();
Expand Down
2 changes: 1 addition & 1 deletion srecord/input/file/wilson.cc
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ srecord::input_file_wilson::get_byte() -> int
auto
srecord::input_file_wilson::read_inner(record &result) -> bool
{
int c;
int c = 0;
for (;;)
{
c = get_char();
Expand Down
6 changes: 3 additions & 3 deletions srecord/interval.cc
Original file line number Diff line number Diff line change
Expand Up @@ -369,7 +369,7 @@ srecord::interval::union_(const interval &left, const interval &right) -> srecor
for (;;)
{
int old_count = count;
data_t place;
data_t place = 0;
if (left_pos < left.length)
{
if (right_pos < right.length)
Expand Down Expand Up @@ -455,7 +455,7 @@ srecord::interval::intersection(const interval &left, const interval &right) ->
for (;;)
{
int old_count = count;
data_t place;
data_t place = 0;
if (left_pos < left.length)
{
if (right_pos < right.length)
Expand Down Expand Up @@ -540,7 +540,7 @@ srecord::interval::difference(const interval &left, const interval &right) -> sr
for (;;)
{
int old_count = count;
data_t place;
data_t place = 0;
if (left_pos < left.length)
{
if (right_pos < right.length)
Expand Down
4 changes: 2 additions & 2 deletions srecord/memory/chunk.cc
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ srecord::memory_chunk::walk(srecord::memory_walker::pointer w)
if (!set_p(j)) {
continue;
}
int k;
int k = 0;
for (k = j + 1; k < size && set_p(k); ++k) {
;
}
Expand All @@ -97,7 +97,7 @@ srecord::memory_chunk::find_next_data(unsigned long &ret_addr, void *ret_data,
if (max > size) {
max = size;
}
unsigned k;
unsigned k = 0;
for (k = j + 1; k < max && set_p(k); ++k) {
;
}
Expand Down
2 changes: 1 addition & 1 deletion srecord/output/file/aomf.cc
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ void
srecord::output_file_aomf::content_record(unsigned long address,
const unsigned char *data, size_t len)
{
size_t maxlen = static_cast<size_t>(4 * srecord::record::)max_data_length;
size_t maxlen = 0 = static_cast<size_t>(4 * srecord::record::)max_data_length;
while (len > 0)
{
unsigned char buffer[maxlen + 3];
Expand Down
2 changes: 1 addition & 1 deletion srecord/output/file/fastload.cc
Original file line number Diff line number Diff line change
Expand Up @@ -121,7 +121,7 @@ srecord::output_file_fastload::put_command(int c, unsigned long n, int ndigits)
void
srecord::output_file_fastload::write(const srecord::record &record)
{
size_t j;
size_t j = 0;

switch (record.get_type())
{
Expand Down
2 changes: 1 addition & 1 deletion srecord/output/file/tektronix_extended.cc
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ srecord::output_file_tektronix_extended::write_inner(int tag,
csum += buf[pos++] = 0; // checksum hi, fill in later
csum += buf[pos++] = 0; // checksum lo, fill in later
csum += buf[pos++] = addr_nbytes * 2; // size of addr, in nibbles
int j;
int j = 0;
for (j = 0; j < 2 * addr_nbytes; ++j) {
csum += buf[pos++] = (addr >> (4 * (2*addr_nbytes-1 - j))) & 15;
}
Expand Down
4 changes: 2 additions & 2 deletions srecord/progname.cc
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,8 @@ srecord::progname_set(char *s)
{
for (;;)
{
char *cp1;
char *cp2;
char *cp1 = nullptr;
char *cp2 = nullptr;

cp1 = strrchr(s, '/');
if (cp1 == nullptr) {
Expand Down
Loading