From 5add877510c926bd1b27ad34a4a2e7809dda3233 Mon Sep 17 00:00:00 2001 From: Tom Tromey Date: Fri, 15 Jun 2001 00:41:29 +0000 Subject: [PATCH] 2001-06-14 Tom Tromey * aclocal.in (scan_m4_files): Removed unused variable. 2001-06-14 Alexandre Duret-Lutz * aclocal.in (scan_m4_files): Tweak the building of &search so that multiple macro names can be found on the same line. Ensure we match whole macro name, not only substrings. --- ChangeLog | 10 ++++++++++ aclocal.in | 18 +++++++++--------- 2 files changed, 19 insertions(+), 9 deletions(-) diff --git a/ChangeLog b/ChangeLog index b56a7f05..4101907e 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,13 @@ +2001-06-14 Tom Tromey + + * aclocal.in (scan_m4_files): Removed unused variable. + +2001-06-14 Alexandre Duret-Lutz + + * aclocal.in (scan_m4_files): Tweak the building of &search so + that multiple macro names can be found on the same line. Ensure + we match whole macro name, not only substrings. + 2001-06-12 Tom Tromey * automake.texi (ANSI): Minor clarification. diff --git a/aclocal.in b/aclocal.in index 5d3f7854..7879806c 100644 --- a/aclocal.in +++ b/aclocal.in @@ -304,7 +304,7 @@ sub scan_m4_files { opendir (DIR, $m4dir) || die "aclocal: couldn't open directory `$m4dir': $!\n"; - local ($file, $fullfile, $expr); + local ($file, $fullfile); foreach $file (sort grep (! /^\./, readdir (DIR))) { # Only examine .m4 files. @@ -322,17 +322,17 @@ sub scan_m4_files # Construct a new function that does the searching. We use a # function (instead of just evalling $search in the loop) so that # "die" is correctly and easily propagated if run. - local ($search, $expr, $key) = ''; - foreach $key (reverse sort keys %map) + my $search = "sub search {\nmy \$found = 0;\n"; + foreach my $key (reverse sort keys %map) { # EXPR is a regexp matching the name of the macro. - ($expr = $key) =~ s/(\W)/\\$1/g; - $search .= ("if (/" . $expr . "/) { & add_macro (" . $key - . "); return 1; }\n"); + (my $expr = $key) =~ s/(\W)/\\$1/g; + $search .= ('if (/\b' . $key . '\b/) { & add_macro (' . $key + . '); $found = 1; }' . "\n"); } - $search .= "return 0;\n"; - eval 'sub search { ' . $search . '};'; - die "internal error: $@\n search is $search " if $@; + $search .= "return \$found;\n};\n"; + eval $search; + die "internal error: $@\n search is $search" if $@; } ################################################################ -- 2.43.5