Change 32954 by [EMAIL PROTECTED] on 2008/01/11 13:55:07

        Remove the -P switch

Affected files ...

... //depot/perl/MANIFEST#1665 edit
... //depot/perl/README.hpux#59 edit
... //depot/perl/README.os390#25 edit
... //depot/perl/embedvar.h#264 edit
... //depot/perl/intrpvar.h#231 edit
... //depot/perl/perl.c#845 edit
... //depot/perl/perlapi.h#186 edit
... //depot/perl/pod/perl.pod#130 edit
... //depot/perl/pod/perldiag.pod#493 edit
... //depot/perl/pod/perlfilter.pod#12 edit
... //depot/perl/pod/perlrun.pod#165 edit
... //depot/perl/sv.c#1483 edit
... //depot/perl/t/comp/cpp.aux#9 delete
... //depot/perl/t/comp/cpp.t#17 delete
... //depot/perl/t/run/switchPx.aux#2 delete
... //depot/perl/t/run/switchPx.t#7 delete
... //depot/perl/toke.c#813 edit

Differences ...

==== //depot/perl/MANIFEST#1665 (text) ====
Index: perl/MANIFEST
--- perl/MANIFEST#1664~32953~   2008-01-11 05:36:54.000000000 -0800
+++ perl/MANIFEST       2008-01-11 05:55:07.000000000 -0800
@@ -3465,8 +3465,6 @@
 t/comp/bproto.t                        See if builtins conform to their 
prototypes
 t/comp/cmdopt.t                        See if command optimization works
 t/comp/colon.t                 See if colons are parsed correctly
-t/comp/cpp.aux                 main file for cpp.t
-t/comp/cpp.t                   See if C preprocessor works
 t/comp/decl.t                  See if declarations work
 t/comp/fold.t                  See if constant folding works
 t/comp/hints.t                 See if %^H works
@@ -4009,8 +4007,6 @@
 t/run/switchI.t                        Test the -I switch
 t/run/switchn.t                        Test the -n switch
 t/run/switchp.t                        Test the -p switch
-t/run/switchPx.aux             Data for switchPx.t
-t/run/switchPx.t               Test the -Px combination
 t/run/switcht.t                        Test the -t switch
 t/run/switchx2.aux             Data for switchx.t
 t/run/switchx.aux              Data for switchx.t

==== //depot/perl/README.hpux#59 (text) ====
Index: perl/README.hpux
--- perl/README.hpux#58~31832~  2007-09-09 03:09:34.000000000 -0700
+++ perl/README.hpux    2008-01-11 05:55:07.000000000 -0800
@@ -559,25 +559,6 @@
 io/fs.t may fail on test #18.  This appears to be a bug in HP-UX and no
 fix is currently available.
 
-=head2 perl -P and // and HP-UX
-
-If HP-UX Perl is compiled with flags that will cause problems if the
--P flag of Perl (preprocess Perl code with the C preprocessor before
-perl sees it) is used.  The problem is that C<//>, being a C++-style
-until-end-of-line comment, will disappear along with the remainder
-of the line.  This means that common Perl constructs like
-
-  s/foo//;
-
-will turn into illegal code
-
-  s/foo
-
-The workaround is to use some other quoting separator than C<"/">,
-like for example C<"!">:
-
-  s!foo!!;
-
 =head2 HP-UX Kernel Parameters (maxdsiz) for Compiling Perl
 
 By default, HP-UX comes configured with a maximum data segment size of

==== //depot/perl/README.os390#25 (text) ====
Index: perl/README.os390
--- perl/README.os390#24~24686~ 2005-06-03 01:04:25.000000000 -0700
+++ perl/README.os390   2008-01-11 05:55:07.000000000 -0800
@@ -231,20 +231,6 @@
 
 A message of the form:
 
