]> git.ipfire.org Git - thirdparty/automake.git/commitdiff
automake: portability warning for dollar-escaped dollar signs.
authorJan Engelhardt <jengelh@inai.de>
Thu, 10 Aug 2023 01:07:00 +0000 (18:07 -0700)
committerKarl Berry <karl@freefriends.org>
Thu, 10 Aug 2023 01:07:00 +0000 (18:07 -0700)
This bug and fix was posted at
https://lists.gnu.org/archive/html/automake/2023-08/msg00003.html.

* lib/Automake/Variable.pm (scan_variable_expansions): rewrite
scan_variable_expansions regex to handle dollar-escaped dollar signs.
* t/dollarvar2.sh: test it.

lib/Automake/Variable.pm
t/dollarvar2.sh

index 8bafc8e3a059a5605f7a952bac4f3b0b2d4537fd..82215b51137fc237635f0981f2d06e112fd21465 100644 (file)
@@ -748,9 +748,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/:[^:=]*=[^=]*$//;
index 5f794a61f16bdb2fcbac1f802d0cbf937ca82a6a..4fc99fd3315f6180a5e1edb12714631f4359b70a 100644 (file)
@@ -83,4 +83,13 @@ AUTOMAKE_fails -Wno-portability -Wportability-recursive
 grep 'var-with-dash' stderr && exit 1
 grep 'recursive variable expansion' stderr
 
+#
+# Ensure that GNU make function calls give a portability warning
+# under a certain condition that older automake missed.
+#
+cat >Makefile.am <<'EOF'
+x = $$$(y z)
+EOF
+AUTOMAKE_fails -Wportability
+
 :