From ccfa538ff65a16b55beb492b943434ef5abff49b Mon Sep 17 00:00:00 2001 From: Brad Roberts Date: Fri, 14 Oct 2011 01:39:22 -0700 Subject: [PATCH 01/10] drop TARGET_MAC --- dm/src/dmc/blklst.c | 22 +-- dm/src/dmc/cpp.c | 258 +-------------------------- dm/src/dmc/eh.c | 24 --- dm/src/dmc/enum.c | 63 ------- dm/src/dmc/err.c | 26 --- dm/src/dmc/errmsgs2.c | 3 - dm/src/dmc/exp.c | 106 +----------- dm/src/dmc/exp2.c | 393 +----------------------------------------- dm/src/dmc/file.c | 4 +- dm/src/dmc/func.c | 93 +--------- dm/src/dmc/getcmd.c | 29 ---- dm/src/dmc/init.c | 26 --- dm/src/dmc/inline.c | 32 ---- dm/src/dmc/msc.c | 7 - dm/src/dmc/msgs.h | 12 -- dm/src/dmc/msgsx.c | 67 ------- dm/src/dmc/nwc.c | 379 +--------------------------------------- dm/src/dmc/ph.c | 9 +- dm/src/dmc/pragma.c | 148 ---------------- dm/src/dmc/scope.c | 8 - dm/src/dmc/struct.c | 180 +------------------ dm/src/dmc/template.c | 124 ------------- dm/src/dmc/token.c | 68 +------- dm/src/dmc/tytostr.c | 5 - dm/src/dmc/util.c | 6 +- 25 files changed, 22 insertions(+), 2070 deletions(-) diff --git a/dm/src/dmc/blklst.c b/dm/src/dmc/blklst.c index ceed129e..64d5956c 100644 --- a/dm/src/dmc/blklst.c +++ b/dm/src/dmc/blklst.c @@ -29,9 +29,6 @@ #include "global.h" #include "parser.h" #include "token.h" -#if TARGET_MAC -#include "TG.h" -#endif #include "filespec.h" #include "outbuf.h" @@ -52,9 +49,7 @@ INITIALIZED_STATIC_DEF blklst * last_blsave; #endif STATIC void freeblk(blklst *); -#if TARGET_MAC -INITIALIZED_STATIC_DEF blklst *bl_freelist = NULL; /* pointer to next free blk */ -#elif TX86 +#if TX86 static blklst *bl_freelist = NULL; /* pointer to next free blk */ #endif @@ -1056,9 +1051,6 @@ UHINT egchar() if ((xc = *btextp) != PRE_EOB && xc != PRE_ARG) { btextp++; -#if TARGET_MAC - bl->BLcurcnt++; -#endif //if (!(config.flags2 & CFG2expand)) if (!switch_E) return xc; @@ -1135,10 +1127,6 @@ void insblk(unsigned char *text, int typ, list_t aargs, int nargs, macro_t *m) TokenCnt = 0; /* count tokens till first #if */ #endif break; -#if TARGET_MAC - case BLpdef: p->BLflags |= BFpdef; /* flag pre_compilation data */ - p->BLtyp = BLarg; -#endif break; case BLstr: case BLarg: @@ -1271,10 +1259,6 @@ STATIC void freeblk(blklst *p) break; case BLarg: /* don't free BLtext */ case BLrtext: -#if (TARGET_MAC) - if (CPP && p->BLflags & BFpdef) - ANSI = ansi_opt; /* now turn on ansi checking */ -#endif break; default: assert(0); @@ -1298,10 +1282,6 @@ STATIC void freeblk(blklst *p) Srcpos getlinnum() { blklst *b; -#if TARGET_MAC - if (FromTokenList) /* rescanning old tokens */ - return tok.TKsrcpos; -#endif #if TX86 b = cstate.CSfilblk; #else diff --git a/dm/src/dmc/cpp.c b/dm/src/dmc/cpp.c index eefbe240..a1ce4204 100644 --- a/dm/src/dmc/cpp.c +++ b/dm/src/dmc/cpp.c @@ -32,11 +32,6 @@ #include "scope.h" #include "speller.h" -#if TARGET_MAC -#include "TG.h" -extern char *unmangle_pt(char **); -#endif - static char __file__[] = __FILE__; /* for tassert.h */ #include "tassert.h" @@ -53,12 +48,7 @@ STATIC list_t cpp_pvirtbase(Classsym *stag , Classsym *sbase); STATIC int fixctorwalk(elem *e , elem *ec , symbol *s_this); STATIC Match cpp_builtinoperator(elem *e); -#if TARGET_MAC -elem *cpp_hdlptr(elem *e); -#define M68HDL(e) cpp_hdlptr(e) -#else #define M68HDL(e) (e) -#endif #if TX86 /* List of elems which are the constructor and destructor calls to make */ @@ -69,9 +59,6 @@ list_t cpp_stidtors; /* auto destructors that go in _STIxxxx */ #endif /* Special predefined functions */ -#if TARGET_MAC -static symbol *s_vec_pnew,*s_vec_pdelete; -#endif static symbol *s_vec_new,*s_vec_ctor,*s_vec_cpct,*s_vec_delete; symbol *s_vec_dtor; symbol *s_vec_invariant; @@ -93,16 +80,6 @@ char cpp_name_initvbases[] = "$initVBases"; #endif char cpp_name_invariant[] = "__invariant"; -#if TARGET_MAC -#if HOST_MPW -char cpp_name_pasnew[] = "__nw__12PascalObjectSFPFv_vUi"; -char cpp_name_pasdel[] = "__dl__12PascalObjectSFPPv"; -#else -char cpp_name_pasnew[] = "__nw__12PascalObjectFPvUi"; -char cpp_name_pasdel[] = "__dl__12PascalObjectFPv"; -#endif -#endif - /*********************************** * Array of linked lists of function symbols. Each function * is an overloaded version of that operator. @@ -375,23 +352,6 @@ char *cpp_prettyident(symbol *s) else p = symbol_ident(s); -#if TARGET_MAC - if (type_struct(s->Stype) && !memcmp(p,"__PT",4)) { - char *n = (char *)p; - if ((p = unmangle_pt(&n)) != NULL) - pi_cpy(p); - } - else - { char *n,*o; - - n = (char *) MEM_PARF_STRDUP(cpp_name); - o = (char *) MEM_PARF_STRDUP(cpp_unmangleident(p)); - strcpy(cpp_name,n); - strcat(cpp_name,o); - MEM_PARF_FREE(n); - MEM_PARF_FREE(o); - } -#else { char *n,*o; n = strdup(cpp_pi); @@ -402,7 +362,6 @@ char *cpp_prettyident(symbol *s) free(n); free(o); } -#endif return cpp_pi; } @@ -453,16 +412,6 @@ void cpp_getpredefined() t_pdtor = s_vec_delete->Stype->Tparamtypes->Pnext->Pnext->Pnext->Ptype; type_debug(t_pdtor); -#if TARGET_MAC /* pascal versions of same */ - if (s_vec_pnew == NULL) - s_vec_pnew = lookupsym("_vec_pnew"); - symbol_debug(s_vec_pnew); - - if (s_vec_pdelete == NULL) - s_vec_pdelete = lookupsym("_vec_pdelete"); - symbol_debug(s_vec_pdelete); -#endif - if (s_vec_ctor == NULL) s_vec_ctor = lookupsym(vecctor); symbol_debug(s_vec_ctor); @@ -512,9 +461,6 @@ elem *cpp_new(int global,symbol *sfunc,elem *esize,list_t arglist,type *tret) Classsym *stag; char *id; -#if TARGET_MAC - unsigned mac_handle = 0; -#endif list_prepend(&arglist,esize); if (global & 2 && !(config.flags4 & CFG4anew)) global = 1; @@ -530,55 +476,10 @@ elem *cpp_new(int global,symbol *sfunc,elem *esize,list_t arglist,type *tret) cpp_memberaccess(snew,sfunc,t->Ttag); #endif } -#if TARGET_MAC - if ((tybasic(t->Tty) == TYstruct) && (t->Ttag->Sstruct->Sflags & STRpasobj)) - { - symbol *sa; - char *name; - - if (snew) - cpp_memberaccess(snew,sfunc,t->Ttag); - Add_pascal_object = TRUE; /* need to call _PGM1 initializatin in main */ - if (!snew) - snew = scope_search(cpp_name_pasnew,SCTglobal); - name = alloca_strdup2("_",t->Ttag->Sident); - sa = scope_search(name,SCTglobal); - if (t->Ttag != snew->Sscope) /* inheriting the function so */ -#if HOST_THINK - sa = po_func_Methout(t->Ttag, SCextern); /* define the pascal method table */ -#else - sa = po_func_Methout(t->Ttag); -#endif - else if (!sa) /* function def will output table */ - sa = po_def_class(t->Ttag); /* reference the pascal method table */ - sa->Smethod = t->Ttag; - list_prepend(&arglist,el_ptr(sa)); - mac_handle = EFpasnew; - assert(snew); - enew = el_var(snew); - e = xfunccall(enew,NULL,NULL,arglist); - //e = func_params(enew,NULL,arglist); - //e = el_bint(OPcall,tret,enew,e); - el_settype(e,tret); - e->Eflags |= mac_handle; - return e; - } -#endif if (!snew) { /* Try global table */ stag = NULL; snew = scope_search(id,SCTglobal); -#if TARGET_MAC - /* if user routine, assume correct storage management */ - /* if __nw, choose between __nw or mac New_Handle */ - if (tybasic(t->Tty) == TYstruct) - { - if (t->Ttag->Sstruct->Sflags & STRmachdl) - mac_handle = EFnewhdl; - else if (t->Ttag->Sstruct->Sflags & STRhandle) - cpperr(EM_nomatch,"operator new",(global & 2) ? "[]" : ""); - } -#endif } assert(snew); snew = cpp_overload(snew,NULL,arglist,stag,NULL,0); @@ -593,9 +494,6 @@ elem *cpp_new(int global,symbol *sfunc,elem *esize,list_t arglist,type *tret) enew = el_var(snew); e = xfunccall(enew,NULL,NULL,arglist); el_settype(e,tret); -#if TARGET_MAC - e->Eflags |= mac_handle; -#endif return e; } @@ -615,9 +513,6 @@ elem *cpp_delete(int global,symbol *sfunc,elem *eptr,elem *esize) list_t arglist; char *id; type *t = eptr->ET->Tnext; -#if TARGET_MAC - unsigned mac_handle = 0; -#endif type *tptr = eptr->ET; if (tptr->Tnext->Tty & (mTYconst | mTYvolatile)) @@ -638,32 +533,10 @@ elem *cpp_delete(int global,symbol *sfunc,elem *eptr,elem *esize) if (!(global & 1) && tybasic(t->Tty) == TYstruct) sdelete = cpp_findmember(t->Ttag,id,FALSE); -#if TARGET_MAC - if ((tybasic(t->Tty) == TYstruct) && (t->Ttag->Sstruct->Sflags & STRpasobj)) - { - Add_pascal_object = TRUE; /* need to call _PGM1 initializatin in main */ - if (!sdelete) - sdelete = scope_search(cpp_name_pasdel,SCTglobal); - mac_handle = EFpasdel; - s = sdelete; - goto L2; - } -#endif list_append(&arglist,esize); if (!sdelete) { /* Try global table */ sdelete = scope_search(id,SCTglobal); -#if TARGET_MAC - /* if user routine, assume correct storage management */ - /* if __dl, choose between __dl or mac Delete_Handle */ - if (tybasic(t->Tty) == TYstruct) - { - if (t->Ttag->Sstruct->Sflags & (STRpasobj | STRmachdl)) - mac_handle = EFdelhdl; - if (t->Ttag->Sstruct->Sflags & STRhandle) - cpperr(EM_nomatch,"delete operator",""); - } -#endif } assert(sdelete); @@ -677,23 +550,9 @@ elem *cpp_delete(int global,symbol *sfunc,elem *eptr,elem *esize) s = sdelete; } } -#if TARGET_MAC -L2: -#endif cpp_memberaccess(s,sfunc,isclassmember(s) ? t->Ttag : NULL); e = xfunccall(el_var(s),NULL,NULL,arglist); -#if TARGET_MAC - e->Eflags |= mac_handle; - if (mac_handle == EFdelhdl && e->E2->Eoper == OPvptrfptr) - { /* handle ptr must be passes to delete function */ - elem *tmp; - tmp = e->E2; - e->E2 = e->E2->E1; // skip the conversion operator - tmp->E1 = NULL; - el_free(tmp); - } -#endif return e; } @@ -1449,9 +1308,6 @@ HINT cpp_cast(elem **pe1,type *t2,int doit) eptr = exp2_addr(e1); eptr = cast(eptr,newpointer(sconv->Sscope->Stype)); /* to correct pointer type */ econv = cpp_getfunc(t1,sconv,&eptr); -#if TARGET_MAC - if (!(econv->Eflags&EFpasmeth)) -#endif econv = el_unat(OPind,econv->ET->Tnext,econv); e1 = xfunccall(econv,eptr,NULL,NULL); @@ -2930,10 +2786,7 @@ elem *cpp_opfunc(elem *e) // Member functions could be virtual efunc = cpp_getfunc(sowner->Stype,s,ðis); -#if TARGET_MAC - if(!(efunc->Eflags&EFpasmeth)) -#endif - efunc = el_unat(OPind,efunc->ET->Tnext,efunc); + efunc = el_unat(OPind,efunc->ET->Tnext,efunc); /* Check for non-const function and const ethis */ if (ethis->ET->Tnext->Tty & (mTYconst | mTYvolatile) & ~s->Stype->Tty) @@ -3006,10 +2859,7 @@ elem *cpp_ind(elem *e) /* Member functions could be virtual */ efunc = cpp_getfunc(sowner->Stype,sm,ðis); -#if TARGET_MAC - if(!(efunc->Eflags&EFpasmeth)) -#endif - efunc = el_unat(OPind,efunc->ET->Tnext,efunc); + efunc = el_unat(OPind,efunc->ET->Tnext,efunc); /* Check for non-const function and const ethis */ if (ethis->ET->Tnext->Tty & (mTYconst | mTYvolatile) & ~sm->Stype->Tty) @@ -3447,11 +3297,6 @@ int cpp_memberaccesst(symbol *smember,symbol *sfunc,Classsym *sclass) assert(c1isbaseofc2(NULL,smember->Sscope,sclass)); st = sclass->Sstruct; assert(st); -#if TARGET_MAC - if (st->Sflags & STRpasobj && /* for pascal member function */ - tyfunc(sfunc->Stype->Tty)) /* protection and symbol at different */ - return 1; // heirarchy level, try catching in dodot -#endif if (smember->Sscope == sclass) { result = (smember->Sflags & SFLpmask) == SFLpublic || @@ -3532,15 +3377,8 @@ type *cpp_thistype(type *tfunc,Classsym *stag) /* Pull in const and volatile from function type */ modifiers = (tfunc->Tty & (mTYconst | mTYvolatile)); type_setty(&t->Tnext,stag->Stype->Tty | modifiers); -#if TARGET_MAC - if (stag->Sstruct->Sflags & (STRpasobj | STRmachdl)) - tym = TYvptr; - else - tym = pointertype; -#else tym = stag->Sstruct->ptrtype; assert(typtr(tym)); -#endif t->Tty = tym; t->Tcount++; return t; @@ -3597,12 +3435,8 @@ elem *cpp_addr_vtable(Classsym *stag) st = stag->Sstruct; svptr = st->Svptr; assert(svptr); -#if TARGET_MAC - scvtbl = (enum SC) (st->Sflags & STRvtblext) ? SCextern : SCstatic; -#else scvtbl = (enum SC) (config.flags2 & CFG2comdat) ? SCcomdat : (st->Sflags & STRvtblext) ? SCextern : SCstatic; -#endif n2_genvtbl(stag,scvtbl,0); // make sure vtbl[]s exist /* ev = &_vtbl+offset */ @@ -3705,12 +3539,8 @@ STATIC elem * cpp_assignvptr(symbol *s_this,int ctor) stag = tclass->Ttag; st = stag->Sstruct; svptr = st->Svptr; -#if TARGET_MAC - scvtbl = (enum SC) (st->Sflags & STRvtblext) ? SCextern : SCstatic; -#else scvtbl = (enum SC) (config.flags2 & CFG2comdat) ? SCcomdat : (st->Sflags & STRvtblext) ? SCextern : SCstatic; -#endif /* If any of the virtual functions are pure, then optimize by not assigning vptr. @@ -3891,13 +3721,8 @@ STATIC elem * cpp_assignvbptr(symbol *s_this) //dbg_printf("cpp_assignvbptr for '%s'\n",stag->Sident); st = stag->Sstruct; svptr = st->Svbptr; -#if TARGET_MAC - scvtbl = (enum SC) (st->Sflags & STRvtblext) ? SCextern : - (config.flags2 & CFG2comdat) ? SCcomdat : SCstatic; -#else scvtbl = (enum SC) (config.flags2 & CFG2comdat) ? SCcomdat : (st->Sflags & STRvtblext) ? SCextern : SCstatic; -#endif symbol_debug(svptr); emos = el_longt(tsint,st->Svbptr_off); @@ -4086,15 +3911,6 @@ elem * cpp_getfunc(type *tclass,symbol *sfunc,elem **pethis) goto L1; } -#if TARGET_MAC - if (st->Sflags & STRpasobj && sfunc->Sfunc->Fflags & Fvirtual) - { /* virtual pascal object function */ - pfunc = el_var(sfunc); - pfunc->Eflags |= EFpasmeth; - *pethis = ethis; - return pfunc; - } -#endif /* We can call function directly if we are in a ctor or dtor and ethis is "this" */ @@ -4119,12 +3935,7 @@ elem * cpp_getfunc(type *tclass,symbol *sfunc,elem **pethis) /* e = *(ethis + offset(vptr)); ethis might be a handle pointer */ M68HDL(e = el_bint(OPadd,newpointer(svptr->Stype), el_same(ðis),el_longt(tsint,(targ_int) svptr->Smemoff))); -#if TARGET_MAC - // if ethis was handle pointer, result has been dereferenced - e->ET->Tty = (tym == TYvptr) ? TYfptr : tym; -#else e->ET->Tty = tym; -#endif e = el_unat(OPind,svptr->Stype,e); #if THUNKS @@ -4212,14 +4023,6 @@ elem *cpp_constructor(elem *ethis,type *tclass,list_t arglist,elem *enelems, (tyfarfunc(st->Sdtor->Stype->Tty) ? !LARGECODE : LARGECODE)) doeh = 0; // not ambient memory model -#if TARGET_MAC - if (enelems && st->Sflags & (STRpasobj|STRmachdl)) - { - e = NULL; - cpperr(EM_new_pascal,stag->Sident); - goto ret; - } -#endif /* Look for conversion operator */ e2 = NULL; @@ -4300,9 +4103,6 @@ elem *cpp_constructor(elem *ethis,type *tclass,list_t arglist,elem *enelems, /*ep = cast(exp2_addr(e2),newpointer(e2->ET));*/ ep = cast(exp2_addr(e2),newpointer(sconv->Sscope->Stype)); /* to correct pointer type */ econv = cpp_getfunc(e2->ET,sconv,&ep); -#if TARGET_MAC - if(!(econv->Eflags&(EFpasmeth/*|EFhdlobj*/))) -#endif econv = el_unat(OPind,econv->ET->Tnext,econv); e2 = xfunccall(econv,ep,NULL,NULL); @@ -4577,10 +4377,6 @@ elem *cpp_destructor(type *tclass,elem *eptr,elem *enelems,int dtorflag) assert(tclass && tybasic(tclass->Tty) == TYstruct && tclass->Ttag); stag = tclass->Ttag; st = stag->Sstruct; -#if TARGET_MAC - if (enelems && st->Sflags & (STRpasobj|STRmachdl)) - cpperr(EM_del_pascal,stag->Sident); -#endif noeh = dtorflag & DTORnoeh; if (!(config.flags3 & CFG3eh) || pointertype != st->ptrtype || eecontext.EEin) noeh = 1; @@ -4679,10 +4475,6 @@ elem *cpp_destructor(type *tclass,elem *eptr,elem *enelems,int dtorflag) /* call __vec_delete(void *Parray,int Free,size_t Sizelem, int (*Dtor)(void)) */ -#if TARGET_MAC - if (stag->Sstruct->Sflags & (STRpasobj|STRmachdl)) - cpperr(EM_del_pascal,stag->Sident); -#endif edtor = cast(edtor,s_vec_delete->Stype->Tparamtypes->Pnext->Pnext->Pnext->Ptype); efunc = el_var(s_vec_delete); arglist = list_build( @@ -4697,9 +4489,6 @@ elem *cpp_destructor(type *tclass,elem *eptr,elem *enelems,int dtorflag) // nwc_mustwrite(sdtor); } else -#if TARGET_MAC - if(!(edtor->Eflags&(EFpasmeth|EFhdlobj))) -#endif { /* Generate: edtor(eptr,dtorflag) */ elem *ed; @@ -5303,9 +5092,6 @@ void cpp_fixconstructor(symbol *s_ctor) /* If there are virtual functions, assign virtual pointer */ abstract = stag->Sstruct->Sflags & STRabstract; -#if TARGET_MAC - if (!(stag->Sstruct->Sflags & STRpasobj)) /* virtual pas obj use pascal methods */ -#endif e = el_combine(e,cpp_assignvptr(s_this,1)); /* Find every occurrence of an assignment to this, and append a */ @@ -5908,31 +5694,6 @@ elem *cpp_structcopy(elem *e) return e; } -#if TARGET_MAC -/**************************** - * cpp_hdlptr(e) - * - * convert handle pointer to far pointer - */ - -elem *cpp_hdlptr(elem *e) -{ type *t; - - assert(e->Eoper == OPadd); - if (tybasic(e->E1->ET->Tty) == TYvptr) - { - t = e->ET; - t->Tty = (t->Tty & ~mTYbasic) | TYfptr; -#if TARGET_MAC - e->E1 = el_unat(OPvptrfptr,t,e->E1); -#else - e->E1 = cast(e->E1,t); /* cast handle to far pointer */ -#endif - } - return e; -} -#endif - /******************************** * Determine if inline invariant needs to be created for tclass. * This routine is parallel to cpp_dtor(). @@ -6153,10 +5914,6 @@ elem *cpp_invariant(type *tclass,elem *eptr,elem *enelems,int invariantflag) assert(tclass && tybasic(tclass->Tty) == TYstruct && tclass->Ttag); stag = tclass->Ttag; st = stag->Sstruct; -#if TARGET_MAC - if (enelems && st->Sflags & (STRpasobj|STRmachdl)) - cpperr(EM_del_pascal,stag->Sident); -#endif invariantflag &= ~DTORnoeh; if (enelems) invariantflag |= DTORvector; @@ -6234,10 +5991,6 @@ elem *cpp_invariant(type *tclass,elem *eptr,elem *enelems,int invariantflag) // call __vec_delete(void *Parray,int Free,size_t Sizelem, // int (*Dtor)(void)) -#if TARGET_MAC - if (stag->Sstruct->Sflags & (STRpasobj|STRmachdl)) - cpperr(EM_del_pascal,stag->Sident); -#endif einvariant = cast(einvariant,s_vec_delete->Stype->Tparamtypes->Pnext->Pnext->Pnext->Ptype); efunc = el_var(s_vec_delete); arglist = list_build( @@ -6250,9 +6003,6 @@ elem *cpp_invariant(type *tclass,elem *eptr,elem *enelems,int invariantflag) #endif } else -#if TARGET_MAC - if(!(einvariant->Eflags&(EFpasmeth|EFhdlobj))) -#endif { // Generate: eptr->einvariant() elem *ed; @@ -6344,8 +6094,4 @@ void cpp_term() #endif /* TERMCODE */ -#if TARGET_MAC -#include "TGcpp.c" -#endif - #endif diff --git a/dm/src/dmc/eh.c b/dm/src/dmc/eh.c index 21fa5c58..a9ad40e6 100644 --- a/dm/src/dmc/eh.c +++ b/dm/src/dmc/eh.c @@ -428,14 +428,6 @@ type *except_declaration(symbol *cv) s->Stype = tsint; tsint->Tcount++; } -#if TARGET_MAC - // If it is a pascal or mac handle object, - // you cannot declare an instance of it. - if (ty == TYstruct && - (s->Stype->Ttag->Sstruct->Sflags & - (STRpasobj | STRmachdl))) - synerr(EM_ptr_handle); -#endif if (!(s->Stype->Tflags & TFsizeunknown) && intsize == 2 && type_size(s->Stype) > 30000) @@ -1007,15 +999,8 @@ symbol *except_gentables() { // Generate the address-table //printf("dim of address-table = %d\n",ehpairi); -#if TARGET_MAC - us = ehpairi; - pdt = dtnbytes(pdt,2,(char *)&us); - sz += 2; - assert(ehpairi < USHRT_MAX); -#else pdt = dtnbytes(pdt,intsize,(char *)&ehpairi); sz += intsize; -#endif for (i = 0; i < ehpairi; i++) { pdt = dtnbytes(pdt,intsize,(char *)&ehpair[i].offset); us = ehpair[i].index; @@ -1119,22 +1104,13 @@ symbol *except_gentables() symbol *s; targ_size_t offset; targ_size_t thisoff; -#if TARGET_MAC - unsigned short prev; -#else long prev; -#endif elem *es; eh = &ehstack[i]; prev = eh->prev; -#if TARGET_MAC - pdt = dtnbytes(pdt,2,(char *)&prev); - sz += 2; -#else pdt = dtnbytes(pdt,intsize,(char *)&prev); sz += intsize; -#endif tb = eh->bl; e = eh->el; if (tb) diff --git a/dm/src/dmc/enum.c b/dm/src/dmc/enum.c index 992edb39..41c34d1e 100644 --- a/dm/src/dmc/enum.c +++ b/dm/src/dmc/enum.c @@ -251,11 +251,6 @@ type * enumspec() STATIC void enumdcllst(symbol *se) { targ_llong enumval = -1LL; symbol *s; -#if TARGET_MAC - long max = 0, min = 0; - type *t; - symlist_t enumlist = NULL; -#endif symlist_t el; type *tmember; type *tbase; @@ -312,9 +307,6 @@ STATIC void enumdcllst(symbol *se) list_append(&se->Senumlist,s); // add to member list of enum #endif } -#if TARGET_MAC // DJB - This is never freed in the C compiler - list_append(&enumlist,s); // add to member list of enum -#endif s->Sflags |= SFLvalue; L1: stoken(); @@ -424,12 +416,6 @@ STATIC void enumdcllst(symbol *se) } enumval++; } -#if TARGET_MAC - if (enumval < min) - min = enumval; - if (enumval > max) - max = enumval; -#endif s->Svalue = el_longt(s->Stype,enumval); #if HTOD if (!CPP && !se) @@ -465,55 +451,6 @@ STATIC void enumdcllst(symbol *se) s->Svalue = e; } } - -#if TARGET_MAC - if(min >= 0) - { /* can use unsigned range sizes */ -#if 0 /* C doc conflict */ - if (max <= 0x7f) /* 1st says smallest size that can hold value */ - t = tschar; /* 2nd says same as pascal */ - else if ( max <= 0x0ff) /* pascal will not allow chars enums > 127 */ - t = tsuchar; /* or less than -128 */ - else if(max <= 0x7fff) - t = tsshort; - else if( max <= 0x0ffff) - t = tsushort; - else if (max > 0x7fffffff) - t = tsuns; - else - t = tsint; -#else - if (max <= 0xff) /* doing Pascal way, always unsigned cause */ - t = tsuchar; /* thats the way MPW C generates code */ - else if (max <= 0xffff) - t = tsushort; - else - t =tsuns; -#endif - } - else /* must use a signed range */ - { - if ( max < 128 && min > -129) - t = tschar; - else if( max < 32768 && min > -32769) - t = tsshort; - else - t = tsint; - } - if(!config.flags2&CFG2sizedenum) /* ignore range if ansi C */ - t = tsint; - se->Stype->Tnext = t; /* both C and C++ now have TYenum */ - t->Tcount++; - if (!CPP) - { - for(el = enumlist; el; el = list_next(el)) - { /* have to set it in all the elements also */ - s = list_symbol(el); - type_settype(&s->Stype, t); - } - list_free(&enumlist,NULL); - } -#endif /* TARGET_MAC */ } /********************************* diff --git a/dm/src/dmc/err.c b/dm/src/dmc/err.c index a372c9d4..206efce3 100644 --- a/dm/src/dmc/err.c +++ b/dm/src/dmc/err.c @@ -42,15 +42,6 @@ int errcnt = 0; // error count void prttype (type *); void errmsgs_init(); -#if TARGET_MAC -static short do_head = TRUE; -static void notice() -{ - printf("%s1 %s %s\n",COMPILER,VERSION,COPYRIGHT); -} -#endif - - /********************************* * Send error message to caller of DLL. @@ -184,9 +175,6 @@ static void err_print(FILE *fp,const char *q,const char *format,va_list args) #endif fprintf(fp,q); vfprintf(fp,format,args); -#if TARGET_MAC - fprintf(fp,"\n#-----------------------"); -#endif crlf(fp); #if _WIN32 fflush(fp); @@ -353,13 +341,8 @@ static short war_to_msg[] = -1, -1, EM_used_b4_set, - #if TARGET_MAC - -1, - -1, - #else EM_bad_op, EM_386_op, - #endif EM_ret_auto, EM_ds_ne_dgroup, EM_unknown_pragma, @@ -382,13 +365,8 @@ static short war_to_msg[] = EM_obsolete_inc, EM_init2tmp, EM_used_b4_set, - #if TARGET_MAC - -1, - -1, - #else EM_bad_op, EM_386_op, - #endif EM_ret_auto, EM_ds_ne_dgroup, EM_unknown_pragma, @@ -705,7 +683,3 @@ void err_notamember(const char *id, Classsym *s, symbol *alternate) #endif -#if TARGET_MAC -#include "TGerr.c" -#endif - diff --git a/dm/src/dmc/errmsgs2.c b/dm/src/dmc/errmsgs2.c index c84d0bff..41b7a29c 100644 --- a/dm/src/dmc/errmsgs2.c +++ b/dm/src/dmc/errmsgs2.c @@ -16,9 +16,6 @@ #include #include "cc.h" #include "global.h" -#if TARGET_MAC -#include "TGvers.h" -#endif static char __file__[] = __FILE__; /* for tassert.h */ #include "tassert.h" diff --git a/dm/src/dmc/exp.c b/dm/src/dmc/exp.c index 066bd2a9..7d76b9f4 100644 --- a/dm/src/dmc/exp.c +++ b/dm/src/dmc/exp.c @@ -50,12 +50,7 @@ STATIC elem *primary_exp(void); STATIC elem *prim_post(elem *); STATIC elem *exp_sizeof(int); -#if (TARGET_MAC) -elem *cpp_hdlptr(elem *e); -#define M68HDL(e) cpp_hdlptr(e) -#else #define M68HDL(e) (e) -#endif #ifndef NAN static unsigned long nanarray[2] = {0,0x7FF80000 }; @@ -1470,15 +1465,6 @@ STATIC elem *una_exp() synerr(EM_prep_exp); // sizeof illegal in preprocessor exp e = exp_sizeof(tok.TKval); goto done; -#if TARGET_MAC - case TK__class: - { - extern elem * exp_class(void); - - e = exp_class(); - goto done; - } -#endif case TKcolcol: /* check for ::new or ::delete */ stoken(); if (tok.TKval == TKnew) @@ -1784,27 +1770,6 @@ STATIC elem *primary_exp() } goto L6; -#if TARGET_MAC - case TKinherited: - stoken(); - if (tok.TKval == TKcolcol) - { - stoken(); - if (tok.TKval == TKident) - tok.TKflags |= TKFinherited; - else - { - synerr(EM_ident_exp); - goto err; - } - } - else - { - cpperr(EM_colcol_lpar); - goto err; - } - goto L6; -#endif case TKident: L6: // Look for case of #if defined(identifier) if (preprocessor && strcmp(tok.TKid,"defined") == 0) @@ -1979,25 +1944,6 @@ STATIC elem *primary_exp() * identifier is a member of that class. If so, replace * ident with this->ident. */ - -#if TARGET_MAC - if (tok.TKflags & TKFinherited) /* just error checking here */ - { /* should probably limit to pasobj, non static */ - baseclass_t *b; - - sclass = funcsym_p->Sscope; - b = funcsym_p->Sfunc->Fclass->Sstruct->Sbase; - if (!b) - { cpperr(EM_inher_member); - goto err; - } - smember = cpp_findmember_nest(&sclass,tok.TKid,FALSE); - if (!smember) - { cpperr(EM_inher_member); - goto err; - } - } -#endif impthis = 1; // implied "this" e = NULL; @@ -2033,14 +1979,6 @@ STATIC elem *primary_exp() assert(sthis); e = el_var(sthis); t = e->ET; -#if TARGET_MAC - if( (tybasic(sthis->Stype->Tty) == TYstruct) && - sthis->Stype->Ttag->Sstruct->Sflags & (STRpasobj|STRmachdl)) - { /* this pointer is a handle */ - e->ET->Tty = TYvptr; - e = cast(e,sthis->Stype); - } -#endif e = el_unat(OPind,t->Tnext,e); e = dodot(e, e->ET, FALSE); } @@ -2279,14 +2217,6 @@ if (!bColcol) if (!pstate.STisaddr) { e = el_var(sthis); -#if TARGET_MAC - if( (tybasic(sthis->Stype->Tty) == TYstruct) && - sthis->Stype->Ttag->Sstruct->Sflags & (STRpasobj|STRmachdl)) - { - e->ET->Tty = TYvptr; - e = cast(e,sthis->Stype); - } -#endif e = el_unat(OPind,tclass,e); } } @@ -2506,19 +2436,6 @@ if (!bColcol) case TKstring: { tym_t ty; -#if TARGET_MAC - e = el_calloc(); - e->Eoper = OPstring; - e->EV.ss.Vstring = combinestrings(&e->EV.ss.Vstrlen, &ty); - t = tstypes[ty]; - // BUG: tok.TKflags not valid after combinestrings - assert(0); - if (tok.TKflags & TKFpasstr) // pascal strings unsigned - t = tsuchar; - e->ET = type_allocn(TYfptr,t); // create pointer to char - // string is in static data - e->ET->Tcount++; -#else e = el_calloc(); e->Eoper = OPstring; e->EV.ss.Vstring = combinestrings(&e->EV.ss.Vstrlen, &ty); @@ -2536,7 +2453,6 @@ if (!bColcol) } t->Tcount++; e->ET = t; -#endif break; } @@ -2555,23 +2471,12 @@ if (!bColcol) #endif chktok(TKlpar,EM_lpar); { -#if TARGET_MAC - typedef short emit_t; -#else typedef char emit_t; int imax = 0; -#endif int i = 0; emit_t *p = NULL; while (tok.TKval != TKrpar) { -#if TARGET_MAC - /* Allocate buffer in chunks of 16 */ - if ((i & 15) == 0) - p = (emit_t *) MEM_PARF_REALLOC(p,(i + 16) * sizeof(emit_t)); - p[i] = msc_getnum(); - i++; -#else elem *ea; tym_t ty; int size; @@ -2602,7 +2507,6 @@ if (!bColcol) } } el_free(ea); -#endif if (tok.TKval != TKcomma) break; stoken(); @@ -3421,11 +3325,7 @@ STATIC elem *exp_delete(int global) } eptr = arraytoptr(una_exp()); /* Can only delete pointers */ - if (tybasic(eptr->ET->Tty) != pointertype -#if TARGET_MAC - && (tybasic(eptr->ET->Tty != TYvptr)) -#endif - ) + if (tybasic(eptr->ET->Tty) != pointertype) { cpperr(EM_del_ptrs); // can only delete pointers el_free(enelems); @@ -3584,8 +3484,4 @@ elem *exp_simplecast(type *t) return e; } -#if TARGET_MAC -#include "TGexp.c" -#endif - #endif /* !SPP */ diff --git a/dm/src/dmc/exp2.c b/dm/src/dmc/exp2.c index 0b63412b..7de77092 100644 --- a/dm/src/dmc/exp2.c +++ b/dm/src/dmc/exp2.c @@ -26,9 +26,6 @@ #include "cpp.h" #include "dt.h" #include "scope.h" -#if TARGET_MAC -#include "TG.h" -#endif static char __file__[] = __FILE__; /* for tassert.h */ #include "tassert.h" @@ -41,12 +38,7 @@ STATIC int paramlstcompat(param_t *,param_t *); STATIC elem * strarg(elem *e); STATIC elem * exp2_castx(elem *e,type *newt,elem **pethis,int flags); -#if (TARGET_MAC) -elem *cpp_hdlptr(elem *e); -#define M68HDL(e) cpp_hdlptr(e) -#else #define M68HDL(e) (e) -#endif /******************************* * Read list of comma-separated arguments into *parglist. @@ -265,10 +257,6 @@ elem *exp2_addr(elem *e) continue; case OPcond: -#if TARGET_MAC - eTemp = eTemp->E2->E1; - continue; -#endif case OPvar: case OPind: case OPstreq: @@ -441,9 +429,6 @@ STATIC type * exp2_issimpletypename() case TKfloat: t = tsfloat; break; case TKdouble: t = tsdouble; break; case TKvoid: t = tsvoid; break; -#if TARGET_MAC - case TKextended: t = tsldouble; break; -#endif case TKsymbol: s = tok.TKsym; goto L1; @@ -578,9 +563,6 @@ elem *dodot(elem *e1,type *tclass, bool bColcol) char destructor; char thisptr; symbol *sTempl = NULL; -#if TARGET_MAC - int PasObjFlg = FALSE,HdlObjFlg = FALSE,inheritedFlg = FALSE,based = FALSE; -#endif int result; if (!tclass) // could happen if int->member @@ -636,9 +618,6 @@ elem *dodot(elem *e1,type *tclass, bool bColcol) Lid3: symbol *sc = NULL; -#if TARGET_MAC - inheritedFlg = tok.TKflags & TKFinherited; -#endif stmp = sclass; if (tok.TKval == TKident) { @@ -721,14 +700,6 @@ elem *dodot(elem *e1,type *tclass, bool bColcol) break; } } -#if TARGET_MAC - if (bColcol) - { - sc = scope_search( vident,SCTglobal | SCTnspace); - bColcol = FALSE; - } - else -#endif sc = scope_search(vident,SCTglobal | SCTnspace | SCTtempsym | SCTtemparg | SCTlocal); if (!sc && sclass->Sscope && sclass->Sscope->Sclass == SCnamespace) { @@ -786,9 +757,6 @@ elem *dodot(elem *e1,type *tclass, bool bColcol) if (!sclass0addr) sclass0addr = sclass; direct = TRUE; /* if virtual function, call it directly */ -#if TARGET_MAC - based = TRUE; -#endif if (tok.TKval == TKcom) /* if p->X::~X() */ { stoken(); @@ -913,109 +881,6 @@ elem *dodot(elem *e1,type *tclass, bool bColcol) } /* try to find the symbol */ -#if TARGET_MAC - if (inheritedFlg) - { /* should probably limit to pasobj, non static */ - sclass = sclass->Sstruct->Sbase->BCbase; - s = cpp_findmember(sclass,vident,TRUE); - direct = TRUE; - stmp = sclass; - } - else if (sclass->Sstruct->Sflags & STRpasobj && !based) - { - baseclass_t *b; -#if 1 - symbol *last_sym_fnd,*last_class; - - last_class = sclass; - last_sym_fnd = s = cpp_findmember(sclass,vident,TRUE); - if (!s) - goto err; /* couldn't find the member */ - if (tyfunc(last_sym_fnd->Stype->Tty)) - { - while (b = last_class->Sstruct->Sbase) - { - symbol *sym; - - last_class = b->BCbase; - sym = cpp_findmember(last_class,vident,FALSE); -#if 0 - if (sym) -#else - // only match "correct" functions; Pat: why not use C++ object code instead? - if (sym && cpp_funccmp(s, sym)) -#endif - last_sym_fnd = sym; - }; - s = last_sym_fnd; - } -#else - symbol *last_class = sclass; - unsigned short result; - - s = cpp_findmember(sclass,vident,TRUE); - if (!s) - goto err; /* couldn't find the member */ - if (tyfunc(s->Stype->Tty)) - { - if (s->Sfunc->Fclass == sclass) - goto PO1; - while (b = last_class->Sstruct->Sbase) - { - symbol *sym; - last_class = b->BCbase; /* will not return sym if can't access */ - sym = cpp_findmember(last_class,vident,FALSE); - if (sym && tyfunc(sym->Stype->Tty)) - { - last_class = sym->Sscope; - break; - } - }; -PO1: - if (!isclassmember(funcsym_p)) // not a member function - { - symbol *bclass; - - result = 1; /* assume access O.K. */ - if ((s->Sflags & SFLpmask) != SFLpublic) - result = 0; /* function protected */ - else if (sclass == s->Sscope) - ; - else - { /* function not protected */ - bclass = sclass; /* is class protected */ - while (b = bclass->Sstruct->Sbase) - { - bclass = b->BCbase;/* check path to function */ - if (b->BCflags & (BCFprivate|BCFprotected)) - { /* can't get to function */ - result = 0; /* protected/private base in the way */ - break; - } - if (bclass == last_class) - break; - } - } - } - else if (s->Sscope == last_class) - result = 1; - else if (cpp_findaccess(s,last_class) == SFLpublic) - result = 1; -PO2: - if (!result) -#if HOST_THINK - if (compile_state == kDataView) /* debugger can violate access restrictions */ - return; - else -#endif - cpperr(EM_not_accessible,cpp_prettyident(s),sclass->Sident); /* no access to member */ - } -#endif - direct = TRUE; - stmp = sclass; - } - else -#endif { stmp = sclass; s = cpp_findmember_nest(&stmp,vident,destructor ^ 1); @@ -1303,21 +1168,8 @@ elem *dodot(elem *e1,type *tclass, bool bColcol) } /* Convert ethis to default pointer type */ -#if TARGET_MAC - PasObjFlg = (sowner->Stype->Ttag->Sstruct->Sflags & STRpasobj); - HdlObjFlg = (sowner->Stype->Ttag->Sstruct->Sflags & STRmachdl); - if (thisptr) - { - type *t; - t = newpointer(ethis->ET->Tnext); - if (PasObjFlg || HdlObjFlg) - t->Tty = TYvptr; - ethis = cast(ethis,t); - } -#else if (thisptr) ethis = cast(ethis,newpointer(ethis->ET->Tnext)); -#endif if (destructor && thisptr) // Explicitly called destructors are not part of the EH mechanism @@ -1334,13 +1186,6 @@ elem *dodot(elem *e1,type *tclass, bool bColcol) e = el_unat(OPind,e->ET->Tnext,e); e = poptelem(e); /* collapse out *& and &* */ -#if TARGET_MAC - if (PasObjFlg && (inheritedFlg || based) && sfunc->Sfunc->Fflags & Fvirtual) - { - assert(e->Eoper == OPvar); - e->Eflags |= EFpinher; - } -#endif if (sfunc->Sfunc->Fflags & Fstatic) { el_free(ethis); ethis = NULL; @@ -1359,12 +1204,6 @@ elem *dodot(elem *e1,type *tclass, bool bColcol) if (tym & ~sfunc->Stype->Tty) typerr(EM_cv_arg,ethis->ET,sfunc->Stype); /* type mismatch */ } -#if TARGET_MAC - if(PasObjFlg) - ethis->Eflags |= EFpasmeth; - if(HdlObjFlg) - ethis->Eflags |= EFhdlobj; -#endif ec = xfunccall(e,ethis,NULL,arglist); } chktok(TKrpar,EM_rpar); @@ -1432,9 +1271,6 @@ elem *dodot(elem *e1,type *tclass, bool bColcol) if (s->Sflags & SFLmutable) modifiers &= ~mTYconst; type_setty(&e->ET,e->ET->Tty | modifiers); -#if (TARGET_MAC) - if(!CPP || (!PasObjFlg && !HdlObjFlg)) -#endif handleaccess(e); if (tyref(e->ET->Tty)) e = reftostar(e); @@ -1486,9 +1322,6 @@ elem *doarray(elem *e1) } else { -#if TARGET_MAC - e2 = convertchk(e2); -#endif e2 = arraytoptr(e2); eplus = el_bint(OPadd,NULL,e1,e2); } @@ -1781,10 +1614,7 @@ elem *dofunc(elem *e) /* Member functions could be virtual */ e1 = cpp_getfunc(tclass,sfunc,ðis); -#if TARGET_MAC - if(!(e1->Eflags&EFpasmeth)) -#endif - e1 = el_unat(OPind,e1->ET->Tnext,e1); + e1 = el_unat(OPind,e1->ET->Tnext,e1); el_copy(e,e1); e1->ET = NULL; e1->E1 = NULL; @@ -1797,12 +1627,7 @@ elem *dofunc(elem *e) else { err_nomatch("operator()",arglist); /* no match for function */ list_free(&arglist,(list_free_fp)el_free); -#if TARGET_MAC - ec = el_longt(tserr,0); - goto ret; -#else return e; -#endif } } else @@ -1979,14 +1804,9 @@ elem *builtinFunc(elem *ec) symbol_debug(s); #if linux || __APPLE__ || __FreeBSD__ || __OpenBSD__ if (ec->Eoper == OPcall) /* forget about OPucall for now */ -#else -#if TARGET_MAC - if ((config.inline68881 & CFGtrans && tyfloating(ec->ET->Tty)) #else if (s->Sident[0] == '_' && memcmp(s->Sident + 1,"inline_",7) == 0 -#endif - && ec->Eoper == OPcall /* forget about OPucall for now */ - ) + && ec->Eoper == OPcall) /* forget about OPucall for now */ #endif { // If not C mangling, don't recognize it @@ -2203,25 +2023,9 @@ STATIC elem * defaultpromotions(elem *e) /* this should be combined with paramtypadj() */ switch (tybasic(e->ET->Tty)) { -#if TARGET_MAC -#if HOST_MPW - case TYfloat: - case TYdouble: - case TYcomp: - t = tsldouble; - break; -#else - case TYfloat: - case TYdouble: - case TYcomp: - t = tsdouble; /* double is smaller size */ - break; -#endif -#else case TYfloat: t = tsdouble; break; -#endif default: return convertchk(e); } @@ -2258,32 +2062,12 @@ elem *convertchk(elem *e) else t = tsuns; break; -#if TARGET_MAC /* NOTE: PAT - no longer doing this for 80x86 */ - case TYfloat: - case TYdouble: - case TYcomp: -#if TARGET_68K - if (config.inline68881) - return e; /* SANE always done long double (classic C not ANSI) */ -#endif - t = tsldouble; - break; - case TYenum: - if (!config.flags2&CFG2sizedenum) - return e; - t = tsint; - /* value-preserving rules ? */ - if (tybasic(e->ET->Tnext->Tty) == TYushort && intsize <= SHORTSIZE) - t = tsuns; - break; -#else case TYsptr: if (!(config.wflags & WFssneds)) { t = type_allocn(TYnptr,e->ET->Tnext); break; } /* FALL-THROUGH */ -#endif default: return e; #if TX86 @@ -2474,22 +2258,6 @@ STATIC elem * strarg(elem *e) arglist = list_build(e,NULL); ector = init_constructor(NULL,tclass,arglist,0,3,NULL); assert(ector); -#if TARGET_MAC - if (ector->Eoper == OPcond) - { - // Add an OPstrctor in front of children of OPcolon - // This way params in codegen can be called recursively to - // handle OPstrctor with conditional call to constructors - elem *ecolon = ector->E2; - ecolon->E1 = el_unat(OPstrctor,tclass,ecolon->E1); - ecolon->E2 = el_unat(OPstrctor,tclass,ecolon->E2); - ecolon->E1->Eflags |= EFstrctor; - ecolon->E2->Eflags |= EFstrctor; - } - else - ector->Eflags |= EFstrctor; /* OPstrctor handles reversal of params */ - /* Flag the call so it is not rewritten */ -#endif return el_unat(OPstrctor,tclass,ector); } } @@ -2529,11 +2297,6 @@ elem *xfunccall(elem *efunc,elem *ethis,list_t pvirtbase,list_t arglist) type *t; tym_t ty; -#if TARGET_MAC - unsigned short hiddenparam = FALSE; - unsigned returnreg = 0; -#endif - tfunc = efunc->ET; if (!tyfunc(tfunc->Tty)) { list_free(&arglist,(list_free_fp)el_free); @@ -2648,28 +2411,6 @@ elem *xfunccall(elem *efunc,elem *ethis,list_t pvirtbase,list_t arglist) if (p) { /* Convert argument to type of parameter */ -#if (TARGET_MAC) - if (CPP && tybasic(p->Ptype->Tty) == TYfptr) - { /* forward referenced class proto-types have fptr not vptr */ - type *tn = p->Ptype->Tnext; - if((tybasic(tn->Tty) == TYstruct) && - tn->Ttag->Sstruct->Sflags & (STRpasobj|STRmachdl)) - { - p->Ptype->Tty &= ~mTYbasic; - p->Ptype->Tty |= TYvptr; /* pick up handle ptr for handle based structs */ - } - } - if (CPP && sfunc && sfunc->Sfunc->Fclass && - sfunc->Sfunc->Fclass->Sstruct->Sflags&STRpasobj && - ((strcmp(sfunc->Sident,"__nw") == 0) || - (strcmp(sfunc->Sident,"__dl") == 0)) ) - { /* skip the type check, will not match */ - /* MPW C++ forces declaration to be (*)() */ - /* instead of method table pointer */ - ; - } - else -#endif e1 = exp2_paramchk(e1,p->Ptype,param); p = p->Pnext; } @@ -2727,18 +2468,7 @@ elem *xfunccall(elem *efunc,elem *ethis,list_t pvirtbase,list_t arglist) if (CPP && ethis) { elem_debug(ethis); /* Convert ethis into correct pointer type for this class */ -#if TARGET_MAC - { - type *t; - t = newpointer(ethis->ET->Tnext); - if (ethis->Eflags & (EFpasmeth|EFhdlobj) || - tybasic(ethis->ET->Tty == TYvptr) ) - t->Tty = TYvptr; - ethis = typechk(ethis,t); - } -#else ethis = typechk(ethis,newpointer(ethis->ET->Tnext)); -#endif e = (e) ? el_bint(OPparam,tsint,e,ethis) : ethis; } #endif @@ -2751,15 +2481,8 @@ elem *xfunccall(elem *efunc,elem *ethis,list_t pvirtbase,list_t arglist) { elem *ehidden; stmp = symbol_genauto(tfunc->Tnext); -#if TARGET_MAC - hiddenparam = TRUE; - ehidden = el_var(stmp); - ehidden->Eflags |= EFhidretp; - ehidden = el_unat(OPaddr,exp2_hiddentype(tfunc),ehidden); -#else ehidden = el_ptr(stmp); ehidden = cast(ehidden,exp2_hiddentype(tfunc)); -#endif if (e) { #if HIDDENPARAM_1ST_ARG @@ -3132,17 +2855,6 @@ STATIC elem * exp2_paramchk(elem *e,type *t,int param) e1 = e1->E2; continue; case OPind: -#if TARGET_MAC - if (e->E1->Eoper == OPvptrfptr && (tybasic(tn->Tty) == TYstruct) && - (tn->Ttag->Sstruct->Sflags & (STRpasobj|STRmachdl)) ) - { /* de-ref handle, pass the handle itself */ - e = selecte1(e1,et); - e = selecte1(e,e->E1->ET); - tn = type_allocn(TYvptr,tn); - e = exp2_paramchk(e,tn,param); // to default pointer type - return e; - } -#endif break; case OPcond: /* Cast each leaf to the reference type */ @@ -3462,11 +3174,6 @@ STATIC elem * exp2_paramchk(elem *e,type *t,int param) { // error if converting from an integer to an enum if (CPP && ty == TYenum && (ety != TYenum || et->Ttag != t->Ttag)) -#if TARGET_MAC - if (ety == TYstruct || ty == TYstruct) - goto doit; // Look for user defined conversions - else -#endif goto mismatch; if (ety == TYnullptr && ty == TYnullptr) @@ -3496,12 +3203,6 @@ STATIC elem * exp2_paramchk(elem *e,type *t,int param) //printf("et:\n");type_print(et); //printf("t:\n");type_print(t); typerr(param ? EM_explicitcast : EM_explicit_cast,et,t,param); // cannot implicitly convert -#if TARGET_MAC - // Pat: wouldn't error recovery be better if e is set to type t, - // not tserr? Also, why is this necessary at all, as the code below - // will try to cast it anyway as error recovery? - return el_settype(e,tserr); -#endif doit: if (ety == TYstruct || ty == TYstruct) @@ -4092,12 +3793,6 @@ int typematch(type *t1,type *t2,int relax) tym = ~(mTYimport | mTYnaked); } -#if TARGET_MAC - if ( t1 && t2 && tybasic(t2->Tty) == TYvptr && tybasic(t1->Tty) == TYfptr && - typematch(t2->Tnext,t1->Tnext,relax)) - t1->Tty = TYvptr | (t1->Tty & (mTYconst | mTYvolatile)); - tym &= ~mTYpasret; // Don't compare mTYpasret, may not be set yet -#else if (relax & (4 | 0x20)) { if (relax & 4) @@ -4105,7 +3800,6 @@ int typematch(type *t1,type *t2,int relax) if (relax & 0x20) tym &= ~mTYfar; } -#endif int i = t1 == t2 || t1 && t2 && @@ -4529,16 +4223,6 @@ void impcnv(elem *e) } } /* Do the usual arithmetic conversions */ -#if TARGET_MAC - else if (t1 == TYldouble) - newt2 = tsldouble; /* convert to double */ - else if (t2 == TYldouble) - newt1 = tsldouble; - else if (t1 == TYcomp) - newt2 = tsldouble; /* convert to double */ - else if (t2 == TYcomp) - newt1 = tsldouble; -#endif else if (t1 > t2) { switch (t1) @@ -4961,9 +4645,6 @@ int exp2_ptrconv(type *tfrom,type *tto) /* Construct a table that gives the action when casting from one type */ /* to another. */ -#if TARGET_MAC -#include "TGcast.h" -#else /* Rename these mainly to get the size down, so the table isn't so wide */ #define SHTLNG OPs16_32 @@ -5033,7 +4714,6 @@ int exp2_ptrconv(type *tfrom,type *tto) #include "castab.c" -#endif /************************* * Cast e to type newt (no cast if newt is NULL). @@ -5074,34 +4754,12 @@ STATIC elem * exp2_castx(elem *e,type *newt,elem **pethis,int flags) oldt = e->ET; assert(oldt); type_debug(oldt); -#if TARGET_MAC - if (tybasic(oldt->Tty) == TYvptr && - (tybasic(newt->Tty) == TYfptr && tybasic(newt->Tnext->Tty) == TYfptr)) - goto paint; - if (tybasic(oldt->Tty) == TYenum && config.flags2&CFG2sizedenum) - { - if(oldt->Ttag->Senum->SEflags & SENforward) - oldt = tsint; - else - oldt = e->ET->Tnext; - if (oldt == newt) - goto paint; - } -#endif if (newt == oldt) /* if cast to same type */ goto ret; oldty = tybasic(oldt->Tty); newty = tybasic(newt->Tty); -#if TARGET_MAC - if (tybasic(newt->Tty) == TYenum && config.flags2&CFG2sizedenum) - newty = tybasic(newt->Tnext->Tty); - /* real enum type */ - if (newty == TYvoid && e->Eoper == OPcall && typasfunc(e->E1->ET->Tty)) - goto ret; /* can't cast pascal func returns */ -#endif - // ARM says that (T&)X is equivalent to *(T*)&X if (tyref(newty)) { @@ -5191,9 +4849,6 @@ STATIC elem * exp2_castx(elem *e,type *newt,elem **pethis,int flags) /* create a new thunk. */ if (d == 0) /* if no offset */ goto paint; -#if TARGET_MAC - e = poptelem(e); -#endif if (tyfunc(oldt->Tnext->Tty)) /* if pointer to function */ { if (e->Eoper == OPrelconst) @@ -5401,10 +5056,6 @@ STATIC elem * exp2_castx(elem *e,type *newt,elem **pethis,int flags) goto paint; #endif typerr(EM_illegal_cast,oldt,newt); // illegal cast -#if TARGET_MAC - if (newty == TYstruct) /* struct not expected, but */ - newt = tsvoid; /* void valid for error condition */ -#endif goto paint; case NONE: /* no conversion (but maybe 'const' or 'volatile') */ @@ -5427,27 +5078,6 @@ STATIC elem * exp2_castx(elem *e,type *newt,elem **pethis,int flags) #endif /* Convert to another type and try again */ -#if TARGET_MAC - case D2LD: - case LD2D: - if (PCrel_option & PC_THINKC_DBL) - goto paint; /* double and long double are the same size */ - else - goto doaction; - case LONG: t = tslong; goto retry; - case ULONG: t = tsulong; goto retry; -#if TARGET_POWERPC - case DOUBLE: t = tsdouble; goto retry; -#else -// 68k - case DOUBLE: t = tsldouble; goto retry; -#endif - case INT: t = tsshort; goto retry; - case UINT: t = tsushort; goto retry; - retry: - e = cast(cast(e,t),newt); - break; -#else // TX86 case LONG: t = tslong; goto retry; case DOUBLE: t = tsdouble; goto retry; case IDOUBLE: t = tsidouble; goto retry; @@ -5520,13 +5150,7 @@ STATIC elem * exp2_castx(elem *e,type *newt,elem **pethis,int flags) else goto doaction; break; -#endif case FPTR: -#if TARGET_MAC - if (tybasic(newt->Tnext->Tty) == TYvoid) - goto paint; /* void * conversion is a paint, otherwise */ - /* can't pass handles to generic routines */ -#endif /* If handle pointer to const, use the constant conversion */ action = (newt->Tnext->Tty & mTYconst) ? OPcvptrfptr : OPvptrfptr; goto doaction; @@ -5589,15 +5213,6 @@ void getinc(elem *e) e->E2 = e2 = el_longt(tsint,1); /* inc always by an int */ if (typtr(e->E1->ET->Tty)) /* if operating with a pointer */ scale(e); /* do any scaling necessary */ -#if TARGET_MAC - else if (tybasic(e->E1->ET->Tty) == TYdouble) - e->E2 = typechk(e->E2,tsldouble); - else if (tybasic(e->E1->ET->Tty) == TYfloat) - e->E2 = typechk(e->E2,tsldouble); -#else - /*else if (tybasic(e->E1->ET->Tty) == TYfloat) - e->E2 = typechk(e->E2,tsdouble);*/ -#endif else { if (CPP) @@ -5606,9 +5221,5 @@ void getinc(elem *e) } } -#if TARGET_MAC -#include "TGexp2.c" -#endif - #endif /* !SPP */ diff --git a/dm/src/dmc/file.c b/dm/src/dmc/file.c index 5451310b..0ca098f3 100644 --- a/dm/src/dmc/file.c +++ b/dm/src/dmc/file.c @@ -349,9 +349,7 @@ char *file_getsource(const char *iname) char *p; size_t len; -#if TARGET_MAC - static char ext[][4] = { "cpp","cp","c" }; -#elif M_UNIX || M_XENIX +#if M_UNIX || M_XENIX static char ext[][4] = { "cpp","cxx","c", "C", "cc", "c++" }; #else static char ext[][5] = { "cpp","c","cxx","htm","html" }; diff --git a/dm/src/dmc/func.c b/dm/src/dmc/func.c index b646174c..5dc57488 100644 --- a/dm/src/dmc/func.c +++ b/dm/src/dmc/func.c @@ -36,11 +36,6 @@ #include "iasm.h" #endif -#if TARGET_MAC -#include "TG.h" -#define token_linnum getlinnum -#endif - static char __file__[] = __FILE__; /* for tassert.h */ #include "tassert.h" @@ -234,19 +229,6 @@ void func_body(symbol *s) f = s->Sfunc; assert(f); file_progress(); -#if (TARGET_MAC) - if (CPP && - isclassmember(s) && - (s->Sscope->Sstruct->Sflags & STRpasobj) && - !(s->Sscope->Sstruct->Sflags & STRabstract) && - (s->Sfunc->Fflags & Fvirtual || - (strcmp(s->Sident,"__ct") == 0) || (strcmp(s->Sident,"__dt") == 0) || - (strcmp(s->Sident,"__nw") == 0) || (strcmp(s->Sident,"__dl") == 0)) ) - { - if (strcmp("PascalObject",s->Sscope->Sident)) - po_func_Methout(s->Sscope); - } -#endif if (configv.verbose == 2) dbg_printf("%s\n",prettyident(s)); funcsym_p = s; @@ -418,11 +400,7 @@ void func_body(symbol *s) } MEM_PH_FREE(p->Pident); p->Pident = NULL; -#if TARGET_MAC - // for internal error with void f(int a, int a) - if (errcnt == olderrcnt) -#endif - list_append(&plist,sp); + list_append(&plist,sp); // Look for VLA expressions if (typtr(p->Ptype->Tty) && type_isvla(p->Ptype->Tnext)) @@ -506,10 +484,6 @@ void func_body(symbol *s) tp->Tcount++; // create copy before adjustment if (!typtr(p->Ptype->Tty)) paramtypadj(&p->Ptype); // default conversions -#if TARGET_MAC - if (type_size(sp->Stype) != type_size(p->Ptype)) - sp->Sflags |= SFLdouble; /* stack size larger than basic type */ -#endif if (tfunc->Tparamtypes) /* if type was specified */ { @@ -738,10 +712,6 @@ void func_body(symbol *s) #endif ) { -#if TARGET_MAC - if ((config.flags2 & CFG2phgen)) - cpperr(EM_vtbl_redecl,s->Sident); -#endif scvtbl = (enum SC) ((config.flags2 & CFG2comdat) ? SCcomdat : SCstatic); n2_genvtbl(stag,scvtbl,1); #if VBTABLES @@ -768,10 +738,6 @@ void paramtypadj(type **pt) assert(pt); t = *pt; assert(t); -#if TARGET_MAC - if (tybasic(t->Tty) == TYenum) - t = t->Tnext; -#endif switch (tybasic(t->Tty)) { case TYarray: assert(0); @@ -1946,39 +1912,6 @@ STATIC void for_state() else state_cpp(); -#if TARGET_MAC - block_goto(forlabel); - if (tok.TKval == TKsemi) - stoken(); - else - { - if (CPP && isexpression() <= 1) // if it could be a declaration - { // assume it is a declaration - if (flag) - { flag = 0; - createlocalsymtab(); - fscope_beg(); - } - - e = declaration(4); // declare the variable - } - else - e2 = addlinnum(func_expr_dtor(TRUE)); - - e2 = cpp_bool(e2, 1); - chknosu(e2); - chkunass(e2); - chktok(TKsemi,EM_semi_member); - { block *b; - - block_appendexp(curblock, e2); - b = curblock; - block_next(BCiftrue,NULL); - list_append(&b->Bsucc,curblock); - list_append(&(b->Bsucc),funcstate.brklabel); - } - } -#else // TX86 block_goto(forlabel); if (tok.TKval == TKsemi) stoken(); @@ -2008,7 +1941,6 @@ STATIC void for_state() list_append(&(b->Bsucc),funcstate.brklabel); } } -#endif /* Be careful to add in destructors immediately for the 3rd expression. @@ -2418,20 +2350,15 @@ STATIC void return_state() { type *tret; -#if TARGET_MAC - if (ety == TYstruct) -#endif + tret = newpointer(e->ET->Tnext); + e = cast(e,tret); + if (CPP) { - tret = newpointer(e->ET->Tnext); - e = cast(e,tret); - if (CPP) - { - e = poptelem(e); - if (e->Eoper == OPinfo) - e = el_selecte2(e); - if (funcstate.namret.s) - list_append(&funcstate.namret.explist,e); - } + e = poptelem(e); + if (e->Eoper == OPinfo) + e = el_selecte2(e); + if (funcstate.namret.s) + list_append(&funcstate.namret.explist,e); } } } @@ -2804,9 +2731,7 @@ STATIC void func_adddestructors() STATIC void func_doblock(block *bstart) { -#if !(TARGET_MAC) _chkstack(); -#endif if (bstart->Bnext) func_doblock(bstart->Bnext); diff --git a/dm/src/dmc/getcmd.c b/dm/src/dmc/getcmd.c index 7321b8ba..9e6f9025 100644 --- a/dm/src/dmc/getcmd.c +++ b/dm/src/dmc/getcmd.c @@ -22,16 +22,7 @@ #include #endif -#if TARGET_MAC -#define INC_ENV "Zincludes" -#else #define INC_ENV "INCLUDE" -#endif - -#if TARGET_MAC -#include -extern char *getenv (const char *); -#endif #include "cc.h" #include "parser.h" @@ -1109,11 +1100,6 @@ void getcmd(int argc,char **argv) config.linkage = LINK_STDCALL; } -#if TARGET_MAC - config.memmodel = Lmodel; /* too many in the code to drop */ - config.wflags |= WFssneds; - pointertype = TYfptr; -#else #if !_WINDLL if (configv.verbose == 2) notice(); @@ -1243,7 +1229,6 @@ void getcmd(int argc,char **argv) (config.flags4 & (CFG4stdcall | CFG4oldstdmangle)) == CFG4stdcall ) config.flags3 |= CFG3autoproto; // turn on autoprototyping -#endif #if _WIN32 && _WINDLL netspawn_flags = NetSpawnGetCompilerFlags(); @@ -1436,18 +1421,8 @@ void getcmd(int argc,char **argv) } #endif -#if TARGET_MAC - fixeddefmac("macintosh",one); - fixeddefmac("MC68000",one); - fixeddefmac("mc68000",one); - fixeddefmac("m68k",one); - fixeddefmac("applec",one); -#endif if (CPP || config.flags3 & CFG3cpp) { fixeddefmac("__cplusplus", "199711L"); -#if TARGET_MAC - fixeddefmac("__safe_link",one); -#endif } else { @@ -1591,11 +1566,7 @@ STATIC void addpath(const char *q) instring ^= 1; // toggle inside/outside of string continue; -#if TARGET_MAC - case ',': -#else case ';': -#endif #if M_UNIX || M_XENIX case ':': #endif diff --git a/dm/src/dmc/init.c b/dm/src/dmc/init.c index 51d7c071..f6a465c5 100644 --- a/dm/src/dmc/init.c +++ b/dm/src/dmc/init.c @@ -882,12 +882,8 @@ symbol *init_typeinfo(type *ptype) // The first entry is a pointer to the vtbl[] assert(st->Svptr->Smemoff == 0); // should be first member -#if TARGET_MAC - scvtbl = (enum SC) (st->Sflags & STRvtblext) ? SCextern : SCstatic; -#else scvtbl = (enum SC) (config.flags2 & CFG2comdat) ? SCcomdat : (st->Sflags & STRvtblext) ? SCextern : SCstatic; -#endif n2_genvtbl(srtti,scvtbl,0); dtxoff(&s->Sdt,st->Svtbl,0,pty); @@ -1632,23 +1628,6 @@ STATIC elem * elemtodt(symbol *s,dt_t **pdt,elem *e,targ_size_t offset) case OPconst: { size = type_size(e->ET); -#if TARGET_MAC - switch(size) - { case 1: p = &e->EV.Vchar; break; - case 2: p = (char *)&e->EV.Vshort; break; - case 4: p = (char *)&e->EV.Vlong; break; - case 8: p = (char *)&e->EV.Vdouble; break; - case 10: p = (char *)&e->EV.Vldouble; break; - case 12: - { - long ldbl[3]; - short len; - util_ldbl(e, &ldbl[0],&ldbl[1],&ldbl[2], &len); - p = (char *)&ldbl[0]; break; - } - default: assert(0); - }; -#else targ_float f; targ_double d; Complex_f fc; @@ -1682,7 +1661,6 @@ STATIC elem * elemtodt(symbol *s,dt_t **pdt,elem *e,targ_size_t offset) p = (char *) &e->EV; break; } -#endif dsout += size; if (size > 1) dtnbytes(&dt,size,p); @@ -1775,11 +1753,7 @@ void init_vtbl(symbol *s_vtbl,list_t virtlist,Classsym *stag,Classsym *srtti) symbol_debug(s_vtbl); symbol_debug(stag); -#if TARGET_MAC - fty = TYfptr; -#else fty = LARGECODE ? TYfptr : TYnptr; -#endif cpp_getpredefined(); /* get s_mptr */ #ifdef DEBUG #if THUNKS diff --git a/dm/src/dmc/inline.c b/dm/src/dmc/inline.c index b84f82c9..ed45b0ae 100644 --- a/dm/src/dmc/inline.c +++ b/dm/src/dmc/inline.c @@ -136,26 +136,6 @@ STATIC elem * inline_do_walk(elem *e) { e1->E1 = inline_do_walk(e1->E1); e1 = e1->E2; } -#if TARGET_MAC - if (e1->Eoper == OPcond) - { - elem *e2; - - e1->E1 = inline_do_walk(e1->E1); // do the conditional - e2 = e1->E2; // the OPcolon - assert(e2->E1->Eoper == OPstrctor); - e1 = e2->E1->E1; // 1st call - /* Never inline expand this function */ - assert(e1->Eoper == OPcall); - - if (e1->E1->Eoper == OPvar) - ; - else - e1->E1 = inline_do_walk(e1->E1); - e1->E2 = inline_do_walk(e1->E2); - e1 = e2->E2->E1; // 2nd call - } // fall through and finish 2nd call -#endif if (e1->Eoper == OPcall && e1->E1->Eoper == OPvar) { // Never inline expand this function @@ -258,16 +238,6 @@ STATIC elem * inline_ifcan(elem *e) if (!tyfunc(sfunc->Stype->Tty)) return e; -#if TARGET_MAC - // virtual pascal object functions are OPvar type calls, don't inline - if (sfunc->Sfunc->Fflags & Fvirtual && - isclassmember(sfunc) && sfunc->Sscope->Sstruct->Sflags & STRpasobj) - { - nwc_mustwrite(sfunc); - return e; - } -#endif - // This function might be an inline template function that was // never parsed. If so, parse it now. if (sfunc->Sfunc->Fbody) @@ -496,11 +466,9 @@ STATIC void inline_expandwalk(elem *e) assert(e); elem_debug(e); //dbg_printf("inline_expandwalk(%p) ",e);WROP(e->Eoper);dbg_printf("\n"); -#if 1 || TARGET_MAC // the debugger falls over on debugging inlines if (configv.addlinenumbers) e->Esrcpos.Slinnum = 0; // suppress debug info for inlines -#endif if (EOP(e)) { if (EBIN(e)) diff --git a/dm/src/dmc/msc.c b/dm/src/dmc/msc.c index c1f2d97b..8f8576bb 100644 --- a/dm/src/dmc/msc.c +++ b/dm/src/dmc/msc.c @@ -358,14 +358,7 @@ tym_t tym_conv(type *t) nty = TYulong; break; case TYenum: -#if TARGET_MAC - if (config.flags2&CFG2sizedenum) - nty = t->Tnext->Tty; - else - nty = TYint; -#else nty = t->Tnext->Tty; -#endif break; case TYref: if (type_struct(t->Tnext)) // if reference to struct diff --git a/dm/src/dmc/msgs.h b/dm/src/dmc/msgs.h index 46ecfc49..df2f536c 100644 --- a/dm/src/dmc/msgs.h +++ b/dm/src/dmc/msgs.h @@ -295,18 +295,6 @@ #if TX86 #define EM_colcol_exp 89 #else -#if TARGET_MAC -#define EM_new_pascal 87 -#define EM_del_pascal 88 -#define EM_new_type 89 -#define EM_delete_type 90 -#define EM_fwd_class_type 91 -#define EM_pascal_class 92 -#define EM_inher_member 93 -#define EM_ovl_conv 94 -#define EM_vtbl_redecl 95 -#define EM_vtbl_inline 96 -#endif #define EM_ptr_ref 97 #define EM_mult_decl 98 #endif diff --git a/dm/src/dmc/msgsx.c b/dm/src/dmc/msgsx.c index 78bf115d..f4580ef5 100644 --- a/dm/src/dmc/msgsx.c +++ b/dm/src/dmc/msgsx.c @@ -2687,73 +2687,6 @@ struct Msgtable msgtable[] = "'::' がありません", // CPP+89 }, #else -#if TARGET_MAC - { "new_pascal", - "new %s [], not allowed for handle/pascal class", /* CPP+87 */ - "new %s [], nicht erlaubt f〉 Handle/Pascal-Klasse", /* CPP+87 */ - "new %s [], non valide avec la classe handle/pascal", /* CPP+87 */ - }, - { "del_pascal", - "delete [] %s , not allowed for handle/pascal class", /* CPP+88 */ - "delete [] %s , nicht erlaubt f〉 Handle/Pascal-Klasse", /* CPP+88 */ - "delete %s [], non valide avec la classe handle/pascal", /* CPP+88 */ - }, - { "new_type", - "type must be void **operator new(pascal void (*)(),size_t);", /* CPP+89 */ - "Typ mu void **operator new(pascal void (*)(),size_t); sein", /* CPP+89 */ - "le type doit tre void**opSateur new(pascal void (*)()size_t);", /* CPP+89 */ - }, - - /* Type of operator delete must be one of: */ - /* void operator delete(void *); */ - /* void operator delete(void *,size_t); */ - { "delete_type", - "must be void operator delete(void **);", /* CPP+90 */ - "Mu lauten void operator delete(void **);", /* CPP+90 */ - "doit tre void opSateur delete(void **);", /* CPP+90 */ - }, - { "fwd_class_type", - "Prior forward reference to class %s must match handle/pascal class type",/* CPP+91 */ - "Fr”ere Vorausreferenz auf Klasse %s mu Handle/Pascal-Klassentyp entsprechen",/* CPP+91 */ - "La rGSence en avant antSieure la classe %s doit correspondre au type de classe handle/pascal",/* CPP+91 */ - }, - { "pascal_class", - "pascal object class expected", /* CPP+92 */ - "Pascal-Objektklasse erwartet", /* CPP+92 */ - "classe d'objets pascal requis", /* CPP+92 */ - }, - { "inher_member", - "inherited function must be member of derived class", /* CPP+93 */ - "Vererbte Funktion mu Glied einer abgeleiteten Klasse sein", /* CPP+93 */ - "la fonction hSitF doit appartenir la classe dSivF", /* CPP+93 */ - }, - /* The Pascal naming conventions do not support type information */ - /* overloading, type conversion, and operator functions are not allowed */ - /* for virtual members of pascal classes or any pascal function */ - { "ovl_conv", - "overloading, type conversion or operator function not allowed", /* CPP+94 */ - "喘erlagerungs-, Typkonvertierungs- oder Operator-Funktion nicht zulгsig", /* CPP+94 */ - "appel d'informations de type, conversion de type ou fonction opSateur non autoris", /* CPP+94 */ - }, -#if HOST_MPW - { "vtbl_redecl", - "dump file requirement: vtable key function '%s' cannot be redeclared inline", /* CPP+95 */ - "Speicherauszugsdatei: Vtable-Schl《selfunktion '%s' kann nicht als 'inline' redeklariert werden", /* CPP+95 */ - "exigence du fichier de vidage : la fonction cl vtable '%s' ne doit pas tre redDlarF de type inline", /* CPP+95 */ - }, -#else - { "vtbl_redecl", - "vtable key function '%s' cannot be redeclared inline in precompiled header", /* CPP+95 */ - "Vtable-Schl《selfunktion '%s' kann nicht in vorkompiliertem Header als 'inline' redeklariert werden", /* CPP+95 */ - "a fonction cl vtable '%s' ne doit pas tre redDlarF de type inline dans un en-tte prDompil", /* CPP+95 */ - }, -#endif - { "vtbl_inline", - "vtable key function '%s' redeclared inline (vtable will be static)", /* CPP+96 */ - "Vtable-Schl《selfunktion '%s' als 'inline' redeklariert (Vtable k]ftig statisch)", /* CPP+96 */ - "fonction cl vtable '%s' redDlarF inline (vtable sera statique)", /* CPP+96 */ - }, -#endif { "ptr_ref", "pointers and references to references are illegal", /* CPP+97 */ "Pointer und Referenzen auf Referenzen unzulгsig", /* CPP+97 */ diff --git a/dm/src/dmc/nwc.c b/dm/src/dmc/nwc.c index c0cd6173..312fb5ab 100644 --- a/dm/src/dmc/nwc.c +++ b/dm/src/dmc/nwc.c @@ -33,10 +33,6 @@ #include "scope.h" #include "outbuf.h" -#if TARGET_MAC -#include "TG.h" -#endif - static char __file__[] = __FILE__; /* for tassert.h */ #include "tassert.h" @@ -55,11 +51,6 @@ Declar gdeclar; static long linkage_kwd; static int msbug; // used to emulate MS C++ bug -#if TARGET_MAC -static int DirSiz; -static short *DirLst; -#endif - int readini(char *argv0,char *ini); #if TX86 @@ -814,11 +805,6 @@ void nwc_mustwrite(symbol *sfunc) //dbg_printf("nwc_mustwrite('%s')\n",sfunc->Sident); //symbol_print(sfunc); assert(tyfunc(sfunc->Stype->Tty)); -#if TARGET_MAC - if (CPP && sfunc->Sfunc->Fflags & Fpure) - return; - else -#endif #if linux || __APPLE__ || __FreeBSD__ || __OpenBSD__ if (sfunc->Sfunc->Fflags3 & Fnowrite) return; @@ -924,9 +910,6 @@ enum TKW TKWvoid = 0x1000, TKWbool = 0x4000, TKWwchar_t = 0x8000, -#if TARGET_MAC - TKWcomp = 0x2000, -#endif TKWimaginary = 0x10000, TKWcomplex = 0x20000, TKWchar16 = 0x40000, @@ -967,10 +950,6 @@ int declaration_specifier(type **ptyp_spec, enum SC *pclass, unsigned long *pcla /* Thus, for HYBRID, at least we set TkStrtSrcpos in ext_def() (and elsewhere for */ /* inlines and templates). ILR */ -#if (TARGET_MAC) - TkStrtSrcpos = getlinnum(); -#endif - msbug = 0; #if TARGET_LINUX || TARGET_OSX || TARGET_FREEBSD || TARGET_OPENBSD || TARGET_SOLARIS if (tok.TKval == TK_extension) @@ -1034,10 +1013,6 @@ int declaration_specifier(type **ptyp_spec, enum SC *pclass, unsigned long *pcla case TKvoid: tkwx = TKWvoid; goto L6; case TKbool: tkwx = TKWbool; goto L6; case TKwchar_t: tkwx = TKWwchar_t; goto L6; -#if TARGET_MAC - case TKextended: tkwx = TKWldouble; goto L6; - case TKcomp: tkwx = TKWcomp; goto L6; -#endif L6: stoken(); L8: @@ -1064,15 +1039,6 @@ int declaration_specifier(type **ptyp_spec, enum SC *pclass, unsigned long *pcla goto L2; #endif -#if TARGET_MAC - case TK__pascal: - case TK_pascal: - case TKpascal: - modifiersx = mTYpascal; goto L3; - case TK__cdecl: - case TK_cdecl: - case TKcdecl: modifiersx = mTYcdecl; goto L3; -#endif case TK_unaligned: modifiersx = mTYunaligned; goto L3; case TKconst: modifiersx = mTYconst; goto L3; case TKvolatile: modifiersx = mTYvolatile; goto L3; @@ -1585,10 +1551,6 @@ int declaration_specifier(type **ptyp_spec, enum SC *pclass, unsigned long *pcla t = tsint; } -#if TARGET_MAC - // "extended" means "long double" - case TKWldouble: t = tsldouble; break; -#endif case TKWtag: case TKWdecltype: case TKWident: type_debug(t); break; // t is already set @@ -1772,9 +1734,6 @@ elem *declaration(int flag) type *tspec; enum SC sc_specifier; int dss; -#if TARGET_MAC - tym_t initial; -#endif _chkstack(); @@ -1787,9 +1746,6 @@ elem *declaration(int flag) } dss = declaration_specifier(&tspec,&sc_specifier,NULL); -#if TARGET_MAC // DJB - initial = tspec->Tty & (mTYcdecl | mTYpascal | mTYman_pas); -#endif type_debug(tspec); s = NULL; @@ -1828,10 +1784,6 @@ elem *declaration(int flag) if (ANSI && (tok.TKval == TKcomma /*|| (tok.TKval == TKsemi && ty != TYstruct && ty != TYenum*/)) synerr(EM_id_or_decl); // ident or '(' expected -#if TARGET_MAC - //tspec->Tty |= initial; - TYPE_MODIFY(tspec,tspec->Tty | initial); -#endif gdeclar.hasExcSpec = 0; dt = declar_fix(tspec,vident); //printf("vident = '%s'\n", vident); @@ -1951,11 +1903,6 @@ elem *declaration(int flag) t = s->Stype; ty = tybasic(t->Tty); -#if TARGET_MAC - if (CPP && ty == TYstruct && - (t->Ttag->Sstruct->Sflags & (STRpasobj | STRmachdl))) - synerr(EM_ptr_handle); -#endif L2: switch (s->Sclass) { @@ -2127,95 +2074,6 @@ L3: synerr(EM_punctuation); // = ; or , expected case TKcomma: stoken(); break; -#if (TARGET_MAC) - case TKcolon: - if (config.ansi_c) - goto L3; - case TKeq: - if (level != 0 || ANSI_STRICT) - goto L3; - if (vident[0] == 0) - { /* if there was no identifier */ - synerr(EM_id_or_decl); // ident or '(' expected -err_ret: panic(TKsemi); - stoken(); - goto ret; /* any use trying to continue? */ - } - - if (tok.TKval == TKcolon) - { /* Low memory global definition */ - unsigned long address; - - stoken(); - address = msc_getnum(); - if (address == 0) - { - synerr(EM_num); - goto err_ret; - } - s->Svalue = el_longt(s->Stype,address); - s->Sclass = SCconst; - s->Sflags |= SFLvalue; - if(tok.TKval != TKsemi) - goto L3; - goto ret; - } - - stoken(); /* C direct function */ - { - int i = 0,rcur = FALSE,nullval = FALSE; - - if(tok.TKval == TKlcur) - { - stoken(); - rcur = TRUE; - } - while (1) - { /* Allocate buffer in chunks of 16 */ - if (tok.TKval == TKrcur) - break; - if (i == DirSiz) - { - DirSiz += 16; - DirLst = (short *) MEM_PERM_REALLOC(DirLst,DirSiz*sizeof(short)); - } - if(!i) /* leave room for count */ - { - i++; - continue; - } - DirLst[i] = msc_getnum(); - if (DirLst[i] == 0) - nullval = TRUE; - i++; - if (!rcur) - break; /* single entry */ - if (tok.TKval != TKcomma) - break; - stoken(); - } - if (rcur) - chktok(TKrcur,EM_rcur); - /* copy the direct function list */ - if (i < 4 && !nullval) - { /* Sdirbdy[1] == 0, one entry */ - s->Sflags |= SFLdirect|SFLsmdir; - s->Sdirect = 0; /* clear the field */ - s->Sdirbdy[0] = (i > 1) ? DirLst[1] : 0; - s->Sdirbdy[1] = (i > 2) ? DirLst[2] : 0; - } - else - { - s->Sdirect = (short *)MEM_PH_MALLOC(i*sizeof(short)); - memcpy(s->Sdirect,DirLst,i*sizeof(short)); - s->Sflags |= SFLdirect; - s->Sdirect[0] = i-1; - } - if(tok.TKval != TKsemi) - goto L3; - goto ret; - } -#endif /* TARGET_MAC */ } } /* while */ @@ -2358,20 +2216,6 @@ type *declar(type *t,char *vident,int flag) if (vident) vident[0] = 0; -#if TARGET_MAC - if (t->Tty & mTYpascal) - { - initial = mTYman_pas | mTYpascal; - t->Tty &= ~(mTYman_pas | mTYpascal); - //assert(t->Tflags & TFbasicrev == 0); - } - if (t->Tty & mTYcdecl) - { - initial = mTYcdecl; - t->Tty &= ~mTYcdecl; - //assert(t->Tflags & TFbasicrev == 0); - } -#endif /* TARGET_MAC */ #if TX86 // Irrational MS syntax can have __declspec anywhere initial = t->Tty & (mTYthread | mTYnaked | mTYimport | mTYexport); @@ -2425,10 +2269,6 @@ type *declar(type *t,char *vident,int flag) if (tok.TKval == TKrpar) goto Ldefault; } -#endif -#if TARGET_MAC - tym |= initial; - initial = 0; #endif if (CPP) { @@ -2730,10 +2570,6 @@ type *declar(type *t,char *vident,int flag) goto Lnd; if (flag == 2) // if ptr-operator goto Ldefault; -#if TARGET_MAC - tym |= initial; - initial = 0; -#endif #if TX86 // This is a hack to support the Borland syntax: // void __interrupt (__far * _dos_getvect(unsigned intr))() @@ -2774,9 +2610,6 @@ type *declar(type *t,char *vident,int flag) case TK_attribute: case TK_extension: #endif -#if TARGET_MAC - case TKextended: -#endif #if TX86 if (tym) synerr(EM_illegal_type_combo); // illegal combination of types @@ -2917,24 +2750,9 @@ type *declar(type *t,char *vident,int flag) case TKstar: msbug = 0; -#if TARGET_MAC - t = newpointer(t); - switch ((tym & ~mTYexport) | initial) -#else t = type_allocn(TYptr,t); switch ((tym_t)(tym & ~(mTYTFF | mTYMOD))) -#endif { -#if TARGET_MAC - case mTYmachdl: ty = TYvptr; goto L5; - case mTYpasobj: ty = TYvptr; goto L5; - case mTYpascal: - case mTYcdecl: t->Tty |= tym; goto L2; - case mTYhandle: ty = TYvptr; goto L5; - L5: - if (!(tym & mTYexport)) - break; -#endif #if TX86 case mTYnear: ty = (TYnptr | tym) & ~mTYnear; break; @@ -3136,10 +2954,6 @@ type *declar(type *t,char *vident,int flag) mangle = mTYman_pas; tym |= mTYpascal; goto L3; case TK_handle: tym |= mTYhandle; goto L3; -#if TARGET_MAC - case TK_machdl: tym |= mTYhandle | mTYmachdl; goto L3; - case TK_pasobj: tym |= mTYhandle | mTYpasobj; goto L3; -#endif L3: if (config.flags3 & CFG3nofar) { // Flat model doesn't have far, etc. @@ -3208,13 +3022,6 @@ type *declar(type *t,char *vident,int flag) } case TKcomma: Ldefault: -#if TARGET_MAC - case TKrpar: - tym |= initial; - if (initial & mTYpascal) - mangle = mTYman_pascal; - initial = 0; -#endif if (CPP) { if (flag == 1) @@ -3473,9 +3280,6 @@ STATIC type * getprototype(const char *fident,type *tret) { char vident[2*IDMAX + 1]; type *tfunc; type *pt; -#if TARGET_MAC - short regcnt = 0; -#endif //printf("getprototype()\n"); @@ -3553,15 +3357,6 @@ STATIC type * getprototype(const char *fident,type *tret) tp2->Tflags &= ~TFfuncparam; type_free(pt); -#if TARGET_MAC - // Function parameters are not allowed to be VOID - // - if (tybasic(tparam->Tty) == TYvoid) - synerr(EM_void_novalue); - if (tybasic(tparam->Tty) == TYstruct && - (tparam->Ttag->Sstruct->Sflags & (STRpasobj | STRmachdl))) - synerr(EM_ptr_handle); -#endif /* Convert function to pointer to function */ if (tyfunc(tparam->Tty)) @@ -3780,9 +3575,6 @@ STATIC type * getprototype(const char *fident,type *tret) tfunc->Tty = (tfunc->Tty & ~mTYbasic) | TYffunc; break; -#if TARGET_MAC - case TYpsfunc: /* no variable arg list in pascal */ -#endif #if TX86 case TYf16func: /* no variable arg list in pascal */ case TYjfunc: @@ -3874,15 +3666,6 @@ STATIC void getparamlst(type *tfunc,type *tprev) #if SOURCE_4PARAMS if (DoFileOffsets) p->Psrcpos = TkIdStrtSrcpos; -#endif -#if TARGET_MAC - if (ParamFunc) - { /* pragma parameter */ - regcnt++; - if (regcnt > 5) - synerr(EM_decl_spec_seq); - p->Pflags |= 1 << (ParamRegs[regcnt] + PRAGMA_PARAM_BIT-1); - } #endif *pp = p; pp = &(p->Pnext); /* append to list */ @@ -3941,16 +3724,12 @@ void fixdeclar(type *t) { case TYffunc: case TYfpfunc: -#if TARGET_MAC - case TYpsfunc: -#else case TYnfunc: case TYnpfunc: case TYnsfunc: case TYfsfunc: case TYnsysfunc: case TYfsysfunc: -#endif switch (tybasic(tn->Tty)) { case TYstruct: @@ -3967,48 +3746,10 @@ void fixdeclar(type *t) case TYfsfunc: case TYnsysfunc: case TYfsysfunc: -#if TARGET_MAC - case TYpsfunc: -#endif synerr(EM_return_type); // can't return those types break; } /* Adjust function type based on modifier keywords */ -#if TARGET_MAC - switch (tym & (mTYTFF|mTYbasic)) - { - case mTYcdecl | TYfpfunc: - newtym = TYffunc; - break; - case mTYpascal | TYfpfunc: - case mTYpascal | TYffunc: - case mTYpascal | TYpsfunc: - newtym = TYpsfunc; - break; - - case TYnfunc: - case TYnpfunc: - case mTYpascal | TYnfunc: - case mTYcdecl | TYnfunc: - case mTYcdecl | TYnpfunc: - case mTYpascal | TYnpfunc: - assert(0); - break; - - case TYffunc: - case mTYcdecl | TYffunc: - case TYpsfunc: - case TYfpfunc: - /* It's already the correct type */ - break; - default: - err: - synerr(EM_illegal_type_combo); /* illegal combination */ - break; - } - /* no longer useful */ - tym &= ~(mTYcdecl | mTYpascal); -#else switch (tym & (mTYLINK|mTYTFF|mTYbasic)) { case mTYnear | TYffunc: @@ -4249,7 +3990,6 @@ void fixdeclar(type *t) break; } } -#endif break; case TYarray: if (!(t->Tflags & TFfuncparam) && pstate.STinparamlist) @@ -4290,23 +4030,10 @@ void fixdeclar(type *t) if (type_chksize(t->Tdim * (unsigned long) size)) t->Tdim = 1; } - t->Tty = newtym | -#if TARGET_MAC - (tym & (mTYconst | mTYvolatile | mTYexport)); -#else - (tym & (mTYLINK | mTYconst | mTYvolatile | mTYMOD)); -#endif + t->Tty = newtym | (tym & (mTYLINK | mTYconst | mTYvolatile | mTYMOD)); return; } break; -#if TARGET_MAC - case TYfptr: - if (tyfunc(tn->Tty)) - { tn->Tty |= tym & (mTYTFF | mTYexport); - tn->Tmangle = mangle; - } - return; -#endif #if TX86 case TYptr: { type *t2; @@ -4395,12 +4122,7 @@ void fixdeclar(type *t) } #endif } - t->Tty = newtym | -#if TARGET_MAC - (tym & (mTYconst | mTYvolatile | mTYexport)); -#else - (tym & (mTYLINK | mTYconst | mTYvolatile | mTYMOD)); -#endif + t->Tty = newtym | (tym & (mTYLINK | mTYconst | mTYvolatile | mTYMOD)); t = tn; /* next type */ } /* while */ } @@ -5078,12 +4800,6 @@ int funcdecl(symbol *s,enum SC sc_specifier,int pflags,Declar *decl) if (sclass) // if member function { -#if TARGET_MAC - /* Overloading not allowed for virtual members of pascal classes */ - /* or any pascal type functions */ - if (!(typsfunc(s->Stype->Tty) || - (sclass->Sstruct->Sflags&STRpasobj && f->Fflags & Fvirtual)) ) -#endif #if TX86 if (sclass->Sstruct->Sflags & STRexport) type_setty(&s->Stype,s->Stype->Tty | mTYexport); // add in _export @@ -5109,13 +4825,6 @@ int funcdecl(symbol *s,enum SC sc_specifier,int pflags,Declar *decl) /* for overloaded functions is global. */ if (sc_specifier == SCoverload || s->Sclass == SCoverload) { -#if TARGET_MAC - // Overloading not allowed for virtual members of pascal classes - // or any pascal type functions - if (typsfunc(s->Stype->Tty) || - (sclass->Sstruct->Sflags&STRpasobj && f->Fflags & Fvirtual) ) - cpperr(EM_not_enum_member); -#endif f->Fflags |= Foverload; if (s->Sclass != SCoverload) sc_specifier = (enum SC) s->Sclass; @@ -5143,13 +4852,6 @@ int funcdecl(symbol *s,enum SC sc_specifier,int pflags,Declar *decl) cpperr(EM_conv_member); // type conversions must be members else if (nparams != 0) /* 'this' is the only parameter */ cpperr(EM_n_op_params,"0"); // incorrect number of parameters -#if TARGET_MAC - /*Overloading not allowed for virtual members of pascal classes */ - /* or any pascal type functions */ - else if (typsfunc(s->Stype->Tty) || - (sclass->Sstruct->Sflags&STRpasobj && f->Fflags & Fvirtual) ) - cpperr(EM_not_enum_member); -#endif else { /* Add to list of type conversions for this class */ //printf("funcdecl: add '%s' to Scastoverload\n", s->Sident); @@ -5164,13 +4866,6 @@ int funcdecl(symbol *s,enum SC sc_specifier,int pflags,Declar *decl) if (nparams == 2) tpp = tp->Pnext; -#if TARGET_MAC - // Overloading not allowed for virtual members of pascal classes - // or any pascal type functions - if (typsfunc(s->Stype->Tty) || - (sclass && sclass->Sstruct->Sflags&STRpasobj && f->Fflags & Fvirtual) ) - cpperr(EM_not_enum_member); -#endif if (sclass) /* if member of a class */ { if (opnum == OPnew || opnum == OPanew || @@ -5449,54 +5144,6 @@ int funcdecl(symbol *s,enum SC sc_specifier,int pflags,Declar *decl) goto done; if (CPP && tok.TKval == TKeq) { targ_uns n; -#if TARGET_MAC - if (!(f->Fflags & Fvirtual)) - { - if (level != 0) - goto L68k; - stoken(); /* C direct function */ - { - int i = 0,rcur = FALSE; - short *p = NULL; - if(tok.TKval != TKnum && tok.TKval != TKlcur) - goto L68k; - if(tok.TKval != TKnum) - { - chktok(TKlcur_exp,EM_lcur); - rcur = TRUE; - } - while (tok.TKval == TKnum) - { - /* Allocate buffer in chunks of 16 */ - if ((i & 15) == 0) - p = (short *) mem_realloc(p,(i + 16)*sizeof(short)); - if(!i) /* leave room for count */ - { - i++; - continue; - } - p[i] = msc_getnum(); - i++; - if (!rcur) - break; /* single entry */ - if (tok.TKval != TKcomma) - break; - stoken(); - } - if (rcur) - chktok(TKrcur,EM_rcur); - /* copy the direct function list */ - s->Sdirect = (short *)mem_realloc(p,i*sizeof(short)); - s->Sdirect[0] = i-1; - if(tok.TKval != TKsemi) - { - synerr(EM_punctuation); // = ; or , expected - panic(TKsemi); - } - } - } - else -#endif { L68k: @@ -5511,11 +5158,7 @@ int funcdecl(symbol *s,enum SC sc_specifier,int pflags,Declar *decl) } } else -#if TARGET_MAC - if (tok.TKval == TKsemi || tok.TKval == TKcomma || tok.TKval == TKeq) -#else if (tok.TKval == TKsemi || tok.TKval == TKcomma) -#endif { if (paramlst) // if there was a parameter list { @@ -5785,10 +5428,6 @@ int isexpression() case TKtrue: case TKfalse: case TKnullptr: -#if (TARGET_MAC) - case TKinherited: - case TK__class: -#endif #if linux || __APPLE__ || __FreeBSD__ || __OpenBSD__ case TK_bltin_const: #endif @@ -5822,9 +5461,6 @@ int isexpression() #if linux || __APPLE__ || __FreeBSD__ || __OpenBSD__ case TK_attribute: case TK_extension: -#endif -#if TARGET_MAC - case TKextended: #endif s = NULL; break; @@ -6122,10 +5758,6 @@ int isexpression() case TK_fortran: case TK_pascal: case TK_handle: -#if TARGET_MAC - case TK_machdl: - case TK_pasobj: -#endif case TKconst: case TKvolatile: case TK_unaligned: @@ -6151,9 +5783,6 @@ int isexpression() #if linux || __APPLE__ || __FreeBSD__ || __OpenBSD__ case TK_attribute: case TK_extension: -#endif -#if TARGET_MAC - case TKextended: #endif if (parens == 1) goto isdecl; @@ -6455,8 +6084,4 @@ tym_t nwc_declspec() #endif -#if TARGET_MAC -#include "TGnwc.c" -#endif - #endif diff --git a/dm/src/dmc/ph.c b/dm/src/dmc/ph.c index ac3dbad9..1923374a 100644 --- a/dm/src/dmc/ph.c +++ b/dm/src/dmc/ph.c @@ -58,13 +58,6 @@ static char __file__[] = __FILE__; /* for tassert.h */ //#define err_nomem() (dbg_printf("err_nomem: %d\n",__LINE__),err_nomem()) -#if TARGET_MAC -#define fclose(f) MacClose(f) -#ifndef __PGOFF -#define __PGOFF sizeof(unsigned short) -#endif -#endif - #if TX86 char *ph_directory; /* directory to read PH files from */ @@ -782,7 +775,7 @@ void *ph_hydrate(void *pp) if (off & 1) /* if dehydrated */ { i = ph_bufk + (int)(off / PHBUFSIZE); -#if (TARGET_MAC) || defined(DEBUG) +#if defined(DEBUG) assert(i < ph_bufi); #endif *(void **)pp = (void *)((char *)ph_buf[i] + (off & ((PHBUFSIZE - 1) & ~1))); diff --git a/dm/src/dmc/pragma.c b/dm/src/dmc/pragma.c index 25d0ffbc..2c0f68e2 100644 --- a/dm/src/dmc/pragma.c +++ b/dm/src/dmc/pragma.c @@ -2238,30 +2238,6 @@ STATIC void prassertid() preerr(EM_unknown_pragma); // unrecognized pragma //printf("Found assert('%s')\n",tok_ident); } - -#endif - -#if TARGET_MAC -/****************** - * Decode pragma parameter registers - */ -STATIC reg_decode(id) - char *id; - { - short reg,i; - if (id[4] != 0 && id[0] != '_' && id[1] != '_') - return -1; - if (id[2] == 'A') - reg = 1; - else if (id[2] == 'D') - reg = 3; - i = id[3] - '0'; - if (i < 0 || i > 2) - return -1; - if (id[2] == 'A' && i == 2) - return -1; - return reg + i; - } #endif /*************************** @@ -2362,22 +2338,9 @@ STATIC void pragma_setstructalign(int flag) STATIC void prpragma() { -#if TARGET_MAC - while (isspace(xc)) - egchar(); - if (xc == '$') /* allow leading $ on names */ - egchar(); -#endif #if SPP exp_ppon(); -#if TARGET_MAC - if (xc == '$') - expstring("#pragma $ "); - else - expstring("#pragma "); -#else expstring("#pragma "); -#endif ptoken(); // BUG: shouldn't macro expand this if it is "STDC" if (tok.TKval == TKident && strcmp(tok.TKid,"STDC") == 0) { @@ -2585,13 +2548,9 @@ STATIC void prpragma() break; case PRXonce: /* once */ -#if TARGET_MAC - bl->BLflags |= BLponce; -#else if (cstate.CSfilblk) // Mark source file as only being #include'd once srcpos_sfile(cstate.CSfilblk->BLsrcpos).SFflags |= SFonce; -#endif break; #if TARGET_POWERPC @@ -2621,108 +2580,6 @@ STATIC void prpragma() prstring(2); return; -#if TARGET_MAC - case PRXtemplate: - { - char *text; - - while (iswhite(xc)) - egchar(); /* skip white space */ - text = macrotext(NULL); /* read like macro text */ - if (*text) - template_getcmd('I',text); - else - goto err; - return; - } - break; - - case PRXtemp_access: - { char *s; - - switch(tok.TKid[0]) - { - case 'e': - s = "e"; - break; - case 'p': - s = "p"; - break; - case 's': - s = "s"; - break; - default: - goto err; - } - if (template_getcmd('A',s)) - goto err; - ptoken(); - break; - } - case PRXpasobj: - Add_pascal_object = TRUE; - break; - - case PRXparameter: /* parameter [reg] func(reg,...) */ - { - int i; - if (ParamFunc) - MEM_PARF_FREE(ParamFunc); - i = reg_decode(tok.TKid); - if (i < 0) - { - ParamFunc = (char *) MEM_PARF_STRDUP(tok.TKid); - ParamRegs[0] = 0; - } - else - { - ParamRegs[0] = i; - ptoken(); - if (tok.TKval != TKident) - goto err; - ParamFunc = (char *) MEM_PARF_STRDUP(tok.TKid); - } - ptoken(); - if (tok.TKval == TKeol) - return; - if (tok.TKval != TKlpar) - goto err; - ptoken(); - for(pragma_param_cnt=1; tok.TKval != TKrpar; pragma_param_cnt++) - { - char flag[6] = {0,0,0,0,0,0}; - short reg; - if (tok.TKval != TKident) - goto err; - reg = ParamRegs[pragma_param_cnt] = reg_decode(tok.TKid); - if(reg < 0 || flag[reg] != 0) - goto err; - flag[reg] = 1; - ptoken(); - if (tok.TKval == TKcomma) - ptoken(); - if (tok.TKval == TKeol) - goto err; - } - ptoken(); - break; - } - case PRXtrace: /* pragma trace */ - if (strcmp(tok.TKid,"on") == 0) - { - if (!(PragmaStatus & P_TRACE_NEVER)) - PragmaStatus |= P_TRACE_ON; - } - else if (strcmp(tok.TKid,"off") == 0) - { - if (!(PragmaStatus & P_TRACE_ALWAYS)) - PragmaStatus &= ~P_TRACE_ON; - } - else - preerr(EM_ident_exp); - ptoken(); - break; -#else // 80x86 pragmas case PRXcode_seg: { char *segname; targ_size_t len; @@ -2909,7 +2766,6 @@ STATIC void prpragma() } ptoken(); break; -#endif /* TARGET_MAC */ case PRXhdrstop: #if !SPP && TX86 @@ -4082,12 +3938,8 @@ STATIC void macrotable_balance(macro_t **ps) if (nmacs > mac_dim) { -#if TARGET_MAC - mac_array = (macro_t **) MEM_PARF_REALLOC(nmacs * sizeof(macro_t *)); -#else // Use malloc instead of mem because of pagesize limits mac_array = (macro_t **) realloc(mac_array,nmacs * sizeof(macro_t *)); -#endif mac_dim = nmacs; if (!mac_array) err_nomem(); diff --git a/dm/src/dmc/scope.c b/dm/src/dmc/scope.c index 50416feb..4d324e62 100644 --- a/dm/src/dmc/scope.c +++ b/dm/src/dmc/scope.c @@ -485,10 +485,6 @@ symbol *scope_addx(symbol *s,Scope *sc) symbol *sCover; switch (s->Sclass) { case SCstruct: -#if TARGET_MAC // DJB old code - case SCunion: - case SCclass: -#endif case SCenum: break; default: @@ -505,10 +501,6 @@ symbol *scope_addx(symbol *s,Scope *sc) else { switch (sCover->Sclass) { case SCstruct: -#if TARGET_MAC // old code - case SCunion: - case SCclass: -#endif case SCenum: //symbol_keep(sCover); s->Scover = sCover; diff --git a/dm/src/dmc/struct.c b/dm/src/dmc/struct.c index 22832334..736d537f 100644 --- a/dm/src/dmc/struct.c +++ b/dm/src/dmc/struct.c @@ -150,11 +150,6 @@ type *stunspec(enum_TK tk, Symbol *s, Symbol *stempsym, param_t *template_argume structflags |= STRimport; goto L5; } -#endif -#if TARGET_MAC - case TK_handle: ptrtype = TYvptr; goto L5; - case TK_pasobj: ptrtype = TYvptr; structflags |= STRpasobj; goto L5; - case TK_machdl: ptrtype = TYvptr; structflags |= STRmachdl; goto L5; #endif L5: stoken(); break; @@ -399,28 +394,8 @@ type *stunspec(enum_TK tk, Symbol *s, Symbol *stempsym, param_t *template_argume //dbg_printf("struct_getbaseclass('%s')\n",s->Sident); s->Sstruct->Sbase = struct_getbaseclass(ptrtype,stempsym,&structflags,flags); stoken(); /* skip over left curly bracket */ - strdcllst((Classsym *)s, -#if TARGET_MAC - (funcsym_p && !stempsym) | flags -#endif - flags); + strdcllst((Classsym *)s, flags); -#if TARGET_MAC - if (structflags & STRpasobj) - { symlist_t sl; /* __vptr is in wrong place */ - for (sl = s->Sstruct->Sfldlst; sl; sl = list_next(sl)) - { - //dbg_printf("class field %s\n",list_symbol(sl)->Sident); - if (strcmp(list_symbol(sl)->Sident,cpp_name_vptr) == 0) - { - //dbg_printf("found __vptr to remove\n"); - list_subtract(&s->Sstruct->Sfldlst,list_symbol(sl)); - list_prepend(&s->Sstruct->Sfldlst,list_symbol(sl)); - break; - } - } - } -#endif // See if we should generate debug info for the class definition #if TX86 && OMFOBJ if (config.fulltypes == CV4 && !eecontext.EEcompile) @@ -652,18 +627,12 @@ STATIC baseclass_t * struct_getbaseclass(tym_t ptrtype,symbol *stempsym, // Append b to end of baseclass list *pb = b; pb = &(b->BCnext); -#if TARGET_MAC - // FIX - Add error for pascal object multiple base classes - ptrtype = sbase->Sstruct->ptrtype; - *pstructflags |= sbase->Sstruct->Sflags & (STRpasobj | STRmachdl); -#else if (ptrtype) { if (ptrtype != sbase->Sstruct->ptrtype) cpperr(EM_base_memmodel,prettyident(sbase)); } else ptrtype = sbase->Sstruct->ptrtype; -#endif } while (tok.TKval == TKcomma); if (tok.TKval != TKlcur) synerr(EM_lcur_exp); // must be a definition @@ -791,25 +760,12 @@ STATIC baseclass_t * struct_getbaseclass(tym_t ptrtype,symbol *stempsym, // Append b to end of baseclass list *pb = b; pb = &(b->BCnext); -#if TARGET_MAC - // FIX - Add error for pascal object multiple base classes - ptrtype = sbase->Sstruct->ptrtype; - if(sbase->Sstruct->Sflags & STRpasobj) - { /* inherit handle tag, pascal obj */ - *pstructflags |= STRpasobj; - } - if(sbase->Sstruct->Sflags & STRmachdl) - { /* inherit handle tag, mac handle */ - *pstructflags |= STRmachdl; - } -#else if (ptrtype) { if (ptrtype != sbase->Sstruct->ptrtype) cpperr(EM_base_memmodel,prettyident(sbase)); } else ptrtype = sbase->Sstruct->ptrtype; -#endif L3: break; @@ -1051,21 +1007,6 @@ STATIC type * strdcllst(Classsym *stag,int flags) switch (tok.TKval) // check for pascal before constructor { -#if TARGET_MAC - case TKpascal: -#if CFMV2 - if (!config.CFMOption) -#endif - { - modifier = mTYpascal|mTYman_pas; - stoken(); - break; - } - case TKcdecl: - modifier = mTYcdecl; - stoken(); - break; -#endif case TK_declspec: modifier = nwc_declspec(); stoken(); @@ -1123,10 +1064,6 @@ STATIC type * strdcllst(Classsym *stag,int flags) if (modifier) { type_setty(&typ_spec,typ_spec->Tty | modifier); -#if TARGET_MAC - if (modifier & mTYpascal) - type_setmangle(&typ_spec,mTYman_pas); -#endif } pstate.STclasssym = stag; } @@ -1599,11 +1536,6 @@ STATIC type * strdcllst(Classsym *stag,int flags) if (s->Sclass != SCfield) offset += size; } -#if TARGET_MAC /* change from right->left to left->right */ - s->Sbit = (size*8) - s->Sbit - s->Swidth; - /* using same bit numbering scheme, modify */ - /* start bit to right most bit left justified */ -#endif /* Check for already existing member name */ n2_chkexist(stag,s->Sident); } @@ -1616,11 +1548,6 @@ STATIC type * strdcllst(Classsym *stag,int flags) L7: if (body) /* if saw a function body */ goto L5; /* ends this declaration loop */ -#if TARGET_MAC - else if ((flags & 1) && (tyfunc(s->Stype->Tty) || - class_m & mskl(SCstatic))) - cpperr(EM_local_static, s->Sident); -#endif L3: ; } else // C @@ -1733,13 +1660,6 @@ STATIC type * strdcllst(Classsym *stag,int flags) if (s->Sclass != SCfield) offset += size; } -#if TARGET_MAC - /* change from right->left to left->right - * using same bit numbering scheme, modify - * start bit to right most bit left justified - */ - s->Sbit = (size*8) - s->Sbit - s->Swidth; -#endif /* Check for already existing member name */ n2_chkexist(stag,vident); @@ -2178,18 +2098,12 @@ STATIC void n2_parsememberfuncs(Classsym *stag,int flag) s->Sfunc->Fbody) { //printf("\t\tparsing\n"); -#if TARGET_MAC - FromTokenList = TRUE; -#endif //assert(s->Sfunc->Fbody); token_markfree(s->Sfunc->Fbody); token_setlist(s->Sfunc->Fbody); s->Sfunc->Fbody = NULL; stoken(); func_nest(s); -#if TARGET_MAC - FromTokenList = FALSE; -#endif } } @@ -2231,17 +2145,11 @@ void n2_instantiate_memfunc(symbol *s) template_createsymtab(stempl->Stemplate->TMptpl,stag->Sstruct->Sarglist); nscopes++; -#if TARGET_MAC - FromTokenList = TRUE; -#endif token_markfree(s->Sfunc->Fbody); token_setlist(s->Sfunc->Fbody); s->Sfunc->Fbody = NULL; stoken(); func_nest(s); -#if TARGET_MAC - FromTokenList = FALSE; -#endif // Unwind scope back to global scope_unwind(nscopes); @@ -2275,9 +2183,6 @@ STATIC void n2_parsefriends(Classsym *stag,list_t friendlist,char *vident) for (fl = friendlist; fl; fl = list_next(fl)) { token_t *t = (token_t *) list_ptr(fl); -#if TARGET_MAC - FromTokenList = TRUE; -#endif assert(t); token_markfree(t); token_setlist(t); @@ -2321,10 +2226,6 @@ STATIC void n2_parsefriends(Classsym *stag,list_t friendlist,char *vident) if (!vident[0]) type_free(memtype); type_free(typ_spec); - -#if TARGET_MAC - FromTokenList = FALSE; -#endif } list_free(&friendlist,FPNULL); @@ -2405,11 +2306,6 @@ STATIC targ_size_t n2_analysebase(Classsym *stag) symbol_debug(stag); st = stag->Sstruct; -#if TARGET_MAC - /* pre-reserve space for vtable*/ - if(st->Sflags & STRpasobj && !st->Sbase && !baseoffset) - baseoffset = (PCrel_option & PC_FARCODE) ? 4 : 2; -#endif #if VBTABLES //dbg_printf("n2_analysebase('%s')\n",stag->Sident); /* Determine if we need an Svbptr. @@ -2841,15 +2737,9 @@ STATIC void n2_virtbase(Classsym *stag) if (st->Sstructsize == 0) /* disallow 0 sized structs */ { -#if TARGET_MAC - st->Salignsize = 2; - st->Sstructsize = 2; /* no byte length sizes */ - st->Snonvirtsize = 2; /* messes up pascal */ -#else st->Salignsize++; st->Sstructsize++; st->Snonvirtsize++; -#endif st->Sflags |= STR0size; if (!(config.flags4 & CFG4noemptybaseopt)) @@ -3119,9 +3009,6 @@ STATIC void chkmemtyp(symbol *s) { case TYffunc: case TYfpfunc: - #if TARGET_MAC - case TYpsfunc: - #endif #if TX86 case TYnfunc: case TYnpfunc: @@ -3198,24 +3085,10 @@ STATIC void n2_createvptr(Classsym *stag,targ_size_t *poffset) else #endif t = s_mptr->Stype; // __mptr *_vptr -#if TARGET_MAC - if (!st->ptrtype || st->Sflags & STRmachdl) - t = type_allocn(TYfptr,t); // vptr is not handle for HandleObjects - else -#endif t = type_allocn(st->ptrtype,t); #endif s_vptr = symbol_name(cpp_name_vptr,SCmember,t); s_vptr->Sflags |= SFLpublic; -#if TARGET_MAC - if (st->Sflags & STRpasobj) - { // it has access to all virtual funcs - // can't have real size in pascal objects - s_vptr->Stype->Tty |= mTYpasobj; - s_vptr->Stype->Tmangle = mTYman_pas; - } - else -#endif #if VBTABLES // vptr members always appear at 0 offset to this, so we // must adjust down the other base classes and members @@ -3272,17 +3145,6 @@ STATIC void n2_createvptr(Classsym *stag,targ_size_t *poffset) } } #else -#if TARGET_MAC - // For pascal objects the space for the vptr is always required - // and already reserved, so don't allow it to take up space - if (st->Sflags & STRpasobj) - { - s_vptr->Stype->Tty |= mTYpasobj; - s_vptr->Stype->Tmangle = mTYman_pas; - s_vptr->Smemoff = n2_structaddsize(t,0,poffset); - } /* can't have real size in pasal objects */ - else -#endif { targ_size_t sz = type_size(t); if (sz > st->Salignsize) @@ -3859,9 +3721,6 @@ void n2_addfunctoclass(Classsym *stag,Funcsym *sfunc, int flags) struct_t *st; func_t *f; type *tfunc; -#if TARGET_MAC - short pasobj_func; -#endif #if 0 printf("n2_addfunctoclass(stag = '%s', sfunc = '%s', %p, flags = %d)\n", stag->Sident, sfunc->Sident, sfunc, flags); @@ -3880,9 +3739,6 @@ void n2_addfunctoclass(Classsym *stag,Funcsym *sfunc, int flags) st = stag->Sstruct; f->Fclass = stag; -#if TARGET_MAC - pasobj_func = stag->Sstruct->Sflags & STRpasobj && sfunc->Sfunc->Fflags&Fvirtual; -#endif /* See if symbol is already defined */ sp = n2_searchmember(stag,sfunc->Sident); @@ -3970,10 +3826,6 @@ void n2_addfunctoclass(Classsym *stag,Funcsym *sfunc, int flags) } } -#if TARGET_MAC - if (pasobj_func) /* can't overload pascal object */ - synerr(EM_multiple_def,sfunc->Sident); /* virtual functions */ -#endif // Append to list of overloaded functions *ps = sfunc; sfunc->Sfunc->Fflags |= Fnotparent; /* sfunc is not first in list */ @@ -3988,10 +3840,6 @@ void n2_addfunctoclass(Classsym *stag,Funcsym *sfunc, int flags) n2_addmember(stag,sfunc); } -#if TARGET_MAC - if(pasobj_func) - tfunc->Tty |= mTYpasobj; /* virtual pascal object function */ -#endif assert(tfunc->Tflags & TFprototype); if (f->Fflags & Fdtor) @@ -4401,11 +4249,7 @@ STATIC int n2_friend(Classsym *stag,type *tfriend,char *vident,unsigned long cla return TRUE; // function has a body } /* Function is not defined */ -#if TARGET_MAC - if (s->Sclass != SCinline && s->Sclass != SCstatic) -#else if (s->Sclass != SCinline) -#endif s->Sclass = mclass; } } @@ -4646,11 +4490,7 @@ STATIC type * n2_vtbltype(Classsym *stag,int nitems) #endif } #endif -#if TARGET_MAC - t->Tdim = nitems ; -#else t->Tdim = 1 + nitems + 1; -#endif return t; } @@ -5074,24 +4914,9 @@ STATIC symbol * n2_createfunc(Classsym *stag,const char *name, si = f->Flocsym.top; /* Do "this" */ -#if TARGET_MAC - { - type *t; - t = newpointer(stag->Stype); - if (stag->Stype->Ttag->Sstruct->Sflags & (STRpasobj | STRmachdl)) - { - t->Tty = TYvptr; - } - sthis = symbol_name(cpp_name_this,SCparameter,t); -#if HOST_MPW - sthis->Ssrcpos = TkIdStrtSrcpos; -#endif - } -#else sthis = symbol_name(cpp_name_this, ((tybasic(t->Tty) == TYmfunc) ? SCfastpar : SCparameter), newpointer(stag->Stype)); -#endif sthis->Ssymnum = 0; sthis->Sflags |= SFLfree; f->Flocsym.tab[0] = sthis; @@ -5149,9 +4974,6 @@ STATIC symbol * n2_createfunc(Classsym *stag,const char *name, param_append_type(&t->Tparamtypes,newref(stag->Stype)); } -#if TARGET_MAC - sfunc->Sclass = (flags & Finline) ? SCinline : SCstatic; -#endif sfunc->Sflags |= SFLimplem | SFLpublic; /* seen implementation */ n2_addfunctoclass(stag,sfunc,0); diff --git a/dm/src/dmc/template.c b/dm/src/dmc/template.c index b3ab4218..88d5a040 100644 --- a/dm/src/dmc/template.c +++ b/dm/src/dmc/template.c @@ -25,10 +25,6 @@ #include "type.h" #include "oper.h" #include "cpp.h" -#if TARGET_MAC -#include "TG.h" -extern char *unmangle_pt(char **); -#endif static char __file__[] = __FILE__; /* for tassert.h */ #include "tassert.h" @@ -581,10 +577,6 @@ STATIC void template_class_decl( structflags |= STRimport; goto L5; } -#endif -#if TARGET_MAC - case TK_machdl: structflags |= STRmachdl; goto L5; - case TK_pasobj: structflags |= STRpasobj; goto L5; #endif L5: stoken(); @@ -2291,66 +2283,6 @@ STATIC symbol * template_define(Classsym *stag, symbol *sprimary, enum_TK tk, in return s; } -#if TARGET_MAC -// -// This function checks to see if an implementation of a template -// function exists prior to calling template matchfunc. It is used to -// prevent #pragma template directives from attempting to expand functions -// that are already expanded. -// -STATIC symbol * -template_implemented_already( symbol *psymTempl, param_t *pactual) -{ - param_t *p; - param_t *ptempl = NULL; - param_t *ptpl = NULL; - param_t *p2; - param_t *pinst; - symbol *psymFunc; - ptpl = psymTempl->Sfunc->Farglist; /* template-argument-list */ -// -// Loop through the overloaded versions of this function -// - for (psymFunc = psymTempl->Sfunc->Foversym; psymFunc; psymFunc = psymFunc->Sfunc->Foversym) { -// -// If the function is not implemented, there is no need to consider it -// - if (!(psymFunc->Sflags & SFLimplem)) - continue; -#ifdef DEBUG -// -// The Ptype's must all be NULL for function template-argument-list's -// - for (p2 = ptpl; p2; p2 = p2->Pnext) - assert(p2->Ptype == NULL); -#endif - -// -// OK, no loop through the arguments to this overloaded version of this function -// and see if they match the types for the #pragma template parameter list -// - for (p = pactual,ptempl = psymTempl->Stype->Tparamtypes, - pinst = psymFunc->Stype->Tparamtypes; - p && ptempl && pinst; - p = p->Pnext, ptempl = ptempl->Pnext, pinst = pinst->Pnext) { - if (!template_match_expanded_type( ptempl->Ptype, - ptpl, ptal, pinst->Ptype, p->Ptype )) { - break; - } - } - - for (p2 = ptpl; p2; p2 = p2->Pnext) - { - type_free(p2->Ptype); - p2->Ptype = NULL; - } - if (!p && !ptempl && !pinst) - return(psymFunc); - - } - return(NULL); -} -#endif /******************************* * Instantiate anything else. @@ -2554,16 +2486,10 @@ void template_instantiate() anyinst = 1; gclasssave = pstate.STgclass; -#if TARGET_MAC - FromTokenList = TRUE; - pstate.STgclass = (config.flags2 & CFG2comdat) ? SCcomdat : - (template_access ? template_access : SCglobal); -#else pstate.STgclass = (config.flags2 & CFG2comdat) ? SCcomdat : SCstatic; // If explicit instantiation, comdat's become global if (pstate.STgclass == SCcomdat && si->Sstruct->Sflags & STRexplicit) pstate.STgclass = SCglobal; -#endif pstate.STflags |= PFLmftemp; /* Instantiate each member */ @@ -2723,9 +2649,6 @@ void template_instantiate() pstate.STflags &= ~PFLmftemp; pstate.STgclass = gclasssave; -#if TARGET_MAC - FromTokenList = FALSE; -#endif list_prepend(&ilist,si); } } @@ -3613,42 +3536,16 @@ STATIC Classsym * template_parsebody(Classsym *stag, symbol *stempl, param_t *ar if (!type_struct(t)) { -#if TARGET_MAC - token_poplist(); /* fix bug where leftover tokens result in crash/hang */ -#endif return(NULL); } stag = t->Ttag; stag->Sstruct->Sflags |= STRgen; /* this instance was generated */ -#if 0 && TARGET_MAC - template_fix_inlines(stag->Sstruct); /* fix inline functions */ -#endif template_instantiate_classmember(stempl, stag); return stag; } -#if 0 -void template_parse_nobody(void) -{ - symlist_t sl; - Classsym *si; - symlist_t sl_tmp; - symbol *s; - - sl_tmp = tmpl_noparse_list; - tmpl_noparse_list = NULL; - for ( sl = sl_tmp; sl; sl = list_next(sl) ) { - si = (Classsym *)list_symbol(sl); - template_instantiate_forward(si); - s = si->Sstruct->Stempsym; - instantiate_list( s, si, s->Stemplate->TMinlinememberfuncs); - } - list_free( &sl_tmp, FPNULL ); -} -#endif - /******************************* * Expand a class template into a symbol. * Input: @@ -3701,9 +3598,6 @@ Classsym *template_expand(symbol *s,int flag) //printf("-instantiating %p '%s')\n", si, si->Sident); if (!type_struct(t)) { -#if TARGET_MAC - token_poplist(); // leftover tokens result in crash/hang -#endif return NULL; } } @@ -4105,9 +3999,6 @@ printf("sf : "); type_print(sf->Stype->Tnext); nscopes++; token_unget(); // Put back the current token token_setlist(ses->Sfunc->Fbody); // instantiate function -#if TARGET_MAC - FromTokenList = TRUE; -#endif stoken(); { type *dt; type *typ_spec; @@ -4291,18 +4182,6 @@ pstate.STclasssym = NULL; config.flags4 & CFG4notempexp) parsebody = 0; -#if TARGET_MAC -#if PUBLIC_EXT - if (sc == SCextern || (sc == SCglobal && (config.template_access == SCextern || - (!template_expansion && config.template_access == SCglobal) || - config.template_access == SCstatic))) - { - parsebody = FALSE; - } - else - template_expansion = FALSE; -#endif -#endif sf->Sfunc->Fflags |= Fflags | Finstance; // flag generated by template sf->Sfunc->Fflags |= stemp->Sfunc->Fflags & Fstatic; sf->Sfunc->Ftempl = stemp; // remember which template created this @@ -4349,9 +4228,6 @@ pstate.STclasssym = NULL; pstate.STclasssym = pstatesave.STclasssym; pstate.STmaxsequence = pstatesave.STmaxsequence; } -#if TARGET_MAC - FromTokenList = FALSE; -#endif // Unwind scope back to global scope_unwind(nscopes); diff --git a/dm/src/dmc/token.c b/dm/src/dmc/token.c index 554535f8..e9bdb025 100644 --- a/dm/src/dmc/token.c +++ b/dm/src/dmc/token.c @@ -25,9 +25,6 @@ #include "global.h" #include "outbuf.h" #include "utf.h" -#if TARGET_MAC -#include "TG.h" -#endif #if _WIN32 && __DMC__ // from \sc\src\include\setlocal.h @@ -119,11 +116,7 @@ unsigned char _chartype[257] = { 0, // in case we use EOF as an index _ZFF,0,0,0,0,0,0,0,0,0,_EOL,_EOL,_EOL,0,0,0, 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, -#if TARGET_MAC // allow '$' for pascal function names - 0,0,0,0,_ID,0,0,0, // !"#$%&' -#else 0,0,0,0,0,0,0,0, -#endif _TOK,_TOK,_MTK,_MTK,_TOK,_MTK,_MTK,_MTK, // ()*+,-./ _ID,_ID,_ID,_ID,_ID,_ID,_ID,_ID, _ID,_ID,_MTK,_TOK,_MTK,_MTK,_MTK,_TOK, // 89:;<=>? @@ -244,9 +237,6 @@ void token_hydrate(token_t **pt) { tl = (token_t *) ph_hydrate(pt); token_debug(tl); -#if TARGET_MAC - tl->TKsrcpos.Sfilnum += File_Hydrate_Num; /* file number relative header build */ -#endif //type_hydrate(&tl->TKtype); switch (tl->TKval) { case TKident: @@ -546,13 +536,7 @@ Srcpos token_linnum() #if SPP return getlinnum(); #else - return toklist - ? -#if TARGET_MAC - (TkIdStrtSrcpos = tok.TKsrcpos), -#endif - tok.TKsrcpos - : getlinnum(); + return toklist ? tok.TKsrcpos : getlinnum(); #endif } @@ -1068,11 +1052,6 @@ enum_TK rtoken(int flag) unsigned char blflags; int insflags; -#if TARGET_MAC - tok.TKflags &= ~TKFinherited; - //tok.tokfoffset = getlinnum(); /* Hate to do this for each token */ - //tok.tokfnum = TokenFile; -#endif #if IMPLIED_PRAGMA_ONCE TokenCnt++; /* too many returns, so use global */ #endif @@ -1130,9 +1109,6 @@ enum_TK rtoken(int flag) goto loop1; case LF: case_LF: -#if TARGET_MAC - file_progress(); -#endif egchar(); if (pstate.STflags & (PFLpreprocessor | PFLmasm | PFLbasm)) return tok.TKval = TKeol; // end of line is a token @@ -1624,10 +1600,6 @@ enum_TK rtoken(int flag) case '(': egchar(); return tok.TKval = TKlpar; case ')': egchar(); return tok.TKval = TKrpar; case '{': -#if TARGET_MAC - if(configv.addlinenumbers) - TklbrackSrcpos = getlinnum(); -#endif egchar(); return tok.TKval = TKlcur; case '}': egchar(); return tok.TKval = TKrcur; case ',': egchar(); return tok.TKval = TKcomma; @@ -1636,9 +1608,6 @@ enum_TK rtoken(int flag) case 0: if (bl) { bl->BLtextp--; -#if (TARGET_MAC) && SOURCE_OFFSETS - bl->Bcurcnt--; -#endif egchar(); goto loop1; } @@ -1834,16 +1803,6 @@ void comment() break; case 0: // end of file found case_eof: -#if TARGET_MAC - if (bl) // if not really end of file - { bl->BLtextp--; -#if SOURCE_OFFSETS - bl->Bcurcnt--; -#endif - egchar(); // get us back on track - break; - } -#endif lexerr(EM_no_comment_term,line); // EOF before end of comment err_fatal(EM_eof); /* NOTREACHED */ @@ -2297,16 +2256,11 @@ STATIC enum_TK inchar(int flags) len -= 2; #endif -#if (TARGET_MAC) && 0 /* fix later with warning */ - if (len > LONGSIZE) - len = 4; -#else if (len > LONGSIZE) { lexerr(EM_string2big,LONGSIZE); tok.TKty = TYint; return TKnum; } -#endif #if !SPP /* If signed chars, this needs to be redone */ @@ -2336,13 +2290,6 @@ STATIC enum_TK inchar(int flags) } else { -#if TARGET_MAC - // Pat: you need to fix this for UNICODE - tok.TKutok.Vlong = 0; - char *p = (char *) &tok.TKutok.Vlong + LONGSIZE-1; - while (len--) - *p-- = tok_string[len]; /* reverse the order of bytes */ -#else #if UNICODE if (flags & INSwchar_t) { @@ -2370,7 +2317,6 @@ STATIC enum_TK inchar(int flags) while (len--) *p++ = tok_string[len]; // reverse the order of bytes } -#endif } return TKnum; } @@ -2745,9 +2691,6 @@ STATIC enum_TK innum() case 'b': // 0b if (!ANSI) { state = STATE_binary0; -#if TARGET_MAC - base = 2; -#endif break; } goto case_hex; @@ -2911,11 +2854,6 @@ STATIC enum_TK innum() #endif errno = 0; -#if TARGET_MAC - if (base == 2) // skip 0b prefix - tok.TKutok.Vlong = strtoul(&tok_string[2],NULL,base); - else -#endif if (i == 1 && (state == STATE_decimal || state == STATE_0)) tok.TKutok.Vllong = tok_string[0] - '0'; else @@ -3586,10 +3524,6 @@ void token_term() } #endif -#if TARGET_MAC -#include "TGtoken.c" -#endif - #ifdef DEBUG /******************************* diff --git a/dm/src/dmc/tytostr.c b/dm/src/dmc/tytostr.c index 41fb5877..9047a628 100644 --- a/dm/src/dmc/tytostr.c +++ b/dm/src/dmc/tytostr.c @@ -75,10 +75,6 @@ char *type_tostring(Outbuffer *buf,type *t) { type_cv_tostring(buf, ty); } -#if TARGET_MAC - if (ty & mTYmachdl) - buf->write("_machdl "); -#else if (ty & mTYloadds) buf->write("__loadds "); if (ty & mTYfar) @@ -92,7 +88,6 @@ char *type_tostring(Outbuffer *buf,type *t) buf->write("__export "); if (ty & mTYimport) buf->write("__import "); -#endif #if TX86 if (mangle == mTYman_pas) buf->write("__pascal "); diff --git a/dm/src/dmc/util.c b/dm/src/dmc/util.c index fc7f9cd4..491a85f1 100644 --- a/dm/src/dmc/util.c +++ b/dm/src/dmc/util.c @@ -24,15 +24,11 @@ #include "token.h" #include "parser.h" -#if TARGET_MAC -#include "TG.h" -#endif - #if _MSDOS || __OS2__ || _WINDOWS #include #endif -#if __SC__ && !(TARGET_MAC) +#if __SC__ #include #endif From db842f0ddbd7dac259eef5769b1fe6aec62dcbb0 Mon Sep 17 00:00:00 2001 From: Brad Roberts Date: Fri, 14 Oct 2011 02:02:50 -0700 Subject: [PATCH 02/10] drop TARGET_POWERPC --- dm/src/dmc/eh.c | 4 ---- dm/src/dmc/exp2.c | 26 -------------------------- dm/src/dmc/pragma.c | 23 ----------------------- 3 files changed, 53 deletions(-) diff --git a/dm/src/dmc/eh.c b/dm/src/dmc/eh.c index a9ad40e6..8148f475 100644 --- a/dm/src/dmc/eh.c +++ b/dm/src/dmc/eh.c @@ -28,10 +28,6 @@ #include "code.h" #include "scope.h" -#if TARGET_POWERPC // DJB -#include "cgobjxcoff.h" -#endif - static char __file__[] = __FILE__; /* for tassert.h */ #include "tassert.h" diff --git a/dm/src/dmc/exp2.c b/dm/src/dmc/exp2.c index 7de77092..17753bb5 100644 --- a/dm/src/dmc/exp2.c +++ b/dm/src/dmc/exp2.c @@ -2277,13 +2277,6 @@ STATIC elem * strarg(elem *e) * call expression tree */ -#if TARGET_POWERPC -// this is silly but i don't want to put this in parser.h and i don't understand -//why tgexp2.c is included at the bottom instead of at the top but i don't want -// to disrupt anybody so there..... -extern elem * insert_hidden(type *, elem * , elem *); // in tgexp2.c -#endif - elem *xfunccall(elem *efunc,elem *ethis,list_t pvirtbase,list_t arglist) { type *tfunc; const char *funcid; @@ -2490,12 +2483,7 @@ elem *xfunccall(elem *efunc,elem *ethis,list_t pvirtbase,list_t arglist) e = el_bint(OPparam,tsint,ehidden,e); else #endif - -#if TARGET_POWERPC - e = insert_hidden(tsint, e, ehidden); -#else e = el_bint(OPparam,tsint,e,ehidden); -#endif } else e = ehidden; @@ -4157,24 +4145,10 @@ void impcnv(elem *e) assert(e && EBIN(e)); elem_debug(e); -#if TARGET_POWERPC - e1 = e->E1 = cpp_bool(e->E1, 0); - e2 = e->E2 = cpp_bool(e->E2, 0); /* perform integral promotions */ - - t1 = tybasic(e1->ET->Tty); - t2 = tybasic(e2->ET->Tty); - if (!tyfloating(t1)) { // do default promotion only for non-floats - e1 = e->E1 = convertchk(e1); - } - if (!tyfloating(t2)) { // do default promotion only for non-floats - e2 = e->E2 = convertchk(e2); - } -#else e1 = e->E1 = convertchk(cpp_bool(e->E1, 0)); e2 = e->E2 = convertchk(cpp_bool(e->E2, 0)); /* perform integral promotions */ t1 = tybasic(e1->ET->Tty); t2 = tybasic(e2->ET->Tty); -#endif if (!tyscalar(t1) || !tyscalar(t2)) { diff --git a/dm/src/dmc/pragma.c b/dm/src/dmc/pragma.c index 2c0f68e2..b88f29a2 100644 --- a/dm/src/dmc/pragma.c +++ b/dm/src/dmc/pragma.c @@ -2553,29 +2553,6 @@ STATIC void prpragma() srcpos_sfile(cstate.CSfilblk->BLsrcpos).SFflags |= SFonce; break; -#if TARGET_POWERPC - case PRXoptions: - if (tok.TKval != TKident || strcmp( tok.TKid, "align" ) ) - goto err; - ptoken(); - if (tok.TKval != TKeq) - goto err; - ptoken(); - if (tok.TKval != TKident) - goto err; - if (!strcmp(tok.TKid, "mac68k")) - structalign = 1; // #pragma align 2 equivalent - else - if (!strcmp(tok.TKid, "reset" )) - structalign = config.defstructalign; - else - if (!strcmp(tok.TKid, "power" )) - structalign = 3; // #pragma align 4 equivalent - else - goto err; - break; -#endif - case PRXsetlocale: prstring(2); return; From 3cec9050243993a977c6c87431b186fd41982581 Mon Sep 17 00:00:00 2001 From: Brad Roberts Date: Sat, 15 Oct 2011 12:38:50 -0700 Subject: [PATCH 03/10] remove HOST_THINK --- dm/src/dmc/blklst.c | 2 +- dm/src/dmc/cpp.c | 10 +--- dm/src/dmc/enum.c | 6 -- dm/src/dmc/exp.c | 15 ----- dm/src/dmc/exp2.c | 10 ---- dm/src/dmc/func.c | 9 --- dm/src/dmc/msc.c | 3 - dm/src/dmc/msgsx.c | 6 -- dm/src/dmc/nwc.c | 2 +- dm/src/dmc/ph.c | 14 ----- dm/src/dmc/pragma.c | 133 ++------------------------------------------ dm/src/dmc/struct.c | 19 ------- 12 files changed, 11 insertions(+), 218 deletions(-) diff --git a/dm/src/dmc/blklst.c b/dm/src/dmc/blklst.c index 64d5956c..d2561566 100644 --- a/dm/src/dmc/blklst.c +++ b/dm/src/dmc/blklst.c @@ -1319,7 +1319,7 @@ void getcharnum() } #endif -#if PRAGMA_ONCE && !HOST_THINK +#if PRAGMA_ONCE void *once_dehydrate() { blklst *bl,*bl_next; diff --git a/dm/src/dmc/cpp.c b/dm/src/dmc/cpp.c index a1ce4204..44b26ba1 100644 --- a/dm/src/dmc/cpp.c +++ b/dm/src/dmc/cpp.c @@ -3350,14 +3350,10 @@ void cpp_memberaccess(symbol *smember,symbol *sfunc,Classsym *sclass) { if (!cpp_memberaccesst(smember, sfunc, sclass)) { -#if HOST_THINK - if (compile_state != kDataView) // debugger can violate access restrictions -#endif - { char *p = (char *) MEM_PARF_STRDUP(cpp_prettyident(smember)); + char *p = (char *) MEM_PARF_STRDUP(cpp_prettyident(smember)); - cpperr(EM_not_accessible,p,cpp_prettyident(sclass)); // no access to member - MEM_PARF_FREE(p); - } + cpperr(EM_not_accessible,p,cpp_prettyident(sclass)); // no access to member + MEM_PARF_FREE(p); } } diff --git a/dm/src/dmc/enum.c b/dm/src/dmc/enum.c index 41c34d1e..263f7cef 100644 --- a/dm/src/dmc/enum.c +++ b/dm/src/dmc/enum.c @@ -28,12 +28,6 @@ #include "cpp.h" #include "el.h" #include "oper.h" -#if (HOST_THINK) -#include "browse.h" -#endif -#if (HOST_THINK) || (HOST_RAINBOW) -#include "callbacks.h" -#endif static char __file__[] = __FILE__; /* for tassert.h */ #include "tassert.h" diff --git a/dm/src/dmc/exp.c b/dm/src/dmc/exp.c index 7d76b9f4..2c97352e 100644 --- a/dm/src/dmc/exp.c +++ b/dm/src/dmc/exp.c @@ -2390,27 +2390,12 @@ if (!bColcol) goto L4; #else case TK_inf: -#if HOST_THINK - if (PCrel_option & PC_THINKC_DBL) - tok.TKutok.Vldouble = INFINITY; /* rely on hosts's SANE engine for conversions */ - else -#endif tok.TKutok.Vdouble = INFINITY; goto L4; case TK_nan: -#if HOST_THINK - if (PCrel_option & PC_THINKC_DBL) - tok.TKutok.Vldouble = NAN; - else -#endif tok.TKutok.Vdouble = NAN; goto L4; case TK_nans: -#if HOST_THINK - if (PCrel_option & PC_THINKC_DBL) - tok.TKutok.Vldouble = NANS; - else -#endif tok.TKutok.Vdouble = NANS; goto L4; #endif diff --git a/dm/src/dmc/exp2.c b/dm/src/dmc/exp2.c index 17753bb5..f620c5fc 100644 --- a/dm/src/dmc/exp2.c +++ b/dm/src/dmc/exp2.c @@ -2583,11 +2583,6 @@ elem *xfunccall(elem *efunc,elem *ethis,list_t pvirtbase,list_t arglist) el_settype(e,tsldouble); /* C and C++ always return long double */ #endif -#if HOST_THINK - if (tyfloating(ty) && tycppfunc(tfunc->Tty)) /* C++ functions can use any return method they like */ - el_settype(e,tsldouble); -#endif - #endif // For functions returning references, put a * in front @@ -3810,12 +3805,7 @@ int typematch(type *t1,type *t2,int relax) (tybasic(t1ty) != TYstruct && tybasic(t1ty) != TYenum && tybasic(t1ty) != TYmemptr -#if HOST_THINK - // cheat a little here to support forward referenced types in PH files - || (t1->Ttag == t2->Ttag || t1->Ttag->Stype->Ttag == t2->Ttag) ) -#else || t1->Ttag == t2->Ttag) -#endif && (typematch(t1->Tnext,t2->Tnext,(relax & (4 | 2)) | 1) diff --git a/dm/src/dmc/func.c b/dm/src/dmc/func.c index 5dc57488..528470b9 100644 --- a/dm/src/dmc/func.c +++ b/dm/src/dmc/func.c @@ -785,10 +785,6 @@ void paramtypadj(type **pt) t = tsldouble; break; #else -#if HOST_THINK - case TYcomp: - case TYdouble: // necessary to mention TYdouble here? -#endif case TYfloat: t = tsdouble; /* convert to double */ break; @@ -2210,12 +2206,7 @@ STATIC void return_state() )) synerr(EM_void_novalue); // void has no value #if TARGET_68K -#if HOST_THINK - /* only use long doubles for C++ functions */ - if (tycppfunc(tf->Tty) && tyfloating(tybasic(tr->Tty))) -#else if(!(typasfunc(tf->Tty)) && tyfloating(tybasic(tr->Tty))) -#endif e = typechk(e,tsldouble); /* return long doubles for C and C++ */ else #endif diff --git a/dm/src/dmc/msc.c b/dm/src/dmc/msc.c index 8f8576bb..dc3b2bee 100644 --- a/dm/src/dmc/msc.c +++ b/dm/src/dmc/msc.c @@ -28,9 +28,6 @@ static char __file__[] = __FILE__; /* for tassert.h */ #include "tassert.h" -#if HOST_THINK -#include "callbacks.h" -#endif /*********************** COMMON FUNCTIONS ********************/ diff --git a/dm/src/dmc/msgsx.c b/dm/src/dmc/msgsx.c index f4580ef5..80c49e24 100644 --- a/dm/src/dmc/msgsx.c +++ b/dm/src/dmc/msgsx.c @@ -2636,16 +2636,10 @@ struct Msgtable msgtable[] = "テンプレート引数 '%s' は関数パラメータ型に使われていない", /* CPP+82 */ }, { "cant_gen_templ_inst", - #if HOST_THINK - "cannot generate template instance from pragma template%s", /* CPP+83 */ - "Schabloneninstanz von Pragma-Schablone%s kann nicht erstellt werden", /* CPP+83 */ - "impossible de gOSer une instance de squelette partir du squelette pragma %s", /* CPP+83 */ - #else "cannot generate template instance from -XI%s", /* CPP+83 */ "Schabloneninstanz von -XI%s kann nicht erstellt werden", /* CPP+83 */ "impossible de gOSer une instance de squelette partir de -XI%s", /* CPP+83 */ "-XI%s からテンプレートのインスタンスを生成できない", /* CPP+83 */ - #endif }, /* ARM 8.4.3 diff --git a/dm/src/dmc/nwc.c b/dm/src/dmc/nwc.c index 312fb5ab..6ee3eb9f 100644 --- a/dm/src/dmc/nwc.c +++ b/dm/src/dmc/nwc.c @@ -747,7 +747,7 @@ void output_func() pstate.do_push = FALSE; } #endif -#if HOST_THINK || HOST_RAINBOW +#if HOST_RAINBOW if (pstate.do_pop) { pragma_restore(); diff --git a/dm/src/dmc/ph.c b/dm/src/dmc/ph.c index 1923374a..f65acf9d 100644 --- a/dm/src/dmc/ph.c +++ b/dm/src/dmc/ph.c @@ -707,20 +707,6 @@ void *ph_dehydrate(void *pp) { if (pb <= p && p < pb + PHBUFSIZE) { -#if HOST_THINK - /* "relocate" references to precompiled header memory vs xsym - * memory. Place precompiled header before xsym, and move - * xsym after precompiled header. - * This is unnecessary when generating a ph file. - */ - if (!(config.flags2 & CFG2phgen) && i < (head_start + head_num)) - { - if (i < head_start) /* xsym memory before ph memory */ - i += head_num; - else - i -= head_start; /* ph memory */ - } -#endif *(long *)pp = ((long)i * PHBUFSIZE + (p - pb)) | 1; #if PH_METRICS hydrate_count++; diff --git a/dm/src/dmc/pragma.c b/dm/src/dmc/pragma.c index b88f29a2..1ebefc41 100644 --- a/dm/src/dmc/pragma.c +++ b/dm/src/dmc/pragma.c @@ -62,13 +62,6 @@ static macro_t **mac_array; static macro_t *premacdefs; // threaded list of predefined macros #endif -#if HOST_THINK -#include "callbacks.h" -#include "dataview.h" -static macro_t **head_mactabroot; /* root of precompiled header macro symbol table */ -#define strcmpl(s1,s2) strcmp(s1,s2) -#endif - void cppcomment(void); STATIC macro_t ** macinsert(const char *p , unsigned hashval); STATIC macro_t ** macfindparent(const char *p,unsigned hashval); @@ -2515,7 +2508,7 @@ STATIC void prpragma() if (level != 0) preerr(EM_cseg_global); // only at global scope output_func(); /* flush pending functions */ -#if !SPP && !HOST_THINK +#if !SPP outcsegname(tok.TKid); #endif ptoken(); @@ -2567,7 +2560,7 @@ STATIC void prpragma() if (level != 0) preerr(EM_cseg_global); // only at global scope output_func(); /* flush pending functions */ -#if !SPP && !HOST_THINK +#if !SPP outcsegname(segname); #endif mem_free(segname); @@ -2827,9 +2820,7 @@ STATIC void prerror() egchar(); } *p = 0; -#if HOST_THINK - err_message("#error directive: %s",buffer); -#elif HOST_MPW +#if HOST_MPW err_message("# File %s; line %d # Error ",name,line,buffer); #else err_message("Error %s %d: %s",name,line,buffer); @@ -3527,13 +3518,9 @@ void pragma_hydrate_macdefs(macro_t **pmb,int flag) { if (!m) { -#if HOST_THINK - if ((config.flags2 & CFG2phgen)) -#endif - { if (mb->ML || mb->MR) - mb->ML = mb->MR = NULL; - *mp = mb; - } + if (mb->ML || mb->MR) + mb->ML = mb->MR = NULL; + *mp = mb; break; } macro_debug(m); @@ -3655,10 +3642,6 @@ void pragma_hydrate(macro_t **pmactabroot) macro_hydrate(pmactabroot[i]); } } -#if HOST_THINK - if (!(config.flags2 & CFG2phgen)) - head_mactabroot = pmactabroot; -#endif } // Run through the old macro table, and transfer any #defines in there @@ -3727,110 +3710,6 @@ STATIC void macro_hydrate(macro_t *mb) } #endif -#if HOST_THINK -static void macro_hydrate_loaded(macro_t *mb) -{ - while (mb) { - macro_t *ml,*mr; - ml = mb->ML; - mr = mb->MR; - /* Skip undefined or predefined macros */ - if ((mb->Mflags & (Mdefined | Mfixeddef)) == Mdefined) { - char *p; - unsigned hash; - int cmp; - macro_t *m,**mp; - - if ((config.flags2 & CFG2phgen)) { - mb->MR = NULL; - mb->ML = NULL; - } - p = mb->Mid; - mb->Mflags |= Mnoheap; /* not in heap */ - - hash = comphash(p); - - mp = &mactabroot[hashtoidx(hash)]; /* parent of root */ - m = *mp; /* root of macro table */ - while (m) { /* while more tree */ - if ((config.flags2 & CFG2phgen)) - *mp = mb; - cmp = strcmp(p,m->Mid); /* compare identifiers */ - if (cmp == 0) { /* already there */ - if (m->Mflags & Mdefined) { - if (strcmp(m->Mtext,mb->Mtext) || - m->Mflags & (Minuse | Mfixeddef)) - preerr(EM_multiple_def,p); // already defined - } - else { /* it was #undef'd */ - assert(!m->Mflags & Mdefined); - m->Mtext = mb->Mtext; - m->Marglist = mb->Marglist; - m->Mflags = (m->Mflags & Mnoheap) | - (mb->Mflags & ~Mnoheap); - } - break; - } - mp = (cmp < 0) ? &m->ML : &m->MR; /* select correct child */ - m = *mp; - } - } - macro_hydrate_loaded(ml); - mb = mr; - } -} - -/* - * Rehydrate an already loaded precompiled header. All we need to do here is - * to hide macros that are undef'd in our current macro table but defined in - * the precompiled header. This is not necessary for dataview compilation, since - * this hiding has already taken place during regular compilation. - */ -void -pragma_hydrate_loaded(macro_t **pmactabroot) -{ - int i; - - if (compile_state != kDataView) { - for (i = 0; i < MACROHASHSIZE; i++) { - macro_hydrate_loaded(pmactabroot[i]); - } - } - if (!(config.flags2 & CFG2phgen)) - head_mactabroot = pmactabroot; -} - -static void -macro_hydrate_xsym(macro_t *m) -{ - while (m) { - ph_hydrate(&m->ML); - ph_hydrate(&m->MR); - ph_hydrate(&m->Mtext); - list_hydrate(&m->Marglist,FPNULL); - macro_hydrate_xsym(m->ML); - m = m->MR; - } -} - -/* - * Rehydrate the XSYM's macro table. Presumably we've already loaded the - * precompiled header macro table, and it's been placed in head_mactabroot. - * We rehydrate as usual, and put the result in mactabroot. - */ -void pragma_hydrate_xsym(macro_t **pmactabroot, short loaded) -{ - int i; - - if (!loaded) { - for (i = 0; i < MACROHASHSIZE; i++) { - ph_hydrate(&pmactabroot[i]); - macro_hydrate_xsym(pmactabroot[i]); - } - } - mactabroot = pmactabroot; -} -#endif #if 1 diff --git a/dm/src/dmc/struct.c b/dm/src/dmc/struct.c index 736d537f..06ec2b39 100644 --- a/dm/src/dmc/struct.c +++ b/dm/src/dmc/struct.c @@ -4518,25 +4518,6 @@ void n2_genvtbl(Classsym *stag,enum SC sc,int flag) /* Don't generate vtbl[] */ } -#if !HOST_THINK - // Sharing vtbls is bad if your linker can't resolve multiply defined - // names, as in Babel. - - /* See if we can get by using our primary base class's vtbl[]. */ - /* In order to use it we must have a base class with an */ - /* identical Svirtual list. Always generate our own vtbl[] if */ - /* dynamic typing information is desired. */ - else if (st->Sprimary && !(st->Sprimary->BCflags & BCFnewvtbl) && - !(config.flags2 & CFG2dyntyping) && - !(config.flags3 & CFG3rtti)) - { Classsym *sbase; - - sbase = st->Sprimary->BCbase; - //dbg_printf("Recursive...\n"); - n2_genvtbl(sbase,sc,flag); - st->Svtbl = sbase->Sstruct->Svtbl; - } -#endif else if (st->Svirtual) { /* Generate our own vtbl[] array */ From 47ed4903f50f47b72b4c0f7e5fd19e2d2b45c906 Mon Sep 17 00:00:00 2001 From: Brad Roberts Date: Sat, 15 Oct 2011 12:48:00 -0700 Subject: [PATCH 04/10] remove HOST_MPW --- dm/src/dmc/blklst.c | 6 ------ dm/src/dmc/exp2.c | 8 ------- dm/src/dmc/func.c | 49 ------------------------------------------- dm/src/dmc/nwc.c | 12 ----------- dm/src/dmc/pragma.c | 4 ---- dm/src/dmc/struct.c | 4 ---- dm/src/dmc/template.c | 8 +------ dm/src/dmc/token.c | 8 ------- 8 files changed, 1 insertion(+), 98 deletions(-) diff --git a/dm/src/dmc/blklst.c b/dm/src/dmc/blklst.c index d2561566..a846b005 100644 --- a/dm/src/dmc/blklst.c +++ b/dm/src/dmc/blklst.c @@ -1286,12 +1286,6 @@ Srcpos getlinnum() b = cstate.CSfilblk; #else b = blklst_getfileblock(); -#endif -#if HOST_MPW -#if SOURCE_OFFSETS - if (b) /* get file offset also */ - b->BLsrcpos.Sfiloff = b->BLfoffset+b->BLlincnt; -#endif #endif // If past end of file, use last known position return b ? b->BLsrcpos : lastpos; diff --git a/dm/src/dmc/exp2.c b/dm/src/dmc/exp2.c index f620c5fc..27ca8fae 100644 --- a/dm/src/dmc/exp2.c +++ b/dm/src/dmc/exp2.c @@ -2577,14 +2577,6 @@ elem *xfunccall(elem *efunc,elem *ethis,list_t pvirtbase,list_t arglist) e = el_unat(OPind,t,e); } -#if (TARGET_68K) -#if HOST_MPW - if (tyfloating(ty) && !typasfunc(tfunc->Tty)) - el_settype(e,tsldouble); /* C and C++ always return long double */ -#endif - -#endif - // For functions returning references, put a * in front else if (tyref(t->Tty)) { // Convert e from to diff --git a/dm/src/dmc/func.c b/dm/src/dmc/func.c index 528470b9..a95a3362 100644 --- a/dm/src/dmc/func.c +++ b/dm/src/dmc/func.c @@ -302,16 +302,6 @@ void func_body(symbol *s) tfunc = s->Stype; assert(tyfunc(tfunc->Tty)); -#if HOST_MPW -#if CPP - if (configv.addlinenumbers) - f->startbline = TklbrackSrcpos; -#else - f->Fstartline = save_offset; - if (configv.addlinenumbers) - startbline = TklbrackSrcpos; -#endif -#endif #if TX86 if (tybasic(tfunc->Tty) == TYf16func) synerr(EM_far16_extern); // _far16 functions can only be extern @@ -449,25 +439,6 @@ void func_body(symbol *s) e = el_combine(e,el_bint(OPeq,tsfloat,el_var(sp),ec)); sp->Sflags |= SFLdouble; } -#if HOST_MPW - else if (tybasic(sp->Stype->Tty) == TYdouble) - { elem *ec; - ec = el_var(sp); - el_settype(ec,tsldouble); - ec = el_unat(OPd_f,tsdouble,ec); - e = el_combine(e,el_bint(OPeq,tsdouble,el_var(sp),ec)); - sp->Sflags |= SFLdouble; - } - else if (tybasic(sp->Stype->Tty) == TYcomp) - { elem *ec; - - ec = el_var(sp); - el_settype(ec,tsldouble); - ec = el_unat(OPdblcomp,tscomp,ec); - e = el_combine(e,el_bint(OPeq,tscomp,el_var(sp),ec)); - sp->Sflags |= SFLdouble; - } -#endif /* HOST_MPW */ #else if (tybasic(sp->Stype->Tty) == TYfloat) { elem *ec; @@ -609,18 +580,6 @@ void func_body(symbol *s) startblock = curblock = block_calloc(); // create initial block startblock->Bsymstart = 0; funcstate.scope = NULL; - if (CPP) - { - -#if HOST_MPW - if (f->Fflags3 & Fmain && Add_pascal_object) - { - symbol *s_pgm1; - s_pgm1 = lookupsym("_PGM1"); - e = el_combine(e,el_unat(OPucall,tsvoid,el_var(s_pgm1))); - } -#endif - } startblock->Belem = e; level = 2; // at function block scope func_state(); // do function_statement @@ -778,17 +737,9 @@ void paramtypadj(type **pt) else t = tsuns; break; -#if HOST_MPW - case TYfloat: - case TYcomp: - case TYdouble: - t = tsldouble; - break; -#else case TYfloat: t = tsdouble; /* convert to double */ break; -#endif default: return; } diff --git a/dm/src/dmc/nwc.c b/dm/src/dmc/nwc.c index 6ee3eb9f..5b975287 100644 --- a/dm/src/dmc/nwc.c +++ b/dm/src/dmc/nwc.c @@ -735,18 +735,6 @@ void output_func() } } -#if HOST_MPW && TARGET_68K - if (pstate.do_pop) - { - PCrel_option = pstate.pop_value; - pstate.do_pop = FALSE; - } - if (pstate.do_push) - { - PCrel_option = pstate.push_value; - pstate.do_push = FALSE; - } -#endif #if HOST_RAINBOW if (pstate.do_pop) { diff --git a/dm/src/dmc/pragma.c b/dm/src/dmc/pragma.c index 1ebefc41..9c6082aa 100644 --- a/dm/src/dmc/pragma.c +++ b/dm/src/dmc/pragma.c @@ -2820,11 +2820,7 @@ STATIC void prerror() egchar(); } *p = 0; -#if HOST_MPW - err_message("# File %s; line %d # Error ",name,line,buffer); -#else err_message("Error %s %d: %s",name,line,buffer); -#endif err_exit(); } diff --git a/dm/src/dmc/struct.c b/dm/src/dmc/struct.c index 06ec2b39..ea75f156 100644 --- a/dm/src/dmc/struct.c +++ b/dm/src/dmc/struct.c @@ -4937,10 +4937,6 @@ STATIC symbol * n2_createfunc(Classsym *stag,const char *name, t = newref(stag->Stype); } s = symbol_name(p,SCparameter,t); -#if HOST_MPW - if (DoFileOffsets) - s->Ssrcpos = TkIdStrtSrcpos; -#endif s->Ssymnum = --si; s->Sflags |= SFLfree; f->Flocsym.tab[si] = s; diff --git a/dm/src/dmc/template.c b/dm/src/dmc/template.c index 88d5a040..74d8a0e8 100644 --- a/dm/src/dmc/template.c +++ b/dm/src/dmc/template.c @@ -97,13 +97,7 @@ int template_getcmd(char p,char *s) default: goto err; } -#if HOST_MPW - if (config.flags2 & CFG2tmpaccspec && - config.template_access != template_access) - warerr(4,s); // command line template access - else -#endif - config.template_access = template_access; + config.template_access = template_access; break; default: goto err; diff --git a/dm/src/dmc/token.c b/dm/src/dmc/token.c index e9bdb025..1d44a5bf 100644 --- a/dm/src/dmc/token.c +++ b/dm/src/dmc/token.c @@ -2356,19 +2356,11 @@ STATIC int escape() switch (i) { case 'a': i = 007; break; -#if HOST_MPW - case 'n': i = 015; break; -#else case 'n': i = 012; break; -#endif case 't': i = 011; break; case 'b': i = 010; break; case 'v': i = 013; break; -#if HOST_MPW - case 'r': i = 012; break; -#else case 'r': i = 015; break; -#endif case 'f': i = 014; break; case 'x': if (!ishex(xc)) From 626df65d7b8c9802ba0bc299e7143bca144177b8 Mon Sep 17 00:00:00 2001 From: Brad Roberts Date: Sat, 15 Oct 2011 12:49:07 -0700 Subject: [PATCH 05/10] remove HOST_RAINBOW --- dm/src/dmc/blklst.c | 32 -------------------------------- dm/src/dmc/nwc.c | 8 -------- 2 files changed, 40 deletions(-) diff --git a/dm/src/dmc/blklst.c b/dm/src/dmc/blklst.c index a846b005..7ccef80c 100644 --- a/dm/src/dmc/blklst.c +++ b/dm/src/dmc/blklst.c @@ -1384,38 +1384,6 @@ void blklst_term() #endif -#if HOST_RAINBOW -/* - * In order to rehydrate the once list and keep its data common, we need - * to append the rehydrated list at the end, instead of insterting it at - * the start. This is OK since the once list is only appended to at the - * beginning, not the end. - */ -void once_hydrate_loaded(blklst *bl) -{ - blklst *last_bl = Once; - - if (last_bl) - { - - /* find the last block */ - - while (last_bl->BLprev) - last_bl = last_bl->BLprev; - - /* point it at the start of the dehyrated Once list */ - - last_bl->BLprev = bl; - } - - /* if Once list is empty, use dehydrated bl to start list */ - - else - Once = bl; -} -#endif - - #if !TX86 void blklst_reinit(void) { diff --git a/dm/src/dmc/nwc.c b/dm/src/dmc/nwc.c index 5b975287..34e87dc2 100644 --- a/dm/src/dmc/nwc.c +++ b/dm/src/dmc/nwc.c @@ -734,14 +734,6 @@ void output_func() writefunc(s); } } - -#if HOST_RAINBOW - if (pstate.do_pop) - { - pragma_restore(); - pstate.do_pop = FALSE; - } -#endif } /****************************************** From 4147bfd0afc86f0749775c704fe0d192305e6e04 Mon Sep 17 00:00:00 2001 From: Brad Roberts Date: Sat, 15 Oct 2011 12:50:41 -0700 Subject: [PATCH 06/10] remove TARGET_68K --- dm/src/dmc/exp2.c | 42 ------------------------------------------ dm/src/dmc/func.c | 17 ----------------- dm/src/dmc/nwc.c | 12 ------------ 3 files changed, 71 deletions(-) diff --git a/dm/src/dmc/exp2.c b/dm/src/dmc/exp2.c index 27ca8fae..11b91459 100644 --- a/dm/src/dmc/exp2.c +++ b/dm/src/dmc/exp2.c @@ -2504,48 +2504,6 @@ elem *xfunccall(elem *efunc,elem *ethis,list_t pvirtbase,list_t arglist) else e = el_unat(OPucall,tfunc->Tnext,efunc); -#if TARGET_68K - if (efunc->Eoper == OPvar) - { /* check for pragma parameter */ - symbol_debug(efunc->EV.sp.Vsym); - returnreg = (efunc->EV.sp.Vsym->Sflags & PRAGMA_RET_MSK); - } - - if (hiddenparam) - e->Eflags |= EFpasret; - - if (returnreg) - { - e->Eflags |= EFpragmap; - e->EV.mac.Ereg[PRAGMA_PARAM_RETREG-1] = returnreg >> PRAGMA_RET_BIT; - } - p = tfunc->Tparamtypes; - if (p && p->Pflags & PRAGMA_PARAM_MSK) - { - returnreg = 0; - reverse = tyrevfunc(tfunc->Tty); - if (!reverse) - { - while(p) - { /* save the regs backward */ - returnreg++; - p = p->Pnext; - } - p = tfunc->Tparamtypes; - returnreg--; - } - while (p) - { - e->EV.mac.Ereg[returnreg] = p->Pflags >> PRAGMA_PARAM_BIT; - if (!reverse) - returnreg--; - else - returnreg++; - p = p->Pnext; - } - } -#endif - // Modify function return elem (e) based on types of result. elem_debug(e); diff --git a/dm/src/dmc/func.c b/dm/src/dmc/func.c index a95a3362..1b57e411 100644 --- a/dm/src/dmc/func.c +++ b/dm/src/dmc/func.c @@ -429,17 +429,6 @@ void func_body(symbol *s) #if SOURCE_4PARAMS sp->Ssrcpos = p->Psrcpos; #endif -#if TARGET_68K - if (tybasic(sp->Stype->Tty) == TYfloat) - { elem *ec; - - ec = el_var(sp); - el_settype(ec,tsldouble); - ec = el_unat(OPdblsflt,tsfloat,ec); - e = el_combine(e,el_bint(OPeq,tsfloat,el_var(sp),ec)); - sp->Sflags |= SFLdouble; - } -#else if (tybasic(sp->Stype->Tty) == TYfloat) { elem *ec; @@ -450,7 +439,6 @@ void func_body(symbol *s) e = el_combine(e,el_bint(OPeq,tsfloat,el_var(sp),ec)); sp->Sflags |= SFLdouble; } -#endif tp = p->Ptype; tp->Tcount++; // create copy before adjustment if (!typtr(p->Ptype->Tty)) @@ -2156,11 +2144,6 @@ STATIC void return_state() || funcsym_p->Sfunc->Fflags & (Fctor | Fdtor | Finvariant) )) synerr(EM_void_novalue); // void has no value -#if TARGET_68K - if(!(typasfunc(tf->Tty)) && tyfloating(tybasic(tr->Tty))) - e = typechk(e,tsldouble); /* return long doubles for C and C++ */ - else -#endif if (funcsym_p->Sfunc->Fflags3 & F3badoparrow) e = el_bint(OPcomma,tr,e,el_longt(tr,0)); e = typechk(e,tr); diff --git a/dm/src/dmc/nwc.c b/dm/src/dmc/nwc.c index 34e87dc2..1127cb74 100644 --- a/dm/src/dmc/nwc.c +++ b/dm/src/dmc/nwc.c @@ -1832,18 +1832,6 @@ elem *declaration(int flag) #endif goto ret; } -#if TARGET_68K - if (ParamFunc) /* pragma parameter prior to declaration */ - { - if (strcmp(ParamFunc,(char *)s->Sident)) - synerr(EM_pragma_proto); - else if (ParamRegs[0]) - s->Sflags |= 1 << (ParamRegs[0] + PRAGMA_RET_BIT-1); - s->Sflags |= Spragmap; - MEM_PARF_FREE(ParamFunc); - ParamFunc = NULL; - } -#endif } else /* else must be data def */ { From 2004627b36dcbd2cb1ac1c78d4218dadfe8753f8 Mon Sep 17 00:00:00 2001 From: Brad Roberts Date: Sat, 15 Oct 2011 12:51:27 -0700 Subject: [PATCH 07/10] remove TARGET_68000 --- dm/src/dmc/file.c | 14 -------------- dm/src/dmc/util.c | 2 +- 2 files changed, 1 insertion(+), 15 deletions(-) diff --git a/dm/src/dmc/file.c b/dm/src/dmc/file.c index 0ca098f3..1fe235e2 100644 --- a/dm/src/dmc/file.c +++ b/dm/src/dmc/file.c @@ -311,20 +311,6 @@ void afopen(char *p,blklst *bl,int flag) list_append(&srcpos_sfile(cstate.CSfilblk->BLsrcpos).SFfillist,*bl->BLsrcpos.Sfilptr); } -#if !TARGET_68000 - if (configv.verbose) - NetSpawnFile(p,(flag & FQsystem) ? -(includenest + 1) : includenest); - includenest++; - if (configv.verbose == 2) - { int i; - char buffer[32]; - - memset(buffer,' ',sizeof(buffer)); - i = (includenest < sizeof(buffer)) ? includenest : sizeof(buffer) - 1; - buffer[i] = 0; - dbg_printf("%s'%s'\n",buffer,p); - } -#endif #if !SPP if (fdep && !(flag & FQsystem)) { diff --git a/dm/src/dmc/util.c b/dm/src/dmc/util.c index 491a85f1..e2e163f2 100644 --- a/dm/src/dmc/util.c +++ b/dm/src/dmc/util.c @@ -37,7 +37,7 @@ static char __file__[] = __FILE__; /* for tassert.h */ #if TX86 -#if __SC__ && !TARGET_68000 && !DEBUG +#if __SC__ && !DEBUG /* disable library versions from being linked in */ //void __cdecl _fltused() { } #endif From 47889d84ecf5c348c048c571705dbe612b5c4640 Mon Sep 17 00:00:00 2001 From: Brad Roberts Date: Sat, 15 Oct 2011 12:53:46 -0700 Subject: [PATCH 08/10] remove HOST_MAC --- dm/src/dmc/file.c | 4 ---- 1 file changed, 4 deletions(-) diff --git a/dm/src/dmc/file.c b/dm/src/dmc/file.c index 1fe235e2..adedeb21 100644 --- a/dm/src/dmc/file.c +++ b/dm/src/dmc/file.c @@ -604,10 +604,8 @@ Lf: mov p,ECX // File must end in LF. If it doesn't, make it. if (p[-1] != LF) { -#if !HOST_MAC // Mac editor does not always terminate last line if (ANSI && !CPP) lexerr(EM_no_nl); // file must be terminated by '\n' -#endif p[0] = LF; p[1] = 0x1A; } @@ -973,10 +971,8 @@ int readln() case EOF: if (p != bl->BLtext) // if we read in some chars { *p = 0; // terminate line so it'll print -#if !HOST_MAC // Mac editor does not alway terminate last line if (ANSI && !CPP) lexerr(EM_no_nl); -#endif c = '\n'; /* fake a '\n' */ goto L2; } From 39756f99795eae755f4fbde3602a3cf5dea99e83 Mon Sep 17 00:00:00 2001 From: Brad Roberts Date: Sat, 15 Oct 2011 13:00:57 -0700 Subject: [PATCH 09/10] remove TARGET_INLINE bits --- dm/src/dmc/cdef.h | 1 - dm/src/dmc/exp2.c | 17 ----------------- dm/src/dmc/oper.h | 4 ---- 3 files changed, 22 deletions(-) diff --git a/dm/src/dmc/cdef.h b/dm/src/dmc/cdef.h index 08d4000e..83b24eaa 100644 --- a/dm/src/dmc/cdef.h +++ b/dm/src/dmc/cdef.h @@ -306,7 +306,6 @@ One and only one of these macros must be set by the makefile: #define NEWSTATICDTOR 1 // support new style static destructors // For Shared Code Base -#define TARGET_INLINEFUNC_NAMES #define PASCAL pascal #define HINT int #define UHINT unsigned int diff --git a/dm/src/dmc/exp2.c b/dm/src/dmc/exp2.c index 11b91459..f0f05929 100644 --- a/dm/src/dmc/exp2.c +++ b/dm/src/dmc/exp2.c @@ -1691,7 +1691,6 @@ elem *builtinFunc(elem *ec) elem *e = ec->E1; elem *e2; -#ifdef TARGET_INLINEFUNC_NAMES if (e->Eoper == OPvar && #if linux || __APPLE__ || __FreeBSD__ || __OpenBSD__ // In linux this is controlled by an option instead of adding defines to @@ -1706,7 +1705,6 @@ elem *builtinFunc(elem *ec) int i; static const char *inlinefunc[] = /* names of inline functions */ { -#if TX86 "bsf", "bsr", "bt", @@ -1757,14 +1755,10 @@ elem *builtinFunc(elem *ec) "strlen", "yl2x", "yl2xp1", -#else - TARGET_INLINEFUNC_NAMES -#endif }; /* Parallel table of corresponding opcodes */ static unsigned char opcode[] = { -#if TX86 OPbsf,OPbsr,OPbt,OPbtc,OPbtr,OPbts, OPcos,OPcos,OPcos, OPabs,OPabs,OPabs,OPmemcmp,OPmemcpy,OPmemset, @@ -1778,14 +1772,10 @@ elem *builtinFunc(elem *ec) OPsetjmp,OPsin,OPsin,OPsin,OPsqrt,OPsqrt,OPsqrt, OPstrcmp,OPstrcpy,OPstrlen, OPyl2x,OPyl2xp1, -#else - TARGET_INLINEFUNC_OPS -#endif }; /* Types of the operands. We check against these to make sure we are not inlining an overloaded function. */ -#if TX86 static tym_t ty1[] = { TYptr,TYptr,TYptr,TYptr,TYptr,TYptr, TYdouble,TYfloat,TYuint,TYuint,TYptr,TYptr,TYuint, @@ -1793,12 +1783,6 @@ elem *builtinFunc(elem *ec) static tym_t ty2[] = { ~0,~0,~0,~0,~0,~0, ~0,~0,TYuint,TYuint,~0,~0,TYchar,TYuint,~0,~0,~0 }; -#else - static tym_t ty1[] = - { TARGET_INLINEFUNC_ARGTY1 }; - static tym_t ty2[] = - { TARGET_INLINEFUNC_ARGTY2 }; -#endif s = e->EV.sp.Vsym; symbol_debug(s); @@ -2005,7 +1989,6 @@ elem *builtinFunc(elem *ec) } #endif } -#endif ret: elem_debug(ec); diff --git a/dm/src/dmc/oper.h b/dm/src/dmc/oper.h index 03bfeb9c..68dc97cb 100644 --- a/dm/src/dmc/oper.h +++ b/dm/src/dmc/oper.h @@ -289,10 +289,6 @@ enum OPER OPpreinc, /* ++x overloading */ OPpredec, /* --x overloading */ -#ifdef TARGET_INLINEFUNC_OPS - TARGET_INLINEFUNC_OPS -#endif - OPMAX /* 1 past last operator */ }; typedef enum OPER OPER; /* needed for optabgen */ From faabad8ce577fb84b45cb4f731d18ee8033c74b9 Mon Sep 17 00:00:00 2001 From: Brad Roberts Date: Sat, 15 Oct 2011 13:17:53 -0700 Subject: [PATCH 10/10] remove M68HDL --- dm/src/dmc/cpp.c | 46 ++++++++++++++++++++++----------------------- dm/src/dmc/cpp.h | 2 -- dm/src/dmc/exp.c | 2 -- dm/src/dmc/exp2.c | 12 +++++------- dm/src/dmc/rtti.c | 4 ++-- dm/src/dmc/struct.c | 6 ++---- 6 files changed, 31 insertions(+), 41 deletions(-) diff --git a/dm/src/dmc/cpp.c b/dm/src/dmc/cpp.c index 44b26ba1..f37718af 100644 --- a/dm/src/dmc/cpp.c +++ b/dm/src/dmc/cpp.c @@ -48,8 +48,6 @@ STATIC list_t cpp_pvirtbase(Classsym *stag , Classsym *sbase); STATIC int fixctorwalk(elem *e , elem *ec , symbol *s_this); STATIC Match cpp_builtinoperator(elem *e); -#define M68HDL(e) (e) - #if TX86 /* List of elems which are the constructor and destructor calls to make */ list_t constructor_list = NULL; /* for _STIxxxx */ @@ -3493,7 +3491,7 @@ elem *cpp_istype(elem *e, type *t) emos->EV.sp.Voffset = st->Sprimary->BCoffset; #endif t = type_allocn(tym,svptr->Stype); // match pointer type of ethis - M68HDL(e = el_bint(OPadd,t,e,emos)); // ethis + mos + e = el_bint(OPadd,t,e,emos); // ethis + mos e = el_unat(OPind,svptr->Stype,e); /* *(ethis + mos) */ ev = cpp_addr_vtable(stag); @@ -3555,7 +3553,7 @@ STATIC elem * cpp_assignvptr(symbol *s_this,int ctor) emos->EV.sp.Voffset = st->Sprimary->BCoffset; #endif t = type_allocn(tym,svptr->Stype); // match pointer type of ethis - M68HDL(e = el_bint(OPadd,t,el_var(s_this),emos)); /* ethis + mos */ + e = el_bint(OPadd,t,el_var(s_this),emos); /* ethis + mos */ e = el_unat(OPind,svptr->Stype,e); /* *(ethis + mos) */ genvtbl = TRUE; @@ -3660,7 +3658,7 @@ STATIC elem * cpp_assignvptr(symbol *s_this,int ctor) } emos = el_longt(tsint,vptroffset); - M68HDL(e = el_bint(OPadd,t,e,emos)); + e = el_bint(OPadd,t,e,emos); e = el_unat(OPind,svptr->Stype,e); /* *(&e + mos) */ /* ev = &_vtbl */ @@ -3723,7 +3721,7 @@ STATIC elem * cpp_assignvbptr(symbol *s_this) symbol_debug(svptr); emos = el_longt(tsint,st->Svbptr_off); t = type_allocn(tym,svptr->Stype); // match pointer type of ethis - M68HDL(e = el_bint(OPadd,t,el_var(s_this),emos)); /* ethis + mos */ + e = el_bint(OPadd,t,el_var(s_this),emos); /* ethis + mos */ e = el_unat(OPind,svptr->Stype,e); /* *(ethis + mos) */ n2_genvbtbl(stag,scvtbl,0); // make sure vtbl[]s exist @@ -3792,7 +3790,7 @@ STATIC elem * cpp_assignvbptr(symbol *s_this) } #endif emos = el_longt(tsint,vptroffset); - M68HDL(e = el_bint(OPadd,t,e,emos)); + e = el_bint(OPadd,t,e,emos); e = el_unat(OPind,svptr->Stype,e); /* *(&e + mos) */ /* ev = &_vtbl */ @@ -3929,8 +3927,8 @@ elem * cpp_getfunc(type *tclass,symbol *sfunc,elem **pethis) symbol_debug(svptr); /* e = *(ethis + offset(vptr)); ethis might be a handle pointer */ - M68HDL(e = el_bint(OPadd,newpointer(svptr->Stype), - el_same(ðis),el_longt(tsint,(targ_int) svptr->Smemoff))); + e = el_bint(OPadd,newpointer(svptr->Stype), + el_same(ðis),el_longt(tsint,(targ_int) svptr->Smemoff)); e->ET->Tty = tym; e = el_unat(OPind,svptr->Stype,e); @@ -3941,15 +3939,15 @@ elem * cpp_getfunc(type *tclass,symbol *sfunc,elem **pethis) /* Add _mptr.d to ethis */ /* *pethis = ethis + (int) *(e + i); */ - M68HDL(ed = el_bint(OPadd,e->ET,el_copytree(e),el_longt(tsint,i))); + ed = el_bint(OPadd,e->ET,el_copytree(e),el_longt(tsint,i)); ed = el_unat(OPind,tsshort,ed); ed = cast(ed,tsint); - *pethis = M68HDL(el_bint(OPadd,ethis->ET,ethis,ed)); + *pethis = el_bint(OPadd,ethis->ET,ethis,ed); i += SHORTSIZE + SHORTSIZE; /* get offset to _mptr.f */ } #endif - M68HDL(e = el_bint(OPadd,e->ET,e,el_longt(tsint,i))); + e = el_bint(OPadd,e->ET,e,el_longt(tsint,i)); pfunc = el_unat(OPind,newpointer(sfunc->Stype),e); } else @@ -4877,8 +4875,8 @@ void cpp_buildinitializer(symbol *s_ctor,list_t baseinit,int flag) SYMIDX marksi; sbase = b->BCbase; - M68HDL(ethis = el_bint(OPadd,newpointer(sbase->Stype), - el_var(s_this),el_longt(tsint,b->BCoffset))); + ethis = el_bint(OPadd,newpointer(sbase->Stype), + el_var(s_this),el_longt(tsint,b->BCoffset)); arglist = cpp_meminitializer(baseinit,sbase); /*dbg_printf("Virtual base '%s', arglist = %p\n",sbase->Sident,arglist);*/ if (sbase->Sstruct->Sflags & STRgenctor0 && !arglist) @@ -4910,8 +4908,8 @@ void cpp_buildinitializer(symbol *s_ctor,list_t baseinit,int flag) if (b->BCflags & BCFvfirst) { elem *eptr; - M68HDL(eptr = el_bint(OPadd,newpointer(newpointer(sbase->Stype)), - el_var(s_this),el_longt(tsint,b->memoffset))); + eptr = el_bint(OPadd,newpointer(newpointer(sbase->Stype)), + el_var(s_this),el_longt(tsint,b->memoffset)); eptr = el_unat(OPind,eptr->ET->Tnext,eptr); ec = el_bint(OPeq,eptr->ET,eptr,ec); } @@ -4969,7 +4967,7 @@ void cpp_buildinitializer(symbol *s_ctor,list_t baseinit,int flag) arglist = cpp_meminitializer(baseinit,s); enelems = el_nelems(t); et = el_var(s_this); - M68HDL(et = el_bint(OPadd,et->ET,et,el_longt(tsuns,s->Smemoff))); + et = el_bint(OPadd,et->ET,et,el_longt(tsuns,s->Smemoff)); et = cpp_constructor(et,tclass,arglist,enelems,NULL,flags & 8); e = el_combine(e,et); } @@ -4987,7 +4985,7 @@ void cpp_buildinitializer(symbol *s_ctor,list_t baseinit,int flag) /* Create et <== *(this + offset) */ et = el_var(s_this); - M68HDL(et = el_bint(OPadd,newpointer(t),et,el_longt(tsuns,s->Smemoff))); + et = el_bint(OPadd,newpointer(t),et,el_longt(tsuns,s->Smemoff)); et = el_unat(OPind, (tyref(t->Tty) ? newpointer(t->Tnext) : t),et); @@ -5404,7 +5402,7 @@ elem *cpp_buildterminator(Classsym *stag, symbol *s_this, elem **ped) } et = el_var(s_this); - M68HDL(et = el_bint(OPadd,et->ET,et,el_longt(tsuns,s->Smemoff))); + et = el_bint(OPadd,et->ET,et,el_longt(tsuns,s->Smemoff)); if (doeh) ector = el_copytree(et); e2 = cpp_destructor(tclass,et,enelems,DTORmostderived | DTORnoeh); @@ -5472,8 +5470,8 @@ elem *cpp_buildterminator(Classsym *stag, symbol *s_this, elem **ped) { elem *et; et = el_var(s_this); - M68HDL(et = el_bint(OPadd,et->ET, - et,el_longt(tsint,b->BCoffset))); + et = el_bint(OPadd,et->ET, + et,el_longt(tsint,b->BCoffset)); et = cpp_destructor(sbase->Stype,et,NULL,DTORnoeh); e1 = el_combine(et,e1); } @@ -5813,7 +5811,7 @@ void cpp_fixinvariant(symbol *s_inv) enelems = el_nelems(t); et = el_var(s_this); - M68HDL(et = el_bint(OPadd,et->ET,et,el_longt(tsuns,s->Smemoff))); + et = el_bint(OPadd,et->ET,et,el_longt(tsuns,s->Smemoff)); et = cpp_invariant(tclass,et,enelems,DTORmostderived | DTORnoeh); e = el_combine(et,e); } @@ -5855,8 +5853,8 @@ void cpp_fixinvariant(symbol *s_inv) { elem *et; et = el_var(s_this); - M68HDL(et = el_bint(OPadd,et->ET, - et,el_longt(tsint,b->BCoffset))); + et = el_bint(OPadd,et->ET, + et,el_longt(tsint,b->BCoffset)); et = cpp_invariant(sbase->Stype,et,NULL,DTORnoeh); e1 = el_combine(et,e1); } diff --git a/dm/src/dmc/cpp.h b/dm/src/dmc/cpp.h index acb2aa49..3cfdbce8 100644 --- a/dm/src/dmc/cpp.h +++ b/dm/src/dmc/cpp.h @@ -120,8 +120,6 @@ symbol *cpp_lookformatch(symbol *sfunc , type *tthis , list_t arglist, unsigned flags, symbol *sfunc2, type *tthis2, symbol *stagfriend = NULL); #endif -#define M68HDL(e) (e) - struct OPTABLE { unsigned char tokn; /* token(TKxxxx) */ unsigned char oper; /* corresponding operator(OPxxxx) */ diff --git a/dm/src/dmc/exp.c b/dm/src/dmc/exp.c index 2c97352e..2fbf9a14 100644 --- a/dm/src/dmc/exp.c +++ b/dm/src/dmc/exp.c @@ -50,8 +50,6 @@ STATIC elem *primary_exp(void); STATIC elem *prim_post(elem *); STATIC elem *exp_sizeof(int); -#define M68HDL(e) (e) - #ifndef NAN static unsigned long nanarray[2] = {0,0x7FF80000 }; #define NAN (*(double *)nanarray) diff --git a/dm/src/dmc/exp2.c b/dm/src/dmc/exp2.c index f0f05929..6cfe368f 100644 --- a/dm/src/dmc/exp2.c +++ b/dm/src/dmc/exp2.c @@ -38,8 +38,6 @@ STATIC int paramlstcompat(param_t *,param_t *); STATIC elem * strarg(elem *e); STATIC elem * exp2_castx(elem *e,type *newt,elem **pethis,int flags); -#define M68HDL(e) (e) - /******************************* * Read list of comma-separated arguments into *parglist. * Input: @@ -1264,8 +1262,8 @@ elem *dodot(elem *e1,type *tclass, bool bColcol) type_setty(ðis->ET,(ethis->ET->Tty & ~mTYbasic) | TYfptr); #endif - mos = el_longt(tsint,s->Smemoff); // offset of member - M68HDL(eplus = el_bint(OPadd,at,ethis,mos)); // &e1 + mos + mos = el_longt(tsint,s->Smemoff); // offset of member + eplus = el_bint(OPadd,at,ethis,mos); // &e1 + mos e = el_unat(OPind,s->Stype,eplus); /* *(&e1 + mos) */ if (s->Sflags & SFLmutable) @@ -3460,7 +3458,7 @@ elem *exp2_ptrvbaseclass(elem *ethis,Classsym *stag,Classsym *sbase) assert(b); e = el_longt(tsint,b->memoffset); tp = type_allocn(tpbase->Tty,tpbase); - M68HDL(e = el_bint(OPadd,tp,ethis,e)); + e = el_bint(OPadd,tp,ethis,e); ethis = el_unat(OPind,tpbase,e); #endif /* VBTABLES */ return ethis; @@ -3615,7 +3613,7 @@ STATIC int c1isbaseofc2x(elem **pethis,symbol *c1,symbol *c2,Classsym **psvirtua tpbase = type_allocn(ethis->ET->Tty,sbase->Stype); assert(typtr(tpbase->Tty)); - M68HDL(ethis = el_bint(OPadd,tpbase,ethis,el_longt(tsint,b->BCoffset))); + ethis = el_bint(OPadd,tpbase,ethis,el_longt(tsint,b->BCoffset)); } *pethis = ethis; if (c1 != sbase) @@ -4794,7 +4792,7 @@ STATIC elem * exp2_castx(elem *e,type *newt,elem **pethis,int flags) else { /* pointer to data member */ el_settype(e,tsint); - M68HDL(e = el_bint(OPadd,newt,e,el_longt(tsint,d))); + e = el_bint(OPadd,newt,e,el_longt(tsint,d)); goto ret; } } diff --git a/dm/src/dmc/rtti.c b/dm/src/dmc/rtti.c index 28b10f30..cdbce73d 100644 --- a/dm/src/dmc/rtti.c +++ b/dm/src/dmc/rtti.c @@ -304,8 +304,8 @@ elem *rtti_typeid(type *t,elem *e) #endif e = el_unat(OPaddr,newpointer(e->ET),e); t = type_allocn(st->ptrtype,svptr->Stype); // match pointer type of ethis - M68HDL(e = el_bint(OPadd,t,e,emos)); // ethis + mos - e = el_unat(OPind,svptr->Stype,e); // *(ethis + mos) + e = el_bint(OPadd,t,e,emos); // ethis + mos + e = el_unat(OPind,svptr->Stype,e); // *(ethis + mos) e = el_bint(OPadd,e->ET,e,el_longt(tsint,-tysize(st->ptrtype))); e = el_unat(OPind,tref,e); diff --git a/dm/src/dmc/struct.c b/dm/src/dmc/struct.c index ea75f156..6a45f120 100644 --- a/dm/src/dmc/struct.c +++ b/dm/src/dmc/struct.c @@ -5007,8 +5007,7 @@ STATIC symbol * n2_createfunc(Classsym *stag,const char *name, { elem *et; et = el_var(sthis); - M68HDL(et = el_bint(OPadd,et->ET, - et,el_longt(tsint,bc->BCoffset))); + et = el_bint(OPadd,et->ET, et,el_longt(tsint,bc->BCoffset)); et = cpp_destructor(sbase->Stype,et,NULL,DTORnoeh); e = el_combine(et,e); } @@ -5030,8 +5029,7 @@ STATIC symbol * n2_createfunc(Classsym *stag,const char *name, { elem *et; et = el_var(sthis); - M68HDL(et = el_bint(OPadd,et->ET, - et,el_longt(tsint,bc->BCoffset))); + et = el_bint(OPadd,et->ET, et,el_longt(tsint,bc->BCoffset)); et = cpp_invariant(sbase->Stype,et,NULL,DTORnoeh); e = el_combine(et,e); }