Perl / perl5

🐪 The Perl programming language
https://dev.perl.org/perl5/
Other
1.99k stars 557 forks source link

remove PERL_STRICT_CR #22775

Closed mauke closed 1 week ago

mauke commented 1 week ago

Background:

Before perl 5.004, the perl parser would skip over CR (carriage return) between tokens in source files, treating it as whitespace, but would retain CRs in quoted constructs such as multi-line strings and here-documents.

In 5.004, the behavior was changed to make CR in source files a fatal error ("Illegal character %s (carriage return)") to avoid surprises with unexpected literal CRs in string constants when scripts were copied from DOS/Windows without newline conversion.

In 5.005, the behavior changed again. Now CR was back to being ignored, but harder: Even in quoted constructs, CR was ignored when immediately followed by a newline. However, the 5.004 behavior could be restored by compiling perl with the PERL_STRICT_CR macro defined (e.g. with ./Configure -A ccflags=-DPERL_STRICT_CR ...). This option was undocumented except for a brief note in perl5005delta. (Also, the "Illegal character ..." error was changed to a warning, but perldiag wasn't updated and so still listed the message as "fatal" (F).)

And that's how things have been ever since 1998.

Foreground:

This patch removes all checks for PERL_STRICT_CR entirely, treating it as always off.

Rationale: It simplifies the code and reduces clutter. (Plus I don't see the need to perpetually maintain an undocumented configuration option that enables compatibility with an ancient perl version used sometime around 1997-1998.)

References:


mauke commented 1 week ago

Re-pushed to fix the Configure invocation in perldelta and the commit message.