Skip to content

Commit 4c84d7f

Browse files
committed
Remove the -P switch
p4raw-id: //depot/perl@32954
1 parent 5ac1e9b commit 4c84d7f

File tree

17 files changed

+9
-333
lines changed

17 files changed

+9
-333
lines changed

MANIFEST

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3465,8 +3465,6 @@ t/cmd/while.t See if while loops work
34653465
t/comp/bproto.t See if builtins conform to their prototypes
34663466
t/comp/cmdopt.t See if command optimization works
34673467
t/comp/colon.t See if colons are parsed correctly
3468-
t/comp/cpp.aux main file for cpp.t
3469-
t/comp/cpp.t See if C preprocessor works
34703468
t/comp/decl.t See if declarations work
34713469
t/comp/fold.t See if constant folding works
34723470
t/comp/hints.t See if %^H works
@@ -4009,8 +4007,6 @@ t/run/switchF.t Test the -F switch
40094007
t/run/switchI.t Test the -I switch
40104008
t/run/switchn.t Test the -n switch
40114009
t/run/switchp.t Test the -p switch
4012-
t/run/switchPx.aux Data for switchPx.t
4013-
t/run/switchPx.t Test the -Px combination
40144010
t/run/switcht.t Test the -t switch
40154011
t/run/switchx2.aux Data for switchx.t
40164012
t/run/switchx.aux Data for switchx.t

README.hpux

Lines changed: 0 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -559,25 +559,6 @@ If you are compiling Perl on a remotely-mounted NFS filesystem, the test
559559
io/fs.t may fail on test #18. This appears to be a bug in HP-UX and no
560560
fix is currently available.
561561

562-
=head2 perl -P and // and HP-UX
563-
564-
If HP-UX Perl is compiled with flags that will cause problems if the
565-
-P flag of Perl (preprocess Perl code with the C preprocessor before
566-
perl sees it) is used. The problem is that C<//>, being a C++-style
567-
until-end-of-line comment, will disappear along with the remainder
568-
of the line. This means that common Perl constructs like
569-
570-
s/foo//;
571-
572-
will turn into illegal code
573-
574-
s/foo
575-
576-
The workaround is to use some other quoting separator than C<"/">,
577-
like for example C<"!">:
578-
579-
s!foo!!;
580-
581562
=head2 HP-UX Kernel Parameters (maxdsiz) for Compiling Perl
582563

583564
By default, HP-UX comes configured with a maximum data segment size of

README.os390

Lines changed: 0 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -229,20 +229,6 @@ anomalies:
229229

230230
=item *
231231

232-
A message of the form:
233-
234-
comp/cpp.............ERROR CBC3191 ./.301989890.c:1 The character $ is not a
235-
valid C source character.
236-
FSUM3065 The COMPILE step ended with return code 12.
237-
FSUM3017 Could not compile .301989890.c. Correct the errors and try again.
238-
ok
239-
240-
indicates that the t/comp/cpp.t test of Perl's -P command line switch has
241-
passed but that the particular invocation of c89 -E in the cpp script does
242-
not suppress the C compiler check of source code validity.
243-
244-
=item *
245-
246232
A message of the form:
247233

248234
io/openpid...........CEE5210S The signal SIGHUP was received.

embedvar.h

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -235,7 +235,6 @@
235235
#define PL_pidstatus (vTHX->Ipidstatus)
236236
#define PL_ppid (vTHX->Ippid)
237237
#define PL_preambleav (vTHX->Ipreambleav)
238-
#define PL_preprocess (vTHX->Ipreprocess)
239238
#define PL_profiledata (vTHX->Iprofiledata)
240239
#define PL_psig_name (vTHX->Ipsig_name)
241240
#define PL_psig_pend (vTHX->Ipsig_pend)
@@ -547,7 +546,6 @@
547546
#define PL_Ipidstatus PL_pidstatus
548547
#define PL_Ippid PL_ppid
549548
#define PL_Ipreambleav PL_preambleav
550-
#define PL_Ipreprocess PL_preprocess
551549
#define PL_Iprofiledata PL_profiledata
552550
#define PL_Ipsig_name PL_psig_name
553551
#define PL_Ipsig_pend PL_psig_pend

intrpvar.h

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -215,7 +215,6 @@ PERLVAR(Ilocalpatches, const char * const *)
215215
PERLVARI(Isplitstr, const char *, " ")
216216

217217
PERLVAR(Iminus_c, bool)
218-
PERLVAR(Ipreprocess, bool)
219218
PERLVAR(Iminus_n, bool)
220219
PERLVAR(Iminus_p, bool)
221220
PERLVAR(Iminus_l, bool)

perl.c

Lines changed: 1 addition & 82 deletions
Original file line numberDiff line numberDiff line change
@@ -894,7 +894,6 @@ perl_destruct(pTHXx)
894894
}
895895

896896
/* switches */
897-
PL_preprocess = FALSE;
898897
PL_minus_n = FALSE;
899898
PL_minus_p = FALSE;
900899
PL_minus_l = FALSE;
@@ -1804,12 +1803,6 @@ S_parse_body(pTHX_ char **env, XSINIT_t xsinit)
18041803
else
18051804
Perl_croak(aTHX_ "No directory specified for -I");
18061805
break;
1807-
case 'P':
1808-
forbid_setid('P', -1);
1809-
PL_preprocess = TRUE;
1810-
s++;
1811-
deprecate("-P");
1812-
goto reswitch;
18131806
case 'S':
18141807
forbid_setid('S', -1);
18151808
dosearch = TRUE;
@@ -2225,7 +2218,6 @@ S_parse_body(pTHX_ char **env, XSINIT_t xsinit)
22252218
#endif
22262219
CopLINE_set(PL_curcop, 0);
22272220
PL_curstash = PL_defstash;
2228-
PL_preprocess = FALSE;
22292221
if (PL_e_script) {
22302222
SvREFCNT_dec(PL_e_script);
22312223
PL_e_script = NULL;
@@ -2862,7 +2854,6 @@ S_usage(pTHX_ const char *name) /* XXX move this out into a module ? */
28622854
"-[mM][-]module execute \"use/no module...\" before executing program",
28632855
"-n assume \"while (<>) { ... }\" loop around program",
28642856
"-p assume loop like -n but print line also, like sed",
2865-
"-P run program through C preprocessor before compilation",
28662857
"-s enable rudimentary parsing for switches after programfile",
28672858
"-S look for programfile using PATH environment variable",
28682859
"-t enable tainting warnings",
@@ -2902,7 +2893,7 @@ Perl_get_debug_opts(pTHX_ const char **s, bool givehelp)
29022893
" t Trace execution",
29032894
" o Method and overloading resolution",
29042895
" c String/numeric conversions",
2905-
" P Print profiling info, preprocessor command for -P, source file input state",
2896+
" P Print profiling info, source file input state",
29062897
" m Memory allocation",
29072898
" f Format processing",
29082899
" r Regular expression parsing and execution",
@@ -3371,10 +3362,6 @@ Internet, point your browser at http://www.perl.org/, the Perl Home Page.\n\n");
33713362
case 'S': /* OS/2 needs -S on "extproc" line. */
33723363
break;
33733364
#endif
3374-
case 'P':
3375-
if (PL_preprocess)
3376-
return s+1;
3377-
/* FALL THROUGH */
33783365
default:
33793366
Perl_croak(aTHX_ "Can't emulate -%.1s on #! line",s);
33803367
}
@@ -3584,72 +3571,6 @@ S_open_script(pTHX_ const char *scriptname, bool dosearch, SV *sv,
35843571
Perl_croak(aTHX_ "suidperl needs (suid) fd script\n");
35853572
}
35863573
#else /* IAMSUID */
3587-
else if (PL_preprocess) {
3588-
const char * const cpp_cfg = CPPSTDIN;
3589-
SV * const cpp = newSVpvs("");
3590-
SV * const cmd = newSV(0);
3591-
3592-
if (cpp_cfg[0] == 0) /* PERL_MICRO? */
3593-
Perl_croak(aTHX_ "Can't run with cpp -P with CPPSTDIN undefined");
3594-
if (strEQ(cpp_cfg, "cppstdin"))
3595-
Perl_sv_catpvf(aTHX_ cpp, "%s/", BIN_EXP);
3596-
sv_catpv(cpp, cpp_cfg);
3597-
3598-
# ifndef VMS
3599-
sv_catpvs(sv, "-I");
3600-
sv_catpv(sv,PRIVLIB_EXP);
3601-
# endif
3602-
3603-
DEBUG_P(PerlIO_printf(Perl_debug_log,
3604-
"PL_preprocess: scriptname=\"%s\", cpp=\"%s\", sv=\"%s\", CPPMINUS=\"%s\"\n",
3605-
scriptname, SvPVX_const (cpp), SvPVX_const (sv),
3606-
CPPMINUS));
3607-
3608-
# if defined(MSDOS) || defined(WIN32) || defined(VMS)
3609-
quote = "\"";
3610-
# else
3611-
quote = "'";
3612-
# endif
3613-
3614-
# ifdef VMS
3615-
cpp_discard_flag = "";
3616-
# else
3617-
cpp_discard_flag = "-C";
3618-
# endif
3619-
3620-
# ifdef OS2
3621-
perl = os2_execname(aTHX);
3622-
# else
3623-
perl = PL_origargv[0];
3624-
# endif
3625-
3626-
3627-
/* This strips off Perl comments which might interfere with
3628-
the C pre-processor, including #!. #line directives are
3629-
deliberately stripped to avoid confusion with Perl's version
3630-
of #line. FWP played some golf with it so it will fit
3631-
into VMS's 255 character buffer.
3632-
*/
3633-
if( PL_doextract )
3634-
code = "(1../^#!.*perl/i)|/^\\s*#(?!\\s*((ifn?|un)def|(el|end)?if|define|include|else|error|pragma)\\b)/||!($|=1)||print";
3635-
else
3636-
code = "/^\\s*#(?!\\s*((ifn?|un)def|(el|end)?if|define|include|else|error|pragma)\\b)/||!($|=1)||print";
3637-
3638-
Perl_sv_setpvf(aTHX_ cmd, "\
3639-
%s -ne%s%s%s %s | %"SVf" %s %"SVf" %s",
3640-
perl, quote, code, quote, scriptname, SVfARG(cpp),
3641-
cpp_discard_flag, SVfARG(sv), CPPMINUS);
3642-
3643-
PL_doextract = FALSE;
3644-
3645-
DEBUG_P(PerlIO_printf(Perl_debug_log,
3646-
"PL_preprocess: cmd=\"%s\"\n",
3647-
SvPVX_const(cmd)));
3648-
3649-
*rsfpp = PerlProc_popen((char *)SvPVX_const(cmd), (char *)"r");
3650-
SvREFCNT_dec(cmd);
3651-
SvREFCNT_dec(cpp);
3652-
}
36533574
else if (!*scriptname) {
36543575
forbid_setid(0, *suidscript);
36553576
*rsfpp = PerlIO_stdin();
@@ -4172,8 +4093,6 @@ FIX YOUR KERNEL, OR PUT A C WRAPPER AROUND THIS SCRIPT!\n");
41724093
Perl_croak(aTHX_ "Effective UID cannot exec script\n"); /* they can't do this */
41734094
}
41744095
# ifdef IAMSUID
4175-
else if (PL_preprocess) /* PSz 13 Nov 03 Caught elsewhere, useless(?!) here */
4176-
Perl_croak(aTHX_ "-P not allowed for setuid/setgid script\n");
41774096
else if (fdscript < 0 || suidscript != 1)
41784097
/* PSz 13 Nov 03 Caught elsewhere, useless(?!) here */
41794098
Perl_croak(aTHX_ "(suid) fdscript needed in suidperl\n");

