X-Git-Url: http://www.chiark.greenend.org.uk/ucgi/~ianmdlvl/git?a=blobdiff_plain;f=generate;h=f571fa19d196efc9aa62299a487a095f0dba2724;hb=80ebf1020232f0aa081f18b3b5fc432bd81a5544;hp=61bbd507c683adc89d5fe648260737a7c0492e73;hpb=08e825fede28f22ce3fbaf494c3e06360ed74d7a;p=secnet.git diff --git a/generate b/generate index 61bbd50..f571fa1 100755 --- a/generate +++ b/generate @@ -177,6 +177,7 @@ our @warn_ena_dfl = map { $_ => 1 } qw( local+global single-char-var unknown-warning + broken-var-ref ); our %warn_ena = @warn_ena_dfl; @@ -198,6 +199,8 @@ sub wrncore ($$) { sub wrn ($$) { my ($wk,$m) = @_; + our %warn_dedupe; + return 0 if $warn_dedupe{$err_file,$.,$wk,$m}++; wrncore($wk, "${err_file}:$.: $m"); } @@ -231,8 +234,8 @@ sub process_input_mk ($$$$) { local $err_file=$f; my %srcdirmap = ( - '^' => "\$(top_srcdir)${dir_suffix}", - '~' => "\$(top_srcdir)", + '^' => "\${top_srcdir}${dir_suffix}", + '~' => "\${top_srcdir}", ); my %pfxmap = ( '' => $dir_prefix, @@ -330,6 +333,10 @@ sub process_input_mk ($$$$) { wrn 'single-char-var', 'possibly confusing unbracketed single-char $-expansion'; } + elsif (m{^$esc}) { + wrn 'broken-var-ref', + 'broken $&... expansion; you probably meant &$'; + } elsif (m{^\(($esc)?([^()\$]+)\)} || m{^\{($esc)?([^{}\$]+)\}}) { $note_varref->($2,!!$1); @@ -343,7 +350,7 @@ sub process_input_mk ($$$$) { elsif (m{^(?=$caps_re)}) { od $var_prefix } elsif (s{^\$([A-Za-z]\w+)}{}) { $note_varref->($1,1); - od "\$(${var_prefix}$1)"; + od "\${${var_prefix}$1}"; } elsif (s{^([~^]?)(?=$lc_re)}{}) { od $pfxmap{$1} } elsif (s{^_}{}) { od $var_prefix }