Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

remove PERL_STRICT_CR #22775

Merged
merged 1 commit into from
Nov 24, 2024
Merged

remove PERL_STRICT_CR #22775

merged 1 commit into from
Nov 24, 2024

Conversation

mauke
Copy link
Contributor

@mauke mauke commented Nov 23, 2024

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:


  • This set of changes requires a perldelta entry, and it is included.

Copy link
Contributor

@leonerd leonerd left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

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:
-----------

- 4fdae80 ("Make \r in script an error (per Larry)")
- ff0cee6 ("Fix carriage-return message")
- 5431012 ("Improve diagnostic on \r in program text")
- 2db4f57
- f63a84b
- 637e912
- b8957cf
- 6a27c18
@mauke
Copy link
Contributor Author

mauke commented Nov 24, 2024

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

@mauke mauke merged commit 94caec9 into Perl:blead Nov 24, 2024
33 checks passed
@mauke mauke deleted the remove-perl-strict-cr branch November 24, 2024 15:56
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants