From cfbe1afa21b3df44d9d87e42282ba85c3dc80c95 Mon Sep 17 00:00:00 2001 From: Giles Atkinson <“gatk555@gmail.com”> Date: Wed, 20 Mar 2024 10:43:13 +0000 Subject: [PATCH] Suppress some warnings from MSVC. --- src/frontend/com_fileio.c | 2 +- src/frontend/com_strcmp.c | 6 +++--- src/frontend/inp.c | 2 +- src/frontend/vectors.c | 12 ++++++------ src/xspice/cmpp/pp_lst.c | 8 +++++--- src/xspice/evt/evtload.c | 1 - src/xspice/icm/digital/bidi_bridge/cfunc.mod | 3 +-- src/xspice/icm/digital/d_cosim/cfunc.mod | 16 ++++++++-------- src/xspice/icm/digital/d_osc/cfunc.mod | 2 -- src/xspice/icm/xtradev/pswitch/cfunc.mod | 4 ++-- 10 files changed, 27 insertions(+), 29 deletions(-) diff --git a/src/frontend/com_fileio.c b/src/frontend/com_fileio.c index 078baa2c3..e795a324d 100644 --- a/src/frontend/com_fileio.c +++ b/src/frontend/com_fileio.c @@ -117,7 +117,7 @@ void com_fread(wordlist *wl) } if (fgets(buf, sizeof buf, Open_Files[fd].fp)) { - length = strlen(buf); + length = (int)strlen(buf); if (length > 0 && buf[length - 1] == '\n') { --length; if (length > 0 && buf[length - 1] == '\r') { diff --git a/src/frontend/com_strcmp.c b/src/frontend/com_strcmp.c index 4663d59b3..6d179485e 100644 --- a/src/frontend/com_strcmp.c +++ b/src/frontend/com_strcmp.c @@ -36,11 +36,11 @@ void com_strstr(wordlist *wl) if (*s2) { var = strstr(s1, s2); // Search for s2 in s1 if (var) - i = var - s1; // Offset to match + i = (int)(var - s1); // Offset to match else i = -1; } else { - i = strlen(s1); // Length + i = (int)strlen(s1); // Length } tfree(s1); tfree(s2); @@ -58,7 +58,7 @@ void com_strslice(wordlist *wl) wl = wl->wl_next; offset = atoi(wl->wl_word); length = atoi(wl->wl_next->wl_word); - actual = strlen(s1); + actual = (int)strlen(s1); if (offset < 0) offset = actual + offset; if (length + offset > actual) diff --git a/src/frontend/inp.c b/src/frontend/inp.c index da24fa05f..1d98ed4df 100644 --- a/src/frontend/inp.c +++ b/src/frontend/inp.c @@ -667,7 +667,7 @@ inp_spsource(FILE *fp, bool comfile, char *filename, bool intfile) with_params = TRUE; size = sizeof header + 10; // Allow for %u and close. for (argc = 0; Copy_of_argv[optind + argc]; ++argc) - size += strlen(Copy_of_argv[optind + argc]); + size += (int)strlen(Copy_of_argv[optind + argc]); size += 3 * argc; // Spaces and quotes. if (size <= sizeof buf) p_buf_active = buf; diff --git a/src/frontend/vectors.c b/src/frontend/vectors.c index adcbb8f1a..0bf986fa0 100644 --- a/src/frontend/vectors.c +++ b/src/frontend/vectors.c @@ -691,16 +691,16 @@ vec_get(const char *vec_name) { for (v = vv; v; v = v->va_next) { struct dvec *nd; - char *vec_name, new_name[256]; + char *new_vec_name, new_name[256]; if (multiple) { snprintf(new_name, sizeof new_name, "@%s[%s]", name, v->va_name); - vec_name = new_name; + new_vec_name = new_name; } else { - vec_name = whole; + new_vec_name = whole; } - nd = dvec_alloc(copy(vec_name), + nd = dvec_alloc(copy(new_vec_name), SV_NOTYPE, VF_REAL, /* No complex values yet... */ 1, NULL); @@ -719,7 +719,7 @@ vec_get(const char *vec_name) { fprintf(stderr, "ERROR: can not handle string value " "of '%s' in vec_get(%s)\nIgnoring...\n", - v->va_name, vec_name); + v->va_name, new_vec_name); dvec_free(nd); continue; break; @@ -752,7 +752,7 @@ vec_get(const char *vec_name) { fprintf(stderr, "ERROR: can not handle mixed, string or list " "value of '%s' in vec_get(%s)\nIgnoring...\n", - v->va_name, vec_name); + v->va_name, new_vec_name); dvec_free(nd); continue; } diff --git a/src/xspice/cmpp/pp_lst.c b/src/xspice/cmpp/pp_lst.c index 1edaaf226..e38ac96ae 100644 --- a/src/xspice/cmpp/pp_lst.c +++ b/src/xspice/cmpp/pp_lst.c @@ -250,7 +250,8 @@ int output_paths_from_lst_file(const char *filename) bool f_have_path = false; /* do not have a path to store */ FBTYPE fbtype; - FBOBJ fbobj; + FBOBJ fbobj = { .dbl_value = 0.0}; // Placate MS compiler. + for ( ; ; ) { /* Read items until end of file */ /* Get the next path if not found yet */ if (!f_have_path) { @@ -378,7 +379,8 @@ static int read_modpath( bool f_have_path = false; /* do not have a path to store */ FBTYPE fbtype; - FBOBJ fbobj; + FBOBJ fbobj = { .dbl_value = 0.0}; + for ( ; ; ) { /* Read items until end of file */ /* Get the next path if not found yet */ if (!f_have_path) { @@ -553,7 +555,7 @@ static int read_udnpath( bool f_have_path = false; /* do not have a path to store */ FBTYPE fbtype; - FBOBJ fbobj; + FBOBJ fbobj = { .dbl_value = 0.0}; for ( ; ; ) { /* Read items until end of file */ /* Get the next path if not found yet */ diff --git a/src/xspice/evt/evtload.c b/src/xspice/evt/evtload.c index a0b75326a..cd570805c 100644 --- a/src/xspice/evt/evtload.c +++ b/src/xspice/evt/evtload.c @@ -108,7 +108,6 @@ int EVTload_with_event( Evt_Node_Data_t *node_data; Mif_Private_t cm_data; - void *value_ptr; /* ***************************** */ /* Prepare the code model inputs */ diff --git a/src/xspice/icm/digital/bidi_bridge/cfunc.mod b/src/xspice/icm/digital/bidi_bridge/cfunc.mod index 6f9371b4a..2776723e6 100644 --- a/src/xspice/icm/digital/bidi_bridge/cfunc.mod +++ b/src/xspice/icm/digital/bidi_bridge/cfunc.mod @@ -147,7 +147,7 @@ void cm_bidi_bridge(ARGS) out = 0.0; /* AtoD, no analogue output. */ svoc = 0.5; } else { - double target, iota, interval[2], range, partial; + double target, iota, interval[2], range, partial = 0.0; int step, step_count; Digital_t drive, *dp; @@ -274,7 +274,6 @@ void cm_bidi_bridge(ARGS) voc = out_low + (out_high - out_low) * voc; target = 0.0; - partial = 0.0; /* Calculate new value for output current. */ diff --git a/src/xspice/icm/digital/d_cosim/cfunc.mod b/src/xspice/icm/digital/d_cosim/cfunc.mod index e85d9e5f7..c22b393f4 100644 --- a/src/xspice/icm/digital/d_cosim/cfunc.mod +++ b/src/xspice/icm/digital/d_cosim/cfunc.mod @@ -140,9 +140,9 @@ void accept_output(struct co_info *pinfo, unsigned int bit_num, Digital_t *val) static void output(struct instance *ip, ARGS) { - double delay; - Digital_t *out_vals; // XSPICE rotating memory - int i, j; + double delay; + Digital_t *out_vals; // XSPICE rotating memory + unsigned int i, j; delay = PARAM(delay) - (TIME - ip->info.vtime); if (delay <= 0) { @@ -314,7 +314,7 @@ static bool check_input(struct instance *ip, Digital_t *ovp, { if (ovp->state != rp->what.state || ovp->strength != rp->what.strength) { - if (++ip->q_index < ip->q_length) { + if (++ip->q_index < (int) ip->q_length) { /* Record this event. */ ip->q[ip->q_index] = *rp; @@ -345,10 +345,10 @@ void ucm_d_cosim(ARGS) { struct instance *ip; Digital_t *in_vals; // XSPICE rotating memory - int i, index; + unsigned int i, index; if (INIT) { - int ins, outs, inouts; + unsigned int ins, outs, inouts; unsigned int alloc_size; void *handle; void (*ifp)(struct co_info *); @@ -380,7 +380,7 @@ void ucm_d_cosim(ARGS) cm_message_send(dlerror()); return; } - ifp = dlsym(handle, "Cosim_setup"); + ifp = (void (*)(struct co_info *))dlsym(handle, "Cosim_setup"); if (*ifp == NULL) { cm_message_printf("ERROR: no entry function in %s", fn); cm_message_send(dlerror()); @@ -468,7 +468,7 @@ void ucm_d_cosim(ARGS) ip = STATIC_VAR(cosim_instance); if (!ip) { - int ports; + unsigned int ports; /* Error state. Do nothing at all. */ diff --git a/src/xspice/icm/digital/d_osc/cfunc.mod b/src/xspice/icm/digital/d_osc/cfunc.mod index 8a598bd89..ab15042cd 100644 --- a/src/xspice/icm/digital/d_osc/cfunc.mod +++ b/src/xspice/icm/digital/d_osc/cfunc.mod @@ -17,8 +17,6 @@ struct pwl { static void cm_d_osc_callback(ARGS, Mif_Callback_Reason_t reason) { - struct panel_instance *instance; - if (reason == MIF_CB_DESTROY) { struct pwl *table = STATIC_VAR(locdata); diff --git a/src/xspice/icm/xtradev/pswitch/cfunc.mod b/src/xspice/icm/xtradev/pswitch/cfunc.mod index d0cf2ff43..3b8d0b6a3 100644 --- a/src/xspice/icm/xtradev/pswitch/cfunc.mod +++ b/src/xspice/icm/xtradev/pswitch/cfunc.mod @@ -177,8 +177,8 @@ void cm_pswitch(ARGS) /* structure holding parms, r_off = (r_off > 1.0e12) ? 1.0e12 : r_off; /* Set maximum 'OFF' resistance */ - if(INIT == 1) { /* first time through, allocate memory, set static parameters */ - char *cntl_error = "\n*****ERROR*****\nPSWITCH: CONTROL voltage delta less than 1.0e-12\n"; + if(INIT == 1) { + /* First time through, allocate memory, set static parameters. */ cntl_on = PARAM(cntl_on); cntl_off = PARAM(cntl_off);