Fix some cppcheck warnings and bugs
This commit is contained in:
parent
2aaa050b7c
commit
399384d81b
|
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
* Copyright (c) 1998-2010 Stephen Williams (steve@icarus.com)
|
* Copyright (c) 1998-2015 Stephen Williams (steve@icarus.com)
|
||||||
*
|
*
|
||||||
* This source code is free software; you can redistribute it
|
* This source code is free software; you can redistribute it
|
||||||
* and/or modify it in source code form under the terms of the GNU
|
* and/or modify it in source code form under the terms of the GNU
|
||||||
|
|
@ -32,6 +32,7 @@ Module::Module(LexicalScope*parent, perm_string n)
|
||||||
{
|
{
|
||||||
library_flag = false;
|
library_flag = false;
|
||||||
is_cell = false;
|
is_cell = false;
|
||||||
|
is_interface = false;
|
||||||
program_block = false;
|
program_block = false;
|
||||||
uc_drive = UCD_NONE;
|
uc_drive = UCD_NONE;
|
||||||
timescale_warn_done = false;
|
timescale_warn_done = false;
|
||||||
|
|
|
||||||
|
|
@ -1,3 +1,3 @@
|
||||||
// These are correct and are used to find the base (zero) pin.
|
// These are correct and are used to find the base (zero) pin.
|
||||||
thisSubtraction:netlist.h:4976
|
thisSubtraction:netlist.h:4991
|
||||||
thisSubtraction:netlist.h:4985
|
thisSubtraction:netlist.h:5000
|
||||||
|
|
|
||||||
10
elab_expr.cc
10
elab_expr.cc
|
|
@ -1277,7 +1277,6 @@ unsigned PECallFunction::test_width_method_(Design*des, NetScope*scope,
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
perm_string member_name;
|
perm_string member_name;
|
||||||
ivl_type_t member_type = 0;
|
|
||||||
pform_name_t use_path = path_;
|
pform_name_t use_path = path_;
|
||||||
perm_string method_name = peek_tail_name(use_path);
|
perm_string method_name = peek_tail_name(use_path);
|
||||||
use_path.pop_back();
|
use_path.pop_back();
|
||||||
|
|
@ -1317,11 +1316,8 @@ unsigned PECallFunction::test_width_method_(Design*des, NetScope*scope,
|
||||||
|
|
||||||
const netclass_t* class_type = net->class_type();
|
const netclass_t* class_type = net->class_type();
|
||||||
int midx = class_type->property_idx_from_name(member_name);
|
int midx = class_type->property_idx_from_name(member_name);
|
||||||
if (midx >= 0)
|
ivl_type_t member_type = 0;
|
||||||
member_type = class_type->get_prop_type(midx);
|
if (midx >= 0) member_type = class_type->get_prop_type(midx);
|
||||||
else
|
|
||||||
member_type = 0;
|
|
||||||
use_path = tmp_path;
|
|
||||||
|
|
||||||
use_darray = dynamic_cast<const netdarray_t*> (member_type);
|
use_darray = dynamic_cast<const netdarray_t*> (member_type);
|
||||||
|
|
||||||
|
|
@ -3936,7 +3932,7 @@ NetExpr* PEIdent::elaborate_expr(Design*des, NetScope*scope,
|
||||||
if ( !(SYS_TASK_ARG & flags) ) {
|
if ( !(SYS_TASK_ARG & flags) ) {
|
||||||
// I cannot interpret this identifier. Error message.
|
// I cannot interpret this identifier. Error message.
|
||||||
cerr << get_fileline() << ": error: Unable to bind "
|
cerr << get_fileline() << ": error: Unable to bind "
|
||||||
<< (NEED_CONST & flags ? "parameter" : "wire/reg/memory")
|
<< ((NEED_CONST & flags) ? "parameter" : "wire/reg/memory")
|
||||||
<< " `" << path_ << "' in `" << scope_path(scope) << "'"
|
<< " `" << path_ << "' in `" << scope_path(scope) << "'"
|
||||||
<< endl;
|
<< endl;
|
||||||
if (scope->need_const_func()) {
|
if (scope->need_const_func()) {
|
||||||
|
|
|
||||||
|
|
@ -733,12 +733,18 @@ NetNet* NetEConcat::synthesize(Design*des, NetScope*scope, NetExpr*root)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (flag == false) return 0;
|
if (flag == false) {
|
||||||
|
delete[]tmp;
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
ivl_assert(*this, data_type != IVL_VT_NO_TYPE);
|
ivl_assert(*this, data_type != IVL_VT_NO_TYPE);
|
||||||
|
|
||||||
/* If this is a replication of zero just return 0. */
|
/* If this is a replication of zero just return 0. */
|
||||||
if (expr_width() == 0) return 0;
|
if (expr_width() == 0) {
|
||||||
|
delete[]tmp;
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
/* Make a NetNet object to carry the output vector. */
|
/* Make a NetNet object to carry the output vector. */
|
||||||
perm_string path = scope->local_symbol();
|
perm_string path = scope->local_symbol();
|
||||||
|
|
|
||||||
|
|
@ -162,13 +162,13 @@ verinum::V Nexus::driven_value() const
|
||||||
if ((sig->type() == NetNet::SUPPLY0) ||
|
if ((sig->type() == NetNet::SUPPLY0) ||
|
||||||
(sig->type() == NetNet::TRI0)) {
|
(sig->type() == NetNet::TRI0)) {
|
||||||
// Multiple drivers are not currently supported.
|
// Multiple drivers are not currently supported.
|
||||||
ivl_assert(*obj, val == verinum::Vz);
|
ivl_assert(*sig, val == verinum::Vz);
|
||||||
val = verinum::V0;
|
val = verinum::V0;
|
||||||
}
|
}
|
||||||
if ((sig->type() == NetNet::SUPPLY1) ||
|
if ((sig->type() == NetNet::SUPPLY1) ||
|
||||||
(sig->type() == NetNet::TRI1)) {
|
(sig->type() == NetNet::TRI1)) {
|
||||||
// Multiple drivers are not currently supported.
|
// Multiple drivers are not currently supported.
|
||||||
ivl_assert(*obj, val == verinum::Vz);
|
ivl_assert(*sig, val == verinum::Vz);
|
||||||
val = verinum::V1;
|
val = verinum::V1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -222,13 +222,13 @@ verinum Nexus::driven_vector() const
|
||||||
if ((sig->type() == NetNet::SUPPLY0) ||
|
if ((sig->type() == NetNet::SUPPLY0) ||
|
||||||
(sig->type() == NetNet::TRI0)) {
|
(sig->type() == NetNet::TRI0)) {
|
||||||
// Multiple drivers are not currently supported.
|
// Multiple drivers are not currently supported.
|
||||||
ivl_assert(*obj, val.len() == 0);
|
ivl_assert(*sig, val.len() == 0);
|
||||||
val = verinum(verinum::V0, width);
|
val = verinum(verinum::V0, width);
|
||||||
}
|
}
|
||||||
if ((sig->type() == NetNet::SUPPLY1) ||
|
if ((sig->type() == NetNet::SUPPLY1) ||
|
||||||
(sig->type() == NetNet::TRI1)) {
|
(sig->type() == NetNet::TRI1)) {
|
||||||
// Multiple drivers are not currently supported.
|
// Multiple drivers are not currently supported.
|
||||||
ivl_assert(*obj, val.len() == 0);
|
ivl_assert(*sig, val.len() == 0);
|
||||||
val = verinum(verinum::V1, width);
|
val = verinum(verinum::V1, width);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
* Copyright (c) 2000-2013 Stephen Williams (steve@icarus.com)
|
* Copyright (c) 2000-2015 Stephen Williams (steve@icarus.com)
|
||||||
*
|
*
|
||||||
* This source code is free software; you can redistribute it
|
* This source code is free software; you can redistribute it
|
||||||
* and/or modify it in source code form under the terms of the GNU
|
* and/or modify it in source code form under the terms of the GNU
|
||||||
|
|
@ -890,8 +890,8 @@ void Design::add_node(NetNode*net)
|
||||||
|
|
||||||
void Design::del_node(NetNode*net)
|
void Design::del_node(NetNode*net)
|
||||||
{
|
{
|
||||||
assert(net->design_ == this);
|
|
||||||
assert(net != 0);
|
assert(net != 0);
|
||||||
|
assert(net->design_ == this);
|
||||||
|
|
||||||
/* Interact with the Design::functor method by manipulating the
|
/* Interact with the Design::functor method by manipulating the
|
||||||
cur and nxt pointers that it is using. */
|
cur and nxt pointers that it is using. */
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
* Copyright (c) 2003-2012 Stephen Williams (steve@icarus.com)
|
* Copyright (c) 2003-2015 Stephen Williams (steve@icarus.com)
|
||||||
* Copyright CERN 2012 / Stephen Williams (steve@icarus.com)
|
* Copyright CERN 2012 / Stephen Williams (steve@icarus.com)
|
||||||
*
|
*
|
||||||
* This source code is free software; you can redistribute it
|
* This source code is free software; you can redistribute it
|
||||||
|
|
@ -66,6 +66,7 @@ static bool symbol_search(const LineInfo*li, Design*des, NetScope*scope,
|
||||||
bool prefix_scope = false;
|
bool prefix_scope = false;
|
||||||
bool recurse_flag = false;
|
bool recurse_flag = false;
|
||||||
|
|
||||||
|
assert(li);
|
||||||
ivl_assert(*li, ! path.empty());
|
ivl_assert(*li, ! path.empty());
|
||||||
name_component_t path_tail = path.back();
|
name_component_t path_tail = path.back();
|
||||||
path.pop_back();
|
path.pop_back();
|
||||||
|
|
@ -94,7 +95,7 @@ static bool symbol_search(const LineInfo*li, Design*des, NetScope*scope,
|
||||||
scope = recurse.scope;
|
scope = recurse.scope;
|
||||||
prefix_scope = true;
|
prefix_scope = true;
|
||||||
|
|
||||||
if (scope->is_auto() && li) {
|
if (scope->is_auto()) {
|
||||||
cerr << li->get_fileline() << ": error: Hierarchical "
|
cerr << li->get_fileline() << ": error: Hierarchical "
|
||||||
"reference to automatically allocated item "
|
"reference to automatically allocated item "
|
||||||
"`" << path_tail.name << "' in path `" << path << "'" << endl;
|
"`" << path_tail.name << "' in path `" << path << "'" << endl;
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
* Copyright (c) 2009 Stephen Williams (steve@icarus.com)
|
* Copyright (c) 2009-2015 Stephen Williams (steve@icarus.com)
|
||||||
*
|
*
|
||||||
* This source code is free software; you can redistribute it
|
* This source code is free software; you can redistribute it
|
||||||
* and/or modify it in source code form under the terms of the GNU
|
* and/or modify it in source code form under the terms of the GNU
|
||||||
|
|
@ -29,10 +29,10 @@ static void run_string(const char*txt)
|
||||||
if (cp[0] == '%' && cp[1] != 0) {
|
if (cp[0] == '%' && cp[1] != 0) {
|
||||||
switch (cp[1]) {
|
switch (cp[1]) {
|
||||||
case 'M':
|
case 'M':
|
||||||
fprintf(stdout, "%u", VERSION_MAJOR);
|
fprintf(stdout, "%d", VERSION_MAJOR);
|
||||||
break;
|
break;
|
||||||
case 'n':
|
case 'n':
|
||||||
fprintf(stdout, "%u", VERSION_MINOR);
|
fprintf(stdout, "%d", VERSION_MINOR);
|
||||||
break;
|
break;
|
||||||
case 'E':
|
case 'E':
|
||||||
fprintf(stdout, "%s", VERSION_EXTRA);
|
fprintf(stdout, "%s", VERSION_EXTRA);
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue