Subject: | Compilation fails with 5.13.3 |
The discussion has been opened on perl5-porters under the subject line
"branch blead, updated. v5.13.3-20-gcfef31b". It has been suggested that
DBI should switch to PL_* for yes/no/dirty/stack_base.
Since my smokers are currently stalled on everything depending on DBI
I'd like to get a working DBI back. Is the attached patch the right way
to go?
It fixes the compilation issues with perl 5.13.3 and still keeps
compatibility with 5.8.9. I haven't tried older perls.
Thanks,
Subject: | DBI-1.613-ANDK-01.patch |
Common subdirectories: DBI-1.613-bWbBDZ//blib and DBI-1.613-newnew//blib
diff -u DBI-1.613-bWbBDZ//dbipport.h DBI-1.613-newnew//dbipport.h
--- DBI-1.613-bWbBDZ//dbipport.h 2009-09-14 15:24:36.000000000 +0200
+++ DBI-1.613-newnew//dbipport.h 2010-07-29 22:31:52.000000000 +0200
@@ -4103,7 +4103,6 @@
# define PL_debstash debstash
# define PL_defgv defgv
# define PL_diehook diehook
-# define PL_dirty dirty
# define PL_dowarn dowarn
# define PL_errgv errgv
# define PL_error_count error_count
@@ -4120,14 +4119,11 @@
# define PL_perldb perldb
# define PL_rsfp_filters rsfp_filters
# define PL_rsfp rsfp
-# define PL_stack_base stack_base
# define PL_stack_sp stack_sp
# define PL_statcache statcache
# define PL_stdingv stdingv
# define PL_sv_arenaroot sv_arenaroot
-# define PL_sv_no sv_no
# define PL_sv_undef sv_undef
-# define PL_sv_yes sv_yes
# define PL_tainted tainted
# define PL_tainting tainting
# define PL_tokenbuf tokenbuf
Only in DBI-1.613-newnew/: dbiprof
Only in DBI-1.613-newnew/: dbi.prof.prev
Only in DBI-1.613-newnew/: dbiproxy
Only in DBI-1.613-newnew/: dbitrace.log
diff -u DBI-1.613-bWbBDZ//DBI.xs DBI-1.613-newnew//DBI.xs
--- DBI-1.613-bWbBDZ//DBI.xs 2010-07-02 16:14:46.000000000 +0200
+++ DBI-1.613-newnew//DBI.xs 2010-07-29 22:33:31.000000000 +0200
@@ -3430,16 +3430,16 @@
(void)(*CvXSUB(xscv))(aTHXo_ xscv); /* Call the C code directly */
if (gimme == G_SCALAR) { /* Enforce sanity in scalar context */
- if (++markix != PL_stack_sp - stack_base ) {
- if (markix > PL_stack_sp - stack_base)
- *(stack_base + markix) = &PL_sv_undef;
- else *(stack_base + markix) = *PL_stack_sp;
- PL_stack_sp = stack_base + markix;
+ if (++markix != PL_stack_sp - PL_stack_base ) {
+ if (markix > PL_stack_sp - PL_stack_base)
+ *(PL_stack_base + markix) = &PL_sv_undef;
+ else *(PL_stack_base + markix) = *PL_stack_sp;
+ PL_stack_sp = PL_stack_base + markix;
}
outitems = 1;
}
else {
- outitems = PL_stack_sp - (stack_base + markix);
+ outitems = PL_stack_sp - (PL_stack_base + markix);
}
}
@@ -3452,7 +3452,7 @@
/* XXX restore local vars so ST(n) works below */
SP -= outitems;
- ax = (SP - stack_base) + 1;
+ ax = (SP - PL_stack_base) + 1;
#ifdef DBI_save_hv_fetch_ent
if (is_FETCH)
diff -u DBI-1.613-bWbBDZ//Driver.xst DBI-1.613-newnew//Driver.xst
--- DBI-1.613-bWbBDZ//Driver.xst 2009-09-02 12:13:15.000000000 +0200
+++ DBI-1.613-newnew//Driver.xst 2010-07-29 22:30:00.000000000 +0200
@@ -47,7 +47,7 @@
CODE:
D_imp_drh(drh);
if (0) ix = ix; /* avoid unused variable warning */
- ST(0) = dbd_discon_all(drh, imp_drh) ? &sv_yes : &sv_no;
+ ST(0) = dbd_discon_all(drh, imp_drh) ? &PL_sv_yes : &PL_sv_no;
#endif /* dbd_discon_all */
@@ -95,11 +95,11 @@
char *u = (SvOK(username)) ? SvPV(username,lna) : "";
char *p = (SvOK(password)) ? SvPV(password,lna) : "";
#ifdef dbd_db_login6_sv
- ST(0) = dbd_db_login6_sv(dbh, imp_dbh, dbname, username, password, attribs) ? &sv_yes : &sv_no;
+ ST(0) = dbd_db_login6_sv(dbh, imp_dbh, dbname, username, password, attribs) ? &PL_sv_yes : &PL_sv_no;
#elif defined(dbd_db_login6)
- ST(0) = dbd_db_login6(dbh, imp_dbh, SvPV_nolen(dbname), u, p, attribs) ? &sv_yes : &sv_no;
+ ST(0) = dbd_db_login6(dbh, imp_dbh, SvPV_nolen(dbname), u, p, attribs) ? &PL_sv_yes : &PL_sv_no;
#else
- ST(0) = dbd_db_login( dbh, imp_dbh, SvPV_nolen(dbname), u, p) ? &sv_yes : &sv_no;
+ ST(0) = dbd_db_login( dbh, imp_dbh, SvPV_nolen(dbname), u, p) ? &PL_sv_yes : &PL_sv_no;
#endif
}
@@ -274,7 +274,7 @@
D_imp_dbh(dbh);
if (DBIc_has(imp_dbh,DBIcf_AutoCommit) && DBIc_WARN(imp_dbh))
warn("commit ineffective with AutoCommit enabled");
- ST(0) = dbd_db_commit(dbh, imp_dbh) ? &sv_yes : &sv_no;
+ ST(0) = dbd_db_commit(dbh, imp_dbh) ? &PL_sv_yes : &PL_sv_no;
void
@@ -284,7 +284,7 @@
D_imp_dbh(dbh);
if (DBIc_has(imp_dbh,DBIcf_AutoCommit) && DBIc_WARN(imp_dbh))
warn("rollback ineffective with AutoCommit enabled");
- ST(0) = dbd_db_rollback(dbh, imp_dbh) ? &sv_yes : &sv_no;
+ ST(0) = dbd_db_rollback(dbh, imp_dbh) ? &PL_sv_yes : &PL_sv_no;
void
@@ -297,14 +297,14 @@
}
/* Check for disconnect() being called whilst refs to cursors */
/* still exists. This possibly needs some more thought. */
- if (DBIc_ACTIVE_KIDS(imp_dbh) && DBIc_WARN(imp_dbh) && !dirty) {
+ if (DBIc_ACTIVE_KIDS(imp_dbh) && DBIc_WARN(imp_dbh) && !PL_dirty) {
STRLEN lna;
char *plural = (DBIc_ACTIVE_KIDS(imp_dbh)==1) ? "" : "s";
warn("%s->disconnect invalidates %d active statement handle%s %s",
SvPV(dbh,lna), (int)DBIc_ACTIVE_KIDS(imp_dbh), plural,
"(either destroy statement handles or call finish on them before disconnecting)");
}
- ST(0) = dbd_db_disconnect(dbh, imp_dbh) ? &sv_yes : &sv_no;
+ ST(0) = dbd_db_disconnect(dbh, imp_dbh) ? &PL_sv_yes : &PL_sv_no;
DBIc_ACTIVE_off(imp_dbh); /* ensure it's off, regardless */
@@ -317,10 +317,10 @@
D_imp_dbh(dbh);
if (SvGMAGICAL(valuesv))
mg_get(valuesv);
- ST(0) = &sv_yes;
+ ST(0) = &PL_sv_yes;
if (!dbd_db_STORE_attrib(dbh, imp_dbh, keysv, valuesv))
if (!DBIc_DBISTATE(imp_dbh)->set_attr(dbh, keysv, valuesv))
- ST(0) = &sv_no;
+ ST(0) = &PL_sv_no;
void
@@ -341,10 +341,10 @@
PPCODE:
/* keep in sync with default DESTROY in DBI.xs */
D_imp_dbh(dbh);
- ST(0) = &sv_yes;
+ ST(0) = &PL_sv_yes;
if (!DBIc_IMPSET(imp_dbh)) { /* was never fully set up */
STRLEN lna;
- if (DBIc_WARN(imp_dbh) && !dirty && DBIc_DBISTATE(imp_dbh)->debug >= 2)
+ if (DBIc_WARN(imp_dbh) && !PL_dirty && DBIc_DBISTATE(imp_dbh)->debug >= 2)
PerlIO_printf(DBIc_LOGPIO(imp_dbh),
" DESTROY for %s ignored - handle not initialised\n",
SvPV(dbh,lna));
@@ -370,7 +370,7 @@
if (DBIc_WARN(imp_dbh) /* only warn if likely to be useful... */
&& DBIc_is(imp_dbh, DBIcf_Executed) /* has not just called commit/rollback */
/* && !DBIc_is(imp_dbh, DBIcf_ReadOnly) -- is not read only */
- && (!dirty || DBIc_DBISTATE(imp_dbh)->debug >= 3)
+ && (!PL_dirty || DBIc_DBISTATE(imp_dbh)->debug >= 3)
) {
warn("Issuing rollback() due to DESTROY without explicit disconnect() of %s handle %s",
SvPV_nolen(*hv_fetch((HV*)SvRV(dbh), "ImplementorClass", 16, 1)),
@@ -449,9 +449,9 @@
D_imp_sth(sth);
DBD_ATTRIBS_CHECK("_prepare", sth, attribs);
#ifdef dbd_st_prepare_sv
- ST(0) = dbd_st_prepare_sv(sth, imp_sth, statement, attribs) ? &sv_yes : &sv_no;
+ ST(0) = dbd_st_prepare_sv(sth, imp_sth, statement, attribs) ? &PL_sv_yes : &PL_sv_no;
#else
- ST(0) = dbd_st_prepare(sth, imp_sth, SvPV_nolen(statement), attribs) ? &sv_yes : &sv_no;
+ ST(0) = dbd_st_prepare(sth, imp_sth, SvPV_nolen(statement), attribs) ? &PL_sv_yes : &PL_sv_no;
#endif
}
@@ -495,13 +495,13 @@
}
}
switch(dbd_st_bind_col(sth, imp_sth, col, ref, sql_type, attribs)) {
- case 2: ST(0) = &sv_yes; /* job done completely */
+ case 2: ST(0) = &PL_sv_yes; /* job done completely */
break;
case 1: /* fallback to DBI default */
ST(0) = (DBIc_DBISTATE(imp_sth)->bind_col(sth, col, ref, attribs))
- ? &sv_yes : &sv_no;
+ ? &PL_sv_yes : &PL_sv_no;
break;
- default: ST(0) = &sv_no; /* dbd_st_bind_col has called set_err */
+ default: ST(0) = &PL_sv_no; /* dbd_st_bind_col has called set_err */
break;
}
}
@@ -533,7 +533,7 @@
}
}
ST(0) = dbd_bind_ph(sth, imp_sth, param, value, sql_type, attribs, FALSE, 0)
- ? &sv_yes : &sv_no;
+ ? &PL_sv_yes : &PL_sv_no;
}
@@ -568,7 +568,7 @@
}
}
ST(0) = dbd_bind_ph(sth, imp_sth, param, value, sql_type, attribs, TRUE, maxlen)
- ? &sv_yes : &sv_no;
+ ? &PL_sv_yes : &PL_sv_no;
}
@@ -679,9 +679,9 @@
XSRETURN_YES;
}
#ifdef dbd_st_finish3
- ST(0) = dbd_st_finish3(sth, imp_sth, 0) ? &sv_yes : &sv_no;
+ ST(0) = dbd_st_finish3(sth, imp_sth, 0) ? &PL_sv_yes : &PL_sv_no;
#else
- ST(0) = dbd_st_finish(sth, imp_sth) ? &sv_yes : &sv_no;
+ ST(0) = dbd_st_finish(sth, imp_sth) ? &PL_sv_yes : &PL_sv_no;
#endif
@@ -713,10 +713,10 @@
D_imp_sth(sth);
if (SvGMAGICAL(valuesv))
mg_get(valuesv);
- ST(0) = &sv_yes;
+ ST(0) = &PL_sv_yes;
if (!dbd_st_STORE_attrib(sth, imp_sth, keysv, valuesv))
if (!DBIc_DBISTATE(imp_sth)->set_attr(sth, keysv, valuesv))
- ST(0) = &sv_no;
+ ST(0) = &PL_sv_no;
# FETCH renamed and ALIAS'd to avoid case clash on VMS :-(
@@ -742,10 +742,10 @@
PPCODE:
/* keep in sync with default DESTROY in DBI.xs */
D_imp_sth(sth);
- ST(0) = &sv_yes;
+ ST(0) = &PL_sv_yes;
if (!DBIc_IMPSET(imp_sth)) { /* was never fully set up */
STRLEN lna;
- if (DBIc_WARN(imp_sth) && !dirty && DBIc_DBISTATE(imp_sth)->debug >= 2)
+ if (DBIc_WARN(imp_sth) && !PL_dirty && DBIc_DBISTATE(imp_sth)->debug >= 2)
PerlIO_printf(DBIc_LOGPIO(imp_sth),
" DESTROY for %s ignored - handle not initialised\n",
SvPV(sth,lna));
@@ -758,7 +758,7 @@
}
if (DBIc_ACTIVE(imp_sth)) {
D_imp_dbh_from_sth;
- if (!dirty && DBIc_ACTIVE(imp_dbh)) {
+ if (!PL_dirty && DBIc_ACTIVE(imp_dbh)) {
#ifdef dbd_st_finish3
dbd_st_finish3(sth, imp_sth, 1);
#else