Browse files

Fix some compile warnings when using more modern compilers

  • Loading branch information...
1 parent 66b4843 commit 0e4dfa67323b04365d566481badfc1c7df15b61d @caryr caryr committed Aug 19, 2015
Showing with 29 additions and 59 deletions.
  1. +2 −0 lexor.lex
  2. +4 −2 vpi/lxt2_write.c
  3. +8 −18 vpi/sys_lxt.c
  4. +8 −18 vpi/sys_lxt2.c
  5. +1 −1 vpi/sys_random.c
  6. +0 −13 vpi/sys_readmem.c
  7. +1 −1 vvp/codes.h
  8. +1 −1 vvp/draw_tt.c
  9. +3 −0 vvp/lexor.lex
  10. +1 −5 vvp/vpip_to_dec.cc
View
2 lexor.lex
@@ -39,6 +39,8 @@
# define YY_USER_INIT reset_lexor();
# define yylval VLlval
+#define YY_NO_INPUT
+
/*
* Lexical location information is passed in the yylloc variable to th
* parser. The file names, strings, are kept in a list so that I can
View
6 vpi/lxt2_write.c
@@ -1005,8 +1005,10 @@ for(cnt = 0; cnt < lt->break_header_size; cnt += sizeof(buf))
seg = sizeof(buf);
}
- fread(buf, seg, 1, clone);
- fwrite(buf, seg, 1, f2);
+ if(fread(buf, seg, 1, clone))
+ {
+ if(!fwrite(buf, seg, 1, f2)) break; /* write error! */
+ }
}
fclose(clone);
View
26 vpi/sys_lxt.c
@@ -476,7 +476,6 @@ static void scan_item(unsigned depth, vpiHandle item, int skip)
struct t_cb_data cb;
struct vcd_info* info;
- const char* type;
const char* name;
const char* ident;
int nexus_id;
@@ -507,10 +506,10 @@ static void scan_item(unsigned depth, vpiHandle item, int skip)
/* There is nothing in named events to dump. */
break;
- case vpiNet: type = "wire"; if(0){
+ case vpiNet:
case vpiIntegerVar:
case vpiTimeVar:
- case vpiReg: type = "reg"; }
+ case vpiReg:
if (skip)
break;
@@ -590,11 +589,11 @@ static void scan_item(unsigned depth, vpiHandle item, int skip)
break;
- case vpiModule: type = "module"; if(0){
- case vpiNamedBegin: type = "begin"; }if(0){
- case vpiTask: type = "task"; }if(0){
- case vpiFunction: type = "function"; }if(0){
- case vpiNamedFork: type = "fork"; }
+ case vpiModule:
+ case vpiNamedBegin:
+ case vpiTask:
+ case vpiFunction:
+ case vpiNamedFork:
if (depth > 0) {
int nskip;
@@ -648,7 +647,6 @@ static int draw_scope(vpiHandle item)
{
int depth;
const char *name;
- char *type;
vpiHandle scope = vpi_handle(vpiScope, item);
if (!scope)
@@ -657,15 +655,7 @@ static int draw_scope(vpiHandle item)
depth = 1 + draw_scope(scope);
name = vpi_get_str(vpiName, scope);
- switch (vpi_get(vpiType, item)) {
- case vpiNamedBegin: type = "begin"; break;
- case vpiTask: type = "task"; break;
- case vpiFunction: type = "function"; break;
- case vpiNamedFork: type = "fork"; break;
- default: type = "module"; break;
- }
-
- push_scope(name); /* keep in type info determination for possible future usage */
+ push_scope(name);
return depth;
}
View
26 vpi/sys_lxt2.c
@@ -487,7 +487,6 @@ static void scan_item(unsigned depth, vpiHandle item, int skip)
struct t_cb_data cb;
struct vcd_info* info;
- const char* type;
const char* name;
const char* ident;
int nexus_id;
@@ -518,10 +517,10 @@ static void scan_item(unsigned depth, vpiHandle item, int skip)
/* There is nothing in named events to dump. */
break;
- case vpiNet: type = "wire"; if(0){
+ case vpiNet:
case vpiIntegerVar:
case vpiTimeVar:
- case vpiReg: type = "reg"; }
+ case vpiReg:
if (skip)
break;
@@ -608,11 +607,11 @@ static void scan_item(unsigned depth, vpiHandle item, int skip)
break;
- case vpiModule: type = "module"; if(0){
- case vpiNamedBegin: type = "begin"; }if(0){
- case vpiTask: type = "task"; }if(0){
- case vpiFunction: type = "function"; }if(0){
- case vpiNamedFork: type = "fork"; }
+ case vpiModule:
+ case vpiNamedBegin:
+ case vpiTask:
+ case vpiFunction:
+ case vpiNamedFork:
if (depth > 0) {
int nskip;
@@ -666,7 +665,6 @@ static int draw_scope(vpiHandle item)
{
int depth;
const char *name;
- char *type;
vpiHandle scope = vpi_handle(vpiScope, item);
if (!scope)
@@ -675,15 +673,7 @@ static int draw_scope(vpiHandle item)
depth = 1 + draw_scope(scope);
name = vpi_get_str(vpiName, scope);
- switch (vpi_get(vpiType, item)) {
- case vpiNamedBegin: type = "begin"; break;
- case vpiTask: type = "task"; break;
- case vpiFunction: type = "function"; break;
- case vpiNamedFork: type = "fork"; break;
- default: type = "module"; break;
- }
-
- push_scope(name); /* keep in type info determination for possible future usage */
+ push_scope(name);
return depth;
}
View
2 vpi/sys_random.c
@@ -49,7 +49,7 @@ long rtl_dist_poisson(long*seed, long mean)
i = 0;
}
- return 0;
+ return i;
}
/* copied from IEEE1364-2001, with slight modifications for 64bit machines. */
View
13 vpi/sys_readmem.c
@@ -354,14 +354,12 @@ static PLI_INT32 sys_readmem_calltf(char*name)
static PLI_INT32 sys_writemem_calltf(char*name)
{
- int wwid;
char*path;
char*mem_name;
FILE*file;
unsigned addr = 0;
unsigned cnt = 0;
s_vpi_value value;
- vpiHandle words;
vpiHandle sys = vpi_handle(vpiSysTfCall, 0);
vpiHandle argv = vpi_iterate(vpiArgument, sys);
vpiHandle item = vpi_scan(argv);
@@ -374,7 +372,6 @@ static PLI_INT32 sys_writemem_calltf(char*name)
int left_addr, right_addr;
int start_addr, stop_addr, addr_incr;
- int min_addr, max_addr;
/*======================================== Get parameters */
@@ -493,9 +490,6 @@ static PLI_INT32 sys_writemem_calltf(char*name)
}
}
- min_addr = start_addr<stop_addr ? start_addr : stop_addr ;
- max_addr = start_addr<stop_addr ? stop_addr : start_addr;
-
/* Check that start_addr and stop_addr are within the memory
range */
if (left_addr<right_addr){
@@ -521,13 +515,6 @@ static PLI_INT32 sys_writemem_calltf(char*name)
}
}
-
- words = vpi_iterate(vpiMemoryWord, mitem);
- assert(words);
-
- item = vpi_scan(words);
- wwid = vpi_get(vpiSize, item);
-
if (strcmp(name,"$writememb")==0){
value.format = vpiBinStrVal;
}
View
2 vvp/codes.h
@@ -142,7 +142,7 @@ struct vvp_code_s {
unsigned bit_idx[2];
vvp_ipoint_t iptr2;
vvp_code_t cptr2;
- struct ufunc_core*ufunc_core_ptr;
+ class ufunc_core*ufunc_core_ptr;
};
};
View
2 vvp/draw_tt.c
@@ -727,7 +727,7 @@ static void draw_oct_table()
printf("};\n");
}
-main()
+int main()
{
printf("# include \"logic.h\"\n");
draw_AND();
View
3 vvp/lexor.lex
@@ -27,6 +27,9 @@
# include "parse.h"
# include <string.h>
# include <assert.h>
+
+# define YY_NO_INPUT
+
%}
%%
View
6 vvp/vpip_to_dec.cc
@@ -108,7 +108,7 @@ static inline int write_digits(unsigned long v, char **buf,
unsigned vpip_bits_to_dec_str(const unsigned char *bits, unsigned int nbits,
char *buf, unsigned int nbuf, int signed_flag)
{
- unsigned int idx, len, vlen;
+ unsigned int idx, vlen;
unsigned int mbits=nbits; /* number of non-sign bits */
unsigned count_x = 0, count_z = 0;
/* Jump through some hoops so we don't have to malloc/free valv
@@ -156,19 +156,15 @@ unsigned vpip_bits_to_dec_str(const unsigned char *bits, unsigned int nbits,
}
if (count_x == nbits) {
- len = 1;
buf[0] = 'x';
buf[1] = 0;
} else if (count_x > 0) {
- len = 1;
buf[0] = 'X';
buf[1] = 0;
} else if (count_z == nbits) {
- len = 1;
buf[0] = 'z';
buf[1] = 0;
} else if (count_z > 0) {
- len = 1;
buf[0] = 'Z';
buf[1] = 0;
} else {

0 comments on commit 0e4dfa6

Please sign in to comment.