[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PATCH] automake: rewrite scan_variable_expansions regex
From: |
Jan Engelhardt |
Subject: |
[PATCH] automake: rewrite scan_variable_expansions regex |
Date: |
Thu, 3 Aug 2023 21:39:50 +0200 |
The regex pattern in function scan_variable_expansions() fails to
report a portability warning when a dollar-escaped dollar sign
precedes the variable:
foo_SOURCES = a.c $$$(patsubst a.c,a,b)
---
lib/Automake/Variable.pm | 5 +++--
1 file changed, 3 insertions(+), 2 deletions(-)
diff --git a/lib/Automake/Variable.pm b/lib/Automake/Variable.pm
index 4227baad9..4fe1e7284 100644
--- a/lib/Automake/Variable.pm
+++ b/lib/Automake/Variable.pm
@@ -746,9 +746,10 @@ sub scan_variable_expansions ($)
$text =~ s/#.*$//;
# Record each use of ${stuff} or $(stuff) that does not follow a $.
- while ($text =~ /(?<!\$)\$(?:\{([^\}]*)\}|\(([^\)]*)\))/g)
+ while ($text =~ m{\$(?:\{([^\}]*)\}|\(([^\)]*)\)|(\$))}g)
{
- my $var = $1 || $2;
+ my $var = $1 || $2 || $3;
+ next if $var eq '$';
# The occurrence may look like $(string1[:subst1=[subst2]]) but
# we want only 'string1'.
$var =~ s/:[^:=]*=[^=]*$//;
--
2.41.0
- [PATCH] automake: rewrite scan_variable_expansions regex,
Jan Engelhardt <=