ParseC.pm: gracefully handle DOS-style end-of-line in source files

When header files happen to have \r\n at line end, prevent hick-ups like:

Unmatched parentheses at include/openssl/asn1.h line 520

make[1]: *** [Makefile:4757: util/libcrypto.num] Error 255
make[1]: *** Waiting for unfinished jobs....
make: *** [Makefile:3387: build_sw] Error 2

Reviewed-by: Richard Levitte <levitte@openssl.org>
Reviewed-by: Tomas Mraz <tomas@openssl.org>
Reviewed-by: David von Oheimb <david.von.oheimb@siemens.com>
(Merged from https://github.com/openssl/openssl/pull/19686)
This commit is contained in:
Dr. David von Oheimb 2022-11-15 16:33:21 +01:00 committed by Dr. David von Oheimb
parent cab5b3a344
commit c507db9678
1 changed files with 1 additions and 1 deletions

View File

@ -822,7 +822,7 @@ sub parse {
# We use ¦undef¦ as a marker for a new line from the file.
# Since we convert one line to several and unshift that into @lines,
# that's the only safe way we have to track the original lines
my @lines = map { ( undef, $_ ) } split $/, $line;
my @lines = map { ( undef, $_ ) } split m|\R|, $line;
# Remember that extra # we added above? Now we remove it
pop @lines;