From ca28d0a3bb83fa8a933a3c10203f6493296ec36f Mon Sep 17 00:00:00 2001 From: Josef Angstenberger Date: Fri, 13 Jan 2023 01:47:37 +0100 Subject: [PATCH 01/15] ShellCheck: Avoid checking success of echo This warning occurs: ~~~ test $? -eq 0 || no_result ^-- SC2320 (warning): This $? refers to echo/printf, not a previous command. Assign to variable to avoid it being overwritten. ~~~ See https://www.shellcheck.net/wiki/SC2320 for details. But in this case the return code of echo is really checked: to make sure that the file redirection worked. To avoid the, otherwise useful, ShellCheck warning, simply pipe through `cat` for these cases. --- test/01/t0150a.sh | 6 +++--- test/01/t0151a.sh | 6 +++--- test/01/t0152a.sh | 6 +++--- 3 files changed, 9 insertions(+), 9 deletions(-) diff --git a/test/01/t0150a.sh b/test/01/t0150a.sh index aa5eb7bd..1b524064 100755 --- a/test/01/t0150a.sh +++ b/test/01/t0150a.sh @@ -43,17 +43,17 @@ test $? -eq 0 || no_result # test_crc16 < zero.length.file > test.out test $? -eq 0 || fail -echo >> test.out +echo | cat >> test.out test $? -eq 0 || no_result test_crc16 < single.a.file >> test.out test $? -eq 0 || fail -echo >> test.out +echo | cat >> test.out test $? -eq 0 || no_result test_crc16 < nine.digits.file >> test.out test $? -eq 0 || fail -echo >> test.out +echo | cat >> test.out test $? -eq 0 || no_result test_crc16 < upper-case-a.256.file >> test.out diff --git a/test/01/t0151a.sh b/test/01/t0151a.sh index 25893997..76b18bb8 100755 --- a/test/01/t0151a.sh +++ b/test/01/t0151a.sh @@ -43,17 +43,17 @@ test $? -eq 0 || no_result # test_crc16 -x < zero.length.file > test.out test $? -eq 0 || fail -echo >> test.out +echo | cat >> test.out test $? -eq 0 || no_result test_crc16 -x < single.a.file >> test.out test $? -eq 0 || fail -echo >> test.out +echo | cat >> test.out test $? -eq 0 || no_result test_crc16 -x < nine.digits.file >> test.out test $? -eq 0 || fail -echo >> test.out +echo | cat >> test.out test $? -eq 0 || no_result test_crc16 -x < upper-case-a.256.file >> test.out diff --git a/test/01/t0152a.sh b/test/01/t0152a.sh index 197fdde8..ea35dd2d 100755 --- a/test/01/t0152a.sh +++ b/test/01/t0152a.sh @@ -43,17 +43,17 @@ test $? -eq 0 || no_result # test_crc16 -a < zero.length.file > test.out test $? -eq 0 || fail -echo >> test.out +echo | cat >> test.out test $? -eq 0 || no_result test_crc16 -a < single.a.file >> test.out test $? -eq 0 || fail -echo >> test.out +echo | cat >> test.out test $? -eq 0 || no_result test_crc16 -a < nine.digits.file >> test.out test $? -eq 0 || fail -echo >> test.out +echo | cat >> test.out test $? -eq 0 || no_result test_crc16 -a < upper-case-a.256.file >> test.out From a1e6f50247a928a60c68f926fff60f496707e410 Mon Sep 17 00:00:00 2001 From: Josef Angstenberger Date: Fri, 13 Jan 2023 02:10:02 +0100 Subject: [PATCH 02/15] cSpell: Add filename exceptions MegaLinter v6.14.0 does also check file name spelling. --- cspell.config.yaml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/cspell.config.yaml b/cspell.config.yaml index b95f1684..a9a12a68 100644 --- a/cspell.config.yaml +++ b/cspell.config.yaml @@ -182,6 +182,7 @@ words: - globbing - gsub - gumph + - howto - htdocs - ifndef - incl @@ -222,6 +223,7 @@ words: - PDFEXE - pirlen - productbuild + - progname - psselect - radixes - readmemh From 72df9325076c9b740a335e68418df4ef08333206 Mon Sep 17 00:00:00 2001 From: Josef Angstenberger Date: Fri, 13 Jan 2023 03:17:07 +0100 Subject: [PATCH 03/15] CI: Do update package index on Linux GitHub advises to do a `apt-get update` first. https://docs.github.com/en/actions/using-github-hosted-runners/customizing-github-hosted-runners --- .github/workflows/ci-linux.yml | 3 +++ .github/workflows/qa.yml | 9 +++++++++ 2 files changed, 12 insertions(+) diff --git a/.github/workflows/ci-linux.yml b/.github/workflows/ci-linux.yml index 88fd8acf..f2a91ef8 100644 --- a/.github/workflows/ci-linux.yml +++ b/.github/workflows/ci-linux.yml @@ -20,6 +20,9 @@ jobs: - clang-14 steps: + - name: Update system + run: sudo apt-get update + - name: Install prerequisites run: >- sudo apt-get install -y diff --git a/.github/workflows/qa.yml b/.github/workflows/qa.yml index 40e49758..ab4901a4 100644 --- a/.github/workflows/qa.yml +++ b/.github/workflows/qa.yml @@ -8,6 +8,9 @@ jobs: runs-on: ubuntu-22.04 steps: + - name: Update system + run: sudo apt-get update + - name: Install prerequisites run: >- sudo apt-get install -y @@ -61,6 +64,9 @@ jobs: runs-on: ubuntu-22.04 steps: + - name: Update system + run: sudo apt-get update + - name: Install prerequisites run: >- sudo apt-get install -y @@ -110,6 +116,9 @@ jobs: runs-on: ubuntu-22.04 steps: + - name: Update system + run: sudo apt-get update + - name: Install prerequisites run: >- sudo apt-get install -y From 984cb7ef9a00d2faaca236b4bb017952b26877ea Mon Sep 17 00:00:00 2001 From: Josef Angstenberger Date: Sun, 15 Jan 2023 19:00:36 +0100 Subject: [PATCH 04/15] cmake: Require C++11 as minimum --- srecord/CMakeLists.txt | 1 + 1 file changed, 1 insertion(+) diff --git a/srecord/CMakeLists.txt b/srecord/CMakeLists.txt index 01b9876f..f8c1aae7 100644 --- a/srecord/CMakeLists.txt +++ b/srecord/CMakeLists.txt @@ -22,6 +22,7 @@ file(GLOB_RECURSE LIB_SRECORD_HDR "*.h") message(STATUS "gcrypt location ${LIB_GCRYPT}") add_library(lib_srecord STATIC ${LIB_SRECORD_SRC} ${LIB_SRECORD_HDR} ${LIB_GCRYPT}) +target_compile_features(lib_srecord PUBLIC cxx_std_11) # Install the library install(TARGETS lib_srecord From 45c6d9fdbcb655950788be6156139c16ebcf7940 Mon Sep 17 00:00:00 2001 From: Josef Angstenberger Date: Thu, 12 Jan 2023 00:14:23 +0100 Subject: [PATCH 05/15] C++: Modernize and de-duplicate includes Command: ~~~sh run-clang-tidy-14 -header-filter='.*' -checks='-*,modernize-deprecated-headers,readability-duplicate-include' -fix ~~~ --- srecord/arglex.cc | 4 ++-- srecord/arglex/tool/output.cc | 5 ++--- srecord/crc16.h | 2 +- srecord/crc32.h | 2 +- srecord/fletcher32.h | 2 +- srecord/input.cc | 4 ++-- srecord/input.h | 4 ++-- srecord/input/file/logisim.h | 2 +- srecord/input/file/msbin.h | 2 +- srecord/interval.h | 2 +- srecord/memory/chunk.h | 2 +- srecord/output/file/msbin.h | 2 +- srecord/quit.h | 2 +- srecord/record.h | 2 +- srecord/stm32.h | 2 +- test/url_decode/main.cc | 1 - 16 files changed, 19 insertions(+), 21 deletions(-) diff --git a/srecord/arglex.cc b/srecord/arglex.cc index 66320e32..2d3c96c9 100644 --- a/srecord/arglex.cc +++ b/srecord/arglex.cc @@ -18,10 +18,10 @@ #include #include -#include +#include #include #include -#include +#include #include #include diff --git a/srecord/arglex/tool/output.cc b/srecord/arglex/tool/output.cc index 6146ae17..1413d6e1 100644 --- a/srecord/arglex/tool/output.cc +++ b/srecord/arglex/tool/output.cc @@ -39,9 +39,8 @@ #include #include #include -#include #include -#include +#include #include #include #include @@ -54,8 +53,8 @@ #include #include #include -#include #include +#include #include #include #include diff --git a/srecord/crc16.h b/srecord/crc16.h index e0bea3d1..45d93bf0 100644 --- a/srecord/crc16.h +++ b/srecord/crc16.h @@ -23,7 +23,7 @@ #ifndef SRECORD_CRC16_H #define SRECORD_CRC16_H -#include +#include namespace srecord { diff --git a/srecord/crc32.h b/srecord/crc32.h index bfcf3518..2acb9267 100644 --- a/srecord/crc32.h +++ b/srecord/crc32.h @@ -20,7 +20,7 @@ #ifndef SRECORD_CRC32_H #define SRECORD_CRC32_H -#include +#include namespace srecord { diff --git a/srecord/fletcher32.h b/srecord/fletcher32.h index 2f313c12..b28fc82a 100644 --- a/srecord/fletcher32.h +++ b/srecord/fletcher32.h @@ -19,7 +19,7 @@ #ifndef SRECORD_FLETCHER32_H #define SRECORD_FLETCHER32_H -#include +#include namespace srecord { diff --git a/srecord/input.cc b/srecord/input.cc index 27b06e56..d4a2d7eb 100644 --- a/srecord/input.cc +++ b/srecord/input.cc @@ -17,9 +17,9 @@ // . // -#include -#include +#include #include +#include #include #include diff --git a/srecord/input.h b/srecord/input.h index f6c83332..ce509dcd 100644 --- a/srecord/input.h +++ b/srecord/input.h @@ -19,9 +19,9 @@ #ifndef SRECORD_INPUT_H #define SRECORD_INPUT_H -#include -#include +#include #include +#include #include diff --git a/srecord/input/file/logisim.h b/srecord/input/file/logisim.h index 23eb9676..db87cbed 100644 --- a/srecord/input/file/logisim.h +++ b/srecord/input/file/logisim.h @@ -19,7 +19,7 @@ #ifndef SRECORD_INPUT_FILE_LOGISIM_H #define SRECORD_INPUT_FILE_LOGISIM_H -#include +#include #include #include diff --git a/srecord/input/file/msbin.h b/srecord/input/file/msbin.h index a5f88b71..944300b0 100644 --- a/srecord/input/file/msbin.h +++ b/srecord/input/file/msbin.h @@ -22,7 +22,7 @@ #ifndef SRECORD_INPUT_FILE_MSBIN_H #define SRECORD_INPUT_FILE_MSBIN_H -#include +#include #include #include diff --git a/srecord/interval.h b/srecord/interval.h index 51426995..5602e8b8 100644 --- a/srecord/interval.h +++ b/srecord/interval.h @@ -21,7 +21,7 @@ #define SRECORD_INTERVAL_H #include -#include +#include #include namespace srecord diff --git a/srecord/memory/chunk.h b/srecord/memory/chunk.h index 4f0cb367..c3821d87 100644 --- a/srecord/memory/chunk.h +++ b/srecord/memory/chunk.h @@ -19,7 +19,7 @@ #ifndef SRECORD_MEMORY_CHUNK_H #define SRECORD_MEMORY_CHUNK_H -#include +#include #include diff --git a/srecord/output/file/msbin.h b/srecord/output/file/msbin.h index a7ffeec1..4fcbbc65 100644 --- a/srecord/output/file/msbin.h +++ b/srecord/output/file/msbin.h @@ -22,7 +22,7 @@ #ifndef SRECORD_OUTPUT_FILE_MSBIN_H #define SRECORD_OUTPUT_FILE_MSBIN_H -#include +#include #include #include #include diff --git a/srecord/quit.h b/srecord/quit.h index f2829d8d..973f2c90 100644 --- a/srecord/quit.h +++ b/srecord/quit.h @@ -19,7 +19,7 @@ #ifndef SRECORD_QUIT_H #define SRECORD_QUIT_H -#include +#include #include namespace srecord diff --git a/srecord/record.h b/srecord/record.h index e94ce5f6..4cf43b0a 100644 --- a/srecord/record.h +++ b/srecord/record.h @@ -20,7 +20,7 @@ #define SRECORD_RECORD_H #include -#include +#include #include diff --git a/srecord/stm32.h b/srecord/stm32.h index 8fe9aa2e..8693fbbd 100644 --- a/srecord/stm32.h +++ b/srecord/stm32.h @@ -28,7 +28,7 @@ #ifndef SRECORD_STM32_H #define SRECORD_STM32_H -#include +#include namespace srecord { diff --git a/test/url_decode/main.cc b/test/url_decode/main.cc index 217d72ca..f94d9456 100644 --- a/test/url_decode/main.cc +++ b/test/url_decode/main.cc @@ -18,7 +18,6 @@ #include #include -#include #include #include #include From e28378f0764030588e0548b8e6d6f260ea3aa92a Mon Sep 17 00:00:00 2001 From: Josef Angstenberger Date: Thu, 12 Jan 2023 00:14:39 +0100 Subject: [PATCH 06/15] C++: Use auto keyword Command: ~~~sh run-clang-tidy-14 -header-filter='.*' -checks='-*,modernize-use-auto,readability-qualified-auto' -fix ~~~ Afterwards remove obsolete newlines manually. --- srec_info/main.cc | 8 ++++---- srecord/adler16.cc | 2 +- srecord/adler32.cc | 2 +- srecord/arglex.cc | 6 +++--- srecord/arglex/test_ambiguous.cc | 4 ++-- srecord/crc16.cc | 2 +- srecord/crc32.cc | 2 +- srecord/defcon.cc | 6 +++--- srecord/fletcher16.cc | 2 +- srecord/fletcher32.cc | 2 +- srecord/input/file/logisim.cc | 2 +- srecord/input/file/ti_tagged.cc | 2 +- srecord/input/file/ti_tagged_16.cc | 2 +- srecord/input/generator.cc | 4 ++-- srecord/interval.cc | 2 +- srecord/memory.cc | 3 +-- srecord/memory/walker/compare.cc | 2 +- srecord/output.cc | 3 +-- srecord/output/file/aomf.cc | 2 +- srecord/output/file/intel.cc | 2 +- srecord/output/file/intel16.cc | 2 +- srecord/output/file/tektronix.cc | 2 +- srecord/output/file/tektronix_extended.cc | 2 +- srecord/output/file/vhdl.cc | 2 +- srecord/stm32.cc | 2 +- 25 files changed, 34 insertions(+), 36 deletions(-) diff --git a/srec_info/main.cc b/srec_info/main.cc index a7db7279..d696d45e 100644 --- a/srec_info/main.cc +++ b/srec_info/main.cc @@ -70,7 +70,7 @@ main(int argc, char **argv) // // Read each file and emit informative gumph. // - for (infile_t::iterator it = infile.begin(); it != infile.end(); ++it) + for (auto it = infile.begin(); it != infile.end(); ++it) { srecord::input::pointer ifp = *it; if (infile.size() > 1U) @@ -157,12 +157,12 @@ main(int argc, char **argv) } const uint32_t lo = tmp.get_lowest(); const uint32_t hi = tmp.get_highest(); - const uint32_t hi_address = static_cast(hi - 1U); + const auto hi_address = static_cast(hi - 1U); std::cout << std::setw(prec) << lo << " - " << std::setw(prec) << hi_address; - const uint32_t interval_size = static_cast(hi - lo); + const auto interval_size = static_cast(hi - lo); if(verbose) { std::cout << " (" << std::setw(prec) << interval_size<< ")"; @@ -184,7 +184,7 @@ main(int argc, char **argv) std::cout << std::setw(prec) << number_bytes; std::cout << std::endl; - const uint32_t range_size + const auto range_size = static_cast(range_highest - range_lowest); const double real_number_bytes = (number_bytes == 0UL) ? 4294967296.0 : number_bytes; diff --git a/srecord/adler16.cc b/srecord/adler16.cc index fab1f558..0b81b3d8 100644 --- a/srecord/adler16.cc +++ b/srecord/adler16.cc @@ -70,7 +70,7 @@ srecord::adler16::next(unsigned char c) void srecord::adler16::nextbuf(const void *data, size_t nbytes) { - const unsigned char *dp = (const unsigned char *)data; + const auto *dp = (const unsigned char *)data; while (nbytes > 0) { next(*dp); diff --git a/srecord/adler32.cc b/srecord/adler32.cc index 54edab57..45f2500b 100644 --- a/srecord/adler32.cc +++ b/srecord/adler32.cc @@ -70,7 +70,7 @@ srecord::adler32::next(unsigned char c) void srecord::adler32::nextbuf(const void *data, size_t nbytes) { - const unsigned char *dp = (const unsigned char *)data; + const auto *dp = (const unsigned char *)data; while (nbytes > 0) { next(*dp); diff --git a/srecord/arglex.cc b/srecord/arglex.cc index 2d3c96c9..5d027865 100644 --- a/srecord/arglex.cc +++ b/srecord/arglex.cc @@ -497,7 +497,7 @@ srecord::arglex::token_next(void) partial = 0; for ( - table_ptr_vec_t::iterator it = tables.begin(); + auto it = tables.begin(); it != tables.end(); ++it ) @@ -607,7 +607,7 @@ srecord::arglex::check_deprecated(const std::string &actual) { for ( - deprecated_options_t::const_iterator it = deprecated_options.begin(); + auto it = deprecated_options.begin(); it != deprecated_options.end(); ++it ) @@ -647,7 +647,7 @@ srecord::arglex::token_name(int n) } for ( - table_ptr_vec_t::const_iterator it = tables.begin(); + auto it = tables.begin(); it != tables.end(); ++it ) diff --git a/srecord/arglex/test_ambiguous.cc b/srecord/arglex/test_ambiguous.cc index 5bb543d6..a781e176 100644 --- a/srecord/arglex/test_ambiguous.cc +++ b/srecord/arglex/test_ambiguous.cc @@ -29,7 +29,7 @@ srecord::arglex::test_ambiguous(void) int number_of_errors = 0; for ( - table_ptr_vec_t::const_iterator it1 = tables.begin(); + auto it1 = tables.begin(); it1 != tables.end(); ++it1 ) @@ -40,7 +40,7 @@ srecord::arglex::test_ambiguous(void) for ( - table_ptr_vec_t::const_iterator it2 = tables.begin(); + auto it2 = tables.begin(); it2 != tables.end(); ++it2 ) diff --git a/srecord/crc16.cc b/srecord/crc16.cc index 076abb48..cb6d1b3b 100644 --- a/srecord/crc16.cc +++ b/srecord/crc16.cc @@ -279,7 +279,7 @@ srecord::crc16::next(unsigned char ch) void srecord::crc16::nextbuf(const void *data, size_t nbytes) { - unsigned char *dp = (unsigned char *)data; + auto *dp = (unsigned char *)data; while (nbytes > 0) { state = updcrc(*dp++, state); diff --git a/srecord/crc32.cc b/srecord/crc32.cc index 100fe1cb..de0caa01 100644 --- a/srecord/crc32.cc +++ b/srecord/crc32.cc @@ -159,7 +159,7 @@ srecord::crc32::next(unsigned char x) void srecord::crc32::nextbuf(const void *data, size_t nbytes) { - const unsigned char *dp = (const unsigned char *)data; + const auto *dp = (const unsigned char *)data; while (nbytes > 0) { state = UPDC32(*dp, state); diff --git a/srecord/defcon.cc b/srecord/defcon.cc index d407be8f..c0a30f21 100644 --- a/srecord/defcon.cc +++ b/srecord/defcon.cc @@ -65,8 +65,8 @@ static const table_t table[] = static int compare(const void *va, const void *vb) { - const table_t *a = (const table_t *)va; - const table_t *b = (const table_t *)vb; + const auto *a = (const table_t *)va; + const auto *b = (const table_t *)vb; return strcmp(a->name, b->name); } @@ -75,7 +75,7 @@ int srecord::defcon_from_text(const char *text) { table_t key = { text, defcon_ignore }; - table_t *tp = + auto *tp = (table_t *) bsearch(&key, table, SIZEOF(table), sizeof(table_t), compare); if (!tp) diff --git a/srecord/fletcher16.cc b/srecord/fletcher16.cc index 97f79842..8ac4e624 100644 --- a/srecord/fletcher16.cc +++ b/srecord/fletcher16.cc @@ -118,7 +118,7 @@ srecord::fletcher16::nextbuf(const void *vdata, size_t nbytes) // overflow in 16 bits. Any smaller value is also permissible; 16 // may be convenient in many cases. // - const unsigned char *data = (const unsigned char *)vdata; + const auto *data = (const unsigned char *)vdata; size_t len = nbytes; while (len) { diff --git a/srecord/fletcher32.cc b/srecord/fletcher32.cc index 878212c6..df58d927 100644 --- a/srecord/fletcher32.cc +++ b/srecord/fletcher32.cc @@ -88,7 +88,7 @@ srecord::fletcher32::nextbuf(const void *vdata, size_t nbytes) // overflow. Any smaller value is also permissible; 256 may be // convenient in many cases. // - const unsigned char *data = (const unsigned char *)vdata; + const auto *data = (const unsigned char *)vdata; size_t len = nbytes; while (len) { diff --git a/srecord/input/file/logisim.cc b/srecord/input/file/logisim.cc index 9112d88e..d2d25f36 100644 --- a/srecord/input/file/logisim.cc +++ b/srecord/input/file/logisim.cc @@ -253,7 +253,7 @@ srecord::input_file_logisim::read(class record &rec) size_t max_data_size = record::maximum_data_length(address); size_t data_size = ((size_t)job.count > max_data_size ? max_data_size : job.count); - auto data = new record::data_t[data_size]; + auto *data = new record::data_t[data_size]; memset(data, job.value, data_size); rec = record(record::type_data, job.address, data, data_size); job.address += data_size; diff --git a/srecord/input/file/ti_tagged.cc b/srecord/input/file/ti_tagged.cc index 2c0bcd9d..e72e1f7a 100644 --- a/srecord/input/file/ti_tagged.cc +++ b/srecord/input/file/ti_tagged.cc @@ -157,7 +157,7 @@ srecord::input_file_ti_tagged::read(record &result) } n -= 5; int max = 250; - unsigned char *buffer = new unsigned char [max]; + auto *buffer = new unsigned char [max]; for (int j = 0; j < n; ++j) { c = get_char(); diff --git a/srecord/input/file/ti_tagged_16.cc b/srecord/input/file/ti_tagged_16.cc index c63466cb..c53c2008 100644 --- a/srecord/input/file/ti_tagged_16.cc +++ b/srecord/input/file/ti_tagged_16.cc @@ -157,7 +157,7 @@ srecord::input_file_ti_tagged_16::read(record &result) } n -= 5; int max = 250; - unsigned char *buffer = new unsigned char [max]; + auto *buffer = new unsigned char [max]; for (int j = 0; j < n; ++j) { c = get_char(); diff --git a/srecord/input/generator.cc b/srecord/input/generator.cc index 60f77a8d..72260a88 100644 --- a/srecord/input/generator.cc +++ b/srecord/input/generator.cc @@ -199,7 +199,7 @@ srecord::input_generator::create(srecord::arglex_tool *cmdln) cmdln->token_next(); size_t length = 0; size_t maxlen = 16; - unsigned char *data = new unsigned char [maxlen]; + auto *data = new unsigned char [maxlen]; for (;;) { // @@ -214,7 +214,7 @@ srecord::input_generator::create(srecord::arglex_tool *cmdln) if (length >= maxlen) { size_t new_maxlen = maxlen * 2 + 16; - unsigned char *new_data = new unsigned char [new_maxlen]; + auto *new_data = new unsigned char [new_maxlen]; memcpy(new_data, data, length); delete [] data; data = new_data; diff --git a/srecord/interval.cc b/srecord/interval.cc index 277864fb..1f7c90db 100644 --- a/srecord/interval.cc +++ b/srecord/interval.cc @@ -287,7 +287,7 @@ srecord::interval::append(data_t datum) if (length >= size) { size = size * 2 + 8; - data_t *tmp = new data_t[size + 1]; + auto *tmp = new data_t[size + 1]; if (data) { for (size_t k = 0; k < length; ++k) diff --git a/srecord/memory.cc b/srecord/memory.cc index 29cbdcd3..b90a903a 100644 --- a/srecord/memory.cc +++ b/srecord/memory.cc @@ -154,8 +154,7 @@ srecord::memory::find(unsigned long address) if (nchunks >= nchunks_max) { nchunks_max = nchunks_max * 2 + 4; - srecord::memory_chunk **tmp = - new srecord::memory_chunk * [nchunks_max]; + auto **tmp = new srecord::memory_chunk * [nchunks_max]; for (int j = 0; j < nchunks; ++j) tmp[j] = chunk[j]; delete [] chunk; diff --git a/srecord/memory/walker/compare.cc b/srecord/memory/walker/compare.cc index 688a3a0e..228aafc6 100644 --- a/srecord/memory/walker/compare.cc +++ b/srecord/memory/walker/compare.cc @@ -51,7 +51,7 @@ srecord::memory_walker_compare::observe(unsigned long addr, const void *p, interval wrongTemp; interval unsetTemp; - unsigned char *data = (unsigned char *)p; + auto *data = (unsigned char *)p; for (int j = 0; j < len; ++j) { if (other.set_p(addr + j)) diff --git a/srecord/output.cc b/srecord/output.cc index 31d064a4..e0ef1e58 100644 --- a/srecord/output.cc +++ b/srecord/output.cc @@ -140,8 +140,7 @@ void srecord::output::write_data(unsigned long address, const void *data, size_t length) { - const srecord::record::data_t *data_p = - (const srecord::record::data_t *)data; + const auto *data_p = (const srecord::record::data_t *)data; size_t block_size = preferred_block_size_get(); while (length > 0) { diff --git a/srecord/output/file/aomf.cc b/srecord/output/file/aomf.cc index 7a5f3b4f..4bbac9b2 100644 --- a/srecord/output/file/aomf.cc +++ b/srecord/output/file/aomf.cc @@ -84,7 +84,7 @@ srecord::output_file_aomf::content_record(unsigned long address, const unsigned char *data, size_t len) { const size_t maxlen = 4 * srecord::record::max_data_length; - auto buffer = new unsigned char[maxlen + 3]; + auto *buffer = new unsigned char[maxlen + 3]; while (len > 0) { diff --git a/srecord/output/file/intel.cc b/srecord/output/file/intel.cc index 644b3fb4..b159e9fc 100644 --- a/srecord/output/file/intel.cc +++ b/srecord/output/file/intel.cc @@ -68,7 +68,7 @@ srecord::output_file_intel::write_inner(int tag, unsigned long address, put_byte(tmp[0]); put_byte(tmp[1]); put_byte(tag); - const unsigned char *data_p = (const unsigned char *)data; + const auto *data_p = (const unsigned char *)data; for (int j = 0; j < data_nbytes; ++j) put_byte(data_p[j]); put_byte(-checksum_get()); diff --git a/srecord/output/file/intel16.cc b/srecord/output/file/intel16.cc index 37018be5..6ec2101d 100644 --- a/srecord/output/file/intel16.cc +++ b/srecord/output/file/intel16.cc @@ -69,7 +69,7 @@ srecord::output_file_intel16::write_inner(int tag, unsigned long address, put_byte(tmp[0]); put_byte(tmp[1]); put_byte(tag); - const unsigned char *data_p = (const unsigned char *)data; + const auto *data_p = (const unsigned char *)data; for (int j = 0; j < data_nbytes; ++j) { // Note: bytes are ordered HI,LO so we invert diff --git a/srecord/output/file/tektronix.cc b/srecord/output/file/tektronix.cc index 3cd5a407..e38f374d 100644 --- a/srecord/output/file/tektronix.cc +++ b/srecord/output/file/tektronix.cc @@ -85,7 +85,7 @@ srecord::output_file_tektronix::write_inner(unsigned long address, if (data_nbytes) { checksum_reset(); - const unsigned char *data_p = (const unsigned char *)data; + const auto *data_p = (const unsigned char *)data; for (int j = 0; j < data_nbytes; ++j) put_byte(data_p[j]); put_byte(checksum_get()); diff --git a/srecord/output/file/tektronix_extended.cc b/srecord/output/file/tektronix_extended.cc index 670f48e5..148227dc 100644 --- a/srecord/output/file/tektronix_extended.cc +++ b/srecord/output/file/tektronix_extended.cc @@ -72,7 +72,7 @@ srecord::output_file_tektronix_extended::write_inner(int tag, int j; for (j = 0; j < 2 * addr_nbytes; ++j) csum += buf[pos++] = (addr >> (4 * (2*addr_nbytes-1 - j))) & 15; - const unsigned char *data = (const unsigned char *)data_p; + const auto *data = (const unsigned char *)data_p; for (j = 0; j < data_nbytes; ++j) { csum += buf[pos++] = (data[j] >> 4) & 15; diff --git a/srecord/output/file/vhdl.cc b/srecord/output/file/vhdl.cc index dbc02089..1ca72914 100644 --- a/srecord/output/file/vhdl.cc +++ b/srecord/output/file/vhdl.cc @@ -61,7 +61,7 @@ srecord::output_file_vhdl::command_line(srecord::arglex_tool *cmdln) if (a1 > 0) { - unsigned a2 = (unsigned)a1; + auto a2 = (unsigned)a1; if (a2 > sizeof(unsigned long)) a2 = sizeof(unsigned long); bytes_per_word = a2; diff --git a/srecord/stm32.cc b/srecord/stm32.cc index 75f866be..0a60c2b0 100644 --- a/srecord/stm32.cc +++ b/srecord/stm32.cc @@ -120,7 +120,7 @@ srecord::stm32::next(unsigned char x) void srecord::stm32::nextbuf(const void *data, size_t nbytes) { - const unsigned char *dp = (const unsigned char *)data; + const auto *dp = (const unsigned char *)data; while (nbytes > 0) { --nbytes; From 39cf14a91b04b2a1019887a8e5a216ea063bcd01 Mon Sep 17 00:00:00 2001 From: Josef Angstenberger Date: Thu, 12 Jan 2023 00:43:24 +0100 Subject: [PATCH 07/15] C++: Improve const usage Command: ~~~sh run-clang-tidy-14 -header-filter='.*' -checks='-*,readability-non-const-parameter,readability-make-member-function-const' -fix ~~~ --- srecord/input/generator/repeat.cc | 2 +- srecord/input/generator/repeat.h | 2 +- srecord/output/file.cc | 4 ++-- srecord/output/file.h | 4 ++-- srecord/output/file/c.cc | 2 +- srecord/output/file/c.h | 2 +- srecord/output/file/hexdump.cc | 2 +- srecord/output/file/hexdump.h | 2 +- 8 files changed, 10 insertions(+), 10 deletions(-) diff --git a/srecord/input/generator/repeat.cc b/srecord/input/generator/repeat.cc index 8999458d..c9e2205e 100644 --- a/srecord/input/generator/repeat.cc +++ b/srecord/input/generator/repeat.cc @@ -27,7 +27,7 @@ srecord::input_generator_repeat::~input_generator_repeat() srecord::input_generator_repeat::input_generator_repeat( - const interval &a_range, unsigned char *a_data, size_t a_length) : + const interval &a_range, const unsigned char *a_data, size_t a_length) : srecord::input_generator(a_range), address(a_range.get_lowest()), data(0), diff --git a/srecord/input/generator/repeat.h b/srecord/input/generator/repeat.h index b0e14102..af31e01c 100644 --- a/srecord/input/generator/repeat.h +++ b/srecord/input/generator/repeat.h @@ -49,7 +49,7 @@ class input_generator_repeat: * @param length * The length of the array of data to be repeated. */ - input_generator_repeat(const interval &range, unsigned char *data, + input_generator_repeat(const interval &range, const unsigned char *data, size_t length); public: diff --git a/srecord/output/file.cc b/srecord/output/file.cc index 6171c81d..a3de46d0 100644 --- a/srecord/output/file.cc +++ b/srecord/output/file.cc @@ -262,14 +262,14 @@ srecord::output_file::put_4bytes_le(unsigned long n) int -srecord::output_file::checksum_get(void) +srecord::output_file::checksum_get(void) const { return (checksum & 0xFF); } int -srecord::output_file::checksum_get16(void) +srecord::output_file::checksum_get16(void) const { return (checksum & 0xFFFF); } diff --git a/srecord/output/file.h b/srecord/output/file.h index 44de6bd7..fbb06229 100644 --- a/srecord/output/file.h +++ b/srecord/output/file.h @@ -224,7 +224,7 @@ class output_file: * called by the #put_byte method). Only the lower 8 bits of the * sum are returned. */ - int checksum_get(void); + int checksum_get(void) const; /** * The checksum_get16 method is used to get the current value of @@ -232,7 +232,7 @@ class output_file: * usually called by the #put_byte method). Only the lower 16 * bits of the sum are returned. */ - int checksum_get16(void); + int checksum_get16(void) const; /** * The seek_to method is used to move the output position to the diff --git a/srecord/output/file/c.cc b/srecord/output/file/c.cc index aa1093db..b40a967d 100644 --- a/srecord/output/file/c.cc +++ b/srecord/output/file/c.cc @@ -637,7 +637,7 @@ srecord::output_file_c::emit_word(unsigned int n) std::string -srecord::output_file_c::format_address(unsigned long addr) +srecord::output_file_c::format_address(unsigned long addr) const { char buffer[30]; if (hex_style) diff --git a/srecord/output/file/c.h b/srecord/output/file/c.h index 8b7ca2b1..faab28fe 100644 --- a/srecord/output/file/c.h +++ b/srecord/output/file/c.h @@ -213,7 +213,7 @@ class output_file_c: * @param addr * The address to be formatted */ - std::string format_address(unsigned long addr); + std::string format_address(unsigned long addr) const; /** * The default constructor. Do not use. diff --git a/srecord/output/file/hexdump.cc b/srecord/output/file/hexdump.cc index fe098d75..99f674e1 100644 --- a/srecord/output/file/hexdump.cc +++ b/srecord/output/file/hexdump.cc @@ -162,7 +162,7 @@ srecord::output_file_hexdump::write(const srecord::record &record) int -srecord::output_file_hexdump::columns_to_line_length(int cols) +srecord::output_file_hexdump::columns_to_line_length(int cols) const { // 0000: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 #................ // ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^^ diff --git a/srecord/output/file/hexdump.h b/srecord/output/file/hexdump.h index be76e9c5..8698f955 100644 --- a/srecord/output/file/hexdump.h +++ b/srecord/output/file/hexdump.h @@ -138,7 +138,7 @@ class output_file_hexdump: /** * The columns_to_line_length method is used to */ - int columns_to_line_length(int cols); + int columns_to_line_length(int cols) const; /** * The default constructor. Do not use. From b220ad96e0cf20328d6e351b9e4a22f8e7b1619a Mon Sep 17 00:00:00 2001 From: Josef Angstenberger Date: Thu, 12 Jan 2023 01:36:11 +0100 Subject: [PATCH 08/15] C++: Apply misc C++11 modernizations Command: ~~~sh run-clang-tidy-14 -header-filter='.*' -checks='-*,modernize-make-shared,modernize-use-emplace,modernize-return-braced-init-list,modernize-use-bool-literals,modernize-raw-string-literal' -fix ~~~ --- srecord/arglex.cc | 10 +++++----- srecord/arglex/tool/get_string.cc | 2 +- srecord/input/file/hp64k.cc | 6 +++--- srecord/interval/flatten.cc | 2 +- srecord/output/file/msbin.cc | 5 +++-- 5 files changed, 13 insertions(+), 12 deletions(-) diff --git a/srecord/arglex.cc b/srecord/arglex.cc index 5d027865..d294381e 100644 --- a/srecord/arglex.cc +++ b/srecord/arglex.cc @@ -65,7 +65,7 @@ srecord::arglex::arglex(int ac, char **av) : if (av[j][0] == '@') read_arguments_file(av[j] + 1); else - arguments.push_back(av[j]); + arguments.emplace_back(av[j]); } table_set(default_table); } @@ -125,7 +125,7 @@ srecord::arglex::read_arguments_file(const char *filename) if (buffer[0] == '@') read_arguments_file(buffer + 1); else - arguments.push_back(std::string(buffer, bp - buffer)); + arguments.emplace_back(buffer, bp - buffer); } fclose(fp); } @@ -391,7 +391,7 @@ deprecated_warning(const char *deprecated_name, const char *preferred_name) { srecord::quit_default.warning ( - "option \"%s\" is deprecated, please use \"%s\" instead", + R"(option "%s" is deprecated, please use "%s" instead)", deprecated_name, preferred_name ); @@ -458,7 +458,7 @@ srecord::arglex::token_next(void) const char *eqp = strchr(arg.c_str(), '='); if (eqp) { - pushback.push_back(eqp + 1); + pushback.emplace_back(eqp + 1); arg = std::string(arg.c_str(), eqp - arg.c_str()); } } @@ -582,7 +582,7 @@ srecord::arglex::token_next(void) case 1: if (partial) { - pushback.push_back(partial); + pushback.emplace_back(partial); partial = 0; } value_string_ = hit[0]->name; diff --git a/srecord/arglex/tool/get_string.cc b/srecord/arglex/tool/get_string.cc index 29c51df6..34836c59 100644 --- a/srecord/arglex/tool/get_string.cc +++ b/srecord/arglex/tool/get_string.cc @@ -41,6 +41,6 @@ srecord::arglex_tool::get_string(const char *caption) token_name(token_cur()) ); // NOTREACHED - return std::string(); + return {}; } } diff --git a/srecord/input/file/hp64k.cc b/srecord/input/file/hp64k.cc index 71d70535..f1b611d4 100644 --- a/srecord/input/file/hp64k.cc +++ b/srecord/input/file/hp64k.cc @@ -90,7 +90,7 @@ srecord::input_file_hp64k::read_u16be(uint16_t *dest) return false; tmp = tmp | (c & 0xFF); *dest = tmp; - return 1; + return true; } //in this implementation, read_datarec is called at the "recsize" position, @@ -239,7 +239,7 @@ srecord::input_file_hp64k::read(record &record) case need_hdr: if (!read_hdr(record)) { - return 0; + return false; } state = need_pir; break; @@ -247,7 +247,7 @@ srecord::input_file_hp64k::read(record &record) case need_pir: if (!read_pir(record)) { - return 0; + return false; } state = data; break; diff --git a/srecord/interval/flatten.cc b/srecord/interval/flatten.cc index 6b97940b..238a7ed8 100644 --- a/srecord/interval/flatten.cc +++ b/srecord/interval/flatten.cc @@ -26,5 +26,5 @@ srecord::interval::flatten() { if (length <= 2) return *this; - return interval(get_lowest(), get_highest()); + return {get_lowest(), get_highest()}; } diff --git a/srecord/output/file/msbin.cc b/srecord/output/file/msbin.cc index 591c2a8e..eca26f3f 100644 --- a/srecord/output/file/msbin.cc +++ b/srecord/output/file/msbin.cc @@ -20,6 +20,7 @@ // #include +#include #include @@ -212,7 +213,7 @@ srecord::output_file_msbin::append_pending_record(const record &r) flush_pending_records(&r); } else - pending_records.push_back(std::shared_ptr(new record(r))); + pending_records.push_back(std::make_shared(r)); } else { @@ -226,7 +227,7 @@ srecord::output_file_msbin::append_pending_record(const record &r) flush_pending_records(&r); } else - pending_records.push_back(std::shared_ptr(new record(r))); + pending_records.push_back(std::make_shared(r)); } } From c07be5297774c84f62cbe8a2ed71a11d29b72988 Mon Sep 17 00:00:00 2001 From: Josef Angstenberger Date: Thu, 12 Jan 2023 02:57:20 +0100 Subject: [PATCH 09/15] C++: Remove void arguments for consistency Command: ~~~sh run-clang-tidy-14 -header-filter='.*' -checks='-*,modernize-redundant-void-arg' -fix ~~~ --- srecord/arglex.cc | 16 ++++----- srecord/arglex.h | 8 ++--- srecord/arglex/test_ambiguous.cc | 2 +- srecord/arglex/tool.cc | 4 +-- srecord/arglex/tool.h | 16 ++++----- srecord/arglex/tool/input.cc | 2 +- srecord/crc16.cc | 6 ++-- srecord/crc16.h | 4 +-- srecord/input.h | 10 +++--- srecord/input/file.cc | 38 ++++++++++---------- srecord/input/file.h | 44 ++++++++++++------------ srecord/input/file/aomf.cc | 4 +-- srecord/input/file/aomf.h | 10 +++--- srecord/input/file/ascii_hex.cc | 2 +- srecord/input/file/ascii_hex.h | 2 +- srecord/input/file/atmel_generic.cc | 2 +- srecord/input/file/atmel_generic.h | 2 +- srecord/input/file/binary.cc | 4 +-- srecord/input/file/binary.h | 4 +-- srecord/input/file/brecord.cc | 4 +-- srecord/input/file/brecord.h | 4 +-- srecord/input/file/cosmac.cc | 2 +- srecord/input/file/cosmac.h | 4 +-- srecord/input/file/dec_binary.cc | 4 +-- srecord/input/file/dec_binary.h | 6 ++-- srecord/input/file/emon52.cc | 6 ++-- srecord/input/file/emon52.h | 6 ++-- srecord/input/file/fairchild.cc | 2 +- srecord/input/file/fairchild.h | 8 ++--- srecord/input/file/fastload.cc | 8 ++--- srecord/input/file/fastload.h | 8 ++--- srecord/input/file/formatted_binary.cc | 6 ++-- srecord/input/file/formatted_binary.h | 6 ++-- srecord/input/file/four_packed_code.cc | 8 ++--- srecord/input/file/four_packed_code.h | 8 ++--- srecord/input/file/hexdump.cc | 8 ++--- srecord/input/file/hexdump.h | 8 ++--- srecord/input/file/hp64k.cc | 6 ++-- srecord/input/file/hp64k.h | 6 ++-- srecord/input/file/idt.cc | 6 ++-- srecord/input/file/idt.h | 8 ++--- srecord/input/file/intel.cc | 2 +- srecord/input/file/intel.h | 4 +-- srecord/input/file/intel16.cc | 2 +- srecord/input/file/intel16.h | 4 +-- srecord/input/file/logisim.cc | 12 +++---- srecord/input/file/logisim.h | 12 +++---- srecord/input/file/mif.cc | 20 +++++------ srecord/input/file/mif.h | 20 +++++------ srecord/input/file/mips_flash.cc | 6 ++-- srecord/input/file/mips_flash.h | 6 ++-- srecord/input/file/mos_tech.cc | 4 +-- srecord/input/file/mos_tech.h | 4 +-- srecord/input/file/motorola.cc | 4 +-- srecord/input/file/motorola.h | 4 +-- srecord/input/file/msbin.cc | 10 +++--- srecord/input/file/msbin.h | 10 +++--- srecord/input/file/needham.cc | 4 +-- srecord/input/file/needham.h | 4 +-- srecord/input/file/os65v.cc | 4 +-- srecord/input/file/os65v.h | 4 +-- srecord/input/file/ppb.cc | 10 +++--- srecord/input/file/ppb.h | 10 +++--- srecord/input/file/ppx.cc | 8 ++--- srecord/input/file/ppx.h | 8 ++--- srecord/input/file/signetics.cc | 4 +-- srecord/input/file/signetics.h | 4 +-- srecord/input/file/spasm.cc | 4 +-- srecord/input/file/spasm.h | 4 +-- srecord/input/file/spectrum.cc | 2 +- srecord/input/file/spectrum.h | 8 ++--- srecord/input/file/stewie.cc | 4 +-- srecord/input/file/stewie.h | 8 ++--- srecord/input/file/tektronix.cc | 8 ++--- srecord/input/file/tektronix.h | 8 ++--- srecord/input/file/tektronix_extended.cc | 6 ++-- srecord/input/file/tektronix_extended.h | 6 ++-- srecord/input/file/ti_tagged.cc | 6 ++-- srecord/input/file/ti_tagged.h | 6 ++-- srecord/input/file/ti_tagged_16.cc | 6 ++-- srecord/input/file/ti_tagged_16.h | 6 ++-- srecord/input/file/ti_txt.cc | 6 ++-- srecord/input/file/ti_txt.h | 6 ++-- srecord/input/file/trs80.cc | 8 ++--- srecord/input/file/trs80.h | 8 ++--- srecord/input/file/vmem.cc | 4 +-- srecord/input/file/vmem.h | 4 +-- srecord/input/file/wilson.cc | 8 ++--- srecord/input/file/wilson.h | 8 ++--- srecord/input/filter/checksum.h | 2 +- srecord/input/filter/message.cc | 2 +- srecord/input/filter/message.h | 2 +- srecord/input/filter/message/stm32.cc | 4 +-- srecord/input/filter/message/stm32.h | 4 +-- srecord/memory.cc | 10 +++--- srecord/memory.h | 10 +++--- srecord/memory/walker.cc | 2 +- srecord/memory/walker.h | 2 +- srecord/memory/walker/alignment.cc | 4 +-- srecord/memory/walker/alignment.h | 4 +-- srecord/memory/walker/fletcher16.cc | 2 +- srecord/memory/walker/fletcher16.h | 2 +- srecord/memory/walker/stm32.cc | 4 +-- srecord/memory/walker/stm32.h | 4 +-- srecord/output.h | 6 ++-- srecord/output/file.cc | 12 +++---- srecord/output/file.h | 16 ++++----- srecord/output/file/aomf.h | 4 +-- srecord/output/file/binary.cc | 2 +- srecord/output/file/binary.h | 2 +- srecord/output/file/coe.cc | 6 ++-- srecord/output/file/coe.h | 6 ++-- srecord/output/file/dec_binary.cc | 2 +- srecord/output/file/dec_binary.h | 2 +- srecord/output/file/formatted_binary.cc | 2 +- srecord/output/file/formatted_binary.h | 2 +- srecord/output/file/hexdump.cc | 6 ++-- srecord/output/file/hexdump.h | 6 ++-- srecord/output/file/idt.cc | 8 ++--- srecord/output/file/idt.h | 8 ++--- srecord/output/file/intel.h | 4 +-- srecord/output/file/logisim.cc | 4 +-- srecord/output/file/logisim.h | 4 +-- srecord/output/file/mem.cc | 6 ++-- srecord/output/file/mem.h | 6 ++-- srecord/output/file/mips_flash.cc | 8 ++--- srecord/output/file/mips_flash.h | 8 ++--- srecord/output/file/motorola.h | 6 ++-- srecord/output/file/msbin.cc | 2 +- srecord/output/file/msbin.h | 2 +- srecord/output/file/os65v.cc | 2 +- srecord/output/file/os65v.h | 2 +- srecord/output/file/ppb.cc | 8 ++--- srecord/output/file/ppb.h | 8 ++--- srecord/output/file/ppx.cc | 4 +-- srecord/output/file/ppx.h | 4 +-- srecord/output/file/trs80.cc | 2 +- srecord/output/file/trs80.h | 2 +- srecord/output/file/wilson.cc | 2 +- srecord/output/file/wilson.h | 2 +- srecord/output/filter.cc | 4 +-- srecord/output/filter/reblock.cc | 4 +-- srecord/output/filter/reblock.h | 4 +-- srecord/r250.cc | 8 ++--- srecord/r250.h | 2 +- srecord/record.h | 12 +++---- srecord/stm32.cc | 4 +-- srecord/stm32.h | 4 +-- srecord/versn_stamp.cc | 8 ++--- srecord/versn_stamp.h | 8 ++--- test/crc16/main.cc | 2 +- test/fletcher16/main.cc | 2 +- test/hyphen/main.cc | 2 +- test/url_decode/main.cc | 8 ++--- 154 files changed, 468 insertions(+), 468 deletions(-) diff --git a/srecord/arglex.cc b/srecord/arglex.cc index d294381e..34882297 100644 --- a/srecord/arglex.cc +++ b/srecord/arglex.cc @@ -422,7 +422,7 @@ deprecated_warning(const char *deprecated_name, const char *preferred_name) // int -srecord::arglex::token_next(void) +srecord::arglex::token_next() { const table_ty *tp; const table_ty *hit[20]; @@ -676,7 +676,7 @@ srecord::arglex::help(const char *name) void -srecord::arglex::version(void) +srecord::arglex::version() const { print_version(); @@ -685,7 +685,7 @@ srecord::arglex::version(void) void -srecord::arglex::license(void) +srecord::arglex::license() const { help("srec_license"); @@ -693,7 +693,7 @@ srecord::arglex::license(void) void -srecord::arglex::bad_argument(void) +srecord::arglex::bad_argument() const { switch (token_cur()) @@ -727,7 +727,7 @@ srecord::arglex::bad_argument(void) int -srecord::arglex::token_first(void) +srecord::arglex::token_first() { #if 1 // We probably don't need to do this all the time. @@ -770,7 +770,7 @@ srecord::arglex::usage_tail_set(const char *s) const char * -srecord::arglex::usage_tail_get(void) +srecord::arglex::usage_tail_get() const { if (!usage_tail_) @@ -780,7 +780,7 @@ srecord::arglex::usage_tail_get(void) void -srecord::arglex::usage(void) +srecord::arglex::usage() const { std::cerr << "Usage: " << progname_get() << " [