Update driver and acc/tf directories with changes suggested by cppcheck
This commit is contained in:
parent
a56747b747
commit
e0313cecbd
|
|
@ -1,6 +1,6 @@
|
||||||
/*
|
/*
|
||||||
|
* Copyright (c) 2015-2021 Martin Whitaker
|
||||||
* Copyright (c) 2002 Gus Baldauf (gus@picturel.com)
|
* Copyright (c) 2002 Gus Baldauf (gus@picturel.com)
|
||||||
* Copyright (c) 2015 Martin Whitaker
|
|
||||||
*
|
*
|
||||||
* This source code is free software; you can redistribute it
|
* This source code is free software; you can redistribute it
|
||||||
* and/or modify it in source code form under the terms of the GNU
|
* and/or modify it in source code form under the terms of the GNU
|
||||||
|
|
@ -241,13 +241,13 @@ static int GetRegistryKey(char *key, char **value)
|
||||||
|
|
||||||
lrv = RegQueryValueEx(hkKey, key, NULL, ®KeyType, NULL, ®KeySize);
|
lrv = RegQueryValueEx(hkKey, key, NULL, ®KeyType, NULL, ®KeySize);
|
||||||
if ((lrv != ERROR_SUCCESS) || (regKeyType != REG_SZ) || (!regKeySize)) {
|
if ((lrv != ERROR_SUCCESS) || (regKeyType != REG_SZ) || (!regKeySize)) {
|
||||||
lrv = RegCloseKey(hkKey);
|
RegCloseKey(hkKey);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
regKeyBuffer = (char *) malloc(regKeySize+1);
|
regKeyBuffer = (char *) malloc(regKeySize+1);
|
||||||
if (!regKeyBuffer) {
|
if (!regKeyBuffer) {
|
||||||
lrv = RegCloseKey(hkKey);
|
RegCloseKey(hkKey);
|
||||||
fprintf(stderr, "error: out of memory\n");
|
fprintf(stderr, "error: out of memory\n");
|
||||||
myExit(4);
|
myExit(4);
|
||||||
}
|
}
|
||||||
|
|
@ -257,7 +257,7 @@ static int GetRegistryKey(char *key, char **value)
|
||||||
lrv = RegQueryValueEx(hkKey, key, NULL, ®KeyType,
|
lrv = RegQueryValueEx(hkKey, key, NULL, ®KeyType,
|
||||||
(unsigned char *) regKeyBuffer, ®KeySize);
|
(unsigned char *) regKeyBuffer, ®KeySize);
|
||||||
if ((lrv != ERROR_SUCCESS) || (regKeyType != REG_SZ) || (!regKeySize)) {
|
if ((lrv != ERROR_SUCCESS) || (regKeyType != REG_SZ) || (!regKeySize)) {
|
||||||
lrv = RegCloseKey(hkKey);
|
RegCloseKey(hkKey);
|
||||||
free(regKeyBuffer);
|
free(regKeyBuffer);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -4,7 +4,7 @@
|
||||||
|
|
||||||
%{
|
%{
|
||||||
/*
|
/*
|
||||||
* Copyright (c) 2001-2017 Stephen Williams (steve@icarus.com)
|
* Copyright (c) 2001-2021 Stephen Williams (steve@icarus.com)
|
||||||
*
|
*
|
||||||
* This source code is free software; you can redistribute it
|
* This source code is free software; you can redistribute it
|
||||||
* and/or modify it in source code form under the terms of the GNU
|
* and/or modify it in source code form under the terms of the GNU
|
||||||
|
|
@ -71,7 +71,7 @@ int cmdfile_stack_ptr = 0;
|
||||||
<LCOMMENT>\n { cflloc.first_line += 1; BEGIN(comment_enter); }
|
<LCOMMENT>\n { cflloc.first_line += 1; BEGIN(comment_enter); }
|
||||||
|
|
||||||
<LCOMMENT><<EOF>> {
|
<LCOMMENT><<EOF>> {
|
||||||
fprintf(stderr, "%s:%d: ERROR: Comment not terminated.\n",
|
fprintf(stderr, "%s:%u: ERROR: Comment not terminated.\n",
|
||||||
current_file, cflloc.first_line);
|
current_file, cflloc.first_line);
|
||||||
command_file_errors += 1;
|
command_file_errors += 1;
|
||||||
BEGIN(0);
|
BEGIN(0);
|
||||||
|
|
@ -84,7 +84,7 @@ int cmdfile_stack_ptr = 0;
|
||||||
<CCOMMENT>"*/" { BEGIN(comment_enter); }
|
<CCOMMENT>"*/" { BEGIN(comment_enter); }
|
||||||
|
|
||||||
<CCOMMENT><<EOF>> {
|
<CCOMMENT><<EOF>> {
|
||||||
fprintf(stderr, "%s:%d: ERROR: Comment not terminated.\n",
|
fprintf(stderr, "%s:%u: ERROR: Comment not terminated.\n",
|
||||||
current_file, cflloc.first_line);
|
current_file, cflloc.first_line);
|
||||||
command_file_errors += 1;
|
command_file_errors += 1;
|
||||||
BEGIN(0);
|
BEGIN(0);
|
||||||
|
|
@ -146,7 +146,7 @@ int cmdfile_stack_ptr = 0;
|
||||||
|
|
||||||
<PLUS_ARGS><<EOF>> {
|
<PLUS_ARGS><<EOF>> {
|
||||||
BEGIN(0);
|
BEGIN(0);
|
||||||
fprintf(stderr, "%s:%d: ERROR: Plusargs statement not terminated.\n",
|
fprintf(stderr, "%s:%u: ERROR: Plusargs statement not terminated.\n",
|
||||||
current_file, cflloc.first_line);
|
current_file, cflloc.first_line);
|
||||||
command_file_errors += 1;
|
command_file_errors += 1;
|
||||||
PROCESS_EOF }
|
PROCESS_EOF }
|
||||||
|
|
@ -194,7 +194,7 @@ int cmdfile_stack_ptr = 0;
|
||||||
<FILE_NAME><<EOF>> {
|
<FILE_NAME><<EOF>> {
|
||||||
cflval.text = trim_trailing_white(yytext, 0);
|
cflval.text = trim_trailing_white(yytext, 0);
|
||||||
BEGIN(0);
|
BEGIN(0);
|
||||||
fprintf(stderr, "%s:%d: ERROR: File name not terminated.\n",
|
fprintf(stderr, "%s:%u: ERROR: File name not terminated.\n",
|
||||||
current_file, cflloc.first_line);
|
current_file, cflloc.first_line);
|
||||||
command_file_errors += 1;
|
command_file_errors += 1;
|
||||||
PROCESS_EOF }
|
PROCESS_EOF }
|
||||||
|
|
@ -233,7 +233,7 @@ void switch_to_command_file(const char *file)
|
||||||
|
|
||||||
if (cmdfile_stack_ptr >= MAX_CMDFILE_DEPTH) {
|
if (cmdfile_stack_ptr >= MAX_CMDFILE_DEPTH) {
|
||||||
fprintf(stderr, "Error: command files nested too deeply (%d) "
|
fprintf(stderr, "Error: command files nested too deeply (%d) "
|
||||||
"at %s:%d.\n", MAX_CMDFILE_DEPTH, current_file,
|
"at %s:%u.\n", MAX_CMDFILE_DEPTH, current_file,
|
||||||
cflloc.first_line);
|
cflloc.first_line);
|
||||||
exit(1);
|
exit(1);
|
||||||
}
|
}
|
||||||
|
|
@ -260,7 +260,7 @@ void switch_to_command_file(const char *file)
|
||||||
yyin = fopen(path, "r");
|
yyin = fopen(path, "r");
|
||||||
if (yyin == NULL) {
|
if (yyin == NULL) {
|
||||||
fprintf(stderr, "Error: unable to read nested command file (%s) "
|
fprintf(stderr, "Error: unable to read nested command file (%s) "
|
||||||
"at %s:%d.\n", path, current_file, cflloc.first_line);
|
"at %s:%u.\n", path, current_file, cflloc.first_line);
|
||||||
exit(1);
|
exit(1);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -382,7 +382,6 @@ static int t_preprocess_only(void)
|
||||||
snprintf(tmp, sizeof tmp, " > \"%s\"", opath);
|
snprintf(tmp, sizeof tmp, " > \"%s\"", opath);
|
||||||
cmd = realloc(cmd, ncmd+strlen(tmp)+1);
|
cmd = realloc(cmd, ncmd+strlen(tmp)+1);
|
||||||
strcpy(cmd+ncmd, tmp);
|
strcpy(cmd+ncmd, tmp);
|
||||||
ncmd += strlen(tmp);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (verbose_flag)
|
if (verbose_flag)
|
||||||
|
|
@ -483,7 +482,6 @@ static int t_compile(void)
|
||||||
rc = strlen(tmp);
|
rc = strlen(tmp);
|
||||||
cmd = realloc(cmd, ncmd+rc+1);
|
cmd = realloc(cmd, ncmd+rc+1);
|
||||||
strcpy(cmd+ncmd, tmp);
|
strcpy(cmd+ncmd, tmp);
|
||||||
ncmd += rc;
|
|
||||||
|
|
||||||
|
|
||||||
if (verbose_flag)
|
if (verbose_flag)
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
* Copyright (c) 2003-2009 Stephen Williams (steve@icarus.com)
|
* Copyright (c) 2003-2021 Stephen Williams (steve@icarus.com)
|
||||||
*
|
*
|
||||||
* This source code is free software; you can redistribute it
|
* This source code is free software; you can redistribute it
|
||||||
* and/or modify it in source code form under the terms of the GNU
|
* and/or modify it in source code form under the terms of the GNU
|
||||||
|
|
@ -44,21 +44,18 @@ int acc_configure(PLI_INT32 config_param, const char*value)
|
||||||
value);
|
value);
|
||||||
}
|
}
|
||||||
|
|
||||||
rc = 1;
|
rc = 0;
|
||||||
if (strcmp(value,"acc_set_scope") == 0) {
|
if (strcmp(value,"acc_set_scope") == 0) {
|
||||||
vpi_printf("XXXX acc_configure argument: Sorry: "
|
vpi_printf("XXXX acc_configure argument: Sorry: "
|
||||||
"(accEnableArgs, %s\n", value);
|
"(accEnableArgs, %s\n", value);
|
||||||
rc = 0;
|
|
||||||
|
|
||||||
} else if (strcmp(value,"no_acc_set_scope") == 0) {
|
} else if (strcmp(value,"no_acc_set_scope") == 0) {
|
||||||
vpi_printf("XXXX acc_configure argument: Sorry: "
|
vpi_printf("XXXX acc_configure argument: Sorry: "
|
||||||
"(accEnableArgs, %s\n", value);
|
"(accEnableArgs, %s\n", value);
|
||||||
rc = 0;
|
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
vpi_printf("XXXX acc_configure argument error. "
|
vpi_printf("XXXX acc_configure argument error. "
|
||||||
"(accEnableArgs, %s(invalid)\n", value);
|
"(accEnableArgs, %s(invalid)\n", value);
|
||||||
rc = 0;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
break;
|
break;
|
||||||
|
|
|
||||||
|
|
@ -59,7 +59,7 @@ unusedFunction:a_handle_parent.c:34
|
||||||
// acc_handle_simulated_net()
|
// acc_handle_simulated_net()
|
||||||
unusedFunction:a_handle_simulated_net.c:26
|
unusedFunction:a_handle_simulated_net.c:26
|
||||||
// acc_handle_tfarg()
|
// acc_handle_tfarg()
|
||||||
unusedFunction:a_handle_tfarg.c:26
|
unusedFunction:a_handle_tfarg.c:27
|
||||||
// acc_handle_tfinst()
|
// acc_handle_tfinst()
|
||||||
unusedFunction:a_handle_tfarg.c:53
|
unusedFunction:a_handle_tfarg.c:53
|
||||||
|
|
||||||
|
|
@ -79,7 +79,7 @@ unusedFunction:a_next_topmod.c:30
|
||||||
unusedFunction:a_product_version.c:23
|
unusedFunction:a_product_version.c:23
|
||||||
|
|
||||||
// acc_set_scope()
|
// acc_set_scope()
|
||||||
unusedFunction:a_handle_object.c:40
|
unusedFunction:a_handle_object.c:39
|
||||||
|
|
||||||
// acc_set_value()
|
// acc_set_value()
|
||||||
unusedFunction:a_set_value.c:27
|
unusedFunction:a_set_value.c:27
|
||||||
|
|
@ -115,7 +115,7 @@ unusedFunction:exprinfo.c:26
|
||||||
// tf_getcstringp()
|
// tf_getcstringp()
|
||||||
unusedFunction:getcstringp.c:26
|
unusedFunction:getcstringp.c:26
|
||||||
// tf_getlongp()
|
// tf_getlongp()
|
||||||
unusedFunction:getlongp.c:29
|
unusedFunction:getlongp.c:30
|
||||||
// tf_getlongtime()
|
// tf_getlongtime()
|
||||||
unusedFunction:getsimtime.c:112
|
unusedFunction:getsimtime.c:112
|
||||||
// tf_getp()
|
// tf_getp()
|
||||||
|
|
@ -125,25 +125,25 @@ unusedFunction:getp.c:120
|
||||||
// tf_gettime()
|
// tf_gettime()
|
||||||
unusedFunction:getsimtime.c:77
|
unusedFunction:getsimtime.c:77
|
||||||
// tf_getworkarea()
|
// tf_getworkarea()
|
||||||
unusedFunction:workarea.c:62
|
unusedFunction:workarea.c:61
|
||||||
// tf_igettimeprecision()
|
// tf_igettimeprecision()
|
||||||
unusedFunction:getsimtime.c:198
|
unusedFunction:getsimtime.c:196
|
||||||
// tf_igettimeunit()
|
// tf_igettimeunit()
|
||||||
unusedFunction:getsimtime.c:228
|
unusedFunction:getsimtime.c:226
|
||||||
// tf_long_to_real()
|
// tf_long_to_real()
|
||||||
unusedFunction:math.c:47
|
unusedFunction:math.c:47
|
||||||
// tf_message()
|
// tf_message()
|
||||||
unusedFunction:io_print.c:56
|
unusedFunction:io_print.c:56
|
||||||
// tf_mipname()
|
// tf_mipname()
|
||||||
unusedFunction:spname.c:47
|
unusedFunction:spname.c:46
|
||||||
// tf_multiply_long()
|
// tf_multiply_long()
|
||||||
unusedFunction:math.c:27
|
unusedFunction:math.c:27
|
||||||
// tf_nodeinfo()
|
// tf_nodeinfo()
|
||||||
unusedFunction:nodeinfo.c:27
|
unusedFunction:nodeinfo.c:27
|
||||||
// tf_nump()
|
// tf_nump()
|
||||||
unusedFunction:nump.c:42
|
unusedFunction:nump.c:43
|
||||||
// tf_putlongp()
|
// tf_putlongp()
|
||||||
unusedFunction:putlongp.c:28
|
unusedFunction:putlongp.c:29
|
||||||
// tf_putp()
|
// tf_putp()
|
||||||
unusedFunction:putp.c:88
|
unusedFunction:putp.c:88
|
||||||
// tf_putrealp()
|
// tf_putrealp()
|
||||||
|
|
@ -151,7 +151,7 @@ unusedFunction:putp.c:137
|
||||||
// tf_real_to_long()
|
// tf_real_to_long()
|
||||||
unusedFunction:math.c:40
|
unusedFunction:math.c:40
|
||||||
// tf_rosynchronize()
|
// tf_rosynchronize()
|
||||||
unusedFunction:veriusertfs.c:391
|
unusedFunction:veriusertfs.c:433
|
||||||
// tf_scale_longdelay()
|
// tf_scale_longdelay()
|
||||||
unusedFunction:getsimtime.c:136
|
unusedFunction:getsimtime.c:136
|
||||||
// tf_scale_realdelay()
|
// tf_scale_realdelay()
|
||||||
|
|
@ -159,9 +159,9 @@ unusedFunction:getsimtime.c:161
|
||||||
// tf_setdelay()
|
// tf_setdelay()
|
||||||
unusedFunction:delay.c:75
|
unusedFunction:delay.c:75
|
||||||
// tf_setrealdelay()
|
// tf_setrealdelay()
|
||||||
unusedFunction:veriusertfs.c:426
|
unusedFunction:veriusertfs.c:468
|
||||||
// tf_setworkarea()
|
// tf_setworkarea()
|
||||||
unusedFunction:workarea.c:36
|
unusedFunction:workarea.c:37
|
||||||
// tf_spname()
|
// tf_spname()
|
||||||
unusedFunction:spname.c:25
|
unusedFunction:spname.c:25
|
||||||
// tf_strgetp()
|
// tf_strgetp()
|
||||||
|
|
@ -169,9 +169,9 @@ unusedFunction:getp.c:177
|
||||||
// tf_strgettime()
|
// tf_strgettime()
|
||||||
unusedFunction:getsimtime.c:85
|
unusedFunction:getsimtime.c:85
|
||||||
// tf_synchronize()
|
// tf_synchronize()
|
||||||
unusedFunction:veriusertfs.c:364
|
unusedFunction:veriusertfs.c:406
|
||||||
// tf_typep()
|
// tf_typep()
|
||||||
unusedFunction:typep.c:24
|
unusedFunction:typep.c:25
|
||||||
// tf_unscale_longdelay()
|
// tf_unscale_longdelay()
|
||||||
unusedFunction:getsimtime.c:144
|
unusedFunction:getsimtime.c:144
|
||||||
// tf_unscale_realdelay()
|
// tf_unscale_realdelay()
|
||||||
|
|
@ -184,4 +184,4 @@ unusedFunction:io_print.c:34
|
||||||
// tf_getlongsimtime()
|
// tf_getlongsimtime()
|
||||||
unusedFunction:getsimtime.c:126
|
unusedFunction:getsimtime.c:126
|
||||||
// veriusertfs_register_table()
|
// veriusertfs_register_table()
|
||||||
unusedFunction:veriusertfs.c:76
|
unusedFunction:veriusertfs.c:93
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue