From 02a986b35d22a96ef081c4572ba1d3cbee92478b Mon Sep 17 00:00:00 2001 From: Cary R Date: Thu, 10 Dec 2009 13:58:50 -0800 Subject: [PATCH] Add some casts in main directory 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 for this directory we mas as well remove 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 81d4cbc4bdd409bd696634049e4c82ab12bb11d9) --- elaborate.cc | 1 + eval_tree.cc | 4 ++++ expr_synth.cc | 2 ++ netlist.cc | 1 + netmisc.cc | 1 + t-dll-api.cc | 2 ++ 6 files changed, 11 insertions(+) diff --git a/elaborate.cc b/elaborate.cc index 8ee1ce374..889a0d831 100644 --- a/elaborate.cc +++ b/elaborate.cc @@ -3109,6 +3109,7 @@ NetProc* PEventStatement::elaborate_st(Design*des, NetScope*scope, break; default: + pr = NULL; assert(0); } diff --git a/eval_tree.cc b/eval_tree.cc index 598628dfd..07638bfc7 100644 --- a/eval_tree.cc +++ b/eval_tree.cc @@ -381,6 +381,7 @@ NetEConst* NetEBComp::eval_leeq_real_(NetExpr*le, NetExpr*ri, bool eq_flag) break; default: + lv = 0.0; cerr << get_fileline() << ": internal error: " << "Unexpected expression type? " << le->expr_type() << endl; assert(0); @@ -401,6 +402,7 @@ NetEConst* NetEBComp::eval_leeq_real_(NetExpr*le, NetExpr*ri, bool eq_flag) break; default: + rv = 0.0; cerr << get_fileline() << ": internal error: " << "Unexpected expression type? " << ri->expr_type() << endl; assert(0); @@ -585,6 +587,7 @@ NetEConst* NetEBComp::eval_eqeq_real_(NetExpr*le, NetExpr*ri, bool ne_flag) break; default: + lv = 0.0; cerr << get_fileline() << ": internal error: " << "Unexpected expression type? " << le->expr_type() << endl; assert(0); @@ -605,6 +608,7 @@ NetEConst* NetEBComp::eval_eqeq_real_(NetExpr*le, NetExpr*ri, bool ne_flag) break; default: + rv = 0.0; cerr << get_fileline() << ": internal error: " << "Unexpected expression type? " << ri->expr_type() << endl; assert(0); diff --git a/expr_synth.cc b/expr_synth.cc index bd031afe9..3c7e258b8 100644 --- a/expr_synth.cc +++ b/expr_synth.cc @@ -200,6 +200,7 @@ NetNet* NetEBBits::synthesize(Design*des, NetScope*scope, NetExpr*root) gate = new NetLogic(scope, oname, 3, NetLogic::XNOR, width); break; default: + gate = NULL; assert(0); } @@ -863,6 +864,7 @@ NetNet* NetEUBits::synthesize(Design*des, NetScope*scope, NetExpr*root) gate = new NetLogic(scope, oname, 2, NetLogic::NOT, width); break; default: + gate = NULL; assert(0); } diff --git a/netlist.cc b/netlist.cc index add9690f0..5dddbfe9f 100644 --- a/netlist.cc +++ b/netlist.cc @@ -2668,6 +2668,7 @@ static DelayType get_loop_delay_type(const NetExpr*expr, const NetProc*proc) /* This should never happen since delay_type_from_expr() only * returns three different values. */ default: + result = NO_DELAY; assert(0); } diff --git a/netmisc.cc b/netmisc.cc index 183d9d47e..f3f2d743a 100644 --- a/netmisc.cc +++ b/netmisc.cc @@ -448,6 +448,7 @@ const char *human_readable_op(const char op, bool unary) case 'p': type = "**"; break; // Power default: + type = "???"; assert(0); } return type; diff --git a/t-dll-api.cc b/t-dll-api.cc index e9f6f9538..8f6d19db3 100644 --- a/t-dll-api.cc +++ b/t-dll-api.cc @@ -545,6 +545,8 @@ extern "C" unsigned long ivl_expr_uvalue(ivl_expr_t net) assert(0); } + assert(0); + return 0; } extern "C" ivl_variable_type_t ivl_expr_value(ivl_expr_t net)