forked from Perl/perl5
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Preprocessor directives must be processed strictly in order. `#if` and `#ifdef` directives can inspect the current state of defined symbols. That's why it is wrong to translate `#define FOO() ...` to `sub foo() { ... }` since subroutine definitions are processed unconditionally at compile time, before the rest of the code starts running. In particular, unless(defined(&FOO)) { sub FOO () { eval q(1); } } is equivalent to # at compile time: sub FOO () { eval q(1); } # ... later, at runtime: unless(defined(&FOO)) { # does nothing } Fix this case by always wrapping subroutines in eval '...', which moves the symbol definition to runtime, regardless of what $t (our indentation state) is. Similarly, generate `_h2ph_pre.ph` without the functionally useless `unless (defined &...) { }` blocks. We don't need runtime definitions (via eval) here because nothing in this file depends on the dynamic state of macro definitions. It's all `#define`s, no `#if`s. Fixes Perl#22109.
- Loading branch information
Showing
3 changed files
with
26 additions
and
24 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters