Change 33180 by [EMAIL PROTECTED] on 2008/02/01 22:57:38

        Integrate:
        [ 31697]
        SWIG uses XS() like this (in the perlrun.swg template):
        
        typedef XS(SwigPerlWrapper);
        typedef SwigPerlWrapper *SwigPerlWrapperPtr;
        
        This breaks if XS() includes the 'extern "C"' decoration under C++.
        The appended patch provides an XSPROTO() macro that could be used
        by SWIG instead.
        
        (Patch from Jan Dubois to fix breakage caused by #28734.)
        
        [ 32241]
        Subject: [PATCH] Bug fix for storing shared objects in shared structures
        From: "Jerry D. Hedden" <[EMAIL PROTECTED]>
        Date: Tue, 6 Nov 2007 14:36:40 -0500
        Message-ID: <[EMAIL PROTECTED]>
        
        (core patch only)

Affected files ...

... //depot/maint-5.8/perl/XSUB.h#42 integrate
... //depot/maint-5.8/perl/embed.fnc#239 integrate
... //depot/maint-5.8/perl/embed.h#182 integrate
... //depot/maint-5.8/perl/embedvar.h#66 integrate
... //depot/maint-5.8/perl/global.sym#77 integrate
... //depot/maint-5.8/perl/intrpvar.h#56 integrate
... //depot/maint-5.8/perl/perl.h#175 integrate
... //depot/maint-5.8/perl/perlapi.h#58 integrate
... //depot/maint-5.8/perl/pod/perlapi.pod#114 integrate
... //depot/maint-5.8/perl/proto.h#229 integrate
... //depot/maint-5.8/perl/sv.c#374 integrate
... //depot/maint-5.8/perl/sv.h#86 integrate
... //depot/maint-5.8/perl/util.c#160 integrate

Differences ...

==== //depot/maint-5.8/perl/XSUB.h#42 (text) ====
Index: perl/XSUB.h
--- perl/XSUB.h#41~32368~       2007-11-17 07:06:50.000000000 -0800
+++ perl/XSUB.h 2008-02-01 14:57:38.000000000 -0800
@@ -96,16 +96,28 @@
 
 #define ST(off) PL_stack_base[ax + (off)]
 
+/* XSPROTO() is also used by SWIG like this:
+ *
+ *     typedef XSPROTO(SwigPerlWrapper);
+ *     typedef SwigPerlWrapper *SwigPerlWrapperPtr;
+ *
+ * This code needs to be compilable under both C and C++.
+ *
+ * Don't forget to change the __attribute__unused__ version of XS()
+ * below too if you change XSPROTO() here.
+ */
+#define XSPROTO(name) void name(pTHX_ CV* cv)
+
 #if defined(__CYGWIN__) && defined(USE_DYNAMIC_LOADING)
-#  define XS(name) __declspec(dllexport) void name(pTHX_ CV* cv)
+#  define XS(name) __declspec(dllexport) XSPROTO(name)
 #else
 #  if defined(HASATTRIBUTE_UNUSED) && !defined(__cplusplus)
 #    define XS(name) void name(pTHX_ CV* cv __attribute__unused__)
 #  else
 #    ifdef __cplusplus
-#      define XS(name) extern "C" void name(pTHX_ CV* cv)
+#      define XS(name) extern "C" XSPROTO(name)
 #    else
-#      define XS(name) void name(pTHX_ CV* cv)
+#      define XS(name) XSPROTO(name)
 #    endif
 #  endif
 #endif

==== //depot/maint-5.8/perl/embed.fnc#239 (text) ====
Index: perl/embed.fnc
--- perl/embed.fnc#238~33177~   2008-02-01 13:32:02.000000000 -0800
+++ perl/embed.fnc      2008-02-01 14:57:38.000000000 -0800
@@ -1073,6 +1073,7 @@
 
 Adp    |void   |sv_nosharing   |NULLOK SV *sv
 Adpbm  |void   |sv_nolocking   |NULLOK SV *sv
+Adp    |bool   |sv_destroyable |NULLOK SV *sv
 #ifdef NO_MATHOMS
 Adpbm  |void   |sv_nounlocking |NULLOK SV *sv
 #else

==== //depot/maint-5.8/perl/embed.h#182 (text+w) ====
Index: perl/embed.h
--- perl/embed.h#181~33168~     2008-02-01 08:10:22.000000000 -0800
+++ perl/embed.h        2008-02-01 14:57:38.000000000 -0800
@@ -1071,6 +1071,7 @@
 #define custom_op_name         Perl_custom_op_name
 #define custom_op_desc         Perl_custom_op_desc
 #define sv_nosharing           Perl_sv_nosharing
+#define sv_destroyable         Perl_sv_destroyable
 #ifdef NO_MATHOMS
 #else
 #define sv_nounlocking         Perl_sv_nounlocking
@@ -3194,6 +3195,7 @@
 #define custom_op_name(a)      Perl_custom_op_name(aTHX_ a)
 #define custom_op_desc(a)      Perl_custom_op_desc(aTHX_ a)
 #define sv_nosharing(a)                Perl_sv_nosharing(aTHX_ a)
+#define sv_destroyable(a)      Perl_sv_destroyable(aTHX_ a)
 #ifdef NO_MATHOMS
 #else
 #define sv_nounlocking(a)      Perl_sv_nounlocking(aTHX_ a)

==== //depot/maint-5.8/perl/embedvar.h#66 (text+w) ====
Index: perl/embedvar.h
--- perl/embedvar.h#65~32544~   2007-11-28 15:06:16.000000000 -0800
+++ perl/embedvar.h     2008-02-01 14:57:38.000000000 -0800
@@ -578,6 +578,7 @@
 #define PL_debug_pad           (vTHX->Idebug_pad)
 #define PL_def_layerlist       (vTHX->Idef_layerlist)
 #define PL_defgv               (vTHX->Idefgv)
+#define PL_destroyhook         (vTHX->Idestroyhook)
 #define PL_diehook             (vTHX->Idiehook)
 #define PL_doextract           (vTHX->Idoextract)
 #define PL_doswitches          (vTHX->Idoswitches)
@@ -912,6 +913,7 @@
 #define PL_Idebug_pad          PL_debug_pad
 #define PL_Idef_layerlist      PL_def_layerlist
 #define PL_Idefgv              PL_defgv
+#define PL_Idestroyhook                PL_destroyhook
 #define PL_Idiehook            PL_diehook
 #define PL_Idoextract          PL_doextract
 #define PL_Idoswitches         PL_doswitches
@@ -1482,8 +1484,8 @@
 #define PL_sv_placeholder      (PL_Vars.Gsv_placeholder)
 #define PL_thr_key             (PL_Vars.Gthr_key)
 #define PL_use_safe_putenv     (PL_Vars.Guse_safe_putenv)
-#define PL_veto_cleanup                (PL_Vars.Gveto_cleanup)
 #define PL_version             (PL_Vars.Gversion)
+#define PL_veto_cleanup                (PL_Vars.Gveto_cleanup)
 
 #else /* !PERL_GLOBAL_STRUCT */
 
@@ -1509,8 +1511,8 @@
 #define PL_Gsv_placeholder     PL_sv_placeholder
 #define PL_Gthr_key            PL_thr_key
 #define PL_Guse_safe_putenv    PL_use_safe_putenv
-#define PL_Gveto_cleanup       PL_veto_cleanup
 #define PL_Gversion            PL_version
+#define PL_Gveto_cleanup       PL_veto_cleanup
 
 #endif /* PERL_GLOBAL_STRUCT */
 

==== //depot/maint-5.8/perl/global.sym#77 (text+w) ====
Index: perl/global.sym
--- perl/global.sym#76~32553~   2007-11-29 08:00:15.000000000 -0800
+++ perl/global.sym     2008-02-01 14:57:38.000000000 -0800
@@ -664,6 +664,7 @@
 Perl_custom_op_desc
 Perl_sv_nosharing
 Perl_sv_nolocking
+Perl_sv_destroyable
 Perl_sv_nounlocking
 Perl_nothreadhook
 Perl_Slab_Alloc

==== //depot/maint-5.8/perl/intrpvar.h#56 (text) ====
Index: perl/intrpvar.h
--- perl/intrpvar.h#55~32471~   2007-11-23 13:59:05.000000000 -0800
+++ perl/intrpvar.h     2008-02-01 14:57:38.000000000 -0800
@@ -620,11 +620,14 @@
 PERLVARA(Ibody_roots, PERL_ARENA_ROOTS_SIZE, void*) /* array of body roots */
 PERLVAR(Ibody_arenas, void*) /* pointer to list of body-arenas */
 
+/* Can shared object be destroyed */
+PERLVARI(Idestroyhook, destroyable_proc_t, MEMBER_TO_FPTR(Perl_sv_destroyable))
+
 /* The last unconditional member of the interpreter structure when 5.8.9 was
    released. The offset of the end of this is baked into a global variable in 
    any shared perl library which will allow a sanity test in future perl
    releases.  */
-#define PERL_LAST_5_8_9_INTERP_MEMBER  Ibody_arenas
+#define PERL_LAST_5_8_9_INTERP_MEMBER  Idestroyhook
 
 #if !defined(USE_THREADS)
 PERLVAR(Iptr_table,    PTR_TBL_t*)

==== //depot/maint-5.8/perl/perl.h#175 (text) ====
Index: perl/perl.h
--- perl/perl.h#174~33168~      2008-02-01 08:10:22.000000000 -0800
+++ perl/perl.h 2008-02-01 14:57:38.000000000 -0800
@@ -3915,6 +3915,7 @@
 typedef void (CPERLscope(*share_proc_t)) (pTHX_ SV *sv);
 typedef int  (CPERLscope(*thrhook_proc_t)) (pTHX);
 typedef OP* (CPERLscope(*PPADDR_t)[]) (pTHX);
+typedef bool (CPERLscope(*destroyable_proc_t)) (pTHX_ SV *sv);
 
 /* _ (for $_) must be first in the following list (DEFSV requires it) */
 #define THREADSV_NAMES "_123456789&`'+/.,\\\";^-%=|~:\001\005!@"

==== //depot/maint-5.8/perl/perlapi.h#58 (text+w) ====
Index: perl/perlapi.h
--- perl/perlapi.h#57~32544~    2007-11-28 15:06:16.000000000 -0800
+++ perl/perlapi.h      2008-02-01 14:57:38.000000000 -0800
@@ -233,6 +233,8 @@
 #define PL_def_layerlist       (*Perl_Idef_layerlist_ptr(aTHX))
 #undef  PL_defgv
 #define PL_defgv               (*Perl_Idefgv_ptr(aTHX))
+#undef  PL_destroyhook
+#define PL_destroyhook         (*Perl_Idestroyhook_ptr(aTHX))
 #undef  PL_diehook
 #define PL_diehook             (*Perl_Idiehook_ptr(aTHX))
 #undef  PL_doextract
@@ -1073,10 +1075,10 @@
 #define PL_thr_key             (*Perl_Gthr_key_ptr(NULL))
 #undef  PL_use_safe_putenv
 #define PL_use_safe_putenv     (*Perl_Guse_safe_putenv_ptr(NULL))
-#undef  PL_veto_cleanup
-#define PL_veto_cleanup                (*Perl_Gveto_cleanup_ptr(NULL))
 #undef  PL_version
 #define PL_version             (*Perl_Gversion_ptr(NULL))
+#undef  PL_veto_cleanup
+#define PL_veto_cleanup                (*Perl_Gveto_cleanup_ptr(NULL))
 
 #endif /* !PERL_CORE */
 #endif /* MULTIPLICITY */

==== //depot/maint-5.8/perl/pod/perlapi.pod#114 (text+w) ====
Index: perl/pod/perlapi.pod
--- perl/pod/perlapi.pod#113~32553~     2007-11-29 08:00:15.000000000 -0800
+++ perl/pod/perlapi.pod        2008-02-01 14:57:38.000000000 -0800
@@ -2606,6 +2606,19 @@
 =for hackers
 Found in file handy.h
 
+=item sv_destroyable
+X<sv_destroyable>
+
+Dummy routine which reports that object can be destroyed when there is no
+sharing module present.  It ignores its single SV argument, and returns
+'true'.  Exists to avoid test for a NULL function pointer and because it
+could potentially warn under some level of strict-ness.
+
+       bool    sv_destroyable(SV *sv)
+
+=for hackers
+Found in file util.c
+
 =item sv_nosharing
 X<sv_nosharing>
 

==== //depot/maint-5.8/perl/proto.h#229 (text+w) ====
Index: perl/proto.h
--- perl/proto.h#228~33177~     2008-02-01 13:32:02.000000000 -0800
+++ perl/proto.h        2008-02-01 14:57:38.000000000 -0800
@@ -1550,6 +1550,7 @@
 
 PERL_CALLCONV void     Perl_sv_nosharing(pTHX_ SV *sv);
 /* PERL_CALLCONV void  Perl_sv_nolocking(pTHX_ SV *sv); */
+PERL_CALLCONV bool     Perl_sv_destroyable(pTHX_ SV *sv);
 #ifdef NO_MATHOMS
 /* PERL_CALLCONV void  Perl_sv_nounlocking(pTHX_ SV *sv); */
 #else

==== //depot/maint-5.8/perl/sv.c#374 (text) ====
Index: perl/sv.c
--- perl/sv.c#373~33176~        2008-02-01 13:03:39.000000000 -0800
+++ perl/sv.c   2008-02-01 14:57:38.000000000 -0800
@@ -4572,7 +4572,9 @@
     }
 
     if (SvOBJECT(sv)) {
-       if (PL_defstash) {              /* Still have a symbol table? */
+       if (PL_defstash &&      /* Still have a symbol table? */
+           SvDESTROYABLE(sv))
+       {
            dSP;
            do {        
                CV* destructor;
@@ -10923,6 +10925,7 @@
     PL_lockhook                = proto_perl->Ilockhook;
     PL_unlockhook      = proto_perl->Iunlockhook;
     PL_threadhook      = proto_perl->Ithreadhook;
+    PL_destroyhook     = proto_perl->Idestroyhook;
 
     PL_runops_std      = proto_perl->Irunops_std;
     PL_runops_dbg      = proto_perl->Irunops_dbg;

==== //depot/maint-5.8/perl/sv.h#86 (text) ====
Index: perl/sv.h
--- perl/sv.h#85~32397~ 2007-11-18 14:57:47.000000000 -0800
+++ perl/sv.h   2008-02-01 14:57:38.000000000 -0800
@@ -1537,6 +1537,7 @@
 #define SvSHARE(sv) CALL_FPTR(PL_sharehook)(aTHX_ sv)
 #define SvLOCK(sv) CALL_FPTR(PL_lockhook)(aTHX_ sv)
 #define SvUNLOCK(sv) CALL_FPTR(PL_unlockhook)(aTHX_ sv)
+#define SvDESTROYABLE(sv) CALL_FPTR(PL_destroyhook)(aTHX_ sv)
 
 #define SvGETMAGIC(x) STMT_START { if (SvGMAGICAL(x)) mg_get(x); } STMT_END
 #define SvSETMAGIC(x) STMT_START { if (SvSMAGICAL(x)) mg_set(x); } STMT_END

==== //depot/maint-5.8/perl/util.c#160 (text) ====
Index: perl/util.c
--- perl/util.c#159~32983~      2008-01-16 06:41:22.000000000 -0800
+++ perl/util.c 2008-02-01 14:57:38.000000000 -0800
@@ -4664,6 +4664,26 @@
     PERL_UNUSED_ARG(sv);
 }
 
+/*
+
+=for apidoc sv_destroyable
+
+Dummy routine which reports that object can be destroyed when there is no
+sharing module present.  It ignores its single SV argument, and returns
+'true'.  Exists to avoid test for a NULL function pointer and because it
+could potentially warn under some level of strict-ness.
+
+=cut
+*/
+
+bool
+Perl_sv_destroyable(pTHX_ SV *sv)
+{
+    PERL_UNUSED_CONTEXT;
+    PERL_UNUSED_ARG(sv);
+    return TRUE;
+}
+
 U32
 Perl_parse_unicode_opts(pTHX_ char **popt)
 {
End of Patch.

Reply via email to