Fix remaining marked as done const* cppcheck warnings

This commit is contained in:
Konstantinos Margaritis
2024-05-15 10:52:31 +03:00
parent 93239afa3a
commit 129df24422
23 changed files with 54 additions and 54 deletions

View File

@@ -401,7 +401,7 @@ char castleFindMatch(const struct Castle *c, const u64a begin, const u64a end,
static really_inline
u64a subCastleNextMatch(const struct Castle *c, const void *full_state,
void *stream_state, const u64a loc,
const void *stream_state, const u64a loc,
const u32 subIdx) {
DEBUG_PRINTF("subcastle %u\n", subIdx);
const struct SubCastle *sub = getSubCastle(c, subIdx);
@@ -883,7 +883,7 @@ char nfaExecCastle_Q2(const struct NFA *n, struct mq *q, s64a end) {
}
static
s64a castleLastKillLoc(const struct Castle *c, struct mq *q) {
s64a castleLastKillLoc(const struct Castle *c, const struct mq *q) {
assert(q_cur_type(q) == MQE_START);
assert(q_last_type(q) == MQE_END);
s64a sp = q_cur_loc(q);

View File

@@ -132,7 +132,7 @@ void GoughSSAVarMin::replace_input(GoughSSAVar *old_v, GoughSSAVar *new_v) {
}
static
void translateRawReports(UNUSED GoughGraph &cfg, UNUSED const raw_som_dfa &raw,
void translateRawReports(UNUSED const GoughGraph &cfg, UNUSED const raw_som_dfa &raw,
const flat_map<u32, GoughSSAVarJoin *> &joins_at_s,
UNUSED GoughVertex s,
const set<som_report> &reports_in,
@@ -433,6 +433,7 @@ unique_ptr<GoughGraph> makeCFG(const raw_som_dfa &raw) {
}
static
// cppcheck-suppress constParameterReference
void copy_propagate_report_set(vector<pair<ReportID, GoughSSAVar *> > &rep) {
vector<pair<ReportID, GoughSSAVar *> >::iterator it = rep.begin();
while (it != rep.end()) {
@@ -650,8 +651,8 @@ GoughSSAVar *GoughSSAVarJoin::get_input(const GoughEdge &prev) const {
return nullptr;
}
const flat_set<GoughEdge> &GoughSSAVarJoin::get_edges_for_input(
GoughSSAVar *input) const {
// cppcheck-suppress constParameterPointer
const flat_set<GoughEdge> &GoughSSAVarJoin::get_edges_for_input(GoughSSAVar *input) const {
return input_map.at(input);
}

View File

@@ -278,7 +278,7 @@ set<const GoughSSAVar *> live_during(GoughSSAVar *def, const GoughGraph &g,
template<typename VarP>
void set_initial_slots(const vector<VarP> &vars, u32 *next_slot) {
for (auto &var : vars) {
for (const auto &var : vars) {
assert(var->slot == INVALID_SLOT);
var->slot = (*next_slot)++;
}

View File

@@ -56,7 +56,7 @@ extern "C"
char gf_name##_Q(const struct NFA *n, struct mq *q, s64a end); \
char gf_name##_Q2(const struct NFA *n, struct mq *q, s64a end); \
char gf_name##_QR(const struct NFA *n, struct mq *q, ReportID report); \
char gf_name##_reportCurrent(const struct NFA *n, struct mq *q); \
char gf_name##_reportCurrent(const struct NFA *n, const struct mq *q); \
char gf_name##_inAccept(const struct NFA *n, ReportID report, \
struct mq *q); \
char gf_name##_inAnyAccept(const struct NFA *n, struct mq *q); \

View File

@@ -927,7 +927,7 @@ char JOIN(LIMEX_API_ROOT, _testEOD)(const struct NFA *n, const char *state,
context);
}
char JOIN(LIMEX_API_ROOT, _reportCurrent)(const struct NFA *n, struct mq *q) {
char JOIN(LIMEX_API_ROOT, _reportCurrent)(const struct NFA *n, const struct mq *q) {
const IMPL_NFA_T *limex = getImplNfa(n);
REPORTCURRENT_FN(limex, q);
return 1;

View File

@@ -534,7 +534,7 @@ double leakiness(const RdfaGraph &g, dfa_info &info,
static
dstate_id_t find_sheng_states(dfa_info &info,
map<dstate_id_t, AccelScheme> &accel_escape_info,
const map<dstate_id_t, AccelScheme> &accel_escape_info,
size_t max_sheng_states) {
RdfaGraph g(info.raw);
auto cyclics = find_vertices_in_cycles(g);

View File

@@ -334,14 +334,14 @@ void fillAccelOut(const map<dstate_id_t, AccelScheme> &accel_escape_info,
template <typename T>
static
u8 getShengState(UNUSED dstate &state, UNUSED dfa_info &info,
UNUSED map<dstate_id_t, AccelScheme> &accelInfo) {
u8 getShengState(UNUSED const dstate &state, UNUSED dfa_info &info,
UNUSED const map<dstate_id_t, AccelScheme> &accelInfo) {
return 0;
}
template <>
u8 getShengState<sheng>(dstate &state, dfa_info &info,
map<dstate_id_t, AccelScheme> &accelInfo) {
u8 getShengState<sheng>(const dstate &state, dfa_info &info,
const map<dstate_id_t, AccelScheme> &accelInfo) {
u8 s = state.impl_id;
if (!state.reports.empty()) {
s |= SHENG_STATE_ACCEPT;
@@ -356,8 +356,8 @@ u8 getShengState<sheng>(dstate &state, dfa_info &info,
}
template <>
u8 getShengState<sheng32>(dstate &state, dfa_info &info,
map<dstate_id_t, AccelScheme> &accelInfo) {
u8 getShengState<sheng32>(const dstate &state, dfa_info &info,
const map<dstate_id_t, AccelScheme> &accelInfo) {
u8 s = state.impl_id;
if (!state.reports.empty()) {
s |= SHENG32_STATE_ACCEPT;
@@ -372,8 +372,8 @@ u8 getShengState<sheng32>(dstate &state, dfa_info &info,
}
template <>
u8 getShengState<sheng64>(dstate &state, dfa_info &info,
UNUSED map<dstate_id_t, AccelScheme> &accelInfo) {
u8 getShengState<sheng64>(const dstate &state, dfa_info &info,
UNUSED const map<dstate_id_t, AccelScheme> &accelInfo) {
u8 s = state.impl_id;
if (!state.reports.empty()) {
s |= SHENG64_STATE_ACCEPT;
@@ -409,8 +409,8 @@ void fillAccelAux(struct NFA *n, dfa_info &info,
template <typename T>
static
void populateBasicInfo(UNUSED struct NFA *n, UNUSED dfa_info &info,
UNUSED map<dstate_id_t, AccelScheme> &accelInfo,
void populateBasicInfo(UNUSED struct NFA *n, UNUSED dfa_info &info, // cppcheck-suppress constParameterPointer
UNUSED const map<dstate_id_t, AccelScheme> &accelInfo,
UNUSED u32 aux_offset, UNUSED u32 report_offset,
UNUSED u32 accel_offset, UNUSED u32 total_size,
UNUSED u32 dfa_size) {
@@ -418,7 +418,7 @@ void populateBasicInfo(UNUSED struct NFA *n, UNUSED dfa_info &info,
template <>
void populateBasicInfo<sheng>(struct NFA *n, dfa_info &info,
map<dstate_id_t, AccelScheme> &accelInfo,
const map<dstate_id_t, AccelScheme> &accelInfo,
u32 aux_offset, u32 report_offset,
u32 accel_offset, u32 total_size,
u32 dfa_size) {
@@ -443,7 +443,7 @@ void populateBasicInfo<sheng>(struct NFA *n, dfa_info &info,
template <>
void populateBasicInfo<sheng32>(struct NFA *n, dfa_info &info,
map<dstate_id_t, AccelScheme> &accelInfo,
const map<dstate_id_t, AccelScheme> &accelInfo,
u32 aux_offset, u32 report_offset,
u32 accel_offset, u32 total_size,
u32 dfa_size) {
@@ -468,7 +468,7 @@ void populateBasicInfo<sheng32>(struct NFA *n, dfa_info &info,
template <>
void populateBasicInfo<sheng64>(struct NFA *n, dfa_info &info,
map<dstate_id_t, AccelScheme> &accelInfo,
const map<dstate_id_t, AccelScheme> &accelInfo,
u32 aux_offset, u32 report_offset,
u32 accel_offset, u32 total_size,
u32 dfa_size) {
@@ -551,19 +551,19 @@ void fillSingleReport(NFA *n, ReportID r_id) {
template <typename T>
static
bool createShuffleMasks(UNUSED T *s, UNUSED dfa_info &info,
UNUSED map<dstate_id_t, AccelScheme> &accelInfo) {
bool createShuffleMasks(UNUSED T *s, UNUSED dfa_info &info, // cppcheck-suppress constParameterPointer
UNUSED const map<dstate_id_t, AccelScheme> &accelInfo) {
return true;
}
template <>
bool createShuffleMasks<sheng>(sheng *s, dfa_info &info,
map<dstate_id_t, AccelScheme> &accelInfo) {
const map<dstate_id_t, AccelScheme> &accelInfo) {
for (u16 chr = 0; chr < 256; chr++) {
u8 buf[16] = {0};
for (dstate_id_t idx = 0; idx < info.size(); idx++) {
auto &succ_state = info.next(idx, chr);
const auto &succ_state = info.next(idx, chr);
buf[idx] = getShengState<sheng>(succ_state, info, accelInfo);
}
@@ -577,13 +577,13 @@ bool createShuffleMasks<sheng>(sheng *s, dfa_info &info,
template <>
bool createShuffleMasks<sheng32>(sheng32 *s, dfa_info &info,
map<dstate_id_t, AccelScheme> &accelInfo) {
const map<dstate_id_t, AccelScheme> &accelInfo) {
for (u16 chr = 0; chr < 256; chr++) {
u8 buf[64] = {0};
assert(info.size() <= 32);
for (dstate_id_t idx = 0; idx < info.size(); idx++) {
auto &succ_state = info.next(idx, chr);
const auto &succ_state = info.next(idx, chr);
buf[idx] = getShengState<sheng32>(succ_state, info, accelInfo);
buf[32 + idx] = buf[idx];
@@ -598,13 +598,13 @@ bool createShuffleMasks<sheng32>(sheng32 *s, dfa_info &info,
template <>
bool createShuffleMasks<sheng64>(sheng64 *s, dfa_info &info,
map<dstate_id_t, AccelScheme> &accelInfo) {
const map<dstate_id_t, AccelScheme> &accelInfo) {
for (u16 chr = 0; chr < 256; chr++) {
u8 buf[64] = {0};
assert(info.size() <= 64);
for (dstate_id_t idx = 0; idx < info.size(); idx++) {
auto &succ_state = info.next(idx, chr);
const auto &succ_state = info.next(idx, chr);
if (accelInfo.find(info.raw_id(succ_state.impl_id))
!= accelInfo.end()) {