perlapi.h

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -506,8 +506,6 @@ END_EXTERN_C
506506
#define PL_ppid (*Perl_Ippid_ptr(aTHX))
507507
#undef PL_preambleav
508508
#define PL_preambleav (*Perl_Ipreambleav_ptr(aTHX))
509-
#undef PL_preprocess
510-
#define PL_preprocess (*Perl_Ipreprocess_ptr(aTHX))
511509
#undef PL_profiledata
512510
#define PL_profiledata (*Perl_Iprofiledata_ptr(aTHX))
513511
#undef PL_psig_name

pod/perl.pod

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,6 @@ B<perl> S<[ B<-sTtuUWX> ]>
1010
S<[ B<-pna> ] [ B<-F>I<pattern> ] [ B<-l>[I<octal>] ] [ B<-0>[I<octal/hexadecimal>] ]>
1111
S<[ B<-I>I<dir> ] [ B<-m>[B<->]I<module> ] [ B<-M>[B<->]I<'module...'> ] [ B<-f> ]>
1212
S<[ B<-C [I<number/list>] >]>
13-
S<[ B<-P> ]>
1413
S<[ B<-S> ]>
1514
S<[ B<-x>[I<dir>] ]>
1615
S<[ B<-i>[I<extension>] ]>

pod/perldiag.pod

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -3294,11 +3294,6 @@ fine from VMS' perspective, it's probably not what you intended.
32943294

32953295
(F) The unpack format P must have an explicit size, not "*".
32963296

3297-
=item B<-P> not allowed for setuid/setgid script
3298-
3299-
(F) The script would have to be opened by the C preprocessor by name,
3300-
which provides a race condition that breaks security.
3301-
33023297
=item POSIX class [:%s:] unknown in regex; marked by <-- HERE in m/%s/
33033298

33043299
(F) The class in the character class [: :] syntax is unknown. The <-- HERE

pod/perlfilter.pod

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -81,9 +81,8 @@ a source filter is just a special kind of module. Like all Perl
8181
modules, a source filter is invoked with a use statement.
8282

8383
Say you want to pass your Perl source through the C preprocessor before
84-
execution. You could use the existing C<-P> command line option to do
85-
this, but as it happens, the source filters distribution comes with a C
86-
preprocessor filter module called Filter::cpp. Let's use that instead.
84+
execution. As it happens, the source filters distribution comes with a C
85+
preprocessor filter module called Filter::cpp.
8786

8887
Below is an example program, C<cpp_test>, which makes use of this filter.
8988
Line numbers have been added to allow specific lines to be referenced

0 commit comments

Comments
 (0)