Enable clang-tidy cppcoreguidelines (#2269)

This commit is contained in:
Andrew Gaul 2023-08-15 22:12:33 +09:00 committed by GitHub
parent d1272d296a
commit 6823c5a7ec
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 30 additions and 3 deletions

View File

@ -8,7 +8,24 @@ Checks: '
-bugprone-macro-parentheses,
-bugprone-narrowing-conversions,
-bugprone-unhandled-self-assignment,
cppcoreguidelines-pro-type-cstyle-cast,
cppcoreguidelines-*,
-cppcoreguidelines-avoid-c-arrays,
-cppcoreguidelines-avoid-do-while,
-cppcoreguidelines-avoid-magic-numbers,
-cppcoreguidelines-avoid-non-const-global-variables,
-cppcoreguidelines-init-variables,
-cppcoreguidelines-macro-usage,
-cppcoreguidelines-narrowing-conversions,
-cppcoreguidelines-no-malloc,
-cppcoreguidelines-owning-memory,
-cppcoreguidelines-pro-bounds-array-to-pointer-decay,
-cppcoreguidelines-pro-bounds-constant-array-index,
-cppcoreguidelines-pro-bounds-pointer-arithmetic,
-cppcoreguidelines-pro-type-const-cast,
-cppcoreguidelines-pro-type-member-init,
-cppcoreguidelines-pro-type-reinterpret-cast,
-cppcoreguidelines-pro-type-union-access,
-cppcoreguidelines-pro-type-vararg,
google-*,
-google-build-using-namespace,
-google-readability-casting,

View File

@ -206,9 +206,15 @@ class MpStatFlag
mutable pthread_mutex_t flag_lock;
bool is_lock_init;
bool has_mp_stat;
public:
MpStatFlag();
MpStatFlag(const MpStatFlag&) = delete;
MpStatFlag(MpStatFlag&&) = delete;
~MpStatFlag();
MpStatFlag& operator=(const MpStatFlag&) = delete;
MpStatFlag& operator=(MpStatFlag&&) = delete;
bool Get();
bool Set(bool flag);
};
@ -272,7 +278,11 @@ class SyncFiller
public:
explicit SyncFiller(void* buff = nullptr, fuse_fill_dir_t filler = nullptr);
SyncFiller(const SyncFiller&) = delete;
SyncFiller(SyncFiller&&) = delete;
~SyncFiller();
SyncFiller& operator=(const SyncFiller&) = delete;
SyncFiller& operator=(SyncFiller&&) = delete;
int Fill(const char *name, const struct stat *stbuf, off_t off);
int SufficiencyFill(const std::vector<std::string>& pathlist);

View File

@ -40,7 +40,7 @@ int main(int argc, char *argv[])
}
const char* filepath = argv[1];
off_t size = (off_t)strtoull(argv[2], NULL, 10);
off_t size = static_cast<off_t>(strtoull(argv[2], nullptr, 10));
int fd;
// open file

View File

@ -171,7 +171,7 @@ static bool parse_arguments(int argc, char** argv, strlist_t& files, wbpart_list
while(-1 != (opt = getopt(argc, argv, "f:p:"))){
switch(opt){
case 'f':
files.push_back(std::string(optarg));
files.emplace_back(optarg);
break;
case 'p':
if(!parse_write_blocks(optarg, wbparts, max_size)){