Skip to content

Commit

Permalink
clang-tidy: minor fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
janweinstock committed Dec 21, 2024
1 parent 909f851 commit 50be680
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 12 deletions.
6 changes: 3 additions & 3 deletions src/vcml/debugging/gdbserver.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -311,9 +311,9 @@ string gdbserver::handle_xfer(const string& cmd) {
if (args.size() != 5)
return ERR_COMMAND;

string object = args[1];
string read = args[2];
string annex = args[3];
const string& object = args[1];
const string& read = args[2];
const string& annex = args[3];

if (read != "read")
return ERR_COMMAND;
Expand Down
2 changes: 1 addition & 1 deletion src/vcml/debugging/vspserver.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -441,7 +441,7 @@ string vspserver::handle_geta(const string& cmd) {
if (args.size() < 2)
return mkstr("E,insufficient arguments %zu", args.size());

string name = args[1];
const string& name = args[1];
sc_attr_base* attr = find_attribute(name);
if (attr == nullptr)
return mkstr("E,attribute '%s' not found", name.c_str());
Expand Down
4 changes: 2 additions & 2 deletions src/vcml/models/ethernet/backend_slirp.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -263,8 +263,8 @@ void slirp_network::host_port_forwarding(const string& desc) {
if (args.size() != 4)
VCML_ERROR("invalid port forwarding: '%s'", desc.c_str());

string protocol = args[0];
string guest_addr = args[1];
const string& protocol = args[0];
const string& guest_addr = args[1];
u16 guest_port = from_string<u16>(args[2]);
u16 host_port = from_string<u16>(args[3]);

Expand Down
14 changes: 8 additions & 6 deletions test/models/can_mcan.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -10,17 +10,17 @@

#include "testing.h"

MATCHER_P(TxEvFIFOElemEq, n, "Equality matcher for TX event FIFO elements") {
MATCHER_P(fifo_match, n, "Equality matcher for TX event FIFO elements") {
return (arg[0] == n[0]) && ((arg[1] | bit(22)) == n[1]);
}

MATCHER_P(CanFrameEq, n, "Equality matcher for CAN frames") {
MATCHER_P(can_frame_match, n, "Equality matcher for CAN frames") {
return (arg.msgid == n.msgid) && (arg.dlc == n.dlc) &&
std::equal(std::begin(arg.data), std::end(arg.data),
std::begin(n.data));
}

MATCHER_P(CanFrameFDEq, n, "Equality matcher for CAN FD frames") {
MATCHER_P(canfd_frame_match, n, "Equality matcher for CAN FD frames") {
return (arg.msgid == n.msgid) && (arg.dlc == n.dlc) &&
(arg.flags == n.flags) &&
std::equal(std::begin(arg.data), std::end(arg.data),
Expand Down Expand Up @@ -275,7 +275,7 @@ class m_can_bench : public test_base
u64 addr = addr_msgram.start + TX_EVFIFO_START_ADDR +
get_field<TXEFS_EFGI>(txefs) * TX_EFIFO_ELEM_SZ;
EXPECT_OK(out.readw(addr, evfifo)) << "cannot read from tx evfifo";
EXPECT_THAT(test, TxEvFIFOElemEq(evfifo))
EXPECT_THAT(test, fifo_match(evfifo))
<< "tx evfifo data is not matching";

// acknowledge read & check new fifo fill level
Expand Down Expand Up @@ -319,7 +319,8 @@ class m_can_bench : public test_base

can_frame chk = {};
ASSERT_TRUE(can.can_rx_pop(chk));
EXPECT_THAT(test, CanFrameEq(chk)) << "tx can frames to not match";
EXPECT_THAT(test, can_frame_match(chk))
<< "tx can frames to not match";
EXPECT_TRUE(irq0.read()) << "irq did not get raised";
check_irq(IR_TEFN | IR_TC);
EXPECT_FALSE(irq0.read()) << "irq did not get cleared";
Expand Down Expand Up @@ -352,7 +353,8 @@ class m_can_bench : public test_base

can_frame chk = {};
ASSERT_TRUE(can.can_rx_pop(chk));
EXPECT_THAT(test, CanFrameFDEq(chk)) << "tx can frames to not match";
EXPECT_THAT(test, canfd_frame_match(chk))
<< "tx can frames to not match";
EXPECT_TRUE(irq0.read()) << "irq did not get raised";
check_irq(IR_TEFN | IR_TC);
EXPECT_FALSE(irq0.read()) << "irq did not get cleared";
Expand Down

0 comments on commit 50be680

Please sign in to comment.