diff --git a/ivlpp/lexor.lex b/ivlpp/lexor.lex index dccc70332..80eff842b 100644 --- a/ivlpp/lexor.lex +++ b/ivlpp/lexor.lex @@ -403,6 +403,12 @@ W [ \t\b\f]+ /* Absorb the rest of the line when a broken directive is detected. */ [^\r\n]* { yy_pop_state(); } +(\n|"\r\n"|"\n\r"|\r) { + yy_pop_state(); + istack->lineno += 1; + fputc('\n', yyout); +} + %% /* Defined macros are kept in this table for convenient lookup. As `define directives are matched (and the do_define() function diff --git a/lexor.lex b/lexor.lex index 5b6da7635..b1230c381 100644 --- a/lexor.lex +++ b/lexor.lex @@ -404,7 +404,7 @@ W [ \t\b\f\r]+ /* Final catchall. something got lost or mishandled. */ -. { cerr << yylloc.text << ":" << yylloc.first_line +<*>.|\n { cerr << yylloc.text << ":" << yylloc.first_line << ": error: unmatched character ("; if (isgraph(yytext[0])) cerr << yytext[0]; diff --git a/vpi/sys_display.c b/vpi/sys_display.c index 49080c397..e82e53f42 100644 --- a/vpi/sys_display.c +++ b/vpi/sys_display.c @@ -1336,7 +1336,7 @@ static PLI_INT32 sys_printtimescale_calltf(char *xx) { vpiHandle sys = vpi_handle(vpiSysTfCall, 0); vpiHandle argv = vpi_iterate(vpiArgument, sys); - vpiHandle scope; + vpiHandle scope = 0; if (!argv) { vpiHandle parent = vpi_handle(vpiScope, sys); while (parent) { diff --git a/vvp/parse.y b/vvp/parse.y index 6b7aa0bd0..1444f5c37 100644 --- a/vvp/parse.y +++ b/vvp/parse.y @@ -359,10 +359,10 @@ statement /* XXXX Legacy declaration has no type name. */ | T_LABEL K_SCOPE T_SYMBOL ',' T_STRING ';' - { compile_scope_decl($1, $3, $5, "", 0); } + { compile_scope_decl($1, $3, $5, 0, 0); } | T_LABEL K_SCOPE T_SYMBOL ',' T_STRING ',' T_SYMBOL ';' - { compile_scope_decl($1, $3, $5, "", $7); } + { compile_scope_decl($1, $3, $5, 0, $7); } /* Scope recall has no label of its own, but refers by label to a declared scope. */ diff --git a/vvp/vpi_mcd.cc b/vvp/vpi_mcd.cc index 9df6a714c..ec7a6bbe0 100644 --- a/vvp/vpi_mcd.cc +++ b/vvp/vpi_mcd.cc @@ -55,14 +55,14 @@ static FILE* logfile; void vpi_mcd_init(FILE *log) { mcd_table[0].fp = stdout; - mcd_table[0].filename = "stdout"; + mcd_table[0].filename = strdup("stdout"); fd_table[0].fp = stdin; - fd_table[0].filename = "stdin"; + fd_table[0].filename = strdup("stdin"); fd_table[1].fp = stdout; - fd_table[1].filename = "stdout"; + fd_table[1].filename = strdup("stdout"); fd_table[2].fp = stderr; - fd_table[2].filename = "stderr"; + fd_table[2].filename = strdup("stderr"); logfile = log; } diff --git a/vvp/vpi_priv.cc b/vvp/vpi_priv.cc index 58b4031dd..e6b93cd29 100644 --- a/vvp/vpi_priv.cc +++ b/vvp/vpi_priv.cc @@ -110,7 +110,7 @@ PLI_INT32 vpi_chk_error(p_vpi_error_info info) info->level = vpip_last_error.level; info->message = vpip_last_error.message; info->product = vpi_vlog_info.product; - info->code = ""; + info->code = (char *) ""; info->file = 0; info->line = 0; @@ -329,8 +329,10 @@ PLI_INT32 vpi_get_vlog_info(p_vpi_vlog_info vlog_info_p) void vpi_set_vlog_info(int argc, char** argv) { - vpi_vlog_info.product = "Icarus Verilog"; - vpi_vlog_info.version = "$Name: $"; + static char icarus_product[] = "Icarus Verilog"; + static char icarus_version[] = "0.8.7"; + vpi_vlog_info.product = icarus_product; + vpi_vlog_info.version = icarus_version; vpi_vlog_info.argc = argc; vpi_vlog_info.argv = argv; diff --git a/vvp/vpi_scope.cc b/vvp/vpi_scope.cc index daee4604e..f50e1a12f 100644 --- a/vvp/vpi_scope.cc +++ b/vvp/vpi_scope.cc @@ -400,7 +400,8 @@ compile_scope_decl(char*label, char*type, char*name, char*tname, char*parent) assert(scope->base.vpi_type); scope->name = vpip_name_string(name); - scope->tname = vpip_name_string(tname); + if (tname) scope->tname = vpip_name_string(tname); + else scope->tname = vpip_name_string(""); scope->intern = 0; scope->nintern = 0; scope->threads = 0; diff --git a/vvp/vpi_time.cc b/vvp/vpi_time.cc index 9daa9fd5a..63bf02862 100644 --- a/vvp/vpi_time.cc +++ b/vvp/vpi_time.cc @@ -75,9 +75,10 @@ static int timevar_time_get(int code, vpiHandle ref) static char* timevar_time_get_str(int code, vpiHandle ref) { + static char func_name[] = "$time"; switch (code) { case vpiName: - return "$time"; + return func_name; default: fprintf(stderr, "Code: %d\n", code); assert(0); @@ -87,9 +88,10 @@ static char* timevar_time_get_str(int code, vpiHandle ref) static char* timevar_realtime_get_str(int code, vpiHandle ref) { + static char func_name[] = "$realtime"; switch (code) { case vpiName: - return "$realtime"; + return func_name; default: fprintf(stderr, "Code: %d\n", code); assert(0); diff --git a/vvp/vpi_vthr_vector.cc b/vvp/vpi_vthr_vector.cc index 3b6fa3e87..fbfe39ec7 100644 --- a/vvp/vpi_vthr_vector.cc +++ b/vvp/vpi_vthr_vector.cc @@ -37,7 +37,7 @@ struct __vpiVThrVec { unsigned bas; unsigned wid; unsigned signed_flag : 1; - char *name; + const char *name; }; inline static @@ -413,7 +413,7 @@ vpiHandle vpip_make_vthr_vector(unsigned base, unsigned wid, bool signed_flag) struct __vpiVThrWord { struct __vpiHandle base; - char* name; + const char* name; int subtype; unsigned index; };