diff options
author | Joel E. Denny <jdenny@clemson.edu> | 2009-08-06 11:34:09 -0400 |
---|---|---|
committer | Joel E. Denny <jdenny@clemson.edu> | 2009-08-06 18:59:48 -0400 |
commit | 642f240e229cb561b401ca8b897621c4c4b37fdc (patch) | |
tree | 14d7b8d173b43f2b639a81a1f291731fbfbdc0d8 /build-aux | |
parent | d0caad01ab38ec33cb6984292d4d2a6af98f78bd (diff) | |
download | bison-642f240e229cb561b401ca8b897621c4c4b37fdc.tar.gz |
maint: make update-b4-copyright easier to use
* build-aux/update-b4-copyright: In warnings, report line
numbers rather than character positions.
* cfg.mk (update-copyright-local): Set to update-b4-copyright so
that update-copyright runs it.
* gnulib: Update.
(cherry picked from commit a1a9422d4a2f70ff89e06318ba154851c3700f60)
Diffstat (limited to 'build-aux')
-rwxr-xr-x | build-aux/update-b4-copyright | 25 |
1 files changed, 15 insertions, 10 deletions
diff --git a/build-aux/update-b4-copyright b/build-aux/update-b4-copyright index 06d3cb76..af43407d 100755 --- a/build-aux/update-b4-copyright +++ b/build-aux/update-b4-copyright @@ -117,29 +117,34 @@ while (/($old_re)/gx) while (/(\bb4_copyright\()/g) { - my $pos = pos (); - pos () -= length ($1); + my $start = pos () - length ($1); + my $end = pos (); my $re = $old_re; + pos () = $start; $re =~ s/\#BEFORE/\\G/; if (!/$re/x) { + my $line = (substr ($_, 0, $start) =~ s/\n/\n/g) + 1; print STDERR - "$ARGV: warning: failed to update a b4_copyright before char" - . " $pos\n"; + "$ARGV:$line: warning: failed to update a b4_copyright\n"; } - pos () = $pos; + pos () = $end; } -while (/\[b4_copyright_years]/g) +while (/(\[b4_copyright_years])/g) { - my $pos = pos (); + my $start = pos () - length ($1); + my $end = pos (); my $re = $old_re; $re =~ s/\#AFTER/\\G/; if (!/$re/x) { + # The substr operation blows away pos (), so restoring pos () + # at the end is necessary. + my $line = (substr ($_, 0, $start) =~ s/\n/\n/g) + 1; print STDERR - "$ARGV: warning: failed to update a b4_copyright_years before" - . " char $pos\n"; + "$ARGV:$line: warning: failed to update a" + . " b4_copyright_years\n"; } - pos () = $pos; + pos () = $end; } |