Move PL_{revision,version,subversion} to perl.h, making them const U8.
authorNicholas Clark <nick@ccl4.org>
Sun, 1 May 2011 13:39:31 +0000 (14:39 +0100)
committerNicholas Clark <nick@ccl4.org>
Sun, 12 Jun 2011 14:15:22 +0000 (16:15 +0200)
To get the initialisation to work, the location of #include patchlevel.h needs
to be moved.

embedvar.h
globvar.sym
perl.h
perlapi.h
perlvars.h

index a6c894a..af58e42 100644 (file)
 #define PL_Gperlio_mutex       (my_vars->Gperlio_mutex)
 #define PL_ppaddr              (my_vars->Gppaddr)
 #define PL_Gppaddr             (my_vars->Gppaddr)
-#define PL_revision            (my_vars->Grevision)
-#define PL_Grevision           (my_vars->Grevision)
 #define PL_runops_dbg          (my_vars->Grunops_dbg)
 #define PL_Grunops_dbg         (my_vars->Grunops_dbg)
 #define PL_runops_std          (my_vars->Grunops_std)
 #define PL_Gsig_trapped                (my_vars->Gsig_trapped)
 #define PL_sigfpe_saved                (my_vars->Gsigfpe_saved)
 #define PL_Gsigfpe_saved       (my_vars->Gsigfpe_saved)
-#define PL_subversion          (my_vars->Gsubversion)
-#define PL_Gsubversion         (my_vars->Gsubversion)
 #define PL_sv_placeholder      (my_vars->Gsv_placeholder)
 #define PL_Gsv_placeholder     (my_vars->Gsv_placeholder)
 #define PL_thr_key             (my_vars->Gthr_key)
 #define PL_Gtimesbase          (my_vars->Gtimesbase)
 #define PL_use_safe_putenv     (my_vars->Guse_safe_putenv)
 #define PL_Guse_safe_putenv    (my_vars->Guse_safe_putenv)
-#define PL_version             (my_vars->Gversion)
-#define PL_Gversion            (my_vars->Gversion)
 #define PL_veto_cleanup                (my_vars->Gveto_cleanup)
 #define PL_Gveto_cleanup       (my_vars->Gveto_cleanup)
 #define PL_watch_pvx           (my_vars->Gwatch_pvx)
 #define PL_Gperlio_fd_refcnt_size      PL_perlio_fd_refcnt_size
 #define PL_Gperlio_mutex       PL_perlio_mutex
 #define PL_Gppaddr             PL_ppaddr
-#define PL_Grevision           PL_revision
 #define PL_Grunops_dbg         PL_runops_dbg
 #define PL_Grunops_std         PL_runops_std
 #ifdef OS2
 #define PL_Gsig_ignoring       PL_sig_ignoring
 #define PL_Gsig_trapped                PL_sig_trapped
 #define PL_Gsigfpe_saved       PL_sigfpe_saved
-#define PL_Gsubversion         PL_subversion
 #define PL_Gsv_placeholder     PL_sv_placeholder
 #define PL_Gthr_key            PL_thr_key
 #define PL_Gtimesbase          PL_timesbase
 #define PL_Guse_safe_putenv    PL_use_safe_putenv
-#define PL_Gversion            PL_version
 #define PL_Gveto_cleanup       PL_veto_cleanup
 #define PL_Gwatch_pvx          PL_watch_pvx
 
index 83e7e1a..9bfdb23 100644 (file)
@@ -41,14 +41,17 @@ ppaddr
 regkind
 reg_name
 reg_extflags_name
+revision
 sig_name
 sig_num
 simple
 simple_bitmask
+subversion
 utf8skip
 uuemap
 varies
 varies_bitmask
+version
 warn_nl
 warn_nosemi
 warn_reserved
diff --git a/perl.h b/perl.h
index 77824d1..0383428 100644 (file)
--- a/perl.h
+++ b/perl.h
@@ -4200,6 +4200,18 @@ extern char **   environ;        /* environment variables supplied via exec */
 #  endif
 #endif
 
+#define PERL_PATCHLEVEL_H_IMPLICIT
+#include "patchlevel.h"
+#undef PERL_PATCHLEVEL_H_IMPLICIT
+
+#define PERL_VERSION_STRING    STRINGIFY(PERL_REVISION) "." \
+                               STRINGIFY(PERL_VERSION) "." \
+                               STRINGIFY(PERL_SUBVERSION)
+
+#define PERL_API_VERSION_STRING        STRINGIFY(PERL_API_REVISION) "." \
+                               STRINGIFY(PERL_API_VERSION) "." \
+                               STRINGIFY(PERL_API_SUBVERSION)
+
 START_EXTERN_C
 
 /* handy constants */
