automake-commit
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[automake-commit] branch master updated: automake: portability warning f


From: Karl Berry
Subject: [automake-commit] branch master updated: automake: portability warning for dollar-escaped dollar signs.
Date: Wed, 09 Aug 2023 21:07:09 -0400

This is an automated email from the git hooks/post-receive script.

karl pushed a commit to branch master
in repository automake.

View the commit online:
https://git.savannah.gnu.org/gitweb/?p=automake.git;a=commitdiff;h=56766ede64d4abfaa7c694122e7bb601a427736d

The following commit(s) were added to refs/heads/master by this push:
     new 56766ede6 automake: portability warning for dollar-escaped dollar 
signs.
56766ede6 is described below

commit 56766ede64d4abfaa7c694122e7bb601a427736d
Author: Jan Engelhardt <jengelh@inai.de>
AuthorDate: Wed Aug 9 18:07:00 2023 -0700

    automake: portability warning for dollar-escaped dollar signs.
    
    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 | 5 +++--
 t/dollarvar2.sh          | 9 +++++++++
 2 files changed, 12 insertions(+), 2 deletions(-)

diff --git a/lib/Automake/Variable.pm b/lib/Automake/Variable.pm
index 8bafc8e3a..82215b511 100644
--- a/lib/Automake/Variable.pm
+++ b/lib/Automake/Variable.pm
@@ -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/:[^:=]*=[^=]*$//;
diff --git a/t/dollarvar2.sh b/t/dollarvar2.sh
index 5f794a61f..4fc99fd33 100644
--- a/t/dollarvar2.sh
+++ b/t/dollarvar2.sh
@@ -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
+
 :



reply via email to

[Prev in Thread] Current Thread [Next in Thread]