Skip to content

Commit

Permalink
Fix some warnings from msys2 build
Browse files Browse the repository at this point in the history
  • Loading branch information
caryr committed Dec 28, 2024
1 parent abaa32f commit 47cf370
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 7 deletions.
6 changes: 3 additions & 3 deletions net_func_eval.cc
Original file line number Diff line number Diff line change
Expand Up @@ -372,7 +372,7 @@ bool NetAssign::eval_func_lval_(const LineInfo&loc,
if (op_) {
for (unsigned idx = 0 ; idx < lpart.len() ; idx += 1) {
long ldx = base + idx;
if (ldx >= 0 && ldx < lval_v.len())
if (ldx >= 0 && (unsigned long)ldx < lval_v.len())
lpart.set(idx, lval_v[ldx]);
}
eval_func_lval_op_(loc, lpart, rval_v);
Expand All @@ -381,7 +381,7 @@ bool NetAssign::eval_func_lval_(const LineInfo&loc,
}
for (unsigned idx = 0 ; idx < lpart.len() ; idx += 1) {
long ldx = base + idx;
if (ldx >= 0 && ldx < lval_v.len())
if (ldx >= 0 && (unsigned long)ldx < lval_v.len())
lval_v.set(idx+base, lpart[idx]);
}

Expand Down Expand Up @@ -1071,7 +1071,7 @@ NetExpr* NetESelect::evaluate_function(const LineInfo&loc,
verinum res (verinum::Vx, expr_width());
for (unsigned idx = 0 ; idx < res.len() ; idx += 1) {
long sdx = base + idx;
if (sdx >= 0 && sdx < sub.len())
if (sdx >= 0 && (unsigned long)sdx < sub.len())
res.set(idx, sub[sdx]);
}

Expand Down
5 changes: 3 additions & 2 deletions netenum.cc
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2010-2014 Stephen Williams ([email protected])
* Copyright (c) 2010-2024 Stephen Williams ([email protected])
*
* This source code is free software; you can redistribute it
* and/or modify it in source code form under the terms of the GNU
Expand Down Expand Up @@ -65,7 +65,8 @@ bool netenum_t::insert_name(size_t name_idx, perm_string name, const verinum&val
{
std::pair<std::map<perm_string,verinum>::iterator, bool> res;

assert(val.has_len() && val.len() == packed_width());
assert(val.has_len() && packed_width() >= 0 &&
val.len() == (unsigned long)packed_width());

// Insert a map of the name to the value. This also gets a
// flag that returns true if the name is unique, or false
Expand Down
3 changes: 2 additions & 1 deletion netlist.cc
Original file line number Diff line number Diff line change
Expand Up @@ -2318,7 +2318,8 @@ NetEConst::NetEConst(ivl_type_t type, const verinum&val)
: NetExpr(type), value_(val)
{
ivl_assert(*this, type->packed());
ivl_assert(*this, type->packed_width() == val.len());
ivl_assert(*this, type->packed_width() >= 0 &&
(unsigned long)type->packed_width() == val.len());
ivl_assert(*this, type->get_signed() == val.has_sign());
}

Expand Down
3 changes: 2 additions & 1 deletion vpi_modules.cc
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2019-2021 Martin Whitaker ([email protected])
* Copyright (c) 2019-2024 Martin Whitaker ([email protected])
*
* This source code is free software; you can redistribute it
* and/or modify it in source code form under the terms of the GNU
Expand Down Expand Up @@ -220,6 +220,7 @@ vpip_routines_s vpi_routines = {
.chk_error = vpi_chk_error,
.compare_objects = vpi_compare_objects,
.free_object = vpi_free_object,
.release_handle = vpi_release_handle,
.get_vlog_info = vpi_get_vlog_info,
.vcontrol = vpi_vcontrol,
.fopen = vpi_fopen,
Expand Down

0 comments on commit 47cf370

Please sign in to comment.