autoconf-patches
[Top][All Lists]
Advanced

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

Re: Better matching of unexpanded macros


From: Pavel Roskin
Subject: Re: Better matching of unexpanded macros
Date: Sun, 29 Oct 2000 20:01:33 -0500 (EST)

Hello, Alexandre!

> I thought we had agreed not to use ranges such as `[A-Z]' any more.

I thought we had agreed not to fix two problems with one patch. On the
other hand, I'm guilty of multiplying this mess, so I'm fixining it right
away :-)

> Also, I think matching A._[_A-Za-z0-9]* will get too many matches.  How
> about just A[A-Z]_...?

Good point! Thank you!

ChangeLog:
        * autoconf.sh: When scanning for unexpanded macros match only
        macros beginning with "A?_" and "m4_" or containing "_A?_".
        Strip the comments before the matching. Don't use character
        ranges.

Regards,
Pavel Roskin

____________________________
Index: autoconf.sh
--- autoconf.sh Sun Oct 29 12:41:57 2000
+++ autoconf.sh Sun Oct 29 19:35:55 2000
@@ -223,6 +223,9 @@
 # Set them in the order expected by the M4 macros: the converse.
 alphabet='abcdefghijklmnopqrstuvwxyz'
 ALPHABET='ABCDEFGHIJKLMNOPQRSTUVWXYZ'
+NUMBERS='0123456789'
+WORDCHAR=_$alphabet$ALPHABET$NUMBERS
+
 _ac_warnings=
 for warning in `IFS=,; echo syntax,$WARNINGS,$warnings |
                          tr $ALPHABET $alphabet`
@@ -303,10 +306,6 @@
   $run_m4f -D_AC_WARNINGS=$_ac_warnings $infile >$tmp/configure ||
     { (exit 1); exit; }
 
-  # You can add your own prefixes to pattern if you want to check for
-  # them too.
-  pattern="_?A[CHM]_|m4_"
-
   if test "x$outfile" != x-; then
     chmod +x $outfile
   fi
@@ -346,10 +345,23 @@
       while (sub (/@%:@/, "#"))
         continue
       # Dubious feature: we tolerate macro names when commented.
-      if (/^[^#]*($pattern)/)
+      code_part = \$0
+      comment_start = index (code_part, "#")
+      if (comment_start)
+        code_part = substr (\$0, 0, comment_start)
+      if (match (code_part, /[^$WORDCHAR](A[$ALPHABET]|m4)_[$WORDCHAR]*/))
+        {
+           macros [substr (code_part, RSTART + 1, RLENGTH - 1)] = oline
+           some_macros_were_not_expanded = 1
+        }
+      if (match (code_part, /^(A[$ALPHABET]|m4)_[$WORDCHAR]*/))
+        {
+           macros [substr (code_part, RSTART, RLENGTH)] = oline
+           some_macros_were_not_expanded = 1
+        }
+      if (match (code_part, /[$WORDCHAR]*_A[$ALPHABET]_[$WORDCHAR]*/))
         {
-           match (\$0, /([_A-Za-z0-9]*($pattern)[_A-Za-z0-9]*)/)
-           macros [substr (\$0, RSTART, RLENGTH)] = oline
+           macros [substr (code_part, RSTART, RLENGTH)] = oline
            some_macros_were_not_expanded = 1
         }
       print
____________________________




reply via email to

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