diff options
author | Bill Meier <wmeier@newsguy.com> | 2013-02-09 22:14:13 +0000 |
---|---|---|
committer | Bill Meier <wmeier@newsguy.com> | 2013-02-09 22:14:13 +0000 |
commit | 233fcd672fa3075416df494d79fd702f2d28486e (patch) | |
tree | fc34256de0c4f8541f322c0d3664ca02fc30552b /tools/checkhf.pl | |
parent | eca5bd1c65381405fd36c2bd11d1a2aabe2940a7 (diff) |
Remove blank lines separately after removing comments rather than as
part of the 'remove comments' regex.
Fixes a bug introduced in SVN #47583 which broke '#if 0' handling.
svn path=/trunk/; revision=47598
Diffstat (limited to 'tools/checkhf.pl')
-rwxr-xr-x | tools/checkhf.pl | 5 |
1 files changed, 2 insertions, 3 deletions
diff --git a/tools/checkhf.pl b/tools/checkhf.pl index 59d498b145..bb12e8f463 100755 --- a/tools/checkhf.pl +++ b/tools/checkhf.pl @@ -107,8 +107,8 @@ while (my $filename = $ARGV[0]) { read_file(\$filename, \$file_contents); - remove_blank_lines (\$file_contents, $filename); remove_comments (\$file_contents, $filename); + remove_blank_lines (\$file_contents, $filename); remove_quoted_strings(\$file_contents, $filename); remove_if0_code (\$file_contents, $filename); @@ -232,8 +232,7 @@ sub remove_comments { # http://aspn.activestate.com/ASPN/Cookbook/Rx/Recipe/59811 # It is in the public domain. # A complicated regex which matches C-style comments. - # (Added: include trailing \n (if any) in deletion) - my $c_comment_regex = qr{ / [*] [^*]* [*]+ (?: [^/*] [^*]* [*]+ )* / \n ? }xmso; + my $c_comment_regex = qr{ / [*] [^*]* [*]+ (?: [^/*] [^*]* [*]+ )* / }xmso; ${$code_ref} =~ s{ $c_comment_regex } {}xmsog; |