Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit ce01548

Browse files
committed
Clarify the regexp used to detect source files in MSVC builds.
The old pattern would match files with strange extensions like *.ry or *.lpp. Refactor it to only include files with known extensions, and to make it more readable. Per Andrew Dunstan's suggestion.
1 parent c340494 commit ce01548

File tree

2 files changed

+2
-2
lines changed

2 files changed

+2
-2
lines changed

src/tools/msvc/MSBuildProject.pm

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -127,7 +127,7 @@ EOF
127127
foreach my $fileNameWithPath (sort keys %{ $self->{files} })
128128
{
129129
confess "Bad format filename '$fileNameWithPath'\n"
130-
unless ($fileNameWithPath =~ /^(.*)\\([^\\]+)\.[r]?[cyl]$/);
130+
unless ($fileNameWithPath =~ /^(.*)\\([^\\]+)\.(c|cpp|y|l|rc)$/);
131131
my $dir = $1;
132132
my $fileName = $2;
133133
if ($fileNameWithPath =~ /\.y$/ or $fileNameWithPath =~ /\.l$/)

src/tools/msvc/VCBuildProject.pm

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,7 @@ EOF
7171
foreach my $fileNameWithPath (sort keys %{ $self->{files} })
7272
{
7373
confess "Bad format filename '$fileNameWithPath'\n"
74-
unless ($fileNameWithPath =~ /^(.*)\\([^\\]+)\.[r]?[cyl]$/);
74+
unless ($fileNameWithPath =~ /^(.*)\\([^\\]+)\.(c|cpp|y|l|rc)$/);
7575
my $dir = $1;
7676
my $file = $2;
7777

0 commit comments

Comments
 (0)