- comp/cpp.............ERROR CBC3191 ./.301989890.c:1     The character $ is 
not a
-  valid C source character.
- FSUM3065 The COMPILE step ended with return code 12.
- FSUM3017 Could not compile .301989890.c. Correct the errors and try again.
- ok
-
-indicates that the t/comp/cpp.t test of Perl's -P command line switch has
-passed but that the particular invocation of c89 -E in the cpp script does
-not suppress the C compiler check of source code validity.
-
-=item *
-
-A message of the form:
-
  io/openpid...........CEE5210S The signal SIGHUP was received.
  CEE5210S The signal SIGHUP was received.
  CEE5210S The signal SIGHUP was received.

==== //depot/perl/embedvar.h#264 (text+w) ====
Index: perl/embedvar.h
--- perl/embedvar.h#263~32477~  2007-11-24 02:44:25.000000000 -0800
+++ perl/embedvar.h     2008-01-11 05:55:07.000000000 -0800
@@ -235,7 +235,6 @@
 #define PL_pidstatus           (vTHX->Ipidstatus)
 #define PL_ppid                        (vTHX->Ippid)
 #define PL_preambleav          (vTHX->Ipreambleav)
-#define PL_preprocess          (vTHX->Ipreprocess)
 #define PL_profiledata         (vTHX->Iprofiledata)
 #define PL_psig_name           (vTHX->Ipsig_name)
 #define PL_psig_pend           (vTHX->Ipsig_pend)
@@ -547,7 +546,6 @@
 #define PL_Ipidstatus          PL_pidstatus
 #define PL_Ippid               PL_ppid
 #define PL_Ipreambleav         PL_preambleav
-#define PL_Ipreprocess         PL_preprocess
 #define PL_Iprofiledata                PL_profiledata
 #define PL_Ipsig_name          PL_psig_name
 #define PL_Ipsig_pend          PL_psig_pend

==== //depot/perl/intrpvar.h#231 (text) ====
Index: perl/intrpvar.h
--- perl/intrpvar.h#230~32944~  2008-01-10 15:55:40.000000000 -0800
+++ perl/intrpvar.h     2008-01-11 05:55:07.000000000 -0800
@@ -215,7 +215,6 @@
 PERLVARI(Isplitstr,    const char *, " ")
 
 PERLVAR(Iminus_c,      bool)
-PERLVAR(Ipreprocess,   bool)
 PERLVAR(Iminus_n,      bool)
 PERLVAR(Iminus_p,      bool)
 PERLVAR(Iminus_l,      bool)

==== //depot/perl/perl.c#845 (text) ====
Index: perl/perl.c
--- perl/perl.c#844~32938~      2008-01-10 13:16:01.000000000 -0800
+++ perl/perl.c 2008-01-11 05:55:07.000000000 -0800
@@ -894,7 +894,6 @@
     }
 
     /* switches */
-    PL_preprocess   = FALSE;
     PL_minus_n      = FALSE;
     PL_minus_p      = FALSE;
     PL_minus_l      = FALSE;
@@ -1804,12 +1803,6 @@
            else
                Perl_croak(aTHX_ "No directory specified for -I");
            break;
-       case 'P':
-           forbid_setid('P', -1);
-           PL_preprocess = TRUE;
-           s++;
-           deprecate("-P");
-           goto reswitch;
        case 'S':
            forbid_setid('S', -1);
            dosearch = TRUE;
@@ -2225,7 +2218,6 @@
 #endif
     CopLINE_set(PL_curcop, 0);
     PL_curstash = PL_defstash;
-    PL_preprocess = FALSE;
     if (PL_e_script) {
        SvREFCNT_dec(PL_e_script);
        PL_e_script = NULL;
@@ -2862,7 +2854,6 @@
 "-[mM][-]module    execute \"use/no module...\" before executing program",
 "-n                assume \"while (<>) { ... }\" loop around program",
 "-p                assume loop like -n but print line also, like sed",
-"-P                run program through C preprocessor before compilation",
 "-s                enable rudimentary parsing for switches after programfile",
 "-S                look for programfile using PATH environment variable",
 "-t                enable tainting warnings",
@@ -2902,7 +2893,7 @@
       "  t  Trace execution",
       "  o  Method and overloading resolution",
       "  c  String/numeric conversions",
-      "  P  Print profiling info, preprocessor command for -P, source file 
input state",
+      "  P  Print profiling info, source file input state",
       "  m  Memory allocation",
       "  f  Format processing",
       "  r  Regular expression parsing and execution",
@@ -3371,10 +3362,6 @@
     case 'S':                  /* OS/2 needs -S on "extproc" line. */
        break;
 #endif
-    case 'P':
-       if (PL_preprocess)
-           return s+1;
-       /* FALL THROUGH */
     default:
        Perl_croak(aTHX_ "Can't emulate -%.1s on #! line",s);
     }
@@ -3584,72 +3571,6 @@
        Perl_croak(aTHX_ "suidperl needs (suid) fd script\n");
     }
 #else /* IAMSUID */
-    else if (PL_preprocess) {
-       const char * const cpp_cfg = CPPSTDIN;
-       SV * const cpp = newSVpvs("");
-       SV * const cmd = newSV(0);
-
-       if (cpp_cfg[0] == 0) /* PERL_MICRO? */
-            Perl_croak(aTHX_ "Can't run with cpp -P with CPPSTDIN undefined");
-       if (strEQ(cpp_cfg, "cppstdin"))
-           Perl_sv_catpvf(aTHX_ cpp, "%s/", BIN_EXP);
-       sv_catpv(cpp, cpp_cfg);
-
-#       ifndef VMS
-           sv_catpvs(sv, "-I");
-           sv_catpv(sv,PRIVLIB_EXP);
-#       endif
-
-       DEBUG_P(PerlIO_printf(Perl_debug_log,
-                             "PL_preprocess: scriptname=\"%s\", cpp=\"%s\", 
sv=\"%s\", CPPMINUS=\"%s\"\n",
-                             scriptname, SvPVX_const (cpp), SvPVX_const (sv),
-                             CPPMINUS));
-
-#       if defined(MSDOS) || defined(WIN32) || defined(VMS)
-            quote = "\"";
-#       else
-            quote = "'";
-#       endif
-
-#       ifdef VMS
-            cpp_discard_flag = "";
-#       else
-            cpp_discard_flag = "-C";
-#       endif
-
-#       ifdef OS2
-            perl = os2_execname(aTHX);
-#       else
-            perl = PL_origargv[0];
-#       endif
-
-
-        /* This strips off Perl comments which might interfere with
-           the C pre-processor, including #!.  #line directives are
-           deliberately stripped to avoid confusion with Perl's version
-           of #line.  FWP played some golf with it so it will fit
-           into VMS's 255 character buffer.
-        */
-        if( PL_doextract )
-            code = 
"(1../^#!.*perl/i)|/^\\s*#(?!\\s*((ifn?|un)def|(el|end)?if|define|include|else|error|pragma)\\b)/||!($|=1)||print";
-        else
-            code = 
"/^\\s*#(?!\\s*((ifn?|un)def|(el|end)?if|define|include|else|error|pragma)\\b)/||!($|=1)||print";
-
-        Perl_sv_setpvf(aTHX_ cmd, "\
-%s -ne%s%s%s %s | %"SVf" %s %"SVf" %s",
-                       perl, quote, code, quote, scriptname, SVfARG(cpp),
-                       cpp_discard_flag, SVfARG(sv), CPPMINUS);
-
-       PL_doextract = FALSE;
-
-        DEBUG_P(PerlIO_printf(Perl_debug_log,
-                              "PL_preprocess: cmd=\"%s\"\n",
-                              SvPVX_const(cmd)));
-
-       *rsfpp = PerlProc_popen((char *)SvPVX_const(cmd), (char *)"r");
-       SvREFCNT_dec(cmd);
-       SvREFCNT_dec(cpp);
-    }
     else if (!*scriptname) {
        forbid_setid(0, *suidscript);
        *rsfpp = PerlIO_stdin();
@@ -4172,8 +4093,6 @@
            Perl_croak(aTHX_ "Effective UID cannot exec script\n");     /* they 
can't do this */
     }
 #  ifdef IAMSUID
-    else if (PL_preprocess)    /* PSz 13 Nov 03  Caught elsewhere, useless(?!) 
here */
-       Perl_croak(aTHX_ "-P not allowed for setuid/setgid script\n");
     else if (fdscript < 0 || suidscript != 1)
        /* PSz 13 Nov 03  Caught elsewhere, useless(?!) here */
        Perl_croak(aTHX_ "(suid) fdscript needed in suidperl\n");

==== //depot/perl/perlapi.h#186 (text+w) ====
Index: perl/perlapi.h
--- perl/perlapi.h#185~32477~   2007-11-24 02:44:25.000000000 -0800
+++ perl/perlapi.h      2008-01-11 05:55:07.000000000 -0800
@@ -506,8 +506,6 @@
 #define PL_ppid                        (*Perl_Ippid_ptr(aTHX))
 #undef  PL_preambleav
 #define PL_preambleav          (*Perl_Ipreambleav_ptr(aTHX))
-#undef  PL_preprocess
-#define PL_preprocess          (*Perl_Ipreprocess_ptr(aTHX))
 #undef  PL_profiledata
 #define PL_profiledata         (*Perl_Iprofiledata_ptr(aTHX))
 #undef  PL_psig_name

==== //depot/perl/pod/perl.pod#130 (text) ====
Index: perl/pod/perl.pod
--- perl/pod/perl.pod#129~32649~        2007-12-19 06:13:07.000000000 -0800
+++ perl/pod/perl.pod   2008-01-11 05:55:07.000000000 -0800
@@ -10,7 +10,6 @@
        S<[ B<-pna> ] [ B<-F>I<pattern> ] [ B<-l>[I<octal>] ] [ 
B<-0>[I<octal/hexadecimal>] ]>
        S<[ B<-I>I<dir> ] [ B<-m>[B<->]I<module> ] [ B<-M>[B<->]I<'module...'> 
] [ B<-f> ]>
        S<[ B<-C [I<number/list>] >]>
-       S<[ B<-P> ]>
        S<[ B<-S> ]>
        S<[ B<-x>[I<dir>] ]>
        S<[ B<-i>[I<extension>] ]>

==== //depot/perl/pod/perldiag.pod#493 (text) ====
Index: perl/pod/perldiag.pod
--- perl/pod/perldiag.pod#492~32910~    2008-01-09 02:11:10.000000000 -0800
+++ perl/pod/perldiag.pod       2008-01-11 05:55:07.000000000 -0800
@@ -3294,11 +3294,6 @@
 
 (F) The unpack format P must have an explicit size, not "*".
 
-=item B<-P> not allowed for setuid/setgid script
-
-(F) The script would have to be opened by the C preprocessor by name,
-which provides a race condition that breaks security.
-
 =item POSIX class [:%s:] unknown in regex; marked by <-- HERE in m/%s/
 
 (F) The class in the character class [: :] syntax is unknown.  The <-- HERE

==== //depot/perl/pod/perlfilter.pod#12 (text) ====
Index: perl/pod/perlfilter.pod
--- perl/pod/perlfilter.pod#11~26073~   2005-11-10 02:52:51.000000000 -0800
+++ perl/pod/perlfilter.pod     2008-01-11 05:55:07.000000000 -0800
@@ -81,9 +81,8 @@
 modules, a source filter is invoked with a use statement.
 
 Say you want to pass your Perl source through the C preprocessor before
-execution. You could use the existing C<-P> command line option to do
-this, but as it happens, the source filters distribution comes with a C
-preprocessor filter module called Filter::cpp. Let's use that instead.
+execution. As it happens, the source filters distribution comes with a C
+preprocessor filter module called Filter::cpp.
 
 Below is an example program, C<cpp_test>, which makes use of this filter.
 Line numbers have been added to allow specific lines to be referenced

==== //depot/perl/pod/perlrun.pod#165 (text) ====
Index: perl/pod/perlrun.pod
--- perl/pod/perlrun.pod#164~32875~     2008-01-06 08:37:21.000000000 -0800
+++ perl/pod/perlrun.pod        2008-01-11 05:55:07.000000000 -0800
@@ -10,7 +10,6 @@
        S<[ B<-pna> ] [ B<-F>I<pattern> ] [ B<-l>[I<octal>] ] [ 
B<-0>[I<octal/hexadecimal>] ]>
        S<[ B<-I>I<dir> ] [ B<-m>[B<->]I<module> ] [ B<-M>[B<->]I<'module...'> 
] [ B<-f> ]>
        S<[ B<-C [I<number/list>] >]>
-       S<[ B<-P> ]>
        S<[ B<-S> ]>
        S<[ B<-x>[I<dir>] ]>
        S<[ B<-i>[I<extension>] ]>
@@ -395,7 +394,7 @@
         8  t  Trace execution
        16  o  Method and overloading resolution
        32  c  String/numeric conversions
-       64  P  Print profiling info, preprocessor command for -P, source file 
input state
+       64  P  Print profiling info, source file input state
       128  m  Memory allocation
       256  f  Format processing
       512  r  Regular expression parsing and execution
@@ -588,9 +587,7 @@
 X<-I> X<@INC>
 
 Directories specified by B<-I> are prepended to the search path for
-modules (C<@INC>), and also tells the C preprocessor where to search for
-include files.  The C preprocessor is invoked with B<-P>; by default it
-searches /usr/include and /usr/lib/perl.
+modules (C<@INC>).
 
 =item B<-l>[I<octnum>]
 X<-l> X<$/> X<$\>
@@ -695,73 +692,6 @@
 C<BEGIN> and C<END> blocks may be used to capture control before or after
 the implicit loop, just as in B<awk>.
 
-=item B<-P>
-X<-P>
-
-B<NOTE: Use of -P is strongly discouraged because of its inherent
-problems, including poor portability. It is deprecated and will be
-removed in a future version of Perl.>
-
-This option causes your program to be run through the C preprocessor before
-compilation by Perl.  Because both comments and B<cpp> directives begin
-with the # character, you should avoid starting comments with any words
-recognized by the C preprocessor such as C<"if">, C<"else">, or C<"define">.
-
-If you're considering using C<-P>, you might also want to look at the
-Filter::cpp module from CPAN.
-
-The problems of -P include, but are not limited to:
-
-=over 10
-
-=item *
-
-The C<#!> line is stripped, so any switches there don't apply.
-
-=item *
-
-A C<-P> on a C<#!> line doesn't work.
-
-=item *
-
-B<All> lines that begin with (whitespace and) a C<#> but
-do not look like cpp commands, are stripped, including anything
-inside Perl strings, regular expressions, and here-docs .
-
-=item *
-
-In some platforms the C preprocessor knows too much: it knows about
-the C++ -style until-end-of-line comments starting with C<"//">.
-This will cause problems with common Perl constructs like
-
-    s/foo//;
-
-because after -P this will became illegal code
-
-    s/foo
-
-The workaround is to use some other quoting separator than C<"/">,
-like for example C<"!">:
-
-    s!foo!!;
-
-
-
-=item *
-
-It requires not only a working C preprocessor but also a working
-F<sed>.  If not on UNIX, you are probably out of luck on this.
-
-=item *
-
-Script line numbers are not preserved.
-
-=item *
-
-The C<-x> does not work with C<-P>.
-
-=back
-
 =item B<-s>
 X<-s>
 

