Browse Source

Fix warnings from gcc 10.2.1.

pre-master-46
Giles Atkinson 3 years ago
committed by Holger Vogt
parent
commit
73e8fed0fc
  1. 4
      src/frontend/dotcards.c
  2. 6
      src/frontend/udevices.c
  3. 2
      src/main.c
  4. 6
      src/xspice/cmpp/file_buffer.c
  5. 20
      src/xspice/cmpp/pp_lst.c
  6. 2
      src/xspice/cmpp/writ_ifs.c

4
src/frontend/dotcards.c

@ -633,7 +633,9 @@ gettoks(char *s)
/* Transfer i(xx) to xxx#branch only when i is the first /* Transfer i(xx) to xxx#branch only when i is the first
character of the token or preceeded by a space. */ character of the token or preceeded by a space. */
if ((*(l - 1) == 'i' || *(l - 1) == 'I') && (l - 1 == t) || ((l > t + 1) && isspace(*(l-2)))) {
if ((*(l - 1) == 'i' ||
((*(l - 1) == 'I') && (l - 1 == t))) ||
((l > t + 1) && isspace(*(l-2)))) {
char buf[513]; char buf[513];
sprintf(buf, "%s#branch", l + 1); sprintf(buf, "%s#branch", l + 1);
wl->wl_word = copy(buf); wl->wl_word = copy(buf);

6
src/frontend/udevices.c

@ -262,6 +262,8 @@ static void clear_name_list(NAME_ENTRY nelist, char *msg)
#ifdef TRACE #ifdef TRACE
printf("%s\n", msg); printf("%s\n", msg);
print_name_list(nelist); print_name_list(nelist);
#else
(void)msg;
#endif #endif
for (x = nelist; x; x = next) { for (x = nelist; x; x = next) {
next = x->next; next = x->next;
@ -1505,7 +1507,7 @@ static struct instance_hdr *create_instance_header(char *line)
return hdr; return hdr;
} }
char *new_inverter(char *iname, char *node, Xlatorp xlp)
static char *new_inverter(char *iname, char *node, Xlatorp xlp)
{ {
/* Return the name of the output of the new inverter */ /* Return the name of the output of the new inverter */
/* tfree the returned string after it has been used by the caller */ /* tfree the returned string after it has been used by the caller */
@ -2469,7 +2471,7 @@ static void estimate_typ(struct timing_data *tdp)
if (strlen(tmpmin) > 0 && strlen(tmpmax) > 0) { if (strlen(tmpmin) > 0 && strlen(tmpmax) > 0) {
valmin = strtof(tmpmin, &units1); valmin = strtof(tmpmin, &units1);
valmax = strtof(tmpmax, &units2); valmax = strtof(tmpmax, &units2);
average = (valmin + valmax) / (float)2.0;
average = (float)((valmin + valmax) / 2.0);
tdp->ave = tprintf("%.2f%s", average, units2); tdp->ave = tprintf("%.2f%s", average, units2);
if (!eq(units1, units2)) { if (!eq(units1, units2)) {
printf("WARNING units do not match\n"); printf("WARNING units do not match\n");

2
src/main.c

@ -810,7 +810,7 @@ int main(int argc, char **argv)
bool qflag = FALSE; /* flag for command completion */ bool qflag = FALSE; /* flag for command completion */
FILE * volatile circuit_file; FILE * volatile circuit_file;
bool oflag = FALSE;
bool volatile oflag = FALSE;
bool srflag = FALSE; bool srflag = FALSE;
#ifdef TRACE #ifdef TRACE

6
src/xspice/cmpp/file_buffer.c

@ -482,7 +482,7 @@ static size_t fb_make_space_at_end(FILEBUF *p_fb)
/* Shift data in use to the front of the buffer if not already */ /* Shift data in use to the front of the buffer if not already */
if (p_dst != p_src) { /* object is not at start of buffer */ if (p_dst != p_src) { /* object is not at start of buffer */
const size_t n = p_fb->p_data_end - p_src;
const size_t n = (size_t)(p_fb->p_data_end - p_src);
if (n > 0) { /* Will be 0 if skipping whitespace and comments */ if (n > 0) { /* Will be 0 if skipping whitespace and comments */
(void) memmove(p_dst, p_src, n); (void) memmove(p_dst, p_src, n);
} }
@ -528,7 +528,7 @@ static size_t fb_make_space_at_end(FILEBUF *p_fb)
} }
} }
return p_fb->p_buf_end - p_fb->p_data_end;
return (size_t)(p_fb->p_buf_end - p_fb->p_data_end);
} /* end of function fb_make_space_at_end */ } /* end of function fb_make_space_at_end */
@ -689,7 +689,7 @@ static int fb_return_string(FILEBUF *p_fb,
{ {
const char *p_data_start = const char *p_data_start =
p_fbobj->str_value.sz = p_fb->p_obj_start; p_fbobj->str_value.sz = p_fb->p_obj_start;
p_fbobj->str_value.n_char = p_fb->p_obj_end - p_data_start;
p_fbobj->str_value.n_char = (size_t)(p_fb->p_obj_end - p_data_start);
*p_type_found = BUF_TYPE_STRING; *p_type_found = BUF_TYPE_STRING;
return 0; return 0;
} /* end of function fb_return_string */ } /* end of function fb_return_string */

20
src/xspice/cmpp/pp_lst.c

@ -471,12 +471,12 @@ EXITPOINT:
/* If error, free model info */ /* If error, free model info */
if (xrc != 0) { if (xrc != 0) {
free_model_info(n_model_info, p_model_info);
free_model_info((int)n_model_info, p_model_info);
n_model_info = 0; n_model_info = 0;
p_model_info = (Model_Info_t *) NULL; p_model_info = (Model_Info_t *) NULL;
} }
*p_num_model_info = n_model_info;
*p_num_model_info = (int)n_model_info;
*pp_model_info = p_model_info; *pp_model_info = p_model_info;
return xrc; return xrc;
@ -648,12 +648,12 @@ EXITPOINT:
/* If error, free node info */ /* If error, free node info */
if (xrc != 0) { if (xrc != 0) {
free_node_info(n_node_info, p_node_info);
free_node_info((int)n_node_info, p_node_info);
n_node_info = 0; n_node_info = 0;
p_node_info = (Node_Info_t *) NULL; p_node_info = (Node_Info_t *) NULL;
} }
*p_num_node_info = n_node_info;
*p_num_node_info = (int)n_node_info;
*pp_node_info = p_node_info; *pp_node_info = p_node_info;
return xrc; return xrc;
@ -945,8 +945,8 @@ static int check_uniqueness(
} }
/* Sizes of models and nodes */ /* Sizes of models and nodes */
const unsigned int n_model = (unsigned int) numSPICEmodels + num_models;
const unsigned int n_node = (unsigned int) numUDNidentifiers + num_nodes;
const unsigned int n_model = (unsigned int)(numSPICEmodels + num_models);
const unsigned int n_node = (unsigned int)(numUDNidentifiers + num_nodes);
const unsigned int n_ks = n_model > n_node ? n_model : n_node; const unsigned int n_ks = n_model > n_node ? n_model : n_node;
/* Allocate structure to compare */ /* Allocate structure to compare */
@ -994,8 +994,8 @@ static int check_uniqueness(
} }
/* Test for duplicates */ /* Test for duplicates */
f_have_duplicate |= test_for_duplicates(num_models, p_ks,
&report_error_function_name);
f_have_duplicate |= test_for_duplicates((unsigned int)num_models,
p_ks, &report_error_function_name);
} }
} }
@ -1588,14 +1588,14 @@ static int read_udn_type_name(
c = fgetc(fp); c = fgetc(fp);
if(c == '"') { if(c == '"') {
found = true; found = true;
if (i >= sizeof name) {
if (i >= (int)sizeof name) {
print_error("name too long"); print_error("name too long");
exit(1); exit(1);
} }
name[i] = '\0'; name[i] = '\0';
} }
else if(c != EOF) { else if(c != EOF) {
if (i > sizeof name) {
if (i > (int)sizeof name) {
print_error("name too long"); print_error("name too long");
exit(1); exit(1);
} }

2
src/xspice/cmpp/writ_ifs.c

@ -1220,7 +1220,7 @@ static char *value_to_str(Data_Type_t type, Value_t value)
str_len = (int) strlen(value.svalue); str_len = (int) strlen(value.svalue);
if ((str_len + BASE_STR_LEN) > max_len) { if ((str_len + BASE_STR_LEN) > max_len) {
int n_byte_alloc = max_len + str_len + 1; int n_byte_alloc = max_len + str_len + 1;
void * const p = realloc(str, n_byte_alloc);
void * const p = realloc(str, (size_t)n_byte_alloc);
if (p == NULL) { if (p == NULL) {
(void) fprintf(stderr, (void) fprintf(stderr,
"Unable to resize string buffer to size %d.\n", "Unable to resize string buffer to size %d.\n",

Loading…
Cancel
Save