From 94ec1830ca08d0407f21b66d4d43f5035e20ec83 Mon Sep 17 00:00:00 2001 From: Olaf Seibert Date: Sat, 29 Aug 2020 22:13:09 +0200 Subject: [PATCH 1/2] Attempt to clean up compiler warnings as given in https://cirrus-ci.com/task/5117093567791104?command=main --- src/dpchaos.c | 4 ++-- src/dvch11.c | 8 ++++---- src/dvlites.c | 2 +- src/inexts.c | 4 +++- src/kn10clk.c | 2 ++ src/osdsup.c | 2 +- src/vmtape.c | 10 ++++++++++ 7 files changed, 23 insertions(+), 9 deletions(-) diff --git a/src/dpchaos.c b/src/dpchaos.c index 020826b..f8956bf 100644 --- a/src/dpchaos.c +++ b/src/dpchaos.c @@ -423,7 +423,7 @@ void net_init_pf(struct dpchaos_s *dpchaos) dbprintln("Can't find EA for \"%s\"", npf.osnpf_ifnam); if (ife) { dbprintln("Found interface '%s', ea %s", ife->ife_name, - (ife->ife_ea != NULL && memcmp(ife->ife_ea,"\0\0\0\0\0\0", ETHER_ADDR_LEN) == 0) ? "found" : "not found"); + (memcmp(ife->ife_ea,"\0\0\0\0\0\0", ETHER_ADDR_LEN) == 0) ? "found" : "not found"); } else dbprintln("Can't find interface '%s'!", npf.osnpf_ifnam); } else { @@ -1287,7 +1287,7 @@ pfbuild(void *arg, struct in_addr *ipa) // Check the ethernet type field #if KLH10_NET_PCAP #define MAX_PFLEN 136 // really need only 130 - u_char bpfilter[MAX_PFLEN]; + char bpfilter[MAX_PFLEN]; char eastr[OSN_EASTRSIZ]; // must also check for address since interface may be in promisc mode although we didn't ask for it sprintf(bpfilter, diff --git a/src/dvch11.c b/src/dvch11.c index bc7bda6..f6913aa 100644 --- a/src/dvch11.c +++ b/src/dvch11.c @@ -592,7 +592,7 @@ ch11_cmd_status(struct ch11 *ch, FILE *of) if (dpc->dpchaos_ifmeth_chudp) fprintf(of, " CHUDP port: %d.\n", ch->ch_chudp_port); else { - if (dpc->dpchaos_ifnam) + if (dpc->dpchaos_ifnam[0]) fprintf(of, " Using ifc=\"%s\"", dpc->dpchaos_ifnam); fprintf(of, " ether addr %02X:%02X:%02X:%02X:%02X:%02X\n", dpc->dpchaos_eth[0],dpc->dpchaos_eth[1],dpc->dpchaos_eth[2], @@ -627,12 +627,12 @@ ch11_cmd_status(struct ch11 *ch, FILE *of) (int)dp_xrcmd(dp_dpxfr(&ch->ch_dp)), (int)dp_xrcnt(dp_dpxfr(&ch->ch_dp))); fprintf(of,"Input buffer: "); if (ch->ch_iptr) - fprintf(of,"%d chars\n",ch->ch_iptr - ch->ch_rbuf); + fprintf(of,"%d chars\n", (int)(ch->ch_iptr - ch->ch_rbuf)); else fprintf(of,"none\n"); fprintf(of,"Output buffer: "); if (ch->ch_optr) - fprintf(of,"%d chars\n",ch->ch_optr - ch->ch_sbuf); + fprintf(of,"%d chars\n", (int)(ch->ch_optr - ch->ch_sbuf)); else fprintf(of,"none\n"); fprintf(of,"Receive count: %d\n", ch->ch_rcnt); @@ -815,7 +815,7 @@ ch11_read(struct device *d, register uint18 addr) chaos_start(ch); switch (addr) { -/* case UB_CHWBF: /* Write buffer (write only) = CHMYN */ +/* case UB_CHWBF: / * Write buffer (write only) = CHMYN */ /* break; */ case UB_CHMYN: /* My chaos address (read only) */ val = ch->ch_myaddr; diff --git a/src/dvlites.c b/src/dvlites.c index 3101bb3..b5b9b12 100644 --- a/src/dvlites.c +++ b/src/dvlites.c @@ -302,7 +302,7 @@ int lites_init (unsigned int prt) if (prt == 0) return lites_init_usb (); /* enable access to the port */ - if (ret = !ioperm (prt,PORT_MAX,ENABLE)) { + if ((ret = !ioperm (prt,PORT_MAX,ENABLE))) { port = prt; /* access granted, note port */ outb (0,port+PORT_CONTROL); /* initialize the displays */ for (i = 0; i <= UNIT_MAX; --i) { diff --git a/src/inexts.c b/src/inexts.c index 5933ed1..bb59127 100644 --- a/src/inexts.c +++ b/src/inexts.c @@ -261,7 +261,9 @@ insdef(i_extend) #elif KLH10_CPU_KS # if (IX_N == 040 || IX_N == 020) /* Faster check if power of 2 */ - if (LHGET(xw) & (((~(IX_N-1))<<9) | (AC_MASK<<5))) /* Check op and AC fields */ +# define IX_MASK ((~(unsigned int)(IX_N-1))<<9) + if (LHGET(xw) & (IX_MASK | (AC_MASK<<5))) /* Check op and AC fields */ +# undef IX_MASK # else if (xop >= IX_N || (LHGET(xw) & (AC_MASK<<5))) /* Check op, AC field */ # endif diff --git a/src/kn10clk.c b/src/kn10clk.c index 6be3699..0e41842 100644 --- a/src/kn10clk.c +++ b/src/kn10clk.c @@ -1092,6 +1092,8 @@ clk_itusset(int32 usec) case CLKENT_ST_MQUIET: ce->cke_oticks = clk_usec2tick(ce->cke_usec); break; + default: + break; } } diff --git a/src/osdsup.c b/src/osdsup.c index dfebdd9..62abbec 100644 --- a/src/osdsup.c +++ b/src/osdsup.c @@ -913,7 +913,7 @@ os_rtmget(register osrtm_t *art) { #if HAVE_SETITIMER /* && HAVE_GETTIMEOFDAY ; implied */ static osrtm_t os_last_rtm = {0,0}; - if (!gettimeofday(art, (struct timezone *)NULL) == 0) + if (gettimeofday(art, (struct timezone *)NULL) != 0) return FALSE; /* did time go backwards? */ if ((os_last_rtm.tv_sec > art->tv_sec) || diff --git a/src/vmtape.c b/src/vmtape.c index 1d265ec..9f89975 100644 --- a/src/vmtape.c +++ b/src/vmtape.c @@ -1804,6 +1804,9 @@ vmt_rspace(register struct vmtape *t, while (tpc_recfwd(t) > 0 && !t->mt_eof && !t->mt_eot && --cnt) ; break; + default: + /* Unexpected tape format value */ + break; } t->mt_frames = origcnt - cnt; return TRUE; @@ -3070,6 +3073,10 @@ vmt_rput(register struct vmtape *t, return FALSE; } break; + + default: + /* Unexpected tape format value */ + break; } return vmt_ioend(t); } @@ -3099,6 +3106,9 @@ vmt_eput(register struct vmtape *t, case VMT_FMT_TPS: /* Possible but not implemented yet */ break; + default: + /* Unexpected tape format value */ + break; } return TRUE; } From 91af8d0b6b10fdcfc39a7ccdc94000404d1cd451 Mon Sep 17 00:00:00 2001 From: Olaf Seibert Date: Sat, 29 Aug 2020 22:33:12 +0200 Subject: [PATCH 2/2] Work around another couple of "nested comment" warning. --- src/cmdline.h | 2 +- src/dvch11.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/cmdline.h b/src/cmdline.h index 92c61db..f5cad85 100644 --- a/src/cmdline.h +++ b/src/cmdline.h @@ -1,7 +1,7 @@ /* CMDLINE.H - header file for command line processing functions */ /* Copyright © 1992, 1993, 2001 Kenneth L. Harrenstien -/* Copyright © 2017 Olaf Seibert +** Copyright © 2017 Olaf Seibert ** All Rights Reserved ** ** This file is part of the KLH10 Distribution. Use, modification, and diff --git a/src/dvch11.c b/src/dvch11.c index f6913aa..1cecc15 100644 --- a/src/dvch11.c +++ b/src/dvch11.c @@ -893,7 +893,7 @@ ch11_write(struct device *d, uint18 addr, register dvureg_t val) chaos_start(ch); switch (addr) { -/* case UB_CHMYN: /* My chaos address (read only) = CHWBF */ +/* case UB_CHMYN: / * My chaos address (read only) = CHWBF */ case UB_CHRBF: /* Read buffer (read only) */ case UB_CHRBC: /* Receive bit counter (read only) */ case UB_CHXMT: /* Initiate transmit (read only) */