From 4aa0a1f7324b8447469670a1b2427c3ac2428bae Mon Sep 17 00:00:00 2001 From: Andy Dougherty Date: Tue, 6 Jun 1995 01:41:07 +0000 Subject: [PATCH] This is my patch patch.1l for perl5.001. To apply, change to your perl directory, run the command above, then apply with patch -p1 -N < thispatch. This patch fixes all the Configure & build problems for which I have a solution. After you apply this patch, I would recommend: make distclean # or at the very least rm config.sh sh Configure [whatever options you use] make depend make make test Patch and enjoy, Andy Dougherty doughera@lafcol.lafayette.edu Dept. of Physics Lafayette College, Easton PA 18042 Here are the file-by-file contents: Changes.Conf Updated a bit. Configure Now honors hints on -related things (for CX/UX, in particular). Now honors previous values of d_stdio_ptr_lval and d_stdio_cnt_lval. DB test programs now conditionally include 'const'. MANIFEST Updated. config_H Updated. config_h.SH Include trailing /**/ on STDIO_..._LVALUE defines. hints/cxux.sh Simplified. Include info about failing test. hints/epix.sh A guess at a dynamic loading fix. hints/next_3.sh Add a few comments. lib/Benchmark.pm Ensure numeric context on number of loop iterations. op.c Spider's padlex and goto &$nonesuch patches. perl.c fputs("\tUnofficial patchlevel 1l.\n",stdout); pp_ctl.c pp_hot.c scope.c Spider's padlex and goto &$nonesuch patches. --- Changes.Conf | 24 ++++++--- Configure | 105 ++++++++++++++++++++++++++------------- MANIFEST | 2 +- config_H | 6 +-- config_h.SH | 4 +- hints/cxux.sh | 33 ++++-------- hints/epix.sh | 2 + hints/{next_3_2.sh => next_3.sh} | 5 +- lib/Benchmark.pm | 7 ++- op.c | 3 +- perl.c | 2 +- pp_ctl.c | 13 ++++- pp_hot.c | 4 +- scope.c | 8 +-- 14 files changed, 137 insertions(+), 81 deletions(-) rename hints/{next_3_2.sh => next_3.sh} (93%) diff --git a/Changes.Conf b/Changes.Conf index a897e13..cfff8a1 100644 --- a/Changes.Conf +++ b/Changes.Conf @@ -22,6 +22,22 @@ This is a brief summary of the most important changes: Many hint file updates. +Upgrade Traps and Pitfalls: + +Since a lot has changed in the build process, you are probably best off +starting with a fresh copy of the perl5.002 sources. In particular, +your 5.000 or 5.001 config.sh will contain several variables that are no +longer needed. Further, improvements in the Configure tests may mean +that some of the answers will be different than they were in previous +versions, and which answer to keep can be difficult to sort out. +Therefore, you are probably better off ignoring your old config.sh, as +in the following: + + make distclean # (if you've built perl before) + sh Configure [whatever options you like] + make depend + make + make test ------------- Version 5.001 @@ -121,11 +137,3 @@ The following is the sequence of steps to upgrade to 5.001: make install - - - - - - - - diff --git a/Configure b/Configure index bf08892..6148149 100755 --- a/Configure +++ b/Configure @@ -20,7 +20,7 @@ # $Id: Head.U,v 3.0.1.7 1995/03/21 08:46:15 ram Exp $ # -# Generated on Mon Jun 5 12:18:53 EDT 1995 [metaconfig 3.0 PL55] +# Generated on Tue Jun 6 12:25:20 EDT 1995 [metaconfig 3.0 PL55] cat >/tmp/c1$$ < found." >&4 +: see if this is a pwd.h system +set pwd.h i_pwd +eval $inhdr + +case "$i_pwd" in +$define) + xxx=`./findhdr pwd.h` $cppstdin $cppflags $cppminus < $xxx >$$.h + if $contains 'pw_quota' $$.h >/dev/null 2>&1; then - d_pwquota="$define" + val="$define" else - d_pwquota="$undef" + val="$undef" fi + set d_pwquota + eval $setvar + if $contains 'pw_age' $$.h >/dev/null 2>&1; then - d_pwage="$define" + val="$define" else - d_pwage="$undef" + val="$undef" fi + set d_pwage + eval $setvar + if $contains 'pw_change' $$.h >/dev/null 2>&1; then - d_pwchange="$define" + val="$define" else - d_pwchange="$undef" + val="$undef" fi + set d_pwchange + eval $setvar + if $contains 'pw_class' $$.h >/dev/null 2>&1; then - d_pwclass="$define" + val="$define" else - d_pwclass="$undef" + val="$undef" fi + set d_pwclass + eval $setvar + if $contains 'pw_expire' $$.h >/dev/null 2>&1; then - d_pwexpire="$define" + val="$define" else - d_pwexpire="$undef" + val="$undef" fi + set d_pwexpire + eval $setvar + if $contains 'pw_comment' $$.h >/dev/null 2>&1; then - d_pwcomment="$define" + val="$define" else - d_pwcomment="$undef" + val="$undef" fi + set d_pwcomment + eval $setvar + $rm -f $$.h -else - i_pwd="$undef" - d_pwquota="$undef" - d_pwage="$undef" - d_pwchange="$undef" - d_pwclass="$undef" - d_pwexpire="$undef" - d_pwcomment="$undef" - echo " NOT found." >&4 -fi + ;; +*) + val="$undef"; + set d_pwquota; eval $setvar + set d_pwage; eval $setvar + set d_pwchange; eval $setvar + set d_pwclass; eval $setvar + set d_pwexpire; eval $setvar + set d_pwcomment; eval $setvar + ;; +esac : see if readdir and friends exist set readdir d_readdir @@ -5615,11 +5636,15 @@ if $contains '_IO_fpos_t' `./findhdr stdio.h` >/dev/null 2>&1 ; then '') stdio_ptr='((fp)->_IO_read_ptr)' ptr_lval=$define ;; + *) ptr_lval=$d_stdio_ptr_lval + ;; esac case "$stdio_cnt" in '') stdio_cnt='((fp)->_IO_read_end - (fp)->_IO_read_ptr)' cnt_lval=$undef ;; + *) cnt_lval=$d_stdio_cnt_lval + ;; esac case "$stdio_base" in '') stdio_base='((fp)->_IO_read_base)';; @@ -5632,11 +5657,15 @@ else '') stdio_ptr='((fp)->_ptr)' ptr_lval=$define ;; + *) ptr_lval=$d_stdio_ptr_lval + ;; esac case "$stdio_cnt" in '') stdio_cnt='((fp)->_cnt)' cnt_lval=$define ;; + *) cnt_lval=$d_stdio_cnt_lval + ;; esac case "$stdio_base" in '') stdio_base='((fp)->_base)';; @@ -6384,11 +6413,15 @@ define) : Check the return type needed for hash echo " " echo "Checking return type needed for hash for Berkeley DB ..." >&4 - $cat >try.c <<'EOCP' + $cat >try.c < #include u_int32_t hash_cb (ptr, size) -void *ptr; +const void *ptr; size_t size; { } @@ -6420,12 +6453,16 @@ define) : Check the return type needed for prefix echo " " echo "Checking return type needed for prefix for Berkeley DB ..." >&4 - cat >try.c <<'EOCP' + cat >try.c < #include size_t prefix_cb (key1, key2) -DBT *key1; -DBT *key2; +const DBT *key1; +const DBT *key2; { } BTREEINFO info; diff --git a/MANIFEST b/MANIFEST index 90c1b7b..3085736 100644 --- a/MANIFEST +++ b/MANIFEST @@ -209,8 +209,8 @@ hints/mpc.sh Hints for named architecture hints/mpeix.sh Hints for named architecture hints/ncr_tower.sh Hints for named architecture hints/netbsd.sh Hints for named architecture +hints/next_3.sh Hints for named architecture hints/next_3_0.sh Hints for named architecture -hints/next_3_2.sh Hints for named architecture hints/opus.sh Hints for named architecture hints/powerunix.sh Hints for named architecture hints/sco_2_3_0.sh Hints for named architecture diff --git a/config_H b/config_H index 0ed7b11..cef709e 100644 --- a/config_H +++ b/config_H @@ -14,7 +14,7 @@ * $Id: Config_h.U,v 3.0.1.3 1995/01/30 14:25:39 ram Exp $ */ -/* Configuration time: Fri Jun 2 14:50:10 EDT 1995 +/* Configuration time: Tue Jun 6 12:34:26 EDT 1995 * Configured by: andy * Target system: crystal crystal 3.2 2 i386 */ @@ -773,9 +773,9 @@ */ #ifdef USE_STDIO_PTR #define FILE_ptr(fp) ((fp)->_ptr) -#define STDIO_PTR_LVALUE +#define STDIO_PTR_LVALUE /**/ #define FILE_cnt(fp) ((fp)->_cnt) -#define STDIO_CNT_LVALUE +#define STDIO_CNT_LVALUE /**/ #endif /* FILE_base: diff --git a/config_h.SH b/config_h.SH index 90f523c..02b6030 100755 --- a/config_h.SH +++ b/config_h.SH @@ -787,9 +787,9 @@ sed <config.h -e 's!^#undef!/\*#define!' -e 's!^#un-def!#undef!' */ #ifdef USE_STDIO_PTR #define FILE_ptr(fp) $stdio_ptr -#$d_stdio_ptr_lval STDIO_PTR_LVALUE +#$d_stdio_ptr_lval STDIO_PTR_LVALUE /**/ #define FILE_cnt(fp) $stdio_cnt -#$d_stdio_cnt_lval STDIO_CNT_LVALUE +#$d_stdio_cnt_lval STDIO_CNT_LVALUE /**/ #endif /* FILE_base: diff --git a/hints/cxux.sh b/hints/cxux.sh index 4946d0b..66608de 100644 --- a/hints/cxux.sh +++ b/hints/cxux.sh @@ -75,30 +75,10 @@ ccdlflags='-Zelf -Zlink=dynamic -Wl,-Bexport -u sigaction' lddlflags='-Zlink=so' # Configure imagines that it sees a pw_quota field, but it is really in a -# different structure than the one it thinks it is looking at. WARNING: -# Setting this here in the hints file doesn't help. You need to fix this by -# editing config.sh after Configure asks you to fix things with a shell -# escape! (Maybe Configure should actually try to compile a routine to -# test each field, but what a pain that would be...). -# -# Perhaps I should create a config.over file and add this to it now? -# +# different structure than the one it thinks it is looking at. d_pwquota='undef' -echo '' -echo '' -echo WARNING: Edit config.sh when Configure offers to let you do so at the -echo end of the configuration process and manually change d_pwquota from -echo define to undef \(or you may want to create a config.over file now\). -echo '' -echo '' - -# The following silly shell variable is set just so it will be printed out -# immediately prior to asking the user to edit config.sh :-). -# -dont_forget_to_fix_d_pwquota_in_config_to_be_undef="really" - -# Configure sometime finds what it believes to be ndbm header files on the +# Configure sometimes finds what it believes to be ndbm header files on the # system and imagines that we have the NDBM library, but we really don't. # There is something there that once resembled ndbm, but it is purely # for internal use in some tool and has been hacked beyond recognition @@ -110,3 +90,12 @@ i_ndbm='undef' # d_mymalloc='undef' usemymalloc='n' + +cat <<'EOM' + +You will get a failure on lib/posix.t test 16 because ungetc() on +stdin does not work if no characters have been read from stdin. +If you type a character at the terminal where you are running +the tests, you can fool it into thinking it worked. + +EOM diff --git a/hints/epix.sh b/hints/epix.sh index 9fd5c90..25e3573 100644 --- a/hints/epix.sh +++ b/hints/epix.sh @@ -61,6 +61,8 @@ if [ -r /usr/ucblib/libucb.a ]; then # If using BSD-compat. library: fi lddlflags="-G $ldflags" # Probably needed for dynamic loading +# We _do_ want the -L paths in ldflags, but we don't want the -non_shared. +lddlflags=`echo $lddlflags | sed 's/-non_shared//'` cat <<'EOM' >&4 diff --git a/hints/next_3_2.sh b/hints/next_3.sh similarity index 93% rename from hints/next_3_2.sh rename to hints/next_3.sh index 887082e..7db901c 100644 --- a/hints/next_3_2.sh +++ b/hints/next_3.sh @@ -1,6 +1,10 @@ # This file has been put together by Anno Siegel # and Andreas Koenig . Comments, questions, and # improvements welcome! +# +# These hints work for NeXT 3.2 and 3.3. 3.0 has it's own +# special hint file. + ccflags='-DUSE_NEXT_CTYPE' POSIX_cflags='ccflags="-posix $ccflags"' ldflags='-u libsys_s' @@ -35,4 +39,3 @@ ranlib='sleep 5; /bin/ranlib' if [ `arch` = "hppa" ]; then pp_cflags='optimize="-g"' fi - diff --git a/lib/Benchmark.pm b/lib/Benchmark.pm index 40481f9..9929e6e 100644 --- a/lib/Benchmark.pm +++ b/lib/Benchmark.pm @@ -242,6 +242,7 @@ September 8th, 1994; by Tim Bunce. # Last updated: Sept 8th 94 by Tim Bunce # +use Carp; use Exporter; @ISA=(Exporter); @EXPORT=qw(timeit timethis timethese timediff timestr); @@ -315,6 +316,10 @@ sub timedebug{ sub runloop { my($n, $c) = @_; + + $n+=0; # force numeric now, so garbage won't creep into the eval + croak "negativ loopcount $n" if $n<0; + confess "Usage: runloop(number, string)" unless defined $c; my($t0, $t1, $td); # before, after, difference # find package of caller so we can execute code there @@ -326,7 +331,7 @@ sub runloop { my $subcode = "sub { package $pack; my(\$_i)=$n; while (\$_i--){$c;} }"; my $subref = eval $subcode; - die "runloop unable to compile '$c': $@\ncode: $subcode\n" if $@; + croak "runloop unable to compile '$c': $@\ncode: $subcode\n" if $@; print STDERR "runloop $n '$subcode'\n" if ($debug); $t0 = &new; diff --git a/op.c b/op.c index 8e66452..09edb0e 100644 --- a/op.c +++ b/op.c @@ -2627,7 +2627,7 @@ CV *cv; SAVESPTR(curpad); curpad = 0; - if (!SvFLAGS(cv) & SVpcv_CLONED) + if (!(SvFLAGS(cv) & SVpcv_CLONED)) op_free(CvROOT(cv)); CvROOT(cv) = Nullop; if (CvPADLIST(cv)) { @@ -2761,6 +2761,7 @@ OP *block; CvOUTSIDE(cv) = CvOUTSIDE(compcv); CvOUTSIDE(compcv) = 0; CvPADLIST(cv) = CvPADLIST(compcv); + CvPADLIST(compcv) = 0; SvREFCNT_dec(compcv); } else { diff --git a/perl.c b/perl.c index 00c7b3c..537d5a8 100644 --- a/perl.c +++ b/perl.c @@ -996,7 +996,7 @@ char *s; return s; case 'v': printf("\nThis is perl, version %s\n\n",patchlevel); - fputs("\tUnofficial patchlevel 1j.\n",stdout); + fputs("\tUnofficial patchlevel 1l.\n",stdout); fputs("\nCopyright 1987-1994, Larry Wall\n",stdout); #ifdef MSDOS fputs("MS-DOS port Copyright (c) 1989, 1990, Diomidis Spinellis\n", diff --git a/pp_ctl.c b/pp_ctl.c index a2dc38e..cb521b4 100644 --- a/pp_ctl.c +++ b/pp_ctl.c @@ -1533,6 +1533,15 @@ PP(pp_goto) I32 items = 0; I32 oldsave; + if (!CvROOT(cv) && !CvXSUB(cv)) { + if (CvGV(cv)) { + SV *tmpstr = sv_newmortal(); + gv_efullname(tmpstr, CvGV(cv)); + DIE("Goto undefined subroutine &%s",SvPVX(tmpstr)); + } + DIE("Goto undefined subroutine"); + } + /* First do some returnish stuff. */ cxix = dopoptosub(cxstack_ix); if (cxix < 0) @@ -1591,7 +1600,7 @@ PP(pp_goto) GvENAME(CvGV(cv))); if (CvDEPTH(cv) > AvFILL(padlist)) { AV *newpad = newAV(); - AV *oldpad = (AV*)AvARRAY(svp[CvDEPTH(cv)-1]); + SV **oldpad = AvARRAY(svp[CvDEPTH(cv)-1]); I32 ix = AvFILL((AV*)svp[1]); svp = AvARRAY(svp[0]); for ( ;ix > 0; ix--) { @@ -1600,7 +1609,7 @@ PP(pp_goto) if (SvFLAGS(svp[ix]) & SVf_FAKE) { /* outer lexical? */ av_store(newpad, ix, - SvREFCNT_inc(AvARRAY(oldpad)[ix]) ); + SvREFCNT_inc(oldpad[ix]) ); } else { /* our own lexical */ if (*name == '@') diff --git a/pp_hot.c b/pp_hot.c index 2628c3a..31983f1 100644 --- a/pp_hot.c +++ b/pp_hot.c @@ -1687,7 +1687,7 @@ PP(pp_entersub) if (CvDEPTH(cv) > AvFILL(padlist)) { AV *av; AV *newpad = newAV(); - AV *oldpad = (AV*)AvARRAY(svp[CvDEPTH(cv)-1]); + SV **oldpad = AvARRAY(svp[CvDEPTH(cv)-1]); I32 ix = AvFILL((AV*)svp[1]); svp = AvARRAY(svp[0]); for ( ;ix > 0; ix--) { @@ -1695,7 +1695,7 @@ PP(pp_entersub) char *name = SvPVX(svp[ix]); if (SvFLAGS(svp[ix]) & SVf_FAKE) { /* outer lexical? */ av_store(newpad, ix, - SvREFCNT_inc(AvARRAY(oldpad)[ix]) ); + SvREFCNT_inc(oldpad[ix]) ); } else { /* our own lexical */ if (*name == '@') diff --git a/scope.c b/scope.c index 44713e1..12f3595 100644 --- a/scope.c +++ b/scope.c @@ -276,7 +276,7 @@ save_iv(ivp) IV *ivp; { SSCHECK(3); - SSPUSHINT(*ivp); + SSPUSHIV(*ivp); SSPUSHPTR(ivp); SSPUSHINT(SAVEt_IV); } @@ -365,7 +365,7 @@ save_clearsv(svp) SV** svp; { SSCHECK(2); - SSPUSHPTR(svp); + SSPUSHLONG((long)(svp-curpad)); SSPUSHINT(SAVEt_CLEARSV); } @@ -540,7 +540,7 @@ I32 base; Safefree((char*)ptr); break; case SAVEt_CLEARSV: - ptr = SSPOPPTR; + ptr = (void*)&curpad[SSPOPLONG]; sv = *(SV**)ptr; if (SvREFCNT(sv) <= 1) { /* Can clear pad variable in place. */ if (SvTHINKFIRST(sv)) { @@ -573,12 +573,14 @@ I32 base; } } else { /* Someone has a claim on this, so abandon it. */ + U32 padflags = SvFLAGS(sv) & (SVs_PADBUSY|SVs_PADMY|SVs_PADTMP); SvREFCNT_dec(sv); /* Cast current value to the winds. */ switch (SvTYPE(sv)) { /* Console ourselves with a new value */ case SVt_PVAV: *(SV**)ptr = (SV*)newAV(); break; case SVt_PVHV: *(SV**)ptr = (SV*)newHV(); break; default: *(SV**)ptr = NEWSV(0,0); break; } + SvFLAGS(*(SV**)ptr) |= padflags; /* preserve pad nature */ } break; case SAVEt_DELETE: -- 1.8.3.1