Add some casts in tgt-vhdl to remove warnings.

The Cygwin compiler is a bit picky. This patch adds some casts
to remove compilation warnings. In the past I have had warnings
off because of problems with the STL, but we may as well get
rid of the warnings we can. It also does not recognize that an
assert(0) or assert(false) ends a routine so it complains about
no return at end of function or variables not being defined.
(cherry picked from commit 3f12a401eb)
This commit is contained in:
Cary R 2009-12-10 12:50:53 -08:00 committed by Stephen Williams
parent a8e1643ae9
commit 327cdc77a3
5 changed files with 18 additions and 14 deletions

View File

@ -1,7 +1,7 @@
/*
* Generate code to convert between VHDL types.
*
* Copyright (C) 2008 Nick Gasson (nick@nickg.me.uk)
* Copyright (C) 2008-2009 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
@ -60,6 +60,8 @@ vhdl_expr *vhdl_expr::cast(const vhdl_type *to)
assert(false);
}
}
assert(false);
return NULL;
}
/*
@ -140,9 +142,8 @@ vhdl_expr *vhdl_expr::to_boolean()
conv->add_expr(this);
return conv;
}
else {
assert(false);
}
assert(false);
return NULL;
}
/*
@ -180,8 +181,8 @@ vhdl_expr *vhdl_expr::to_std_logic()
return ah;
}
else
assert(false);
assert(false);
return NULL;
}
/*
@ -274,8 +275,8 @@ vhdl_expr *vhdl_const_bits::to_vector(vhdl_type_name_t name, int w)
value_.resize(w, sign_bit());
return this;
}
else
assert(false);
assert(false);
return NULL;
}
vhdl_expr *vhdl_const_bits::to_integer()

View File

@ -139,6 +139,7 @@ ivl_signal_t find_signal_named(const std::string &name, const vhdl_scope *scope)
return (*it).first;
}
assert(false);
return NULL;
}
// Compare the name of an entity against a string

View File

@ -239,9 +239,9 @@ assign_for(vhdl_decl::assign_type_t atype, vhdl_var_ref *lhs, vhdl_expr *rhs)
return new vhdl_assign_stmt(lhs, rhs);
case vhdl_decl::ASSIGN_NONBLOCK:
return new vhdl_nbassign_stmt(lhs, rhs);
default:
assert(false);
}
assert(false);
return NULL;
}
/*

View File

@ -1,7 +1,7 @@
/*
* Support functions for VHDL output.
*
* Copyright (C) 2008 Nick Gasson (nick@nickg.me.uk)
* Copyright (C) 2008-2009 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
@ -51,6 +51,7 @@ const char *support_function::function_name(support_function_t type)
default:
assert(false);
}
return "Invalid";
}
vhdl_type *support_function::function_type(support_function_t type)
@ -74,9 +75,9 @@ vhdl_type *support_function::function_type(support_function_t type)
return new vhdl_type(VHDL_TYPE_UNSIGNED);
case SF_LOGIC_TO_INTEGER:
return vhdl_type::integer();
default:
assert(false);
}
assert(false);
return vhdl_type::boolean();
}
void support_function::emit_ternary(std::ostream &of, int level) const

View File

@ -571,7 +571,8 @@ public:
// For some sorts of declarations it doesn't make sense
// to assign to it so calling assignment_type just raises
// an assertion failure
virtual assign_type_t assignment_type() const { assert(false); }
virtual assign_type_t assignment_type() const { assert(false);
return ASSIGN_BLOCK; }
// True if this declaration can be read from
virtual bool is_readable() const { return true; }