1
0
mirror of https://github.com/upx/upx.git synced 2025-08-11 22:52:30 +08:00

all: add support for clang-tidy

This commit is contained in:
Markus F.X.J. Oberhumer
2023-07-07 21:40:36 +02:00
parent c79aa6ad8a
commit d7754a97c7
5 changed files with 22 additions and 9 deletions

6
.clang-tidy Normal file
View File

@ -0,0 +1,6 @@
# for clang-tidy-16 from https://clang.llvm.org/extra/clang-tidy/
---
Checks: 'bugprone-exception-*,clang-analyzer-*,-clang-analyzer-optin.performance.Padding,-clang-analyzer-security.insecureAPI.strcpy,clang-diagnostics-*'
FormatStyle: file
HeaderFilterRegex: '.*'
...

View File

@ -52,7 +52,9 @@
#pragma clang diagnostic ignored "-Wtautological-constant-compare"
#endif
// NOLINTBEGIN(bugprone-exception-escape)
#include <doctest/doctest/parts/doctest.cpp>
// NOLINTEND(bugprone-exception-escape)
#endif // DOCTEST_CONFIG_DISABLE

View File

@ -207,9 +207,12 @@ error:
**************************************************************************/
// ensure proper nullptr usage
// TODO later: examine why we need this in the first place
#include <cstddef>
#undef NULL
// NOLINTBEGIN(clang-analyzer-optin.cplusplus.*)
#define NULL nullptr
// NOLINTEND(clang-analyzer-optin.cplusplus.*)
#if defined(__GNUC__)
#undef __null
#define __null nullptr

View File

@ -27,8 +27,10 @@
#include "../conf.h"
#include "compress.h"
#include "../util/membuffer.h"
// NOLINTBEGIN(clang-analyzer-optin.performance.Padding)
#include <zlib/zlib.h>
#include <zlib/deflate.h>
// NOLINTEND(clang-analyzer-optin.performance.Padding)
void zlib_compress_config_t::reset() noexcept {
mem_clear(this);

View File

@ -417,16 +417,16 @@ protected:
struct upx_rleaf;
MemBuffer mb_start;
const byte *start;
byte *newstart;
upx_rnode *root;
upx_rleaf *head;
upx_rleaf *current;
unsigned dsize;
unsigned ssize;
const byte *start = nullptr;
byte *newstart = nullptr;
upx_rnode *root = nullptr;
upx_rleaf *head = nullptr;
upx_rleaf *current = nullptr;
unsigned dsize = 0;
unsigned ssize = 0;
const byte *ibufstart;
const byte *ibufend;
const byte *ibufstart = nullptr;
const byte *ibufend = nullptr;
void check(const res_dir *, unsigned);
upx_rnode *convert(const void *, upx_rnode *, unsigned);