Remove some cppcheck warnings.
This patch removes some cppcheck warnings.
This commit is contained in:
parent
f186c81403
commit
c2225f679b
|
|
@ -1,7 +1,7 @@
|
|||
/*
|
||||
* VHDL code generation for expressions.
|
||||
*
|
||||
* Copyright (C) 2008-2009 Nick Gasson (nick@nickg.me.uk)
|
||||
* Copyright (C) 2008-2011 Nick Gasson (nick@nickg.me.uk)
|
||||
*
|
||||
* 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
|
||||
|
|
@ -313,8 +313,10 @@ static vhdl_expr *translate_binary(ivl_expr_t e)
|
|||
return NULL;
|
||||
|
||||
vhdl_expr *rhs = translate_expr(ivl_expr_oper2(e));
|
||||
if (NULL == rhs)
|
||||
if (NULL == rhs) {
|
||||
delete lhs;
|
||||
return NULL;
|
||||
}
|
||||
|
||||
int lwidth = lhs->get_type()->get_width();
|
||||
int rwidth = rhs->get_type()->get_width();
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
/*
|
||||
* VHDL abstract syntax elements.
|
||||
*
|
||||
* Copyright (C) 2008 Nick Gasson (nick@nickg.me.uk)
|
||||
* Copyright (C) 2008-2011 Nick Gasson (nick@nickg.me.uk)
|
||||
*
|
||||
* 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
|
||||
|
|
@ -79,7 +79,7 @@ void vhdl_element::set_comment(std::string comment)
|
|||
void vhdl_element::emit_comment(std::ostream &of, int level,
|
||||
bool end_of_line) const
|
||||
{
|
||||
if (comment_.size() > 0) {
|
||||
if (! comment_.empty()) {
|
||||
if (end_of_line)
|
||||
of << " -- " << comment_;
|
||||
else {
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
/*
|
||||
* VHDL abstract syntax elements.
|
||||
*
|
||||
* Copyright (C) 2008-2010 Nick Gasson (nick@nickg.me.uk)
|
||||
* Copyright (C) 2008-2011 Nick Gasson (nick@nickg.me.uk)
|
||||
*
|
||||
* 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
|
||||
|
|
@ -230,7 +230,7 @@ void vhdl_process::emit(std::ostream &of, int level) const
|
|||
|
||||
newline(of, level);
|
||||
emit_comment(of, level);
|
||||
if (name_.size() > 0)
|
||||
if (! name_.empty())
|
||||
of << name_ << ": ";
|
||||
of << "process ";
|
||||
|
||||
|
|
@ -315,7 +315,7 @@ void vhdl_comp_inst::emit(std::ostream &of, int level) const
|
|||
of << inst_name_ << ": " << comp_name_;
|
||||
|
||||
// If there are no ports or generics we don't need to mention them...
|
||||
if (mapping_.size() > 0) {
|
||||
if (! mapping_.empty()) {
|
||||
newline(of, indent(level));
|
||||
of << "port map (";
|
||||
|
||||
|
|
@ -362,7 +362,7 @@ void vhdl_component_decl::emit(std::ostream &of, int level) const
|
|||
emit_comment(of, level);
|
||||
of << "component " << name_ << " is";
|
||||
|
||||
if (ports_.size() > 0) {
|
||||
if (! ports_.empty()) {
|
||||
newline(of, indent(level));
|
||||
of << "port (";
|
||||
emit_children<vhdl_decl>(of, ports_, indent(level), ";");
|
||||
|
|
@ -956,7 +956,7 @@ void vhdl_binop_expr::emit(std::ostream &of, int level) const
|
|||
{
|
||||
open_parens(of);
|
||||
|
||||
assert(operands_.size() > 0);
|
||||
assert(! operands_.empty());
|
||||
std::list<vhdl_expr*>::const_iterator it = operands_.begin();
|
||||
|
||||
(*it)->emit(of, level);
|
||||
|
|
|
|||
|
|
@ -59,7 +59,7 @@ __inline__ static void draw_execute_header(ivl_design_t des)
|
|||
}
|
||||
fprintf(vvp_out, ":ivl_version \"" VERSION "\"");
|
||||
/* I am assuming that a base release will have a blank tag. */
|
||||
if (strcmp(VERSION_TAG, "") != 0) {
|
||||
if (*VERSION_TAG != 0) {
|
||||
fprintf(vvp_out, " \"(" VERSION_TAG ")\"");
|
||||
}
|
||||
fprintf(vvp_out, ";\n");
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright (c) 2007-2010 Stephen Williams (steve@icarus.com)
|
||||
* Copyright (c) 2007-2011 Stephen Williams (steve@icarus.com)
|
||||
*
|
||||
* This source code is free software; you can redistribute it
|
||||
* and/or modify it in source code form under the terms of the GNU
|
||||
|
|
@ -1440,7 +1440,9 @@ void array_word_change(vvp_array_t array, unsigned long addr)
|
|||
class array_resolv_list_t : public resolv_list_s {
|
||||
|
||||
public:
|
||||
explicit array_resolv_list_t(char*lab) : resolv_list_s(lab) { }
|
||||
explicit array_resolv_list_t(char*lab) : resolv_list_s(lab) {
|
||||
array = 0;
|
||||
}
|
||||
|
||||
vvp_array_t*array;
|
||||
bool resolve(bool mes);
|
||||
|
|
|
|||
|
|
@ -405,7 +405,9 @@ void postpone_functor_input(vvp_net_ptr_t port, char*lab)
|
|||
*/
|
||||
|
||||
struct functor_gen_resolv_list_s: public resolv_list_s {
|
||||
explicit functor_gen_resolv_list_s(char*txt) : resolv_list_s(txt) { }
|
||||
explicit functor_gen_resolv_list_s(char*txt) : resolv_list_s(txt) {
|
||||
ref = 0;
|
||||
}
|
||||
vvp_net_t**ref;
|
||||
virtual bool resolve(bool mes);
|
||||
};
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright (c) 2004-2010 Stephen Williams (steve@icarus.com)
|
||||
* Copyright (c) 2004-2011 Stephen Williams (steve@icarus.com)
|
||||
*
|
||||
* This source code is free software; you can redistribute it
|
||||
* and/or modify it in source code form under the terms of the GNU
|
||||
|
|
@ -2652,7 +2652,7 @@ vvp_vector8_t::vvp_vector8_t(const vvp_vector8_t&that)
|
|||
{
|
||||
size_ = that.size_;
|
||||
if (size_ <= sizeof val_) {
|
||||
ptr_ = that.ptr_;
|
||||
memcpy(val_, that.val_, sizeof val_);
|
||||
} else {
|
||||
ptr_ = new unsigned char[size_];
|
||||
memcpy(ptr_, that.ptr_, size_);
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
#ifndef __vvp_net_H
|
||||
#define __vvp_net_H
|
||||
/*
|
||||
* Copyright (c) 2004-2010 Stephen Williams (steve@icarus.com)
|
||||
* Copyright (c) 2004-2011 Stephen Williams (steve@icarus.com)
|
||||
*
|
||||
* This source code is free software; you can redistribute it
|
||||
* and/or modify it in source code form under the terms of the GNU
|
||||
|
|
@ -924,8 +924,7 @@ inline vvp_vector8_t::vvp_vector8_t(unsigned size__)
|
|||
: size_(size__)
|
||||
{
|
||||
if (size_ <= sizeof val_) {
|
||||
// This should set all the bytes of val_ to 0
|
||||
ptr_ = 0;
|
||||
memset(val_, 0, sizeof val_);
|
||||
} else {
|
||||
ptr_ = new unsigned char[size_];
|
||||
memset(ptr_, 0, size_);
|
||||
|
|
|
|||
Loading…
Reference in New Issue