diff --git a/driver/substit.c b/driver/substit.c index 1e67784b3..0b9ef84d5 100644 --- a/driver/substit.c +++ b/driver/substit.c @@ -17,7 +17,7 @@ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA */ #ifdef HAVE_CVS_IDENT -#ident "$Id: substit.c,v 1.4 2002/08/12 01:35:01 steve Exp $" +#ident "$Id: substit.c,v 1.5 2003/12/19 01:27:10 steve Exp $" #endif # include @@ -66,7 +66,7 @@ char* substitutions(const char*str) cp += strlen(cp); } else { - if ( (cp - buf) == nbuf ) { + if ( cp == (buf + nbuf) ) { size_t old_size = nbuf; nbuf = old_size + 32; buf = realloc(buf, nbuf); @@ -79,7 +79,7 @@ char* substitutions(const char*str) /* Add the trailing nul to the string, and reallocate the buffer to be a tight fit. */ - if ( (cp - buf) == nbuf ) { + if ( cp == (buf + nbuf) ) { size_t old_size = nbuf; nbuf = old_size + 1; buf = realloc(buf, nbuf); @@ -96,6 +96,9 @@ char* substitutions(const char*str) /* * $Log: substit.c,v $ + * Revision 1.5 2003/12/19 01:27:10 steve + * Fix various unsigned compare warnings. + * * Revision 1.4 2002/08/12 01:35:01 steve * conditional ident string using autoconfig. * diff --git a/t-dll-proc.cc b/t-dll-proc.cc index b7d5e6c7c..951711683 100644 --- a/t-dll-proc.cc +++ b/t-dll-proc.cc @@ -18,7 +18,7 @@ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA */ #ifdef HAVE_CVS_IDENT -#ident "$Id: t-dll-proc.cc,v 1.61 2003/12/03 02:46:24 steve Exp $" +#ident "$Id: t-dll-proc.cc,v 1.62 2003/12/19 01:27:10 steve Exp $" #endif # include "config.h" @@ -747,7 +747,7 @@ bool dll_target::proc_wait(const NetEvWait*net) statement so that the generator can find it easily. */ const NetEvent*ev = net->event(edx); ivl_scope_t ev_scope = lookup_scope_(ev->scope()); - ivl_event_t ev_tmp; + ivl_event_t ev_tmp=0; for (unsigned idx = 0 ; idx < ev_scope->nevent_ ; idx += 1) { const char*ename = ivl_event_basename(ev_scope->event_[idx]); @@ -756,6 +756,7 @@ bool dll_target::proc_wait(const NetEvWait*net) break; } } + // XXX should we assert(ev_tmp)? if (net->nevents() == 1) stmt_cur_->u_.wait_.event = ev_tmp; @@ -842,6 +843,9 @@ void dll_target::proc_while(const NetWhile*net) /* * $Log: t-dll-proc.cc,v $ + * Revision 1.62 2003/12/19 01:27:10 steve + * Fix various unsigned compare warnings. + * * Revision 1.61 2003/12/03 02:46:24 steve * Add support for wait on list of named events. * diff --git a/tgt-vvp/draw_mux.c b/tgt-vvp/draw_mux.c index 447282781..fd4b98f6f 100644 --- a/tgt-vvp/draw_mux.c +++ b/tgt-vvp/draw_mux.c @@ -17,7 +17,7 @@ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA */ #ifdef HAVE_CVS_IDENT -#ident "$Id: draw_mux.c,v 1.6 2003/02/25 03:40:45 steve Exp $" +#ident "$Id: draw_mux.c,v 1.7 2003/12/19 01:27:10 steve Exp $" #endif # include "vvp_priv.h" @@ -124,11 +124,11 @@ static void draw_lpm_mux_bitslice(ivl_lpm_t net, unsigned slice) vvp_mangle_id(ivl_lpm_basename(net)), slice); - if ((2 << (sel-1))/2 < size) { + if ((2U << (sel-1))/2 < size) { fprintf(vvp_out, "L_%s.%s/%u/2/%u, ", vvp_mangle_id(ivl_scope_name(ivl_lpm_scope(net))), vvp_mangle_id(ivl_lpm_basename(net)), - slice, (2 << (sel-1))/2); + slice, (2U << (sel-1))/2); } else { fprintf(vvp_out, "C, "); } @@ -185,6 +185,9 @@ void draw_lpm_mux(ivl_lpm_t net) /* * $Log: draw_mux.c,v $ + * Revision 1.7 2003/12/19 01:27:10 steve + * Fix various unsigned compare warnings. + * * Revision 1.6 2003/02/25 03:40:45 steve * Eliminate use of ivl_lpm_name function. * diff --git a/tgt-vvp/eval_real.c b/tgt-vvp/eval_real.c index 5f9952ad1..0749ab3f8 100644 --- a/tgt-vvp/eval_real.c +++ b/tgt-vvp/eval_real.c @@ -17,7 +17,7 @@ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA */ #ifdef HAVE_CVS_IDENT -#ident "$Id: eval_real.c,v 1.9 2003/05/25 02:50:08 steve Exp $" +#ident "$Id: eval_real.c,v 1.10 2003/12/19 01:27:10 steve Exp $" #endif /* @@ -103,7 +103,7 @@ static int draw_binary_real(ivl_expr_t exp) static int draw_number_real(ivl_expr_t exp) { - int idx; + unsigned int idx; int res = allocate_word(); const char*bits = ivl_expr_bits(exp); unsigned wid = ivl_expr_width(exp); @@ -298,6 +298,9 @@ int draw_eval_real(ivl_expr_t exp) /* * $Log: eval_real.c,v $ + * Revision 1.10 2003/12/19 01:27:10 steve + * Fix various unsigned compare warnings. + * * Revision 1.9 2003/05/25 02:50:08 steve * Add % in real expressions. * diff --git a/tgt-vvp/vvp_scope.c b/tgt-vvp/vvp_scope.c index 8bf128bf1..f6080a9b1 100644 --- a/tgt-vvp/vvp_scope.c +++ b/tgt-vvp/vvp_scope.c @@ -17,7 +17,7 @@ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA */ #ifdef HAVE_CVS_IDENT -#ident "$Id: vvp_scope.c,v 1.97 2003/10/09 23:45:03 steve Exp $" +#ident "$Id: vvp_scope.c,v 1.98 2003/12/19 01:27:10 steve Exp $" #endif # include "vvp_priv.h" @@ -55,7 +55,7 @@ const char *vvp_mangle_id(const char *id) do { int n = se - inp; - int nlen = strlen(id) + 4*(++nesc) + 1; + unsigned int nlen = strlen(id) + 4*(++nesc) + 1; if (out_len < nlen) { out = (char *) realloc(out, nlen); assert(out); @@ -105,7 +105,7 @@ const char *vvp_mangle_name(const char *id) do { int n = se - inp; - int nlen = strlen(id) + 2*(++nesc) + 1; + unsigned int nlen = strlen(id) + 2*(++nesc) + 1; if (out_len < nlen) { out = (char *) realloc(out, nlen); assert(out); @@ -502,7 +502,7 @@ const char* draw_net_input(ivl_nexus_t nex) level = 0; while (ndrivers) { - int inst; + unsigned int inst; for (inst = 0; inst < ndrivers; inst += 4) { if (ndrivers > 4) fprintf(vvp_out, "RS_%p/%d/%d .resolv tri", @@ -628,7 +628,7 @@ static void draw_delay(ivl_net_logic_t lptr) static void draw_udp_def(ivl_udp_t udp) { unsigned init; - int i; + unsigned i; switch (ivl_udp_init(udp)) { @@ -1658,6 +1658,9 @@ int draw_scope(ivl_scope_t net, ivl_scope_t parent) /* * $Log: vvp_scope.c,v $ + * Revision 1.98 2003/12/19 01:27:10 steve + * Fix various unsigned compare warnings. + * * Revision 1.97 2003/10/09 23:45:03 steve * Emit .event inputs before the .event statement. * diff --git a/vpi/sys_display.c b/vpi/sys_display.c index e5dc1024c..1c32d9923 100644 --- a/vpi/sys_display.c +++ b/vpi/sys_display.c @@ -17,7 +17,7 @@ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA */ #ifdef HAVE_CVS_IDENT -#ident "$Id: sys_display.c,v 1.66 2003/10/30 03:43:19 steve Exp $" +#ident "$Id: sys_display.c,v 1.67 2003/12/19 01:27:10 steve Exp $" #endif # include "config.h" @@ -169,6 +169,7 @@ static void format_time(unsigned mcd, int fsize, char*bp, *start_address; int idx; + unsigned int fusize; int fraction_chars, fraction_pad, value_chop, whole_fill; /* This is the format precision expressed as the power of 10 @@ -179,10 +180,9 @@ static void format_time(unsigned mcd, int fsize, /* If the fsize is <0, then use the value from the $timeformat. If the fsize is >=0, then it overrides the $timeformat value. */ - if (fsize < 0) - fsize = timeformat_info.width; + fusize = (fsize<0) ? timeformat_info.width : (unsigned) fsize; - assert(fsize < (sizeof buf - 1)); + assert(fusize < (sizeof buf - 1)); /* This is the number of characters to the right of the @@ -228,12 +228,12 @@ static void format_time(unsigned mcd, int fsize, whole_fill = 0; /* This is the expected start address of the output. It - accounts for the fsize value that is chosen. The output + accounts for the f(u)size value that is chosen. The output will be filled out to complete the buffer. */ - if (fsize == 0) + if (fusize == 0) start_address = buf; else - start_address = buf + sizeof buf - fsize - 1; + start_address = buf + sizeof buf - fusize - 1; /* Now start the character pointers, ready to start copying the value into the format. */ @@ -286,7 +286,7 @@ static void format_time(unsigned mcd, int fsize, /* Fill the leading characters to make up the desired width. This may require a '0' if the last character written was the decimal point. */ - if (fsize > 0) { + if (fusize > 0) { while (bp > start_address) { if (*bp == '.') *--bp = '0'; @@ -452,7 +452,7 @@ static int format_str_char(vpiHandle scope, unsigned int mcd, { char* value_str = value.value.str; if (leading_zero==1){ // Strip away all leading zeros from string - int i=0; + unsigned int i=0; while(i< (strlen(value_str)-1) && value_str[i]=='0') i++; value_str += i; @@ -643,7 +643,7 @@ static int format_str_char(vpiHandle scope, unsigned int mcd, if (!(is_constant(argv[idx]) && vpi_get(vpiConstType, argv[idx]) == vpiStringConst)) { - int i=0; + unsigned int i=0; // Strip away all leading zeros from string while((i < (strlen(value_str)-1)) && (value_str[i]==' ')) @@ -833,7 +833,7 @@ static void do_display(unsigned int mcd, struct strobe_cb_info*info) { char*fmt; s_vpi_value value; - int idx; + unsigned int idx; int size; for (idx = 0 ; idx < info->nitems ; idx += 1) { @@ -1580,6 +1580,9 @@ void sys_display_register() /* * $Log: sys_display.c,v $ + * Revision 1.67 2003/12/19 01:27:10 steve + * Fix various unsigned compare warnings. + * * Revision 1.66 2003/10/30 03:43:19 steve * Rearrange fileio functions, and add ungetc. * diff --git a/vpi/sys_readmem.c b/vpi/sys_readmem.c index 2871235b2..86ac7189e 100644 --- a/vpi/sys_readmem.c +++ b/vpi/sys_readmem.c @@ -17,7 +17,7 @@ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA */ #ifdef HAVE_CVS_IDENT -#ident "$Id: sys_readmem.c,v 1.13 2003/05/10 16:06:50 steve Exp $" +#ident "$Id: sys_readmem.c,v 1.14 2003/12/19 01:27:10 steve Exp $" #endif # include "config.h" @@ -132,7 +132,7 @@ static int sys_readmem_calltf(char*name) /* min_addr and max_addr are equal to start_addr and stop_addr if start_addr