From e4211f22be5c11edfab0a668de3c99001b933610 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Stefan=20E=C3=9Fer?= Date: Tue, 1 Sep 2020 10:49:52 +0000 Subject: [PATCH] Fix build with clang11 Reported by: pkg-fallout --- emulators/simh/Makefile | 2 +- emulators/simh/files/patch-AltairZ80_i86.h | 10 ++++ .../simh/files/patch-AltairZ80_i86__decode.c | 10 ++++ .../simh/files/patch-AltairZ80_i86__ops.c | 10 ++++ emulators/simh/files/patch-makefile | 24 +++++++-- emulators/simh/files/patch-scp.c | 53 ++++++++++++------- 6 files changed, 87 insertions(+), 22 deletions(-) create mode 100644 emulators/simh/files/patch-AltairZ80_i86.h create mode 100644 emulators/simh/files/patch-AltairZ80_i86__decode.c create mode 100644 emulators/simh/files/patch-AltairZ80_i86__ops.c diff --git a/emulators/simh/Makefile b/emulators/simh/Makefile index cb5b80f44c9f..bf54551618ef 100644 --- a/emulators/simh/Makefile +++ b/emulators/simh/Makefile @@ -3,7 +3,7 @@ PORTNAME= simh PORTVERSION= 3.9.0 -PORTREVISION= 4 +PORTREVISION= 5 CATEGORIES= emulators MASTER_SITES= http://simh.trailing-edge.com/sources/:src \ http://www.ml1.org.uk/distfiles/:pdf \ diff --git a/emulators/simh/files/patch-AltairZ80_i86.h b/emulators/simh/files/patch-AltairZ80_i86.h new file mode 100644 index 000000000000..3d22b65a3ab8 --- /dev/null +++ b/emulators/simh/files/patch-AltairZ80_i86.h @@ -0,0 +1,10 @@ +--- AltairZ80/i86.h.orig 2020-09-01 09:55:27 UTC ++++ AltairZ80/i86.h +@@ -215,7 +215,6 @@ struct pc_env + }; + + /* GLOBAL */ +-volatile int intr; + + void halt_sys (PC_ENV *sys); + void fetch_decode_modrm (PC_ENV *m, uint16 *mod, uint16 *regh, uint16 *regl); diff --git a/emulators/simh/files/patch-AltairZ80_i86__decode.c b/emulators/simh/files/patch-AltairZ80_i86__decode.c new file mode 100644 index 000000000000..ffe75a50b7bc --- /dev/null +++ b/emulators/simh/files/patch-AltairZ80_i86__decode.c @@ -0,0 +1,10 @@ +--- AltairZ80/i86_decode.c.orig 2020-09-01 09:55:27 UTC ++++ AltairZ80/i86_decode.c +@@ -46,6 +46,7 @@ extern uint32 PCX; /* external view of PC + extern uint32 sim_brk_summ; + extern UNIT cpu_unit; + ++volatile int intr; + void i86_intr_raise(PC_ENV *m,uint8 intrnum); + void cpu8086reset(void); + t_stat sim_instr_8086(void); diff --git a/emulators/simh/files/patch-AltairZ80_i86__ops.c b/emulators/simh/files/patch-AltairZ80_i86__ops.c new file mode 100644 index 000000000000..2541e8d97c8b --- /dev/null +++ b/emulators/simh/files/patch-AltairZ80_i86__ops.c @@ -0,0 +1,10 @@ +--- AltairZ80/i86_ops.c.orig 2020-09-01 09:55:27 UTC ++++ AltairZ80/i86_ops.c +@@ -109,6 +109,7 @@ extern uint32 in(const uint32 Port); + */ + + extern uint8 parity_tab[]; ++extern volatile int intr; + + static void i86op_illegal_op(PC_ENV *m) + { diff --git a/emulators/simh/files/patch-makefile b/emulators/simh/files/patch-makefile index 22a56620e410..b25cae103f83 100644 --- a/emulators/simh/files/patch-makefile +++ b/emulators/simh/files/patch-makefile @@ -1,11 +1,11 @@ ---- makefile.orig 2016-12-01 22:43:43 UTC +--- makefile.orig 2020-09-01 10:06:51 UTC +++ makefile -@@ -110,7 +110,7 @@ ifeq ($(WIN32),) #*nix Environments (&& +@@ -110,7 +110,7 @@ ifeq ($(WIN32),) #*nix Environments (&& cygwin) PCAPLIB = wpcap LIBEXT = a else - LDSEARCH :=$(shell ldconfig -r | grep 'search directories' | awk '{print $$3}' | sed 's/:/ /g') -+########## LDSEARCH :=$(shell ldconfig -r | grep 'search directories' | awk '{print $$3}' | sed 's/:/ /g') ++########### LDSEARCH :=$(shell ldconfig -r | grep 'search directories' | awk '{print $$3}' | sed 's/:/ /g') ifneq (,$(LDSEARCH)) LIBPATH := $(LDSEARCH) endif @@ -52,3 +52,21 @@ BUILD_FEATURES = - compiler optimizations and no debugging support endif ifneq (3,$(GCC_MAJOR_VERSION)) +@@ -523,7 +525,7 @@ IBM1130 = ${IBM1130D}/ibm1130_cpu.c ${IBM1130D}/ibm113 + ${IBM1130D}/ibm1130_fmt.c ${IBM1130D}/ibm1130_ptrp.c \ + ${IBM1130D}/ibm1130_plot.c ${IBM1130D}/ibm1130_sca.c \ + ${IBM1130D}/ibm1130_t2741.c +-IBM1130_OPT = -I ${IBM1130D} ++IBM1130_OPT = -I ${IBM1130D} -D HAVE_VM_INIT + + + ID16D = Interdata +@@ -570,7 +572,7 @@ ALTAIRZ80 = ${ALTAIRZ80D}/altairz80_cpu.c ${ALTAIRZ80D + ${ALTAIRZ80D}/s100_scp300f.c ${ALTAIRZ80D}/sim_imd.c \ + ${ALTAIRZ80D}/wd179x.c ${ALTAIRZ80D}/s100_hdc1001.c \ + ${ALTAIRZ80D}/s100_if3.c ${ALTAIRZ80D}/s100_adcs6.c +-ALTAIRZ80_OPT = -I ${ALTAIRZ80D} ++ALTAIRZ80_OPT = -I ${ALTAIRZ80D} -D HAVE_VM_INIT + + + GRID = GRI diff --git a/emulators/simh/files/patch-scp.c b/emulators/simh/files/patch-scp.c index 87ded0afee9c..4c696c8cd9fd 100644 --- a/emulators/simh/files/patch-scp.c +++ b/emulators/simh/files/patch-scp.c @@ -1,6 +1,23 @@ ---- scp.c.orig 2016-12-01 22:43:43 UTC +--- scp.c.orig 2020-09-01 10:06:51 UTC +++ scp.c -@@ -678,14 +678,14 @@ else if (*argv[0]) { +@@ -266,10 +266,14 @@ extern t_stat fprint_sym (FILE *ofile, t_addr addr, t_ + extern t_stat parse_sym (char *cptr, t_addr addr, UNIT *uptr, t_value *val, + int32 sw); + +-/* The per-simulator init routine is a weak global that defaults to NULL ++/* The per-simulator init routine is only required for a few machines + The other per-simulator pointers can be overrriden by the init routine */ + +-void (*sim_vm_init) (void); ++#ifdef HAVE_VM_INIT ++extern void (*sim_vm_init) (void); ++#else ++void (*sim_vm_init) (void) = NULL; ++#endif + char* (*sim_vm_read) (char *ptr, int32 size, FILE *stream) = NULL; + void (*sim_vm_post) (t_bool from_scp) = NULL; + CTAB *sim_vm_cmd = NULL; +@@ -678,14 +682,14 @@ else if (*argv[0]) { char nbuf[PATH_MAX + 7], *np; /* "path.ini" */ nbuf[0] = '"'; /* starting " */ strncpy (nbuf + 1, argv[0], PATH_MAX + 1); /* copy sim name */ @@ -17,7 +34,7 @@ printf ("sim> %s\n", cptr); /* echo */ else if (sim_vm_read != NULL) { /* sim routine? */ printf ("sim> "); /* prompt */ -@@ -700,7 +700,7 @@ while (stat != SCPE_EXIT) { +@@ -700,7 +704,7 @@ while (stat != SCPE_EXIT) { fprintf (sim_log, "sim> %s\n", cptr); cptr = get_glyph (cptr, gbuf, 0); /* get command glyph */ sim_switches = 0; /* init switches */ @@ -26,7 +43,7 @@ stat = cmdp->action (cmdp->arg, cptr); /* if found, exec */ else stat = SCPE_UNK; if (stat >= SCPE_BASE) { /* error? */ -@@ -767,7 +767,7 @@ if (*cptr) { +@@ -767,7 +771,7 @@ if (*cptr) { cptr = get_glyph (cptr, gbuf, 0); if (*cptr) return SCPE_2MARG; @@ -35,7 +52,7 @@ fputs (cmdp->help, stdout); if (sim_log) fputs (cmdp->help, sim_log); -@@ -911,7 +911,7 @@ do { +@@ -911,7 +915,7 @@ do { cptr = get_glyph (cptr, gbuf, 0); /* get command glyph */ sim_switches = 0; /* init switches */ isdo = FALSE; @@ -44,7 +61,7 @@ isdo = (cmdp->action == &do_cmd); if (isdo) { /* DO command? */ if (flag >= DO_NEST_LVL) /* nest too deep? */ -@@ -1091,18 +1091,18 @@ if (*cptr == 0) +@@ -1091,18 +1095,18 @@ if (*cptr == 0) return SCPE_2FARG; cptr = get_glyph (cptr, gbuf, 0); /* get glob/dev/unit */ @@ -66,7 +83,7 @@ return gcmdp->action (gcmdp->arg, cptr); /* do the rest */ else return SCPE_NXDEV; /* no match */ if (*cptr == 0) /* must be more */ -@@ -1110,7 +1110,7 @@ if (*cptr == 0) +@@ -1110,7 +1114,7 @@ if (*cptr == 0) while (*cptr != 0) { /* do all mods */ cptr = get_glyph (svptr = cptr, gbuf, ','); /* get modifier */ @@ -75,7 +92,7 @@ *cvptr++ = 0; for (mptr = dptr->modifiers; mptr && (mptr->mask != 0); mptr++) { if ((mptr->mstring) && /* match string */ -@@ -1123,7 +1123,7 @@ while (*cptr != 0) { +@@ -1123,7 +1127,7 @@ while (*cptr != 0) { if (mptr->valid) { /* validation rtn? */ if (cvptr && (mptr->mask & MTAB_NC)) { get_glyph_nc (svptr, gbuf, ','); @@ -84,7 +101,7 @@ *cvptr++ = 0; } r = mptr->valid (uptr, mptr->match, cvptr, mptr->desc); -@@ -1156,7 +1156,7 @@ while (*cptr != 0) { +@@ -1156,7 +1160,7 @@ while (*cptr != 0) { } /* end if match */ } /* end for */ if (!mptr || (mptr->mask == 0)) { /* no match? */ @@ -93,7 +110,7 @@ r = glbr->action (dptr, uptr, glbr->arg, cvptr); /* do global */ if (r != SCPE_OK) return r; -@@ -1349,15 +1349,15 @@ GET_SWITCHES (cptr); +@@ -1349,15 +1353,15 @@ GET_SWITCHES (cptr); if (*cptr == 0) /* must be more */ return SCPE_2FARG; cptr = get_glyph (cptr, gbuf, 0); /* get next glyph */ @@ -112,7 +129,7 @@ if (uptr == NULL) /* invalid unit */ return SCPE_NXUN; if (uptr->flags & UNIT_DIS) /* disabled? */ -@@ -1377,7 +1377,7 @@ if (dptr->modifiers == NULL) +@@ -1377,7 +1381,7 @@ if (dptr->modifiers == NULL) while (*cptr != 0) { /* do all mods */ cptr = get_glyph (cptr, gbuf, ','); /* get modifier */ @@ -121,7 +138,7 @@ *cvptr++ = 0; for (mptr = dptr->modifiers; mptr->mask != 0; mptr++) { if (((mptr->mask & MTAB_XTD)? /* right level? */ -@@ -1396,7 +1396,7 @@ while (*cptr != 0) { +@@ -1396,7 +1400,7 @@ while (*cptr != 0) { } /* end if */ } /* end for */ if (mptr->mask == 0) { /* no match? */ @@ -130,7 +147,7 @@ shptr->action (ofile, dptr, uptr, shptr->arg, cptr); else return SCPE_ARG; } /* end if */ -@@ -1800,7 +1800,7 @@ if (sim_brk_types == 0) +@@ -1800,7 +1804,7 @@ if (sim_brk_types == 0) return SCPE_NOFNC; if ((dptr == NULL) || (uptr == NULL)) return SCPE_IERR; @@ -139,7 +156,7 @@ if (flg != SSH_ST) /* only on SET */ return SCPE_ARG; *aptr++ = 0; /* separate strings */ -@@ -3699,7 +3699,7 @@ if ((cptr == NULL) || (*cptr == 0)) +@@ -3699,7 +3703,7 @@ if ((cptr == NULL) || (*cptr == 0)) return SCPE_ARG; strncpy (gbuf, cptr, CBUFSIZE); addrp = gbuf; /* default addr */ @@ -148,7 +165,7 @@ *portp++ = 0; else if (strchr (gbuf, '.')) /* x.y...? */ portp = NULL; -@@ -3782,7 +3782,7 @@ DEVICE *dptr; +@@ -3782,7 +3786,7 @@ DEVICE *dptr; if (uptr == NULL) /* arg error? */ return NULL; @@ -157,7 +174,7 @@ if (qdisable (dptr)) /* disabled? */ return NULL; *uptr = dptr->units; /* unit 0 */ -@@ -3862,7 +3862,7 @@ REG *rptr, *srptr = NULL; +@@ -3862,7 +3866,7 @@ REG *rptr, *srptr = NULL; for (i = 0; (dptr = sim_devices[i]) != 0; i++) { /* all dev */ if (dptr->flags & DEV_DIS) /* skip disabled */ continue; @@ -166,7 +183,7 @@ if (srptr) /* ambig? err */ return NULL; srptr = rptr; /* save reg */ -@@ -4080,15 +4080,15 @@ const char logstr[] = "|&^", cmpstr[] = +@@ -4080,15 +4084,15 @@ const char logstr[] = "|&^", cmpstr[] = "=!><"; logval = cmpval = 0; if (*cptr == 0) /* check for clause */ return NULL; @@ -185,7 +202,7 @@ cmpop = (int32)(sptr - cmpstr); if (*cptr == '=') { cmpop = cmpop + strlen (cmpstr); -@@ -4753,7 +4753,7 @@ while (isspace (*sim_brk_act)) +@@ -4753,7 +4757,7 @@ while (isspace (*sim_brk_act)) sim_brk_act++; if (*sim_brk_act == 0) /* now empty? */ return (sim_brk_act = NULL);