diff --git a/.clang-tidy b/.clang-tidy index d35209e4b..f3787782c 100644 --- a/.clang-tidy +++ b/.clang-tidy @@ -10,12 +10,21 @@ Checks: >- -cppcoreguidelines-avoid-magic-numbers, -cppcoreguidelines-non-private-member-variables-in-classes, -cppcoreguidelines-owning-memory, - -cppcoreguidelines-pro-bounds*, + -cppcoreguidelines-pro-bounds-array-to-pointer-decay, + -cppcoreguidelines-pro-bounds-constant-array-index, + -cppcoreguidelines-pro-bounds-pointer-arithmetic, -cppcoreguidelines-pro-type-vararg, -cppcoreguidelines-avoid-c-arrays, -cppcoreguidelines-macro-to-enum, google*, -google-build-using-namespace, + hicpp*, + -hicpp-avoid-c-arrays, + -hicpp-multiway-paths-covered, + -hicpp-no-array-decay, + -hicpp-no-malloc, + -hicpp-signed-bitwise, + -hicpp-vararg, misc*, -misc-no-recursion, -misc-non-private-member-variables-in-classes, @@ -41,6 +50,7 @@ WarningsAsErrors: >- clang-analyzer*, cppcoreguidelines*, google*, + hicpp*, misc*, modernize*, performance*, diff --git a/src/send-cmio-response.cpp b/src/send-cmio-response.cpp index 8455f36cb..566cdd7c0 100644 --- a/src/send-cmio-response.cpp +++ b/src/send-cmio-response.cpp @@ -17,7 +17,7 @@ /// \file /// \brief This file is be converted to Solidity by the machine-solidity-step. -// NOLINTBEGIN(google-readability-casting,misc-const-correctness,modernize-use-auto) +// NOLINTBEGIN(google-readability-casting,misc-const-correctness,modernize-use-auto,hicpp-use-auto) #include @@ -66,4 +66,4 @@ template void send_cmio_response(record_state_access &a, uint16_t reason, const template void send_cmio_response(replay_state_access &a, uint16_t reason, const unsigned char *data, uint32 length); } // namespace cartesi -// NOLINTEND(google-readability-casting,misc-const-correctness,modernize-use-auto) +// NOLINTEND(google-readability-casting,misc-const-correctness,modernize-use-auto,hicpp-use-auto) diff --git a/src/uarch-reset-state.cpp b/src/uarch-reset-state.cpp index 70c7ec693..053f8a270 100644 --- a/src/uarch-reset-state.cpp +++ b/src/uarch-reset-state.cpp @@ -17,7 +17,7 @@ /// \file /// \brief This file is be converted to Solidity by the machine-solidity-step. -// NOLINTBEGIN(google-readability-casting,misc-const-correctness,modernize-use-auto) +// NOLINTBEGIN(google-readability-casting,misc-const-correctness,modernize-use-auto,hicpp-use-auto) #include @@ -45,4 +45,4 @@ template void uarch_reset_state(uarch_record_state_access &a); template void uarch_reset_state(uarch_replay_state_access &a); } // namespace cartesi -// NOLINTEND(google-readability-casting,misc-const-correctness,modernize-use-auto) +// NOLINTEND(google-readability-casting,misc-const-correctness,modernize-use-auto,hicpp-use-auto) diff --git a/src/uarch-step.cpp b/src/uarch-step.cpp index 87c5cce65..5c5e118bf 100644 --- a/src/uarch-step.cpp +++ b/src/uarch-step.cpp @@ -17,7 +17,7 @@ /// \file /// \brief This file is be converted to Solidity by the machine-solidity-step. -// NOLINTBEGIN(google-readability-casting,misc-const-correctness,modernize-use-auto) +// NOLINTBEGIN(google-readability-casting,misc-const-correctness,modernize-use-auto,hicpp-use-auto) #include @@ -1101,4 +1101,4 @@ template UArchStepStatus uarch_step(uarch_record_state_access &a); template UArchStepStatus uarch_step(uarch_replay_state_access &a); } // namespace cartesi -// NOLINTEND(google-readability-casting,misc-const-correctness,modernize-use-auto) +// NOLINTEND(google-readability-casting,misc-const-correctness,modernize-use-auto,hicpp-use-auto) diff --git a/uarch/uarch-run.cpp b/uarch/uarch-run.cpp index b06250ca2..f077771f0 100644 --- a/uarch/uarch-run.cpp +++ b/uarch/uarch-run.cpp @@ -26,6 +26,7 @@ using namespace cartesi; static void set_uarch_halt_flag() { + // NOLINTNEXTLINE(hicpp-no-assembler) asm volatile("mv a7, %0\n" "ecall\n" : // no output diff --git a/uarch/uarch-runtime.cpp b/uarch/uarch-runtime.cpp index 21de8f9b7..38939c03d 100644 --- a/uarch/uarch-runtime.cpp +++ b/uarch/uarch-runtime.cpp @@ -28,10 +28,10 @@ extern "C" void __cxa_pure_virtual() { abort(); } -// NOLINTNEXTLINE(cert-dcl54-cpp,misc-new-delete-overloads) +// NOLINTNEXTLINE(cert-dcl54-cpp,misc-new-delete-overloads,hicpp-new-delete-operators) void operator delete(void * /*ptr*/) {} -// NOLINTNEXTLINE(cert-dcl54-cpp,misc-new-delete-overloads) +// NOLINTNEXTLINE(cert-dcl54-cpp,misc-new-delete-overloads,hicpp-new-delete-operators) void operator delete(void * /*ptr*/, size_t /*size*/) {} // NOLINTNEXTLINE(bugprone-reserved-identifier,cert-dcl37-c,cert-dcl51-cpp) @@ -82,6 +82,7 @@ extern "C" void *memset(void *ptr, int value, size_t num) { } extern "C" void _putchar(char c) { + // NOLINTNEXTLINE(hicpp-no-assembler) asm volatile("mv a7, %0\n" "mv a6, %1\n" "ecall\n" @@ -93,6 +94,7 @@ extern "C" void _putchar(char c) { } extern "C" NO_RETURN void abort() { + // NOLINTNEXTLINE(hicpp-no-assembler) asm volatile("ebreak" : // no output : // no input