Fix some compile warnings when using more modern compilers

This commit is contained in:
Cary R 2015-08-19 11:14:23 -07:00
parent 66b4843987
commit 0e4dfa6732
10 changed files with 29 additions and 59 deletions

View File

@ -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 File

@ -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 File

@ -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 File

@ -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 File

@ -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 File

@ -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 File

@ -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 File

@ -727,7 +727,7 @@ static void draw_oct_table()
printf("};\n");
}
main()
int main()
{
printf("# include \"logic.h\"\n");
draw_AND();

View File

@ -27,6 +27,9 @@
# include "parse.h"
# include <string.h>
# include <assert.h>
# define YY_NO_INPUT
%}
%%

View File

@ -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 {