summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJan Dubois <jand@activestate.com>1999-01-24 02:12:00 +0100
committerGurusamy Sarathy <gsar@cpan.org>1999-02-12 13:25:59 +0000
commit9e7bc3e8c0a5a5a357a2bda9981a86c5a61092c1 (patch)
treedc6c1d0c460cd55c7d2b7b74378919964cf50799
parent01e22528c2c3f941ba946b303423dfa59ea39444 (diff)
downloadperl-9e7bc3e8c0a5a5a357a2bda9981a86c5a61092c1.tar.gz
remove OVERLOAD conditionals
Message-ID: <36b66479.62756298@smtp1.ibm.net> p4raw-id: //depot/perl@2903
-rw-r--r--XSUB.h12
-rw-r--r--dump.c4
-rw-r--r--gv.c5
-rw-r--r--hv.h4
-rw-r--r--mg.c3
-rw-r--r--perl.h9
-rw-r--r--perlvars.h5
-rw-r--r--pp.c2
-rw-r--r--pp.h10
-rw-r--r--proto.h4
-rw-r--r--sv.c43
-rw-r--r--sv.h14
12 files changed, 18 insertions, 97 deletions
diff --git a/XSUB.h b/XSUB.h
index dbe0c3985b..ad465a0cbb 100644
--- a/XSUB.h
+++ b/XSUB.h
@@ -108,10 +108,8 @@
# ifdef USE_LOCALE_COLLATE
# define VTBL_collxfrm get_vtbl(want_vtbl_collxfrm)
# endif
-# ifdef OVERLOAD
-# define VTBL_amagic get_vtbl(want_vtbl_amagic)
-# define VTBL_amagicelem get_vtbl(want_vtbl_amagicelem)
-# endif
+# define VTBL_amagic get_vtbl(want_vtbl_amagic)
+# define VTBL_amagicelem get_vtbl(want_vtbl_amagicelem)
#else
# define VTBL_sv &PL_vtbl_sv
# define VTBL_env &PL_vtbl_env
@@ -141,10 +139,8 @@
# ifdef USE_LOCALE_COLLATE
# define VTBL_collxfrm &PL_vtbl_collxfrm
# endif
-# ifdef OVERLOAD
-# define VTBL_amagic &PL_vtbl_amagic
-# define VTBL_amagicelem &PL_vtbl_amagicelem
-# endif
+# define VTBL_amagic &PL_vtbl_amagic
+# define VTBL_amagicelem &PL_vtbl_amagicelem
#endif
#ifdef PERL_OBJECT
diff --git a/dump.c b/dump.c
index 77b3604706..baf3b40f3e 100644
--- a/dump.c
+++ b/dump.c
@@ -632,10 +632,8 @@ do_magic_dump(I32 level, PerlIO *file, MAGIC *mg, I32 nest, I32 maxnest, bool du
#ifdef USE_LOCALE_COLLATE
else if (v == &PL_vtbl_collxfrm) s = "collxfrm";
#endif
-#ifdef OVERLOAD
else if (v == &PL_vtbl_amagic) s = "amagic";
else if (v == &PL_vtbl_amagicelem) s = "amagicelem";
-#endif
if (s)
dump_indent(level, file, " MG_VIRTUAL = &PL_vtbl_%s\n", s);
else
@@ -769,9 +767,7 @@ do_sv_dump(I32 level, PerlIO *file, SV *sv, I32 nest, I32 maxnest, bool dumpops,
if (flags & SVf_FAKE) sv_catpv(d, "FAKE,");
if (flags & SVf_READONLY) sv_catpv(d, "READONLY,");
-#ifdef OVERLOAD
if (flags & SVf_AMAGIC) sv_catpv(d, "OVERLOAD,");
-#endif /* OVERLOAD */
if (flags & SVp_IOK) sv_catpv(d, "pIOK,");
if (flags & SVp_NOK) sv_catpv(d, "pNOK,");
if (flags & SVp_POK) sv_catpv(d, "pPOK,");
diff --git a/gv.c b/gv.c
index e6e4a55690..a1e5073bb3 100644
--- a/gv.c
+++ b/gv.c
@@ -654,7 +654,6 @@ gv_fetchpv(char *nambeg, I32 add, I32 sv_type)
}
}
break;
-#ifdef OVERLOAD
case 'O':
if (strEQ(name, "OVERLOAD")) {
HV* hv = GvHVn(gv);
@@ -662,7 +661,6 @@ gv_fetchpv(char *nambeg, I32 add, I32 sv_type)
hv_magic(hv, gv, 'A');
}
break;
-#endif /* OVERLOAD */
case 'S':
if (strEQ(name, "SIG")) {
HV *hv;
@@ -1005,7 +1003,6 @@ register GV *gv;
}
#endif /* Microport 2.4 hack */
-#ifdef OVERLOAD
/* Updates and caches the CV's */
bool
@@ -1483,5 +1480,3 @@ amagic_call(SV *left, SV *right, int method, int flags)
}
}
}
-#endif /* OVERLOAD */
-
diff --git a/hv.h b/hv.h
index 466f33d2bb..1f8d9ce934 100644
--- a/hv.h
+++ b/hv.h
@@ -71,8 +71,6 @@ struct xpvhv {
#define HvLAZYDEL_on(hv) (SvFLAGS(hv) |= SVphv_LAZYDEL)
#define HvLAZYDEL_off(hv) (SvFLAGS(hv) &= ~SVphv_LAZYDEL)
-#ifdef OVERLOAD
-
/* Maybe amagical: */
/* #define HV_AMAGICmb(hv) (SvFLAGS(hv) & (SVpgv_badAM | SVpgv_AM)) */
@@ -86,8 +84,6 @@ struct xpvhv {
#define HV_badAMAGIC_off(hv) (SvFLAGS(hv) &= ~SVpgv_badAM)
*/
-#endif /* OVERLOAD */
-
#define Nullhe Null(HE*)
#define HeNEXT(he) (he)->hent_next
#define HeKEY_hek(he) (he)->hent_hek
diff --git a/mg.c b/mg.c
index ce6052f901..76da1b4b84 100644
--- a/mg.c
+++ b/mg.c
@@ -1040,8 +1040,6 @@ magic_setisa(SV *sv, MAGIC *mg)
return 0;
}
-#ifdef OVERLOAD
-
int
magic_setamagic(SV *sv, MAGIC *mg)
{
@@ -1050,7 +1048,6 @@ magic_setamagic(SV *sv, MAGIC *mg)
return 0;
}
-#endif /* OVERLOAD */
int
magic_getnkeys(SV *sv, MAGIC *mg)
diff --git a/perl.h b/perl.h
index ddde94baad..0661558b8f 100644
--- a/perl.h
+++ b/perl.h
@@ -8,7 +8,6 @@
*/
#ifndef H_PERL
#define H_PERL 1
-#define OVERLOAD
#ifdef PERL_FOR_X2P
/*
@@ -2495,12 +2494,10 @@ EXT MGVTBL PL_vtbl_collxfrm = {0,
0, 0, 0};
#endif
-#ifdef OVERLOAD
EXT MGVTBL PL_vtbl_amagic = {0, magic_setamagic,
0, 0, magic_setamagic};
EXT MGVTBL PL_vtbl_amagicelem = {0, magic_setamagic,
0, 0, magic_setamagic};
-#endif /* OVERLOAD */
#else /* !DOINIT */
@@ -2539,15 +2536,11 @@ EXT MGVTBL PL_vtbl_regdatum;
EXT MGVTBL PL_vtbl_collxfrm;
#endif
-#ifdef OVERLOAD
EXT MGVTBL PL_vtbl_amagic;
EXT MGVTBL PL_vtbl_amagicelem;
-#endif /* OVERLOAD */
#endif /* !DOINIT */
-#ifdef OVERLOAD
-
enum {
fallback_amg, abs_amg,
bool__amg, nomethod_amg,
@@ -2682,8 +2675,6 @@ typedef struct am_table_short AMTS;
# endif
#endif /* _FASTMATH */
-#endif /* OVERLOAD */
-
#define PERLDB_ALL 0x3f /* No _NONAME, _GOTO */
#define PERLDBf_SUB 0x01 /* Debug sub enter/exit. */
#define PERLDBf_LINE 0x02 /* Keep line #. */
diff --git a/perlvars.h b/perlvars.h
index 29093870cb..174747884f 100644
--- a/perlvars.h
+++ b/perlvars.h
@@ -141,13 +141,8 @@ PERLVAR(Ghints, U32) /* pragma-tic compile-time flags */
PERLVAR(Gdo_undump, bool) /* -u or dump seen? */
PERLVAR(Gdebug, VOL U32) /* flags given to -D switch */
-
-#ifdef OVERLOAD
-
PERLVAR(Gamagic_generation, long)
-#endif
-
#ifdef USE_LOCALE_COLLATE
PERLVAR(Gcollation_ix, U32) /* Collation generation index */
PERLVAR(Gcollation_name,char *) /* Name of current collation */
diff --git a/pp.c b/pp.c
index 83d881b58d..348cff9b53 100644
--- a/pp.c
+++ b/pp.c
@@ -1361,9 +1361,7 @@ PP(pp_negate)
PP(pp_not)
{
-#ifdef OVERLOAD
djSP; tryAMAGICunSET(not);
-#endif /* OVERLOAD */
*PL_stack_sp = boolSV(!SvTRUE(*PL_stack_sp));
return NORMAL;
}
diff --git a/pp.h b/pp.h
index 64020020c8..e9bb1133d1 100644
--- a/pp.h
+++ b/pp.h
@@ -168,8 +168,6 @@
Renew(PL_tmps_stack, PL_tmps_max = PL_tmps_ix + (n) + 1, SV*); \
} STMT_END
-#ifdef OVERLOAD
-
#define AMGf_noright 1
#define AMGf_noleft 2
#define AMGf_assign 4
@@ -240,11 +238,3 @@
SvREFCNT_dec(tmpRef); \
SvRV(rv)=AMG_CALLun(rv,copy); \
} } STMT_END
-#else
-
-#define tryAMAGICbin(a,b)
-#define tryAMAGICbinSET(a,b)
-#define tryAMAGICun(a)
-#define tryAMAGICunSET(a)
-
-#endif /* OVERLOAD */
diff --git a/proto.h b/proto.h
index 7e3d4c5862..903d78b675 100644
--- a/proto.h
+++ b/proto.h
@@ -22,10 +22,8 @@ START_EXTERN_C
#define __attribute__(attr)
#endif
#endif
-#ifdef OVERLOAD
VIRTUAL SV* amagic_call _((SV* left,SV* right,int method,int dir));
VIRTUAL bool Gv_AMupdate _((HV* stash));
-#endif /* OVERLOAD */
VIRTUAL OP* append_elem _((I32 optype, OP* head, OP* tail));
VIRTUAL OP* append_list _((I32 optype, LISTOP* first, LISTOP* last));
VIRTUAL I32 apply _((I32 type, SV** mark, SV** sp));
@@ -271,9 +269,7 @@ VIRTUAL int magic_nextpack _((SV* sv, MAGIC* mg, SV* key));
VIRTUAL U32 magic_regdata_cnt _((SV* sv, MAGIC* mg));
VIRTUAL int magic_regdatum_get _((SV* sv, MAGIC* mg));
VIRTUAL int magic_set _((SV* sv, MAGIC* mg));
-#ifdef OVERLOAD
VIRTUAL int magic_setamagic _((SV* sv, MAGIC* mg));
-#endif /* OVERLOAD */
VIRTUAL int magic_setarylen _((SV* sv, MAGIC* mg));
VIRTUAL int magic_setbm _((SV* sv, MAGIC* mg));
VIRTUAL int magic_setdbline _((SV* sv, MAGIC* mg));
diff --git a/sv.c b/sv.c
index be8870f48a..545a9d5fdc 100644
--- a/sv.c
+++ b/sv.c
@@ -1173,11 +1173,9 @@ sv_2iv(register SV *sv)
}
if (SvTHINKFIRST(sv)) {
if (SvROK(sv)) {
-#ifdef OVERLOAD
SV* tmpstr;
if (SvAMAGIC(sv) && (tmpstr=AMG_CALLun(sv, numer)))
- return SvIV(tmpstr);
-#endif /* OVERLOAD */
+ return SvIV(tmpstr);
return (IV)SvRV(sv);
}
if (SvREADONLY(sv)) {
@@ -1254,11 +1252,9 @@ sv_2uv(register SV *sv)
}
if (SvTHINKFIRST(sv)) {
if (SvROK(sv)) {
-#ifdef OVERLOAD
SV* tmpstr;
if (SvAMAGIC(sv) && (tmpstr=AMG_CALLun(sv, numer)))
- return SvUV(tmpstr);
-#endif /* OVERLOAD */
+ return SvUV(tmpstr);
return (UV)SvRV(sv);
}
if (SvREADONLY(sv)) {
@@ -1336,11 +1332,9 @@ sv_2nv(register SV *sv)
}
if (SvTHINKFIRST(sv)) {
if (SvROK(sv)) {
-#ifdef OVERLOAD
SV* tmpstr;
if (SvAMAGIC(sv) && (tmpstr=AMG_CALLun(sv,numer)))
- return SvNV(tmpstr);
-#endif /* OVERLOAD */
+ return SvNV(tmpstr);
return (double)(unsigned long)SvRV(sv);
}
if (SvREADONLY(sv)) {
@@ -1553,11 +1547,9 @@ sv_2pv(register SV *sv, STRLEN *lp)
}
if (SvTHINKFIRST(sv)) {
if (SvROK(sv)) {
-#ifdef OVERLOAD
SV* tmpstr;
if (SvAMAGIC(sv) && (tmpstr=AMG_CALLun(sv,string)))
- return SvPV(tmpstr,*lp);
-#endif /* OVERLOAD */
+ return SvPV(tmpstr,*lp);
sv = (SV*)SvRV(sv);
if (!sv)
s = "NULLREF";
@@ -1762,14 +1754,10 @@ sv_2bool(register SV *sv)
if (!SvOK(sv))
return 0;
if (SvROK(sv)) {
-#ifdef OVERLOAD
- {
dTHR;
SV* tmpsv;
if (SvAMAGIC(sv) && (tmpsv = AMG_CALLun(sv,bool_)))
- return SvTRUE(tmpsv);
- }
-#endif /* OVERLOAD */
+ return SvTRUE(tmpsv);
return SvRV(sv) != 0;
}
if (SvPOKp(sv)) {
@@ -1822,9 +1810,8 @@ sv_setsv(SV *dstr, register SV *sstr)
dtype = SvTYPE(dstr);
}
-#ifdef OVERLOAD
SvAMAGIC_off(dstr);
-#endif /* OVERLOAD */
+
/* There's a lot of redundancy below but we're going for speed here */
switch (stype) {
@@ -2093,11 +2080,9 @@ sv_setsv(SV *dstr, register SV *sstr)
(void)SvIOK_on(dstr);
SvIVX(dstr) = SvIVX(sstr);
}
-#ifdef OVERLOAD
if (SvAMAGIC(sstr)) {
SvAMAGIC_on(dstr);
}
-#endif /* OVERLOAD */
}
else if (sflags & SVp_POK) {
@@ -2441,7 +2426,6 @@ sv_magic(register SV *sv, SV *obj, int how, char *name, I32 namlen)
case 0:
mg->mg_virtual = &PL_vtbl_sv;
break;
-#ifdef OVERLOAD
case 'A':
mg->mg_virtual = &PL_vtbl_amagic;
break;
@@ -2451,7 +2435,6 @@ sv_magic(register SV *sv, SV *obj, int how, char *name, I32 namlen)
case 'c':
mg->mg_virtual = 0;
break;
-#endif /* OVERLOAD */
case 'B':
mg->mg_virtual = &PL_vtbl_bm;
break;
@@ -3453,9 +3436,8 @@ sv_inc(register SV *sv)
}
if (SvROK(sv)) {
IV i;
-#ifdef OVERLOAD
- if (SvAMAGIC(sv) && AMG_CALLun(sv,inc)) return;
-#endif /* OVERLOAD */
+ if (SvAMAGIC(sv) && AMG_CALLun(sv,inc))
+ return;
i = (IV)SvRV(sv);
sv_unref(sv);
sv_setiv(sv, i);
@@ -3547,9 +3529,8 @@ sv_dec(register SV *sv)
}
if (SvROK(sv)) {
IV i;
-#ifdef OVERLOAD
- if (SvAMAGIC(sv) && AMG_CALLun(sv,dec)) return;
-#endif /* OVERLOAD */
+ if (SvAMAGIC(sv) && AMG_CALLun(sv,dec))
+ return;
i = (IV)SvRV(sv);
sv_unref(sv);
sv_setiv(sv, i);
@@ -4128,9 +4109,7 @@ newSVrv(SV *rv, char *classname)
SvFLAGS(sv) = 0;
SV_CHECK_THINKFIRST(rv);
-#ifdef OVERLOAD
SvAMAGIC_off(rv);
-#endif /* OVERLOAD */
if (SvTYPE(rv) < SVt_RV)
sv_upgrade(rv, SVt_RV);
@@ -4202,12 +4181,10 @@ sv_bless(SV *sv, HV *stash)
(void)SvUPGRADE(tmpRef, SVt_PVMG);
SvSTASH(tmpRef) = (HV*)SvREFCNT_inc(stash);
-#ifdef OVERLOAD
if (Gv_AMG(stash))
SvAMAGIC_on(sv);
else
SvAMAGIC_off(sv);
-#endif /* OVERLOAD */
return sv;
}
diff --git a/sv.h b/sv.h
index 7884aeb332..a08a9c8239 100644
--- a/sv.h
+++ b/sv.h
@@ -147,11 +147,7 @@ struct io {
#define SVf_OK (SVf_IOK|SVf_NOK|SVf_POK|SVf_ROK| \
SVp_IOK|SVp_NOK|SVp_POK)
-#ifdef OVERLOAD
-#define SVf_AMAGIC 0x10000000 /* has magical overloaded methods */
-#else
-#define SVf_AMAGIC 0 /* can be or-ed without effect */
-#endif /* OVERLOAD */
+#define SVf_AMAGIC 0x10000000 /* has magical overloaded methods */
#define PRIVSHIFT 8
@@ -384,10 +380,9 @@ struct xpvio {
#define SvRMAGICAL_on(sv) (SvFLAGS(sv) |= SVs_RMG)
#define SvRMAGICAL_off(sv) (SvFLAGS(sv) &= ~SVs_RMG)
-#ifdef OVERLOAD
-#define SvAMAGIC(sv) (SvFLAGS(sv) & SVf_AMAGIC)
-#define SvAMAGIC_on(sv) (SvFLAGS(sv) |= SVf_AMAGIC)
-#define SvAMAGIC_off(sv) (SvFLAGS(sv) &= ~SVf_AMAGIC)
+#define SvAMAGIC(sv) (SvFLAGS(sv) & SVf_AMAGIC)
+#define SvAMAGIC_on(sv) (SvFLAGS(sv) |= SVf_AMAGIC)
+#define SvAMAGIC_off(sv) (SvFLAGS(sv) &= ~SVf_AMAGIC)
/*
#define Gv_AMG(stash) \
@@ -395,7 +390,6 @@ struct xpvio {
((!HV_AMAGICbad(stash) && HV_AMAGIC(stash)) || Gv_AMupdate(stash)))
*/
#define Gv_AMG(stash) (PL_amagic_generation && Gv_AMupdate(stash))
-#endif /* OVERLOAD */
#define SvTHINKFIRST(sv) (SvFLAGS(sv) & SVf_THINKFIRST)