-
Notifications
You must be signed in to change notification settings - Fork 541
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Update tgt- directories with cppcheck suggested fixes
- Loading branch information
Showing
14 changed files
with
33 additions
and
34 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,5 @@ | ||
/* | ||
* Copyright (c) 2003-2014 Stephen Williams ([email protected]) | ||
* Copyright (c) 2003-2021 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 | ||
|
@@ -553,7 +553,7 @@ static void lpm_show_mux(ivl_lpm_t net) | |
edif_cellref_t ref; | ||
edif_joint_t jnt; | ||
|
||
unsigned idx, rdx; | ||
unsigned idx; | ||
|
||
char cellname[32]; | ||
|
||
|
@@ -626,6 +626,7 @@ static void lpm_show_mux(ivl_lpm_t net) | |
} | ||
|
||
for (idx = 0 ; idx < wid_z ; idx += 1) { | ||
unsigned rdx; | ||
for (rdx = 0 ; rdx < wid_r ; rdx += 1) { | ||
unsigned pin; | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,5 @@ | ||
/* | ||
* Copyright (c) 2001-2010 Stephen Williams ([email protected]) | ||
* Copyright (c) 2001-2021 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 | ||
|
@@ -30,9 +30,7 @@ static size_t xnf_mangle_scope_name(ivl_scope_t net, char*buf, size_t nbuf) | |
if (parent) { | ||
cnt = xnf_mangle_scope_name(parent, buf, nbuf); | ||
buf += cnt; | ||
nbuf -= cnt; | ||
*buf++ = '/'; | ||
nbuf -= 1; | ||
cnt += 1; | ||
} | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,5 @@ | ||
/* | ||
* Copyright (c) 2007-2013 Stephen Williams ([email protected]) | ||
* Copyright (c) 2007-2021 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 | ||
|
@@ -75,7 +75,7 @@ static void show_branch_access_expression(ivl_expr_t net, unsigned ind) | |
} | ||
|
||
ivl_discipline_t tb_disc = discipline_of_nexus(tb); | ||
if (ta_disc == 0) { | ||
if (tb_disc == 0) { | ||
fprintf(out, "%*sERROR: Reference terminal of branch has no discipline\n", | ||
ind, ""); | ||
stub_errors += 1; | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,5 @@ | ||
/* | ||
* Copyright (c) 2000-2020 Stephen Williams ([email protected]) | ||
* Copyright (c) 2000-2021 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 | ||
|
@@ -1427,7 +1427,7 @@ static void show_signal(ivl_signal_t net) | |
|
||
fprintf(out, " %s %s %s", type, sign, port); | ||
show_type_of_signal(net); | ||
fprintf(out, " %s[word=%u, adr=%d] <width=%u%s> <discipline=%s> ", | ||
fprintf(out, " %s[word=%u, adr=%u] <width=%u%s> <discipline=%s> ", | ||
ivl_signal_basename(net), | ||
idx, ivl_signal_array_base(net)+idx, | ||
ivl_signal_width(net), | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2,4 +2,4 @@ | |
// are not used here. | ||
|
||
// target_design() | ||
unusedFunction:verilog.c:408 | ||
unusedFunction:verilog.c:411 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,7 @@ | ||
/* | ||
* VHDL abstract syntax elements. | ||
* | ||
* Copyright (C) 2008-2011 Nick Gasson ([email protected]) | ||
* Copyright (C) 2008-2021 Nick Gasson ([email protected]) | ||
* | ||
* This program is free software; you can redistribute it and/or modify | ||
* it under the terms of the GNU General Public License as published by | ||
|
@@ -66,7 +66,7 @@ vector<vhdl_element*> vhdl_element::allocated_; | |
// Just a counter of total bytes allocated for statistics | ||
size_t vhdl_element::total_alloc_(0); | ||
|
||
void vhdl_element::set_comment(std::string comment) | ||
void vhdl_element::set_comment(const std::string&comment) | ||
{ | ||
comment_ = comment; | ||
} | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,7 @@ | ||
/* | ||
* VHDL abstract syntax elements. | ||
* | ||
* Copyright (C) 2008 Nick Gasson ([email protected]) | ||
* Copyright (C) 2008-2021 Nick Gasson ([email protected]) | ||
* | ||
* This program is free software; you can redistribute it and/or modify | ||
* it under the terms of the GNU General Public License as published by | ||
|
@@ -52,7 +52,7 @@ public: | |
virtual void emit(std::ostream &of, int level=0) const = 0; | ||
void print() const; | ||
|
||
void set_comment(std::string comment); | ||
void set_comment(const std::string&comment); | ||
|
||
static int free_all_objects(); | ||
static size_t total_allocated(); | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,7 @@ | ||
/* | ||
* VHDL abstract syntax elements. | ||
* | ||
* Copyright (C) 2008-2013 Nick Gasson ([email protected]) | ||
* Copyright (C) 2008-2021 Nick Gasson ([email protected]) | ||
* | ||
* This program is free software; you can redistribute it and/or modify | ||
* it under the terms of the GNU General Public License as published by | ||
|
@@ -38,7 +38,7 @@ typedef set<vhdl_var_ref*> vhdl_var_set_t; | |
|
||
class vhdl_expr : public vhdl_element { | ||
public: | ||
vhdl_expr(const vhdl_type* type, bool isconst=false) | ||
explicit vhdl_expr(const vhdl_type* type, bool isconst=false) | ||
: type_(type), isconst_(isconst) {} | ||
virtual ~vhdl_expr(); | ||
|
||
|
@@ -227,7 +227,7 @@ enum time_unit_t { | |
|
||
class vhdl_const_time : public vhdl_expr { | ||
public: | ||
vhdl_const_time(uint64_t value, time_unit_t units = TIME_UNIT_NS) | ||
explicit vhdl_const_time(uint64_t value, time_unit_t units = TIME_UNIT_NS) | ||
: vhdl_expr(vhdl_type::time(), true), value_(value), units_(units) {} | ||
void emit(std::ostream &of, int level) const; | ||
private: | ||
|
@@ -464,8 +464,8 @@ enum vhdl_severity_t { | |
|
||
class vhdl_report_stmt : public vhdl_seq_stmt { | ||
public: | ||
vhdl_report_stmt(vhdl_expr *text, | ||
vhdl_severity_t severity = SEVERITY_NOTE); | ||
explicit vhdl_report_stmt(vhdl_expr *text, | ||
vhdl_severity_t severity = SEVERITY_NOTE); | ||
virtual ~vhdl_report_stmt() {} | ||
|
||
virtual void emit(ostream& of, int level) const; | ||
|
@@ -602,8 +602,8 @@ private: | |
*/ | ||
class vhdl_decl : public vhdl_element { | ||
public: | ||
vhdl_decl(const string& name, const vhdl_type *type = NULL, | ||
vhdl_expr *initial = NULL) | ||
explicit vhdl_decl(const string& name, const vhdl_type *type = NULL, | ||
vhdl_expr *initial = NULL) | ||
: name_(name), type_(type), initial_(initial), | ||
has_initial_(initial != NULL) {} | ||
virtual ~vhdl_decl(); | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,7 @@ | ||
/* | ||
* VHDL variable and signal types. | ||
* | ||
* Copyright (C) 2008-2013 Nick Gasson ([email protected]) | ||
* Copyright (C) 2008-2021 Nick Gasson ([email protected]) | ||
* | ||
* This program is free software; you can redistribute it and/or modify | ||
* it under the terms of the GNU General Public License as published by | ||
|
@@ -188,7 +188,7 @@ vhdl_type *vhdl_type::type_for(int width, bool issigned, | |
return vhdl_type::nunsigned(width, lsb); | ||
} | ||
|
||
vhdl_type *vhdl_type::array_of(vhdl_type *b, std::string &n, int m, int l) | ||
vhdl_type *vhdl_type::array_of(vhdl_type *b, const std::string &n, int m, int l) | ||
{ | ||
return new vhdl_type(b, n, m, l); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,7 @@ | ||
/* | ||
* VHDL variable and signal types. | ||
* | ||
* Copyright (C) 2008-2010 Nick Gasson ([email protected]) | ||
* Copyright (C) 2008-2021 Nick Gasson ([email protected]) | ||
* | ||
* This program is free software; you can redistribute it and/or modify | ||
* it under the terms of the GNU General Public License as published by | ||
|
@@ -46,7 +46,7 @@ enum vhdl_type_name_t { | |
class vhdl_type : public vhdl_element { | ||
public: | ||
// Scalar constructor | ||
vhdl_type(vhdl_type_name_t name, int msb = 0, int lsb = 0) | ||
explicit vhdl_type(vhdl_type_name_t name, int msb = 0, int lsb = 0) | ||
: name_(name), msb_(msb), lsb_(lsb), base_(NULL) {} | ||
|
||
// Array constructor | ||
|
@@ -84,7 +84,7 @@ public: | |
|
||
static vhdl_type *type_for(int width, bool issigned, | ||
int lsb=0, bool unresolved=false); | ||
static vhdl_type *array_of(vhdl_type *b, std::string &n, int m, int l); | ||
static vhdl_type *array_of(vhdl_type *b, const std::string &n, int m, int l); | ||
protected: | ||
vhdl_type_name_t name_; | ||
int msb_, lsb_; | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -5,4 +5,4 @@ | |
unusedFunction:vlog95.c:59 | ||
|
||
// target_query() | ||
unusedFunction:vlog95.c:251 | ||
unusedFunction:vlog95.c:257 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,5 @@ | ||
/* | ||
* Copyright (C) 2011-2014 Cary R. ([email protected]) | ||
* Copyright (C) 2011-2021 Cary R. ([email protected]) | ||
* | ||
* This program is free software; you can redistribute it and/or modify | ||
* it under the terms of the GNU General Public License as published by | ||
|
@@ -65,7 +65,7 @@ static int32_t get_int32_from_bits(const char *bits, unsigned nbits, | |
// HERE: Need to emit 1 instead of -1 for some of the constants. | ||
// if (is_signed && (nbits > 1) && (msb == '1') && (trim_wid < 32U)) { | ||
if (is_signed && (msb == '1') && (trim_wid < 32U)) { | ||
value |= ~(((int32_t)1 << trim_wid) - (int32_t)1); | ||
value |= ~(((uint32_t)1 << trim_wid) - (uint32_t)1); | ||
} | ||
*result_type = 0; | ||
return value; | ||
|
@@ -309,7 +309,7 @@ int64_t get_int64_from_number(ivl_expr_t expr, int *result_type) | |
} | ||
/* Sign extend as needed. */ | ||
if (is_signed && (msb == '1') && (trim_wid < 64U)) { | ||
value |= ~(((int64_t)1 << trim_wid) - (int64_t)1); | ||
value |= ~(((uint64_t)1 << trim_wid) - (uint64_t)1); | ||
} | ||
*result_type = 0; | ||
return value; | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters