Repository: randombit/botan
Pull request #3602 (2023-06-27 11:07:26)

Fix clang-tidy warnings in the compression code


Patch:
diff --git a/.github/workflows/nightly.yml b/.github/workflows/nightly.yml
index 9bae93903..307787575 100644
--- a/.github/workflows/nightly.yml
+++ b/.github/workflows/nightly.yml
@@ -33,7 +33,7 @@ jobs:
         run: sudo apt-get -qq install libboost-dev
 
       - name: Configure Build
-        run: python3 ./configure.py --cc=clang --build-targets=shared,cli,tests,examples,bogo_shim --build-fuzzers=test --with-boost --with-sqlite
+        run: python3 ./configure.py --cc=clang --build-targets=shared,cli,tests,examples,bogo_shim --build-fuzzers=test --with-boost --with-sqlite --with-zlib --with-lzma --with-bzip2
 
       - name: Run Clang Tidy
         run: python3 ./src/scripts/dev_tools/run_clang_tidy.py --verbose
diff --git a/src/.clang-tidy b/src/.clang-tidy
deleted file mode 100644
index ff7eb7acd..000000000
--- a/src/.clang-tidy
+++ /dev/null
@@ -1,80 +0,0 @@
----
-# This file was automatically generated by src/scripts/dev_tools/run_clang_tidy.py --regenerate-inline-config-file
-#
-# All manual edits to this file will be lost. Edit the script
-# then regenerate this configuration file.
-
-Checks: >
-    bugprone-*,
-    cert-*,
-    clang-analyzer-*,
-    cppcoreguidelines-*,
-    hicpp-*,
-    misc-*,
-    modernize-*,
-    performance-*,
-    portability-*,
-    readability-*,
-    -*-named-parameter,
-    -*-member-init,
-    -bugprone-lambda-function-name,
-    -bugprone-unchecked-optional-access,
-    -cert-err58-cpp,
-    -cppcoreguidelines-init-variables,
-    -cppcoreguidelines-owning-memory,
-    -cppcoreguidelines-prefer-member-initializer,
-    -cppcoreguidelines-slicing,
-    -hicpp-explicit-conversions,
-    -misc-const-correctness,
-    -misc-redundant-expression,
-    -misc-misplaced-const,
-    -misc-confusable-identifiers,
-    -modernize-avoid-bind,
-    -modernize-pass-by-value,
-    -readability-convert-member-functions-to-static,
-    -readability-implicit-bool-conversion,
-    -readability-inconsistent-declaration-parameter-name,
-    -readability-qualified-auto,
-    -readability-simplify-boolean-expr,
-    -readability-static-accessed-through-instance,
-    -*-array-to-pointer-decay,
-    -*-avoid-c-arrays,
-    -*-else-after-return,
-    -*-function-size,
-    -*-magic-numbers,
-    -*-narrowing-conversions,
-    -*-no-array-decay,
-    -*-use-auto,
-    -*-use-emplace,
-    -*-deprecated-headers,
-    -bugprone-argument-comment,
-    -bugprone-branch-clone,
-    -bugprone-easily-swappable-parameters,
-    -bugprone-implicit-widening-of-multiplication-result,
-    -cppcoreguidelines-non-private-member-variables-in-classes,
-    -cppcoreguidelines-pro-bounds-pointer-arithmetic,
-    -cppcoreguidelines-pro-bounds-constant-array-index,
-    -cppcoreguidelines-pro-type-const-cast,
-    -cppcoreguidelines-pro-type-reinterpret-cast,
-    -cppcoreguidelines-pro-type-vararg,
-    -hicpp-no-assembler,
-    -hicpp-vararg,
-    -hicpp-signed-bitwise,
-    -misc-no-recursion,
-    -modernize-loop-convert,
-    -modernize-raw-string-literal,
-    -modernize-use-trailing-return-type,
-    -modernize-return-braced-init-list,
-    -modernize-use-default-member-init,
-    -modernize-use-nodiscard,
-    -modernize-use-using,
-    -portability-simd-intrinsics,
-    -readability-container-data-pointer,
-    -readability-function-cognitive-complexity,
-    -readability-identifier-length,
-    -readability-isolate-declaration,
-    -readability-non-const-parameter,
-    -readability-redundant-access-specifiers,
-    -readability-suspicious-call-argument,
-    -readability-use-anyofallof,
----
diff --git a/src/cli/compress.cpp b/src/cli/compress.cpp
index 85828b5b7..6514479ee 100644
--- a/src/cli/compress.cpp
+++ b/src/cli/compress.cpp
@@ -28,7 +28,7 @@ class Compress final : public Command {
          };
 
          auto suffix_info = suffixes.find(comp_type);
-         if(suffixes.count(comp_type) == 0) {
+         if(!suffixes.contains(comp_type)) {
             throw CLI_Error_Unsupported("Compressing", comp_type);
          }
 
diff --git a/src/lib/compression/bzip2/bzip2.cpp b/src/lib/compression/bzip2/bzip2.cpp
index f129c0d3a..738ac0917 100644
--- a/src/lib/compression/bzip2/bzip2.cpp
+++ b/src/lib/compression/bzip2/bzip2.cpp
@@ -42,22 +42,30 @@ class Bzip2_Compression_Stream final : public Bzip2_Stream {
          * compression is not overly affected by the size, though
          * more memory is required.
          */
-         if(block_size == 0 || block_size >= 9)
+         if(block_size == 0 || block_size >= 9) {
             block_size = 9;
+         }
 
          int rc = BZ2_bzCompressInit(streamp(), static_cast<unsigned int>(block_size), 0, 0);
 
-         if(rc != BZ_OK)
+         if(rc != BZ_OK) {
             throw Compression_Error("BZ2_bzCompressInit", ErrorType::Bzip2Error, rc);
+         }
       }
 
-      ~Bzip2_Compression_Stream() { BZ2_bzCompressEnd(streamp()); }
+      Bzip2_Compression_Stream(const Bzip2_Compression_Stream& other) = delete;
+      Bzip2_Compression_Stream(Bzip2_Compression_Stream&& other) = delete;
+      Bzip2_Compression_Stream& operator=(const Bzip2_Compression_Stream& other) = delete;
+      Bzip2_Compression_Stream& operator=(Bzip2_Compression_Stream&& other) = delete;
+
+      ~Bzip2_Compression_Stream() override { BZ2_bzCompressEnd(streamp()); }
 
       bool run(uint32_t flags) override {
          int rc = BZ2_bzCompress(streamp(), flags);
 
-         if(rc < 0)
+         if(rc < 0) {
             throw Compression_Error("BZ2_bzCompress", ErrorType::Bzip2Error, rc);
+         }
 
          return (rc == BZ_STREAM_END);
       }
@@ -68,17 +76,24 @@ class Bzip2_Decompression_Stream final : public Bzip2_Stream {
       Bzip2_Decompression_Stream() {
          int rc = BZ2_bzDecompressInit(streamp(), 0, 0);
 
-         if(rc != BZ_OK)
+         if(rc != BZ_OK) {
             throw Compression_Error("BZ2_bzDecompressInit", ErrorType::Bzip2Error, rc);
+         }
       }
 
-      ~Bzip2_Decompression_Stream() { BZ2_bzDecompressEnd(streamp()); }
+      Bzip2_Decompression_Stream(const Bzip2_Decompression_Stream& other) = delete;
+      Bzip2_Decompression_Stream(Bzip2_Decompression_Stream&& other) = delete;
+      Bzip2_Decompression_Stream& operator=(const Bzip2_Decompression_Stream& other) = delete;
+      Bzip2_Decompression_Stream& operator=(Bzip2_Decompression_Stream&& other) = delete;
+
+      ~Bzip2_Decompression_Stream() override { BZ2_bzDecompressEnd(streamp()); }
 
       bool run(uint32_t) override {
          int rc = BZ2_bzDecompress(streamp());
 
-         if(rc != BZ_OK && rc != BZ_STREAM_END)
+         if(rc != BZ_OK && rc != BZ_STREAM_END) {
             throw Compression_Error("BZ2_bzDecompress", ErrorType::Bzip2Error, rc);
+         }
 
          return (rc == BZ_STREAM_END);
       }
diff --git a/src/lib/compression/compress_utils.cpp b/src/lib/compression/compress_utils.cpp
index efd608507..67d98ce68 100644
--- a/src/lib/compression/compress_utils.cpp
+++ b/src/lib/compression/compress_utils.cpp
@@ -22,7 +22,7 @@ void* Compression_Alloc_Info::do_malloc(size_t n, size_t size) {
       return nullptr;
    }
 
-   void* ptr = std::calloc(n, size);
+   void* ptr = std::calloc(n, size);  // NOLINT(*-no-malloc)
 
    /*
    * Return null rather than throwing here as we are being called by a
@@ -43,11 +43,12 @@ void Compression_Alloc_Info::do_free(void* ptr) {
    if(ptr) {
       auto i = m_current_allocs.find(ptr);
 
-      if(i == m_current_allocs.end())
+      if(i == m_current_allocs.end()) {
          throw Internal_Error("Compression_Alloc_Info::free got pointer not allocated by us");
+      }
 
       secure_scrub_memory(ptr, i->second);
-      std::free(ptr);
+      std::free(ptr);  // NOLINT(*-no-malloc)
       m_current_allocs.erase(i);
    }
 }
@@ -69,16 +70,18 @@ void Stream_Compression::process(secure_vector<uint8_t>& buf, size_t offset, uin
       return;
    }
 
-   if(m_buffer.size() < buf.size() + offset)
+   if(m_buffer.size() < buf.size() + offset) {
       m_buffer.resize(buf.size() + offset);
+   }
 
    // If the output buffer has zero length, .data() might return nullptr. This would
    // make some compression algorithms (notably those provided by zlib) fail.
    // Any small positive value works fine, but we choose 32 as it is the smallest power
    // of two that is large enough to hold all the headers and trailers of the common
    // formats, preventing further resizings to make room for output data.
-   if(m_buffer.size() == 0)
+   if(m_buffer.empty()) {
       m_buffer.resize(32);
+   }
 
    m_stream->next_in(buf.data() + offset, buf.size() - offset);
    m_stream->next_out(m_buffer.data() + offset, m_buffer.size() - offset);
@@ -127,8 +130,9 @@ void Stream_Decompression::process(secure_vector<uint8_t>& buf, size_t offset, u
    BOTAN_ASSERT(m_stream, "Initialized");
    BOTAN_ASSERT(buf.size() >= offset, "Offset is sane");
 
-   if(m_buffer.size() < buf.size() + offset)
+   if(m_buffer.size() < buf.size() + offset) {
       m_buffer.resize(buf.size() + offset);
+   }
 
    m_stream->next_in(buf.data() + offset, buf.size() - offset);
    m_stream->next_out(m_buffer.data() + offset, m_buffer.size() - offset);
@@ -169,11 +173,13 @@ void Stream_Decompression::update(secure_vector<uint8_t>& buf, size_t offset) {
 }
 
 void Stream_Decompression::finish(secure_vector<uint8_t>& buf, size_t offset) {
-   if(buf.size() != offset || m_stream.get())
+   if(buf.size() != offset || m_stream.get()) {
       process(buf, offset, m_stream->finish_flag());
+   }
 
-   if(m_stream.get())
+   if(m_stream) {
       throw Invalid_State(fmt("{} finished but not at stream end", name()));
+   }
 }
 
 }  // namespace Botan
diff --git a/src/lib/compression/compress_utils.h b/src/lib/compression/compress_utils.h
index ab916530b..f537d3f0d 100644
--- a/src/lib/compression/compress_utils.h
+++ b/src/lib/compression/compress_utils.h
@@ -55,6 +55,11 @@ class Zlib_Style_Stream : public Compression_Stream {
 
       Zlib_Style_Stream() : m_allocs(std::make_unique<Compression_Alloc_Info>()) { clear_mem(&m_stream, 1); }
 
+      Zlib_Style_Stream(const Zlib_Style_Stream& other) = delete;
+      Zlib_Style_Stream(Zlib_Style_Stream&& other) = delete;
+      Zlib_Style_Stream& operator=(const Zlib_Style_Stream& other) = delete;
+      Zlib_Style_Stream& operator=(Zlib_Style_Stream&& other) = delete;
+
       ~Zlib_Style_Stream() { clear_mem(&m_stream, 1); }
 
    protected:
diff --git a/src/lib/compression/compression.cpp b/src/lib/compression/compression.cpp
index 97dd25056..6a2019a29 100644
--- a/src/lib/compression/compression.cpp
+++ b/src/lib/compression/compression.cpp
@@ -28,22 +28,27 @@ namespace Botan {
 //static
 std::unique_ptr<Compression_Algorithm> Compression_Algorithm::create(std::string_view name) {
 #if defined(BOTAN_HAS_ZLIB)
-   if(name == "Zlib" || name == "zlib")
+   if(name == "Zlib" || name == "zlib") {
       return std::make_unique<Zlib_Compression>();
-   if(name == "Gzip" || name == "gzip" || name == "gz")
+   }
+   if(name == "Gzip" || name == "gzip" || name == "gz") {
       return std::make_unique<Gzip_Compression>();
-   if(name == "Deflate" || name == "deflate")
+   }
+   if(name == "Deflate" || name == "deflate") {
       return std::make_unique<Deflate_Compression>();
+   }
 #endif
 
 #if defined(BOTAN_HAS_BZIP2)
-   if(name == "bzip2" || name == "bz2" || name == "Bzip2")
+   if(name == "bzip2" || name == "bz2" || name == "Bzip2") {
       return std::make_unique<Bzip2_Compression>();
+   }
 #endif
 
 #if defined(BOTAN_HAS_LZMA)
-   if(name == "lzma" || name == "xz" || name == "LZMA")
+   if(name == "lzma" || name == "xz" || name == "LZMA") {
       return std::make_unique<LZMA_Compression>();
+   }
 #endif
 
    BOTAN_UNUSED(name);
@@ -61,22 +66,27 @@ std::unique_ptr<Compression_Algorithm> Compression_Algorithm::create_or_throw(st
 //static
 std::unique_ptr<Decompression_Algorithm> Decompression_Algorithm::create(std::string_view name) {
 #if defined(BOTAN_HAS_ZLIB)
-   if(name == "Zlib" || name == "zlib")
+   if(name == "Zlib" || name == "zlib") {
       return std::make_unique<Zlib_Decompression>();
-   if(name == "Gzip" || name == "gzip" || name == "gz")
+   }
+   if(name == "Gzip" || name == "gzip" || name == "gz") {
       return std::make_unique<Gzip_Decompression>();
-   if(name == "Deflate" || name == "deflate")
+   }
+   if(name == "Deflate" || name == "deflate") {
       return std::make_unique<Deflate_Decompression>();
+   }
 #endif
 
 #if defined(BOTAN_HAS_BZIP2)
-   if(name == "bzip2" || name == "bz2" || name == "Bzip2")
+   if(name == "bzip2" || name == "bz2" || name == "Bzip2") {
       return std::make_unique<Bzip2_Decompression>();
+   }
 #endif
 
 #if defined(BOTAN_HAS_LZMA)
-   if(name == "lzma" || name == "xz" || name == "LZMA")
+   if(name == "lzma" || name == "xz" || name == "LZMA") {
       return std::make_unique<LZMA_Decompression>();
+   }
 #endif
 
    BOTAN_UNUSED(name);
diff --git a/src/lib/compression/lzma/lzma.cpp b/src/lib/compression/lzma/lzma.cpp
index 0d7f18037..defbc1ba9 100644
--- a/src/lib/compression/lzma/lzma.cpp
+++ b/src/lib/compression/lzma/lzma.cpp
@@ -27,13 +27,19 @@ class LZMA_Stream : public Zlib_Style_Stream<lzma_stream, uint8_t> {
          streamp()->allocator = &m_allocator;
       }
 
-      ~LZMA_Stream() { ::lzma_end(streamp()); }
+      ~LZMA_Stream() override { ::lzma_end(streamp()); }
+
+      LZMA_Stream(const LZMA_Stream& other) = delete;
+      LZMA_Stream(LZMA_Stream&& other) = delete;
+      LZMA_Stream& operator=(const LZMA_Stream& other) = delete;
+      LZMA_Stream& operator=(LZMA_Stream&& other) = delete;
 
       bool run(uint32_t flags) override {
          lzma_ret rc = ::lzma_code(streamp(), static_cast<lzma_action>(flags));
 
-         if(rc != LZMA_OK && rc != LZMA_STREAM_END)
+         if(rc != LZMA_OK && rc != LZMA_STREAM_END) {
             throw Compression_Error("lzma_code", ErrorType::LzmaError, rc);
+         }
 
          return (rc == LZMA_STREAM_END);
       }
@@ -51,15 +57,17 @@ class LZMA_Stream : public Zlib_Style_Stream<lzma_stream, uint8_t> {
 class LZMA_Compression_Stream final : public LZMA_Stream {
    public:
       explicit LZMA_Compression_Stream(size_t level) {
-         if(level == 0)
+         if(level == 0) {
             level = 6;  // default
-         else if(level > 9)
+         } else if(level > 9) {
             level = 9;  // clamp to maximum allowed value
+         }
 
          lzma_ret rc = ::lzma_easy_encoder(streamp(), static_cast<uint32_t>(level), LZMA_CHECK_CRC64);
 
-         if(rc != LZMA_OK)
+         if(rc != LZMA_OK) {
             throw Compression_Error("lzam_easy_encoder", ErrorType::LzmaError, rc);
+         }
       }
 };
 
@@ -68,8 +76,9 @@ class LZMA_Decompression_Stream final : public LZMA_Stream {
       LZMA_Decompression_Stream() {
          lzma_ret rc = ::lzma_stream_decoder(streamp(), UINT64_MAX, LZMA_TELL_UNSUPPORTED_CHECK);
 
-         if(rc != LZMA_OK)
+         if(rc != LZMA_OK) {
             throw Compression_Error("lzma_stream_decoder", ErrorType::LzmaError, rc);
+         }
       }
 };
 
diff --git a/src/lib/compression/zlib/zlib.cpp b/src/lib/compression/zlib/zlib.cpp
index cde9f1d0d..596c05132 100644
--- a/src/lib/compression/zlib/zlib.cpp
+++ b/src/lib/compression/zlib/zlib.cpp
@@ -32,10 +32,11 @@ class Zlib_Stream : public Zlib_Style_Stream<z_stream, Bytef, unsigned int> {
       uint32_t finish_flag() const override { return Z_FINISH; }
 
       int compute_window_bits(int wbits, int wbits_offset) const {
-         if(wbits_offset == -1)
+         if(wbits_offset == -1) {
             return -wbits;
-         else
+         } else {
             return wbits + wbits_offset;
+         }
       }
 };
 
@@ -44,24 +45,32 @@ class Zlib_Compression_Stream : public Zlib_Stream {
       Zlib_Compression_Stream(size_t level, int wbits, int wbits_offset = 0) {
          wbits = compute_window_bits(wbits, wbits_offset);
 
-         if(level >= 9)
+         if(level >= 9) {
             level = 9;
-         else if(level == 0)
+         } else if(level == 0) {
             level = 6;
+         }
 
          int rc = ::deflateInit2(streamp(), static_cast<int>(level), Z_DEFLATED, wbits, 8, Z_DEFAULT_STRATEGY);
 
-         if(rc != Z_OK)
+         if(rc != Z_OK) {
             throw Compression_Error("deflateInit2", ErrorType::ZlibError, rc);
+         }
       }
 
-      ~Zlib_Compression_Stream() { ::deflateEnd(streamp()); }
+      ~Zlib_Compression_Stream() override { ::deflateEnd(streamp()); }
+
+      Zlib_Compression_Stream(const Zlib_Compression_Stream& other) = delete;
+      Zlib_Compression_Stream(Zlib_Compression_Stream&& other) = delete;
+      Zlib_Compression_Stream& operator=(const Zlib_Compression_Stream& other) = delete;
+      Zlib_Compression_Stream& operator=(Zlib_Compression_Stream&& other) = delete;
 
       bool run(uint32_t flags) override {
          int rc = ::deflate(streamp(), flags);
 
-         if(rc != Z_OK && rc != Z_STREAM_END && rc != Z_BUF_ERROR)
+         if(rc != Z_OK && rc != Z_STREAM_END && rc != Z_BUF_ERROR) {
             throw Compression_Error("zlib deflate", ErrorType::ZlibError, rc);
+         }
 
          return (rc == Z_STREAM_END);
       }
@@ -72,17 +81,24 @@ class Zlib_Decompression_Stream : public Zlib_Stream {
       Zlib_Decompression_Stream(int wbits, int wbits_offset = 0) {
          int rc = ::inflateInit2(streamp(), compute_window_bits(wbits, wbits_offset));
 
-         if(rc != Z_OK)
+         if(rc != Z_OK) {
             throw Compression_Error("inflateInit2", ErrorType::ZlibError, rc);
+         }
       }
 
-      ~Zlib_Decompression_Stream() { ::inflateEnd(streamp()); }
+      ~Zlib_Decompression_Stream() override { ::inflateEnd(streamp()); }
+
+      Zlib_Decompression_Stream(const Zlib_Decompression_Stream& other) = delete;
+      Zlib_Decompression_Stream(Zlib_Decompression_Stream&& other) = delete;
+      Zlib_Decompression_Stream& operator=(const Zlib_Decompression_Stream& other) = delete;
+      Zlib_Decompression_Stream& operator=(Zlib_Decompression_Stream&& other) = delete;
 
       bool run(uint32_t flags) override {
          int rc = ::inflate(streamp(), flags);
 
-         if(rc != Z_OK && rc != Z_STREAM_END && rc != Z_BUF_ERROR)
+         if(rc != Z_OK && rc != Z_STREAM_END && rc != Z_BUF_ERROR) {
             throw Compression_Error("zlib inflate", ErrorType::ZlibError, rc);
+         }
 
          return (rc == Z_STREAM_END);
       }
@@ -107,8 +123,9 @@ class Gzip_Compression_Stream final : public Zlib_Compression_Stream {
          m_header.time = static_cast<uLong>(hdr_time);
 
          int rc = deflateSetHeader(streamp(), &m_header);
-         if(rc != Z_OK)
+         if(rc != Z_OK) {
             throw Compression_Error("deflateSetHeader", ErrorType::ZlibError, rc);
+         }
       }
 
    private:
diff --git a/src/lib/filters/comp_filter.cpp b/src/lib/filters/comp_filter.cpp
index 1cb70435c..1eeaa3dbe 100644
--- a/src/lib/filters/comp_filter.cpp
+++ b/src/lib/filters/comp_filter.cpp
@@ -26,8 +26,7 @@ Compression_Filter::Compression_Filter(std::string_view type, size_t level, size
    }
 }
 
-Compression_Filter::~Compression_Filter() { /* for unique_ptr */
-}
+Compression_Filter::~Compression_Filter() = default;
 
 std::string Compression_Filter::name() const {
    return m_comp->name();
@@ -71,8 +70,7 @@ Decompression_Filter::Decompression_Filter(std::string_view type, size_t bs) :
    }
 }
 
-Decompression_Filter::~Decompression_Filter() { /* for unique_ptr */
-}
+Decompression_Filter::~Decompression_Filter() = default;
 
 std::string Decompression_Filter::name() const {
    return m_comp->name();
diff --git a/src/scripts/dev_tools/run_clang_tidy.py b/src/scripts/dev_tools/run_clang_tidy.py
index f712bef38..c2c6b07e0 100755
--- a/src/scripts/dev_tools/run_clang_tidy.py
+++ b/src/scripts/dev_tools/run_clang_tidy.py
@@ -112,22 +112,6 @@ disabled_checks = disabled_needs_work + disabled_not_interested
 def create_check_option(enabled, disabled):
     return ','.join(enabled) + ',' + ','.join(['-' + d for d in disabled])
 
-def render_clang_tidy_file(target_dir, enabled, disabled):
-    filepath = os.path.join(target_dir, '.clang-tidy')
-    print(f'regenerating {filepath}')
-    with open(filepath, "w", encoding="utf-8") as clang_tidy_file:
-        clang_tidy_file.writelines([
-            '---\n',
-            f'# This file was automatically generated by {sys.argv[0]} --regenerate-inline-config-file\n',
-            '#\n',
-            '# All manual edits to this file will be lost. Edit the script\n',
-            '# then regenerate this configuration file.\n',
-            '\n',
-            'Checks: >\n'] +
-            [ f'    {check},\n' for check in enabled ] +
-            [ f'    -{check},\n' for check in disabled] +
-            ['---\n'])
-
 def load_compile_commands(build_dir):
     compile_commands_file = os.path.join(build_dir, 'compile_commands.json')
     compile_commands = open(compile_commands_file, encoding='utf8').read()
@@ -181,7 +165,7 @@ def file_matches(file, args):
             return True
     return False
 
-def main(args = None): # pylint: disable=too-many-return-statements
+def main(args = None):
     if args is None:
         args = sys.argv
 
@@ -192,7 +176,6 @@ def main(args = None): # pylint: disable=too-many-return-statements
     parser.add_option('--fixit', action='store_true', default=False)
     parser.add_option('--build-dir', default='build')
     parser.add_option('--list-checks', action='store_true', default=False)
-    parser.add_option('--regenerate-inline-config-file', action='store_true', default=False)
     parser.add_option('--fast-checks-only', action='store_true', default=False)
     parser.add_option('--only-changed-files', action='store_true', default=False)
     parser.add_option('--only-matching', metavar='REGEX', default='.*')
@@ -240,10 +223,6 @@ def main(args = None): # pylint: disable=too-many-return-statements
         print(run_command(['clang-tidy', '-list-checks', '-checks', check_config]), end='')
         return 0
 
-    if options.regenerate_inline_config_file:
-        render_clang_tidy_file('src', enabled_checks, disabled_checks)
-        return 0
-
     pool = ThreadPool(jobs)
 
     start_time = time.time()


Test patch:
diff --git a/src/tests/test_compression.cpp b/src/tests/test_compression.cpp
index a3278d448..633cef3df 100644
--- a/src/tests/test_compression.cpp
+++ b/src/tests/test_compression.cpp
@@ -16,7 +16,7 @@ namespace Botan_Tests {
 
 namespace {
 
-const char* text_str =
+const char* const COMPRESSION_TEST_TEXT =
    "'Twas brillig, and the slithy toves"
    "Did gyre and gimble in the wabe:"
    "All mimsy were the borogoves,"
@@ -56,7 +56,7 @@ class Compression_Tests final : public Test {
    public:
       std::vector<Test::Result> run() override {
          std::vector<Test::Result> results;
-         const size_t text_len = std::strlen(text_str);
+         const size_t text_len = std::strlen(COMPRESSION_TEST_TEXT);
 
          for(std::string algo : {"zlib", "deflate", "gzip", "bz2", "lzma"}) {
             try {
@@ -79,7 +79,7 @@ class Compression_Tests final : public Test {
                const Botan::secure_vector<uint8_t> random_binary = Test::rng().random_vec(text_len);
                const Botan::secure_vector<uint8_t> short_text = {'f', 'o', 'o', '\n'};
 
-               const uint8_t* textb = reinterpret_cast<const uint8_t*>(text_str);
+               const uint8_t* textb = reinterpret_cast<const uint8_t*>(COMPRESSION_TEST_TEXT);
                const Botan::secure_vector<uint8_t> text(textb, textb + text_len);
 
                const size_t c1_e = run_compression(result, 1, *c, *d, empty);