@@ -4263,6 +4275,17 @@ EXTCONST char PL_cshname[]
 #  define PL_cshlen    (sizeof(CSH "") - 1)
 #endif
 
+/* These are baked at compile time into any shared perl library.
+   In future releases this will allow us in main() to sanity test the
+   library we're linking against.  */
+
+EXTCONST U8 PL_revision
+  INIT(PERL_REVISION);
+EXTCONST U8 PL_version
+  INIT(PERL_VERSION);
+EXTCONST U8 PL_subversion
+  INIT(PERL_SUBVERSION);
+
 EXTCONST char PL_uuemap[65]
   INIT("`!\"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\\]^_");
 
@@ -4869,18 +4892,6 @@ typedef struct exitlistentry {
 #  define  FAKE_DEFAULT_SIGNAL_HANDLERS
 #endif
 
-#define PERL_PATCHLEVEL_H_IMPLICIT
-#include "patchlevel.h"
-#undef PERL_PATCHLEVEL_H_IMPLICIT
-
-#define PERL_VERSION_STRING    STRINGIFY(PERL_REVISION) "." \
-                               STRINGIFY(PERL_VERSION) "." \
-                               STRINGIFY(PERL_SUBVERSION)
-
-#define PERL_API_VERSION_STRING        STRINGIFY(PERL_API_REVISION) "." \
-                               STRINGIFY(PERL_API_VERSION) "." \
-                               STRINGIFY(PERL_API_SUBVERSION)
-
 #if !defined(MULTIPLICITY)
 
 struct interpreter {
index fcbc440..7458c67 100644 (file)
--- a/perlapi.h
+++ b/perlapi.h
@@ -147,8 +147,6 @@ END_EXTERN_C
 #define PL_perlio_mutex                (*Perl_Gperlio_mutex_ptr(NULL))
 #undef  PL_ppaddr
 #define PL_ppaddr              (*Perl_Gppaddr_ptr(NULL))
-#undef  PL_revision
-#define PL_revision            (*Perl_Grevision_ptr(NULL))
 #undef  PL_runops_dbg
 #define PL_runops_dbg          (*Perl_Grunops_dbg_ptr(NULL))
 #undef  PL_runops_std
@@ -165,8 +163,6 @@ END_EXTERN_C
 #define PL_sig_trapped         (*Perl_Gsig_trapped_ptr(NULL))
 #undef  PL_sigfpe_saved
 #define PL_sigfpe_saved                (*Perl_Gsigfpe_saved_ptr(NULL))
-#undef  PL_subversion
-#define PL_subversion          (*Perl_Gsubversion_ptr(NULL))
 #undef  PL_sv_placeholder
 #define PL_sv_placeholder      (*Perl_Gsv_placeholder_ptr(NULL))
 #undef  PL_thr_key
@@ -175,8 +171,6 @@ END_EXTERN_C
 #define PL_timesbase           (*Perl_Gtimesbase_ptr(NULL))
 #undef  PL_use_safe_putenv
 #define PL_use_safe_putenv     (*Perl_Guse_safe_putenv_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))
 #undef  PL_watch_pvx
index fb6201e..2facbeb 100644 (file)
@@ -145,15 +145,6 @@ PERLVARI(Gveto_cleanup,    int, FALSE)     /* exit without cleanup */
 PERLVARI(Grunops_std,  runops_proc_t,  Perl_runops_standard)
 PERLVARI(Grunops_dbg,  runops_proc_t,  Perl_runops_debug)
 
-
-/* These are baked at compile time into any shared perl library.
-   In future 5.10.x releases this will allow us in main() to sanity test the
-   library we're linking against.  */
-
-PERLVARI(Grevision,    U8,     PERL_REVISION)
-PERLVARI(Gversion,     U8,     PERL_VERSION)
-PERLVARI(Gsubversion,  U8,     PERL_SUBVERSION)
-
 #if defined(MULTIPLICITY)
 #  define PERL_INTERPRETER_SIZE_UPTO_MEMBER(member)                    \
     STRUCT_OFFSET(struct interpreter, member) +                                \