From af4954206dfba1b5195f1d962d6a5af92d7efa12 Mon Sep 17 00:00:00 2001 From: Karl Williamson Date: Sat, 6 Jul 2013 14:56:39 -0600 Subject: [PATCH] Reinstate "regcomp.c: Make C-array inversion lists const" This reverts commit 18505f093a44607b687ae5fe644872f835f66313, which reverted 241136e0ed70738cccd6c4b20ce12b26231f30e5, thus reinstating the latter commit. It turns out that the error being chased down was not due to this commit. Its original message was: The inversion lists that are compiled into a C header are now const. --- charclass_invlists.h | 136 +++++++++++++++++++++++++-------------------------- embed.fnc | 2 +- inline_invlist.c | 2 +- proto.h | 2 +- regcomp.c | 2 +- regen/mk_invlists.pl | 4 +- 6 files changed, 74 insertions(+), 74 deletions(-) diff --git a/charclass_invlists.h b/charclass_invlists.h index 00b84bf..b1a6772 100644 --- a/charclass_invlists.h +++ b/charclass_invlists.h @@ -9,9 +9,9 @@ #ifndef PERL_IN_XSUB_RE -static UV Latin1_invlist[] = { +static const UV Latin1_invlist[] = { 2, /* Number of elements */ - 1511554547, /* Version and data structure type */ + 1826693541, /* Version and data structure type */ 0, /* 0 if the list starts at 0; 1 if it starts at the element beyond 0 */ 0, @@ -23,9 +23,9 @@ static UV Latin1_invlist[] = { #ifndef PERL_IN_XSUB_RE -static UV AboveLatin1_invlist[] = { +static const UV AboveLatin1_invlist[] = { 1, /* Number of elements */ - 1511554547, /* Version and data structure type */ + 1826693541, /* Version and data structure type */ 1, /* 0 if the list starts at 0; 1 if it starts at the element beyond 0 */ 0, @@ -36,9 +36,9 @@ static UV AboveLatin1_invlist[] = { #ifndef PERL_IN_XSUB_RE -static UV ASCII_invlist[] = { +static const UV ASCII_invlist[] = { 2, /* Number of elements */ - 1511554547, /* Version and data structure type */ + 1826693541, /* Version and data structure type */ 0, /* 0 if the list starts at 0; 1 if it starts at the element beyond 0 */ 0, @@ -50,9 +50,9 @@ static UV ASCII_invlist[] = { #ifndef PERL_IN_XSUB_RE -static UV L1Cased_invlist[] = { +static const UV L1Cased_invlist[] = { 16, /* Number of elements */ - 1511554547, /* Version and data structure type */ + 1826693541, /* Version and data structure type */ 1, /* 0 if the list starts at 0; 1 if it starts at the element beyond 0 */ 0, @@ -78,9 +78,9 @@ static UV L1Cased_invlist[] = { #ifndef PERL_IN_XSUB_RE -static UV VertSpace_invlist[] = { +static const UV VertSpace_invlist[] = { 6, /* Number of elements */ - 1511554547, /* Version and data structure type */ + 1826693541, /* Version and data structure type */ 1, /* 0 if the list starts at 0; 1 if it starts at the element beyond 0 */ 0, @@ -96,9 +96,9 @@ static UV VertSpace_invlist[] = { #ifndef PERL_IN_XSUB_RE -static UV PerlSpace_invlist[] = { +static const UV PerlSpace_invlist[] = { 4, /* Number of elements */ - 1511554547, /* Version and data structure type */ + 1826693541, /* Version and data structure type */ 1, /* 0 if the list starts at 0; 1 if it starts at the element beyond 0 */ 0, @@ -112,9 +112,9 @@ static UV PerlSpace_invlist[] = { #ifndef PERL_IN_XSUB_RE -static UV XPerlSpace_invlist[] = { +static const UV XPerlSpace_invlist[] = { 22, /* Number of elements */ - 1511554547, /* Version and data structure type */ + 1826693541, /* Version and data structure type */ 1, /* 0 if the list starts at 0; 1 if it starts at the element beyond 0 */ 0, @@ -146,9 +146,9 @@ static UV XPerlSpace_invlist[] = { #ifndef PERL_IN_XSUB_RE -static UV PosixAlnum_invlist[] = { +static const UV PosixAlnum_invlist[] = { 6, /* Number of elements */ - 1511554547, /* Version and data structure type */ + 1826693541, /* Version and data structure type */ 1, /* 0 if the list starts at 0; 1 if it starts at the element beyond 0 */ 0, @@ -164,9 +164,9 @@ static UV PosixAlnum_invlist[] = { #ifndef PERL_IN_XSUB_RE -static UV L1PosixAlnum_invlist[] = { +static const UV L1PosixAlnum_invlist[] = { 18, /* Number of elements */ - 1511554547, /* Version and data structure type */ + 1826693541, /* Version and data structure type */ 1, /* 0 if the list starts at 0; 1 if it starts at the element beyond 0 */ 0, @@ -194,9 +194,9 @@ static UV L1PosixAlnum_invlist[] = { #ifndef PERL_IN_XSUB_RE -static UV PosixAlpha_invlist[] = { +static const UV PosixAlpha_invlist[] = { 4, /* Number of elements */ - 1511554547, /* Version and data structure type */ + 1826693541, /* Version and data structure type */ 1, /* 0 if the list starts at 0; 1 if it starts at the element beyond 0 */ 0, @@ -210,9 +210,9 @@ static UV PosixAlpha_invlist[] = { #ifndef PERL_IN_XSUB_RE -static UV L1PosixAlpha_invlist[] = { +static const UV L1PosixAlpha_invlist[] = { 16, /* Number of elements */ - 1511554547, /* Version and data structure type */ + 1826693541, /* Version and data structure type */ 1, /* 0 if the list starts at 0; 1 if it starts at the element beyond 0 */ 0, @@ -238,9 +238,9 @@ static UV L1PosixAlpha_invlist[] = { #ifndef PERL_IN_XSUB_RE -static UV PosixBlank_invlist[] = { +static const UV PosixBlank_invlist[] = { 4, /* Number of elements */ - 1511554547, /* Version and data structure type */ + 1826693541, /* Version and data structure type */ 1, /* 0 if the list starts at 0; 1 if it starts at the element beyond 0 */ 0, @@ -254,9 +254,9 @@ static UV PosixBlank_invlist[] = { #ifndef PERL_IN_XSUB_RE -static UV XPosixBlank_invlist[] = { +static const UV XPosixBlank_invlist[] = { 18, /* Number of elements */ - 1511554547, /* Version and data structure type */ + 1826693541, /* Version and data structure type */ 1, /* 0 if the list starts at 0; 1 if it starts at the element beyond 0 */ 0, @@ -284,9 +284,9 @@ static UV XPosixBlank_invlist[] = { #ifndef PERL_IN_XSUB_RE -static UV PosixCntrl_invlist[] = { +static const UV PosixCntrl_invlist[] = { 4, /* Number of elements */ - 1511554547, /* Version and data structure type */ + 1826693541, /* Version and data structure type */ 0, /* 0 if the list starts at 0; 1 if it starts at the element beyond 0 */ 0, @@ -300,9 +300,9 @@ static UV PosixCntrl_invlist[] = { #ifndef PERL_IN_XSUB_RE -static UV XPosixCntrl_invlist[] = { +static const UV XPosixCntrl_invlist[] = { 4, /* Number of elements */ - 1511554547, /* Version and data structure type */ + 1826693541, /* Version and data structure type */ 0, /* 0 if the list starts at 0; 1 if it starts at the element beyond 0 */ 0, @@ -316,9 +316,9 @@ static UV XPosixCntrl_invlist[] = { #ifndef PERL_IN_XSUB_RE -static UV PosixDigit_invlist[] = { +static const UV PosixDigit_invlist[] = { 2, /* Number of elements */ - 1511554547, /* Version and data structure type */ + 1826693541, /* Version and data structure type */ 1, /* 0 if the list starts at 0; 1 if it starts at the element beyond 0 */ 0, @@ -330,9 +330,9 @@ static UV PosixDigit_invlist[] = { #ifndef PERL_IN_XSUB_RE -static UV PosixGraph_invlist[] = { +static const UV PosixGraph_invlist[] = { 2, /* Number of elements */ - 1511554547, /* Version and data structure type */ + 1826693541, /* Version and data structure type */ 1, /* 0 if the list starts at 0; 1 if it starts at the element beyond 0 */ 0, @@ -344,9 +344,9 @@ static UV PosixGraph_invlist[] = { #ifndef PERL_IN_XSUB_RE -static UV L1PosixGraph_invlist[] = { +static const UV L1PosixGraph_invlist[] = { 4, /* Number of elements */ - 1511554547, /* Version and data structure type */ + 1826693541, /* Version and data structure type */ 1, /* 0 if the list starts at 0; 1 if it starts at the element beyond 0 */ 0, @@ -360,9 +360,9 @@ static UV L1PosixGraph_invlist[] = { #ifndef PERL_IN_XSUB_RE -static UV PosixLower_invlist[] = { +static const UV PosixLower_invlist[] = { 2, /* Number of elements */ - 1511554547, /* Version and data structure type */ + 1826693541, /* Version and data structure type */ 1, /* 0 if the list starts at 0; 1 if it starts at the element beyond 0 */ 0, @@ -374,9 +374,9 @@ static UV PosixLower_invlist[] = { #ifndef PERL_IN_XSUB_RE -static UV L1PosixLower_invlist[] = { +static const UV L1PosixLower_invlist[] = { 12, /* Number of elements */ - 1511554547, /* Version and data structure type */ + 1826693541, /* Version and data structure type */ 1, /* 0 if the list starts at 0; 1 if it starts at the element beyond 0 */ 0, @@ -398,9 +398,9 @@ static UV L1PosixLower_invlist[] = { #ifndef PERL_IN_XSUB_RE -static UV PosixPrint_invlist[] = { +static const UV PosixPrint_invlist[] = { 2, /* Number of elements */ - 1511554547, /* Version and data structure type */ + 1826693541, /* Version and data structure type */ 1, /* 0 if the list starts at 0; 1 if it starts at the element beyond 0 */ 0, @@ -412,9 +412,9 @@ static UV PosixPrint_invlist[] = { #ifndef PERL_IN_XSUB_RE -static UV L1PosixPrint_invlist[] = { +static const UV L1PosixPrint_invlist[] = { 4, /* Number of elements */ - 1511554547, /* Version and data structure type */ + 1826693541, /* Version and data structure type */ 1, /* 0 if the list starts at 0; 1 if it starts at the element beyond 0 */ 0, @@ -428,9 +428,9 @@ static UV L1PosixPrint_invlist[] = { #ifndef PERL_IN_XSUB_RE -static UV PosixPunct_invlist[] = { +static const UV PosixPunct_invlist[] = { 8, /* Number of elements */ - 1511554547, /* Version and data structure type */ + 1826693541, /* Version and data structure type */ 1, /* 0 if the list starts at 0; 1 if it starts at the element beyond 0 */ 0, @@ -448,9 +448,9 @@ static UV PosixPunct_invlist[] = { #ifndef PERL_IN_XSUB_RE -static UV L1PosixPunct_invlist[] = { +static const UV L1PosixPunct_invlist[] = { 20, /* Number of elements */ - 1511554547, /* Version and data structure type */ + 1826693541, /* Version and data structure type */ 1, /* 0 if the list starts at 0; 1 if it starts at the element beyond 0 */ 0, @@ -480,9 +480,9 @@ static UV L1PosixPunct_invlist[] = { #ifndef PERL_IN_XSUB_RE -static UV PosixSpace_invlist[] = { +static const UV PosixSpace_invlist[] = { 4, /* Number of elements */ - 1511554547, /* Version and data structure type */ + 1826693541, /* Version and data structure type */ 1, /* 0 if the list starts at 0; 1 if it starts at the element beyond 0 */ 0, @@ -496,9 +496,9 @@ static UV PosixSpace_invlist[] = { #ifndef PERL_IN_XSUB_RE -static UV XPosixSpace_invlist[] = { +static const UV XPosixSpace_invlist[] = { 22, /* Number of elements */ - 1511554547, /* Version and data structure type */ + 1826693541, /* Version and data structure type */ 1, /* 0 if the list starts at 0; 1 if it starts at the element beyond 0 */ 0, @@ -530,9 +530,9 @@ static UV XPosixSpace_invlist[] = { #ifndef PERL_IN_XSUB_RE -static UV PosixUpper_invlist[] = { +static const UV PosixUpper_invlist[] = { 2, /* Number of elements */ - 1511554547, /* Version and data structure type */ + 1826693541, /* Version and data structure type */ 1, /* 0 if the list starts at 0; 1 if it starts at the element beyond 0 */ 0, @@ -544,9 +544,9 @@ static UV PosixUpper_invlist[] = { #ifndef PERL_IN_XSUB_RE -static UV L1PosixUpper_invlist[] = { +static const UV L1PosixUpper_invlist[] = { 6, /* Number of elements */ - 1511554547, /* Version and data structure type */ + 1826693541, /* Version and data structure type */ 1, /* 0 if the list starts at 0; 1 if it starts at the element beyond 0 */ 0, @@ -562,9 +562,9 @@ static UV L1PosixUpper_invlist[] = { #ifndef PERL_IN_XSUB_RE -static UV PosixWord_invlist[] = { +static const UV PosixWord_invlist[] = { 8, /* Number of elements */ - 1511554547, /* Version and data structure type */ + 1826693541, /* Version and data structure type */ 1, /* 0 if the list starts at 0; 1 if it starts at the element beyond 0 */ 0, @@ -582,9 +582,9 @@ static UV PosixWord_invlist[] = { #ifndef PERL_IN_XSUB_RE -static UV L1PosixWord_invlist[] = { +static const UV L1PosixWord_invlist[] = { 20, /* Number of elements */ - 1511554547, /* Version and data structure type */ + 1826693541, /* Version and data structure type */ 1, /* 0 if the list starts at 0; 1 if it starts at the element beyond 0 */ 0, @@ -614,9 +614,9 @@ static UV L1PosixWord_invlist[] = { #ifndef PERL_IN_XSUB_RE -static UV PosixXDigit_invlist[] = { +static const UV PosixXDigit_invlist[] = { 6, /* Number of elements */ - 1511554547, /* Version and data structure type */ + 1826693541, /* Version and data structure type */ 1, /* 0 if the list starts at 0; 1 if it starts at the element beyond 0 */ 0, @@ -632,9 +632,9 @@ static UV PosixXDigit_invlist[] = { #ifndef PERL_IN_XSUB_RE -static UV XPosixXDigit_invlist[] = { +static const UV XPosixXDigit_invlist[] = { 12, /* Number of elements */ - 1511554547, /* Version and data structure type */ + 1826693541, /* Version and data structure type */ 1, /* 0 if the list starts at 0; 1 if it starts at the element beyond 0 */ 0, @@ -654,9 +654,9 @@ static UV XPosixXDigit_invlist[] = { #endif -static UV NonL1_Perl_Non_Final_Folds_invlist[] = { +static const UV NonL1_Perl_Non_Final_Folds_invlist[] = { 44, /* Number of elements */ - 1511554547, /* Version and data structure type */ + 1826693541, /* Version and data structure type */ 1, /* 0 if the list starts at 0; 1 if it starts at the element beyond 0 */ 0, @@ -708,9 +708,9 @@ static UV NonL1_Perl_Non_Final_Folds_invlist[] = { #ifndef PERL_IN_XSUB_RE -static UV _Perl_Multi_Char_Folds_invlist[] = { +static const UV _Perl_Multi_Char_Folds_invlist[] = { 58, /* Number of elements */ - 1511554547, /* Version and data structure type */ + 1826693541, /* Version and data structure type */ 1, /* 0 if the list starts at 0; 1 if it starts at the element beyond 0 */ 0, diff --git a/embed.fnc b/embed.fnc index a901b99..1ef5935 100644 --- a/embed.fnc +++ b/embed.fnc @@ -1088,7 +1088,7 @@ Ap |SV* |regclass_swash |NULLOK const regexp *prog \ |NN const struct regnode *node|bool doinit \ |NULLOK SV **listsvp|NULLOK SV **altsvp #ifdef PERL_IN_REGCOMP_C -EMsR |SV* |_new_invlist_C_array|NN UV* list +EMsR |SV* |_new_invlist_C_array|NN const UV* const list : Not used currently: EXMs |bool |_invlistEQ |NN SV* const a|NN SV* const b|const bool complement_b #endif Ap |I32 |pregexec |NN REGEXP * const prog|NN char* stringarg \ diff --git a/inline_invlist.c b/inline_invlist.c index 936a298..c6bc47e 100644 --- a/inline_invlist.c +++ b/inline_invlist.c @@ -16,7 +16,7 @@ * in the range 2**31-1 should be generated. Then, if an auxiliary program * doesn't change correspondingly, it will be discovered immediately */ #define INVLIST_VERSION_ID_OFFSET 1 -#define INVLIST_VERSION_ID 1511554547 +#define INVLIST_VERSION_ID 1826693541 #define INVLIST_OFFSET_OFFSET 2 /* 0 or 1 */ /* The UV at this position contains either 0 or 1. If 0, the inversion list diff --git a/proto.h b/proto.h index 4ece709..eb2c7c1 100644 --- a/proto.h +++ b/proto.h @@ -6439,7 +6439,7 @@ PERL_STATIC_INLINE UV* S__invlist_array_init(pTHX_ SV* const invlist, const bool #define PERL_ARGS_ASSERT__INVLIST_ARRAY_INIT \ assert(invlist) -STATIC SV* S__new_invlist_C_array(pTHX_ UV* list) +STATIC SV* S__new_invlist_C_array(pTHX_ const UV* const list) __attribute__warn_unused_result__ __attribute__nonnull__(pTHX_1); #define PERL_ARGS_ASSERT__NEW_INVLIST_C_ARRAY \ diff --git a/regcomp.c b/regcomp.c index c029ca2..9637212 100644 --- a/regcomp.c +++ b/regcomp.c @@ -7239,7 +7239,7 @@ Perl__new_invlist(pTHX_ IV initial_size) #endif STATIC SV* -S__new_invlist_C_array(pTHX_ UV* list) +S__new_invlist_C_array(pTHX_ const UV* const list) { /* Return a pointer to a newly constructed inversion list, initialized to * point to , which has to be in the exact correct inversion list diff --git a/regen/mk_invlists.pl b/regen/mk_invlists.pl index d9f3d59..c1caf4f 100644 --- a/regen/mk_invlists.pl +++ b/regen/mk_invlists.pl @@ -15,7 +15,7 @@ require 'regen/regen_lib.pl'; # in the headers is used to minimize the possibility of things getting # out-of-sync, or the wrong data structure being passed. Currently that # random number is: -my $VERSION_DATA_STRUCTURE_TYPE = 1511554547; +my $VERSION_DATA_STRUCTURE_TYPE = 1826693541; my $out_fh = open_new('charclass_invlists.h', '>', {style => '*', by => $0, @@ -50,7 +50,7 @@ sub output_invlist ($$) { } print $out_fh "\n#ifndef PERL_IN_XSUB_RE\n" unless exists $include_in_ext_re{$name}; - print $out_fh "\nstatic UV ${name}_invlist[] = {\n"; + print $out_fh "\nstatic const UV ${name}_invlist[] = {\n"; print $out_fh "\t$count,\t/* Number of elements */\n"; print $out_fh "\t$VERSION_DATA_STRUCTURE_TYPE, /* Version and data structure type */\n"; -- 2.7.4