Skip to content

Commit

Permalink
refactor: include hicpp lint checks
Browse files Browse the repository at this point in the history
  • Loading branch information
edubart committed Oct 16, 2024
1 parent b35d1cc commit 04bab77
Show file tree
Hide file tree
Showing 6 changed files with 22 additions and 9 deletions.
12 changes: 11 additions & 1 deletion .clang-tidy
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand All @@ -41,6 +50,7 @@ WarningsAsErrors: >-
clang-analyzer*,
cppcoreguidelines*,
google*,
hicpp*,
misc*,
modernize*,
performance*,
Expand Down
4 changes: 2 additions & 2 deletions src/send-cmio-response.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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 <stdexcept>

Expand Down Expand Up @@ -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)
4 changes: 2 additions & 2 deletions src/uarch-reset-state.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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 <stdexcept>

Expand Down Expand Up @@ -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)
4 changes: 2 additions & 2 deletions src/uarch-step.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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 <stdexcept>

Expand Down Expand Up @@ -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)
1 change: 1 addition & 0 deletions uarch/uarch-run.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
6 changes: 4 additions & 2 deletions uarch/uarch-runtime.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down Expand Up @@ -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"
Expand All @@ -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
Expand Down

0 comments on commit 04bab77

Please sign in to comment.