From c6c66487acf97aba43449716e57c7d4457328c70 Mon Sep 17 00:00:00 2001 From: Mark Pizzolato Date: Fri, 30 Nov 2012 13:22:15 -0800 Subject: [PATCH] Compiler suggested cleanups --- ALTAIR/altair_cpu.c | 2 +- HP2100/hp2100_defs.h | 1 + Ibm1130/ibm1130_cpu.c | 10 +++++----- NOVA/nova_qty.c | 2 +- PDP18B/pdp18b_stddev.c | 2 +- SDS/sds_cpu.c | 2 +- sim_console.c | 6 +++--- sim_ether.c | 2 +- sim_serial.c | 14 +++++++------- 9 files changed, 21 insertions(+), 20 deletions(-) diff --git a/ALTAIR/altair_cpu.c b/ALTAIR/altair_cpu.c index 196893c4..834006b4 100644 --- a/ALTAIR/altair_cpu.c +++ b/ALTAIR/altair_cpu.c @@ -366,7 +366,7 @@ int32 sim_instr (void) if ((OP & 0xCF) == 0x01) { /* LXI */ DAR = M[PC] & 0x00ff; PC++; - DAR = DAR | (M[PC] <<8) & 0xFF00;; + DAR = DAR | ((M[PC] <<8) & 0xFF00); putpair((OP >> 4) & 0x03, DAR); PC++; continue; diff --git a/HP2100/hp2100_defs.h b/HP2100/hp2100_defs.h index 9ee83e32..d5126db4 100644 --- a/HP2100/hp2100_defs.h +++ b/HP2100/hp2100_defs.h @@ -81,6 +81,7 @@ #pragma GCC diagnostic ignored "-Wunknown-pragmas" #pragma GCC diagnostic ignored "-Wpragmas" #pragma GCC diagnostic ignored "-Wlogical-op-parentheses" +#pragma GCC diagnostic ignored "-Wbitwise-op-parentheses" #endif diff --git a/Ibm1130/ibm1130_cpu.c b/Ibm1130/ibm1130_cpu.c index d35bbcbd..bcc5ad19 100644 --- a/Ibm1130/ibm1130_cpu.c +++ b/Ibm1130/ibm1130_cpu.c @@ -768,7 +768,7 @@ t_stat sim_instr (void) CCC--; } C = (CCC != 0); - WriteIndex(TAG, ReadIndex(TAG) & 0xFF00 | CCC); /* put 6 bits back into low byte of index register */ + WriteIndex(TAG, (ReadIndex(TAG) & 0xFF00) | CCC); /* put 6 bits back into low byte of index register */ break; } /* if TAG == 0, fall through and treat like normal shift SLT */ @@ -814,8 +814,8 @@ t_stat sim_instr (void) while (CCC > 0) { xbit = (ACC & 0x0001) << 15; abit = (ACC & 0x8000); - ACC = (ACC >> 1) & 0x7FFF | abit; - EXT = (EXT >> 1) & 0x7FFF | xbit; + ACC = ((ACC >> 1) & 0x7FFF) | abit; + EXT = ((EXT >> 1) & 0x7FFF) | xbit; CCC--; } break; @@ -824,8 +824,8 @@ t_stat sim_instr (void) while (CCC > 0) { abit = (EXT & 0x0001) << 15; xbit = (ACC & 0x0001) << 15; - ACC = (ACC >> 1) & 0x7FFF | abit; - EXT = (EXT >> 1) & 0x7FFF | xbit; + ACC = ((ACC >> 1) & 0x7FFF) | abit; + EXT = ((EXT >> 1) & 0x7FFF) | xbit; CCC--; } break; diff --git a/NOVA/nova_qty.c b/NOVA/nova_qty.c index 215ac3fe..7a40e1bb 100644 --- a/NOVA/nova_qty.c +++ b/NOVA/nova_qty.c @@ -222,7 +222,7 @@ DEVICE qty_dev = #define QTY_LINE_RX_CHAR( line ) (qty_status[ (line) ] & QTY_S_DMASK) #define QTY_UNIT_ACTIVE( unitp ) ( (unitp)->conn ) -#define QTY_LINE_BITS( line, bits ) qty_status[ (line) ] & bits +#define QTY_LINE_BITS( line, bits ) (qty_status[ (line) ] & bits) #define QTY_LINE_SET_BIT( line, bit ) qty_status[ (line) ] |= (bit) ; #define QTY_LINE_CLEAR_BIT( line, bit ) qty_status[ (line) ] &= ~(bit) ; diff --git a/PDP18B/pdp18b_stddev.c b/PDP18B/pdp18b_stddev.c index 78cfeba3..9e5ed3a6 100644 --- a/PDP18B/pdp18b_stddev.c +++ b/PDP18B/pdp18b_stddev.c @@ -994,7 +994,7 @@ if (pulse & 001) { /* KSF */ } if (pulse & 002) { /* KRS/KRB */ CLR_INT (TTI); /* clear flag */ - dat = dat | tti_unit.buf & TTI_MASK; /* return buffer */ + dat = dat | (tti_unit.buf & TTI_MASK); /* return buffer */ #if defined (PDP15) if (pulse & 020) /* KRS? */ tti_fdpx = 1; diff --git a/SDS/sds_cpu.c b/SDS/sds_cpu.c index f045b6e7..0621dc4f 100644 --- a/SDS/sds_cpu.c +++ b/SDS/sds_cpu.c @@ -1341,7 +1341,7 @@ if (sc >= 24) { A = sgn; } else { - B = ((B >> sc) | (A << (24 - sc)) & DMASK); + B = ((B >> sc) | (A << (24 - sc))) & DMASK; A = ((A >> sc) | (sgn << (24 - sc))) & DMASK; } return; diff --git a/sim_console.c b/sim_console.c index f1fb5354..18173aa6 100644 --- a/sim_console.c +++ b/sim_console.c @@ -1766,7 +1766,7 @@ if (tcsetattr (0, TCSAFLUSH, &runtty) < 0) return SCPE_TTIERR; if (prior_norm) { /* at normal pri? */ errno = 0; - nice (10); /* try to lower pri */ + (void)nice (10); /* try to lower pri */ prior_norm = errno; /* if no error, done */ } return SCPE_OK; @@ -1778,7 +1778,7 @@ if (!isatty (fileno (stdin))) /* skip if !tty */ return SCPE_OK; if (!prior_norm) { /* priority down? */ errno = 0; - nice (-10); /* try to raise pri */ + (void)nice (-10); /* try to raise pri */ prior_norm = (errno == 0); /* if no error, done */ } if (tcsetattr (0, TCSAFLUSH, &cmdtty) < 0) @@ -1829,7 +1829,7 @@ t_stat sim_os_putchar (int32 out) char c; c = out; -write (1, &c, 1); +(void)write (1, &c, 1); return SCPE_OK; } diff --git a/sim_ether.c b/sim_ether.c index 8e43bbc5..5504cba2 100644 --- a/sim_ether.c +++ b/sim_ether.c @@ -1406,7 +1406,7 @@ static void eth_get_nic_hw_addr(ETH_DEV* dev, char *devname) memset(command, 0, sizeof(command)); for (i=0; patterns[i] && (0 == dev->have_host_nic_phy_addr); ++i) { snprintf(command, sizeof(command)-1, "ifconfig %s | %s >NIC.hwaddr", devname, patterns[i]); - system(command); + (void)system(command); if (NULL != (f = fopen("NIC.hwaddr", "r"))) { while (0 == dev->have_host_nic_phy_addr) { if (fgets(command, sizeof(command)-1, f)) { diff --git a/sim_serial.c b/sim_serial.c index 0110c8f0..2ee5b7fc 100644 --- a/sim_serial.c +++ b/sim_serial.c @@ -996,10 +996,10 @@ if (tcgetattr (port, &tio)) { /* get the terminal attr #if 1 -tio.c_iflag = tio.c_iflag & ~i_clear | i_set; /* configure the serial line for raw mode */ -tio.c_oflag = tio.c_oflag & ~o_clear | o_set; -tio.c_cflag = tio.c_cflag & ~c_clear | c_set; -tio.c_lflag = tio.c_lflag & ~l_clear | l_set; +tio.c_iflag = (tio.c_iflag & ~i_clear) | i_set; /* configure the serial line for raw mode */ +tio.c_oflag = (tio.c_oflag & ~o_clear) | o_set; +tio.c_cflag = (tio.c_cflag & ~c_clear) | c_set; +tio.c_lflag = (tio.c_lflag & ~l_clear) | l_set; #elif 0 @@ -1079,15 +1079,15 @@ for (i = 0; i < baud_count; i++) /* assign baud rate */ if (i == baud_count) /* baud rate assigned? */ return SCPE_ARG; /* invalid rate specified */ -if (config.charsize >= 5 && config.charsize <= 8) /* character size OK? */ - tio.c_cflag = tio.c_cflag & ~CSIZE | /* replace character size code */ +if ((config.charsize >= 5) && (config.charsize <= 8)) /* character size OK? */ + tio.c_cflag = (tio.c_cflag & ~CSIZE) | /* replace character size code */ charsize_map [config.charsize - 5]; else return SCPE_ARG; /* not a valid size */ switch (config.parity) { /* assign parity */ case 'E': - tio.c_cflag = tio.c_cflag & ~PARODD | PARENB; /* set for even parity */ + tio.c_cflag = (tio.c_cflag & ~PARODD) | PARENB; /* set for even parity */ break; case 'N':