==== //depot/perl/sv.c#1483 (text) ====
Index: perl/sv.c
--- perl/sv.c#1482~32937~       2008-01-10 13:15:02.000000000 -0800
+++ perl/sv.c   2008-01-11 05:55:07.000000000 -0800
@@ -11234,7 +11234,6 @@
     PL_patchlevel      = sv_dup_inc(proto_perl->Ipatchlevel, param);
     PL_localpatches    = proto_perl->Ilocalpatches;
     PL_splitstr                = proto_perl->Isplitstr;
-    PL_preprocess      = proto_perl->Ipreprocess;
     PL_minus_n         = proto_perl->Iminus_n;
     PL_minus_p         = proto_perl->Iminus_p;
     PL_minus_l         = proto_perl->Iminus_l;

==== //depot/perl/toke.c#813 (text) ====
Index: perl/toke.c
--- perl/toke.c#812~32819~      2008-01-03 09:42:27.000000000 -0800
+++ perl/toke.c 2008-01-11 05:55:07.000000000 -0800
@@ -1109,16 +1109,14 @@
            PL_bufend = SvPVX(PL_linestr) + SvCUR(PL_linestr);
            PL_last_lop = PL_last_uni = NULL;
 
-           /* Close the filehandle.  Could be from -P preprocessor,
+           /* Close the filehandle.  Could be from
             * STDIN, or a regular file.  If we were reading code from
             * STDIN (because the commandline held no -e or filename)
             * then we don't close it, we reset it so the code can
             * read from STDIN too.
             */
 
-           if (PL_preprocess && !PL_in_eval)
-               (void)PerlProc_pclose(PL_rsfp);
-           else if ((PerlIO*)PL_rsfp == PerlIO_stdin())
+           if ((PerlIO*)PL_rsfp == PerlIO_stdin())
                PerlIO_clearerr(PL_rsfp);
            else
                (void)PerlIO_close(PL_rsfp);
@@ -3668,9 +3666,7 @@
                PL_realtokenstart = -1;
 #endif
                if (PL_rsfp) {
-                   if (PL_preprocess && !PL_in_eval)
-                       (void)PerlProc_pclose(PL_rsfp);
-                   else if ((PerlIO *)PL_rsfp == PerlIO_stdin())
+                   if ((PerlIO *)PL_rsfp == PerlIO_stdin())
                        PerlIO_clearerr(PL_rsfp);
                    else
                        (void)PerlIO_close(PL_rsfp);
@@ -3717,16 +3713,7 @@
 #    endif
 #  endif
 #endif
-#ifdef FTELL_FOR_PIPE_IS_BROKEN
-               /* This loses the possibility to detect the bof
-                * situation on perl -P when the libc5 is being used.
-                * Workaround?  Maybe attach some extra state to PL_rsfp?
-                */
-               if (!PL_preprocess)
-                   bof = PerlIO_tell(PL_rsfp) == SvCUR(PL_linestr);
-#else
                bof = PerlIO_tell(PL_rsfp) == (Off_t)SvCUR(PL_linestr);
-#endif
                if (bof) {
                    PL_bufend = SvPVX(PL_linestr) + SvCUR(PL_linestr);
                    s = swallow_bom((U8*)s);
@@ -5662,9 +5649,7 @@
 #endif
                /* Mark this internal pseudo-handle as clean */
                IoFLAGS(GvIOp(gv)) |= IOf_UNTAINT;
-               if (PL_preprocess)
-                   IoTYPE(GvIOp(gv)) = IoTYPE_PIPE;
-               else if ((PerlIO*)PL_rsfp == PerlIO_stdin())
+               if ((PerlIO*)PL_rsfp == PerlIO_stdin())
                    IoTYPE(GvIOp(gv)) = IoTYPE_STD;
                else
                    IoTYPE(GvIOp(gv)) = IoTYPE_RDONLY;
End of Patch.

Reply via email to