SCP: Avoid potential compiler warnings
Essentially all are non-functional problems but silencing them is a good idea
This commit is contained in:
parent
85858b1287
commit
31606161ce
6 changed files with 27 additions and 19 deletions
27
scp.c
27
scp.c
|
@ -2689,7 +2689,7 @@ for (i = 1; i < argc; i++) { /* loop thru args */
|
||||||
if (get_switches (argv[i], &sw, NULL) == SW_ERROR) {
|
if (get_switches (argv[i], &sw, NULL) == SW_ERROR) {
|
||||||
fprintf (stderr, "Invalid switch %s\n", argv[i]);
|
fprintf (stderr, "Invalid switch %s\n", argv[i]);
|
||||||
free (targv);
|
free (targv);
|
||||||
return 0;
|
return EXIT_FAILURE;
|
||||||
}
|
}
|
||||||
sim_switches = sim_switches | sw;
|
sim_switches = sim_switches | sw;
|
||||||
}
|
}
|
||||||
|
@ -2697,7 +2697,7 @@ for (i = 1; i < argc; i++) { /* loop thru args */
|
||||||
if ((strlen (argv[i]) + strlen (cbuf) + 3) >= sizeof(cbuf)) {
|
if ((strlen (argv[i]) + strlen (cbuf) + 3) >= sizeof(cbuf)) {
|
||||||
fprintf (stderr, "Argument string too long\n");
|
fprintf (stderr, "Argument string too long\n");
|
||||||
free (targv);
|
free (targv);
|
||||||
return 0;
|
return EXIT_FAILURE;
|
||||||
}
|
}
|
||||||
if (*cbuf) /* concat args */
|
if (*cbuf) /* concat args */
|
||||||
strlcat (cbuf, " ", sizeof (cbuf));
|
strlcat (cbuf, " ", sizeof (cbuf));
|
||||||
|
@ -2741,6 +2741,7 @@ if (sim_timer_init ()) {
|
||||||
fprintf (stderr, "Fatal timer initialization error\n");
|
fprintf (stderr, "Fatal timer initialization error\n");
|
||||||
if (sim_ttisatty())
|
if (sim_ttisatty())
|
||||||
read_line_p ("Hit Return to exit: ", cbuf, sizeof (cbuf) - 1, stdin);
|
read_line_p ("Hit Return to exit: ", cbuf, sizeof (cbuf) - 1, stdin);
|
||||||
|
free (targv);
|
||||||
return EXIT_FAILURE;
|
return EXIT_FAILURE;
|
||||||
}
|
}
|
||||||
sim_register_internal_device (&sim_scp_dev);
|
sim_register_internal_device (&sim_scp_dev);
|
||||||
|
@ -2754,12 +2755,14 @@ if ((stat = sim_ttinit ()) != SCPE_OK) {
|
||||||
sim_error_text (stat));
|
sim_error_text (stat));
|
||||||
if (sim_ttisatty())
|
if (sim_ttisatty())
|
||||||
read_line_p ("Hit Return to exit: ", cbuf, sizeof (cbuf) - 1, stdin);
|
read_line_p ("Hit Return to exit: ", cbuf, sizeof (cbuf) - 1, stdin);
|
||||||
|
free (targv);
|
||||||
return EXIT_FAILURE;
|
return EXIT_FAILURE;
|
||||||
}
|
}
|
||||||
if ((sim_eval = (t_value *) calloc (sim_emax, sizeof (t_value))) == NULL) {
|
if ((sim_eval = (t_value *) calloc (sim_emax, sizeof (t_value))) == NULL) {
|
||||||
fprintf (stderr, "Unable to allocate examine buffer\n");
|
fprintf (stderr, "Unable to allocate examine buffer\n");
|
||||||
if (sim_ttisatty())
|
if (sim_ttisatty())
|
||||||
read_line_p ("Hit Return to exit: ", cbuf, sizeof (cbuf) - 1, stdin);
|
read_line_p ("Hit Return to exit: ", cbuf, sizeof (cbuf) - 1, stdin);
|
||||||
|
free (targv);
|
||||||
return EXIT_FAILURE;
|
return EXIT_FAILURE;
|
||||||
};
|
};
|
||||||
if (sim_dflt_dev == NULL) /* if no default */
|
if (sim_dflt_dev == NULL) /* if no default */
|
||||||
|
@ -2769,6 +2772,7 @@ if ((stat = reset_all_p (0)) != SCPE_OK) {
|
||||||
sim_failed_reset_dptr->name, sim_error_text (stat));
|
sim_failed_reset_dptr->name, sim_error_text (stat));
|
||||||
if (sim_ttisatty())
|
if (sim_ttisatty())
|
||||||
read_line_p ("Hit Return to exit: ", cbuf, sizeof (cbuf) - 1, stdin);
|
read_line_p ("Hit Return to exit: ", cbuf, sizeof (cbuf) - 1, stdin);
|
||||||
|
free (targv);
|
||||||
return EXIT_FAILURE;
|
return EXIT_FAILURE;
|
||||||
}
|
}
|
||||||
if (register_check) {
|
if (register_check) {
|
||||||
|
@ -2779,17 +2783,21 @@ if (register_check) {
|
||||||
sim_printf ("Simulator device register sanity check error\n");
|
sim_printf ("Simulator device register sanity check error\n");
|
||||||
if (sim_ttisatty())
|
if (sim_ttisatty())
|
||||||
read_line_p ("Hit Return to exit: ", cbuf, sizeof (cbuf) - 1, stdin);
|
read_line_p ("Hit Return to exit: ", cbuf, sizeof (cbuf) - 1, stdin);
|
||||||
|
free (targv);
|
||||||
return EXIT_FAILURE;
|
return EXIT_FAILURE;
|
||||||
}
|
}
|
||||||
sim_printf ("*** Good Registers in %s simulator.\n", sim_name);
|
sim_printf ("*** Good Registers in %s simulator.\n", sim_name);
|
||||||
if (argc < 2) /* No remaining command arguments? */
|
if (argc < 2) { /* No remaining command arguments? */
|
||||||
|
free (targv);
|
||||||
return EXIT_SUCCESS; /* then we're done */
|
return EXIT_SUCCESS; /* then we're done */
|
||||||
|
}
|
||||||
}
|
}
|
||||||
if ((stat = sim_brk_init ()) != SCPE_OK) {
|
if ((stat = sim_brk_init ()) != SCPE_OK) {
|
||||||
fprintf (stderr, "Fatal breakpoint table initialization error\n%s\n",
|
fprintf (stderr, "Fatal breakpoint table initialization error\n%s\n",
|
||||||
sim_error_text (stat));
|
sim_error_text (stat));
|
||||||
if (sim_ttisatty())
|
if (sim_ttisatty())
|
||||||
read_line_p ("Hit Return to exit: ", cbuf, sizeof (cbuf) - 1, stdin);
|
read_line_p ("Hit Return to exit: ", cbuf, sizeof (cbuf) - 1, stdin);
|
||||||
|
free (targv);
|
||||||
return EXIT_FAILURE;
|
return EXIT_FAILURE;
|
||||||
}
|
}
|
||||||
/* always check for register definition problems */
|
/* always check for register definition problems */
|
||||||
|
@ -2867,7 +2875,7 @@ return sim_exit_status;
|
||||||
t_stat process_stdin_commands (t_stat stat, char *argv[], t_bool do_called)
|
t_stat process_stdin_commands (t_stat stat, char *argv[], t_bool do_called)
|
||||||
{
|
{
|
||||||
char cbuf[4*CBUFSIZE], gbuf[CBUFSIZE];
|
char cbuf[4*CBUFSIZE], gbuf[CBUFSIZE];
|
||||||
CONST char *cptr;
|
CONST char *cptr = NULL;
|
||||||
t_stat stat_nomessage;
|
t_stat stat_nomessage;
|
||||||
CTAB *cmdp = NULL;
|
CTAB *cmdp = NULL;
|
||||||
|
|
||||||
|
@ -4639,12 +4647,12 @@ t_stat assert_cmd (int32 flag, CONST char *cptr)
|
||||||
char gbuf[CBUFSIZE], gbuf2[CBUFSIZE];
|
char gbuf[CBUFSIZE], gbuf2[CBUFSIZE];
|
||||||
CONST char *tptr, *gptr;
|
CONST char *tptr, *gptr;
|
||||||
REG *rptr;
|
REG *rptr;
|
||||||
uint32 idx;
|
uint32 idx = 0;
|
||||||
t_stat r;
|
t_stat r;
|
||||||
t_bool Not = FALSE;
|
t_bool Not = FALSE;
|
||||||
t_bool Exist = FALSE;
|
t_bool Exist = FALSE;
|
||||||
t_bool result;
|
t_bool result;
|
||||||
t_addr addr;
|
t_addr addr = 0;
|
||||||
t_stat reason;
|
t_stat reason;
|
||||||
|
|
||||||
cptr = (CONST char *)get_sim_opt (CMD_OPT_SW|CMD_OPT_DFT, (CONST char *)cptr, &r);
|
cptr = (CONST char *)get_sim_opt (CMD_OPT_SW|CMD_OPT_DFT, (CONST char *)cptr, &r);
|
||||||
|
@ -4771,7 +4779,8 @@ else {
|
||||||
return SCPE_ARG;
|
return SCPE_ARG;
|
||||||
gptr = tptr; /* update */
|
gptr = tptr; /* update */
|
||||||
}
|
}
|
||||||
else idx = 0; /* not array */
|
else
|
||||||
|
idx = 0; /* not array */
|
||||||
if (idx >= rptr->depth) /* validate subscript */
|
if (idx >= rptr->depth) /* validate subscript */
|
||||||
return SCPE_SUB;
|
return SCPE_SUB;
|
||||||
}
|
}
|
||||||
|
@ -10797,7 +10806,7 @@ SCHTAB *get_asearch (CONST char *cptr, int32 radix, SCHTAB *schptr)
|
||||||
{
|
{
|
||||||
int32 c, logop, cmpop;
|
int32 c, logop, cmpop;
|
||||||
t_value *logval, *cmpval;
|
t_value *logval, *cmpval;
|
||||||
t_stat reason;
|
t_stat reason = SCPE_OK;
|
||||||
CONST char *ocptr = cptr;
|
CONST char *ocptr = cptr;
|
||||||
const char *sptr;
|
const char *sptr;
|
||||||
char gbuf[CBUFSIZE];
|
char gbuf[CBUFSIZE];
|
||||||
|
@ -12656,7 +12665,7 @@ return SCPE_OK;
|
||||||
t_stat sim_exp_check (EXPECT *exp, uint8 data)
|
t_stat sim_exp_check (EXPECT *exp, uint8 data)
|
||||||
{
|
{
|
||||||
int32 i;
|
int32 i;
|
||||||
EXPTAB *ep;
|
EXPTAB *ep = NULL;
|
||||||
int regex_checks = 0;
|
int regex_checks = 0;
|
||||||
char *tstr = NULL;
|
char *tstr = NULL;
|
||||||
|
|
||||||
|
|
4
scp.h
4
scp.h
|
@ -339,8 +339,8 @@ void sim_debug_unit (uint32 dbits, UNIT* uptr, const char *fmt, ...) GCC_FMT_ATT
|
||||||
#else
|
#else
|
||||||
void _sim_debug_unit (uint32 dbits, UNIT *uptr, const char* fmt, ...) GCC_FMT_ATTR(3, 4);
|
void _sim_debug_unit (uint32 dbits, UNIT *uptr, const char* fmt, ...) GCC_FMT_ATTR(3, 4);
|
||||||
void _sim_debug_device (uint32 dbits, DEVICE* dptr, const char* fmt, ...) GCC_FMT_ATTR(3, 4);
|
void _sim_debug_device (uint32 dbits, DEVICE* dptr, const char* fmt, ...) GCC_FMT_ATTR(3, 4);
|
||||||
#define sim_debug(dbits, dptr, ...) do { if (sim_deb && dptr && ((dptr)->dctrl & (dbits))) _sim_debug_device (dbits, dptr, __VA_ARGS__);} while (0)
|
#define sim_debug(dbits, dptr, ...) do { if ((sim_deb != NULL) && ((dptr) != NULL) && ((dptr)->dctrl & (dbits))) _sim_debug_device (dbits, dptr, __VA_ARGS__);} while (0)
|
||||||
#define sim_debug_unit(dbits, uptr, ...) do { if (sim_deb && uptr && (((uptr)->dctrl | (uptr)->dptr->dctrl) & (dbits))) _sim_debug_unit (dbits, uptr, __VA_ARGS__);} while (0)
|
#define sim_debug_unit(dbits, uptr, ...) do { if ((sim_deb != NULL) && ((uptr) != NULL) && (((uptr)->dctrl | (uptr)->dptr->dctrl) & (dbits))) _sim_debug_unit (dbits, uptr, __VA_ARGS__);} while (0)
|
||||||
#endif
|
#endif
|
||||||
void sim_flush_buffered_files (void);
|
void sim_flush_buffered_files (void);
|
||||||
|
|
||||||
|
|
|
@ -2049,7 +2049,7 @@ else
|
||||||
return sim_messagef (SCPE_INVREM, "Can't enable Remote Console Master mode with Remote Console disabled\n");
|
return sim_messagef (SCPE_INVREM, "Can't enable Remote Console Master mode with Remote Console disabled\n");
|
||||||
|
|
||||||
if (sim_rem_master_mode) {
|
if (sim_rem_master_mode) {
|
||||||
t_stat stat_nomessage;
|
t_stat stat_nomessage = 0;
|
||||||
|
|
||||||
sim_messagef (SCPE_OK, "Command input starting on Master Remote Console Session\n");
|
sim_messagef (SCPE_OK, "Command input starting on Master Remote Console Session\n");
|
||||||
stat = sim_run_boot_prep (0);
|
stat = sim_run_boot_prep (0);
|
||||||
|
@ -2291,7 +2291,7 @@ t_stat sim_set_debon (int32 flag, CONST char *cptr)
|
||||||
char gbuf[CBUFSIZE];
|
char gbuf[CBUFSIZE];
|
||||||
t_stat r;
|
t_stat r;
|
||||||
time_t now;
|
time_t now;
|
||||||
size_t buffer_size;
|
size_t buffer_size = 0;
|
||||||
|
|
||||||
if ((cptr == NULL) || (*cptr == 0)) /* need arg */
|
if ((cptr == NULL) || (*cptr == 0)) /* need arg */
|
||||||
return SCPE_2FARG;
|
return SCPE_2FARG;
|
||||||
|
|
|
@ -1671,7 +1671,6 @@ return SCPE_IOERR;
|
||||||
|
|
||||||
static t_stat rstsLoadAndScanSATT(rstsContext *context, uint16 uaa, uint16 uar, t_offset *result)
|
static t_stat rstsLoadAndScanSATT(rstsContext *context, uint16 uaa, uint16 uar, t_offset *result)
|
||||||
{
|
{
|
||||||
t_offset blocks = 0;
|
|
||||||
uint8 bitmap[8192];
|
uint8 bitmap[8192];
|
||||||
int i, j;
|
int i, j;
|
||||||
RSTS_ACNT acnt;
|
RSTS_ACNT acnt;
|
||||||
|
@ -2080,6 +2079,7 @@ switch (DK_GET_FMT (uptr)) { /* case on format */
|
||||||
|
|
||||||
/* Construct a pseudo simh disk footer*/
|
/* Construct a pseudo simh disk footer*/
|
||||||
memcpy (f->Signature, "simh", 4);
|
memcpy (f->Signature, "simh", 4);
|
||||||
|
f->DriveType[sizeof (f->DriveType) - 1] = '\0'; /* Force NUL termination */
|
||||||
strncpy ((char *)f->DriveType, sim_vhd_disk_get_dtype (uptr->fileref, &f->SectorSize, &f->TransferElementSize, (char *)f->CreatingSimulator, &creation_time), sizeof (f->DriveType) - 1);
|
strncpy ((char *)f->DriveType, sim_vhd_disk_get_dtype (uptr->fileref, &f->SectorSize, &f->TransferElementSize, (char *)f->CreatingSimulator, &creation_time), sizeof (f->DriveType) - 1);
|
||||||
f->SectorSize = NtoHl (f->SectorSize);
|
f->SectorSize = NtoHl (f->SectorSize);
|
||||||
f->TransferElementSize = NtoHl (f->TransferElementSize);
|
f->TransferElementSize = NtoHl (f->TransferElementSize);
|
||||||
|
@ -2146,6 +2146,7 @@ f = (struct simh_disk_footer *)calloc (1, sizeof (*f));
|
||||||
f->AccessFormat = DK_GET_FMT (uptr);
|
f->AccessFormat = DK_GET_FMT (uptr);
|
||||||
total_sectors = (((t_offset)uptr->capac) * ctx->capac_factor * ((dptr->flags & DEV_SECTORS) ? 512 : 1)) / ctx->sector_size;
|
total_sectors = (((t_offset)uptr->capac) * ctx->capac_factor * ((dptr->flags & DEV_SECTORS) ? 512 : 1)) / ctx->sector_size;
|
||||||
memcpy (f->Signature, "simh", 4);
|
memcpy (f->Signature, "simh", 4);
|
||||||
|
f->CreatingSimulator[sizeof (f->CreatingSimulator) - 1] = '\0'; /* Force NUL termination */
|
||||||
strncpy ((char *)f->CreatingSimulator, sim_name, sizeof (f->CreatingSimulator) - 1);
|
strncpy ((char *)f->CreatingSimulator, sim_name, sizeof (f->CreatingSimulator) - 1);
|
||||||
strncpy ((char *)f->DriveType, dtype, sizeof (f->DriveType) - 1);
|
strncpy ((char *)f->DriveType, dtype, sizeof (f->DriveType) - 1);
|
||||||
f->SectorSize = NtoHl (ctx->sector_size);
|
f->SectorSize = NtoHl (ctx->sector_size);
|
||||||
|
@ -4736,6 +4737,7 @@ memset (hVHD->Footer.DriveType, '\0', sizeof hVHD->Footer.DriveType);
|
||||||
memcpy (hVHD->Footer.DriveType, dtype, ((1+strlen (dtype)) < sizeof (hVHD->Footer.DriveType)) ? (1+strlen (dtype)) : sizeof (hVHD->Footer.DriveType));
|
memcpy (hVHD->Footer.DriveType, dtype, ((1+strlen (dtype)) < sizeof (hVHD->Footer.DriveType)) ? (1+strlen (dtype)) : sizeof (hVHD->Footer.DriveType));
|
||||||
hVHD->Footer.DriveSectorSize = NtoHl (SectorSize);
|
hVHD->Footer.DriveSectorSize = NtoHl (SectorSize);
|
||||||
hVHD->Footer.DriveTransferElementSize = NtoHl (xfer_element_size);
|
hVHD->Footer.DriveTransferElementSize = NtoHl (xfer_element_size);
|
||||||
|
hVHD->Footer.CreatingSimulator[sizeof (hVHD->Footer.CreatingSimulator) - 1] = '\0'; /* Force NUL termination */
|
||||||
strncpy ((char *)hVHD->Footer.CreatingSimulator, sim_name, sizeof (hVHD->Footer.CreatingSimulator) - 1);
|
strncpy ((char *)hVHD->Footer.CreatingSimulator, sim_name, sizeof (hVHD->Footer.CreatingSimulator) - 1);
|
||||||
hVHD->Footer.Checksum = 0;
|
hVHD->Footer.Checksum = 0;
|
||||||
hVHD->Footer.Checksum = NtoHl (CalculateVhdFooterChecksum (&hVHD->Footer, sizeof(hVHD->Footer)));
|
hVHD->Footer.Checksum = NtoHl (CalculateVhdFooterChecksum (&hVHD->Footer, sizeof(hVHD->Footer)));
|
||||||
|
|
|
@ -1908,7 +1908,7 @@ static void *
|
||||||
_eth_writer(void *arg)
|
_eth_writer(void *arg)
|
||||||
{
|
{
|
||||||
ETH_DEV* volatile dev = (ETH_DEV*)arg;
|
ETH_DEV* volatile dev = (ETH_DEV*)arg;
|
||||||
ETH_WRITE_REQUEST *request;
|
ETH_WRITE_REQUEST *request = NULL;
|
||||||
|
|
||||||
/* Boost Priority for this I/O thread vs the CPU instruction execution
|
/* Boost Priority for this I/O thread vs the CPU instruction execution
|
||||||
thread which in general won't be readily yielding the processor when
|
thread which in general won't be readily yielding the processor when
|
||||||
|
@ -4272,7 +4272,6 @@ ETH_MAC filter_address[3] = {
|
||||||
{0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF},
|
{0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF},
|
||||||
};
|
};
|
||||||
int addr_count;
|
int addr_count;
|
||||||
ETH_MAC physical_addr = {0x04, 0x05, 0x06, 0x07, 0x08, 0x09};
|
|
||||||
ETH_MAC host_nic_phy_hw_addr = {0x02, 0x03, 0x04, 0x05, 0x06, 0x07};
|
ETH_MAC host_nic_phy_hw_addr = {0x02, 0x03, 0x04, 0x05, 0x06, 0x07};
|
||||||
ETH_MAC *host_phy_addr_list[2] = {&host_nic_phy_hw_addr, NULL};
|
ETH_MAC *host_phy_addr_list[2] = {&host_nic_phy_hw_addr, NULL};
|
||||||
int host_phy_addr_listindex;
|
int host_phy_addr_listindex;
|
||||||
|
|
|
@ -992,9 +992,7 @@ if (dir) {
|
||||||
#endif
|
#endif
|
||||||
t_offset FileSize;
|
t_offset FileSize;
|
||||||
char *FileName;
|
char *FileName;
|
||||||
const char *MatchName = 1 + strrchr (cptr, '/');
|
char *p_name;
|
||||||
char *p_name;
|
|
||||||
struct tm *local;
|
|
||||||
#if defined (HAVE_GLOB)
|
#if defined (HAVE_GLOB)
|
||||||
size_t i;
|
size_t i;
|
||||||
#endif
|
#endif
|
||||||
|
|
Loading…
Add table
Reference in a new issue