mirror of git://gcc.gnu.org/git/gcc.git
mklog: Always doubt in functions.
contrib/ 2014-11-07 Marat Zakirov <m.zakirov@samsung.com> * mklog: Always doubt in functions. Add EOF protection. From-SVN: r217212
This commit is contained in:
parent
decfc6e113
commit
a8cfbbdc74
|
|
@ -1,3 +1,8 @@
|
||||||
|
2014-11-07 Marat Zakirov <m.zakirov@samsung.com>
|
||||||
|
|
||||||
|
* mklog: Always doubt in functions.
|
||||||
|
Add EOF protection.
|
||||||
|
|
||||||
2014-10-31 Jan-Benedict Glaw <jbglaw@lug-owl.de>
|
2014-10-31 Jan-Benedict Glaw <jbglaw@lug-owl.de>
|
||||||
|
|
||||||
* config-list.mk: Don't build Go for certain targets.
|
* config-list.mk: Don't build Go for certain targets.
|
||||||
|
|
|
||||||
|
|
@ -108,10 +108,22 @@ sub remove_suffixes ($) {
|
||||||
return $filename;
|
return $filename;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
sub is_context_hunk_start {
|
||||||
|
return @_[0] =~ /^\*\*\*\*\*\** ([a-zA-Z0-9_].*)/;
|
||||||
|
}
|
||||||
|
|
||||||
|
sub is_unified_hunk_start {
|
||||||
|
return @_[0] =~ /^@@ .* @@ ([a-zA-Z0-9_].*)/;
|
||||||
|
}
|
||||||
|
|
||||||
# Check if line is a top-level declaration.
|
# Check if line is a top-level declaration.
|
||||||
# TODO: ignore preprocessor directives except maybe #define ?
|
# TODO: ignore preprocessor directives except maybe #define ?
|
||||||
sub is_top_level {
|
sub is_top_level {
|
||||||
my ($function, $is_context_diff) = (@_);
|
my ($function, $is_context_diff) = (@_);
|
||||||
|
if (is_unified_hunk_start ($function)
|
||||||
|
|| is_context_hunk_start ($function)) {
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
if ($is_context_diff) {
|
if ($is_context_diff) {
|
||||||
$function =~ s/^..//;
|
$function =~ s/^..//;
|
||||||
} else {
|
} else {
|
||||||
|
|
@ -200,14 +212,10 @@ foreach (@diff_lines) {
|
||||||
$look_for_funs = 0;
|
$look_for_funs = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
# Mark if we met doubtfully changed function.
|
if (is_unified_hunk_start ($diff_lines[$line_idx])) {
|
||||||
$doubtfunc = 0;
|
|
||||||
if ($diff_lines[$line_idx] =~ /^@@ .* @@ ([a-zA-Z0-9_].*)/) {
|
|
||||||
$doubtfunc = 1;
|
|
||||||
$is_context_diff = 0;
|
$is_context_diff = 0;
|
||||||
}
|
}
|
||||||
elsif ($diff_lines[$line_idx] =~ /^\*\*\*\*\*\** ([a-zA-Z0-9_].*)/) {
|
elsif (is_context_hunk_start ($diff_lines[$line_idx])) {
|
||||||
$doubtfunc = 1;
|
|
||||||
$is_context_diff = 1;
|
$is_context_diff = 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -222,7 +230,6 @@ foreach (@diff_lines) {
|
||||||
#
|
#
|
||||||
# The third pattern looks for the starts of functions or classes
|
# The third pattern looks for the starts of functions or classes
|
||||||
# within a diff block both for context and unified diff files.
|
# within a diff block both for context and unified diff files.
|
||||||
|
|
||||||
if ($look_for_funs
|
if ($look_for_funs
|
||||||
&& (/^\*\*\*\*\*\** ([a-zA-Z0-9_].*)/
|
&& (/^\*\*\*\*\*\** ([a-zA-Z0-9_].*)/
|
||||||
|| /^@@ .* @@ ([a-zA-Z0-9_].*)/
|
|| /^@@ .* @@ ([a-zA-Z0-9_].*)/
|
||||||
|
|
@ -249,19 +256,19 @@ foreach (@diff_lines) {
|
||||||
}
|
}
|
||||||
# Check is function really modified
|
# Check is function really modified
|
||||||
$no_real_change = 0;
|
$no_real_change = 0;
|
||||||
if ($doubtfunc) {
|
$idx = $line_idx;
|
||||||
$idx = $line_idx;
|
|
||||||
# Skip line info in context diffs.
|
# Skip line info in context diffs.
|
||||||
while ($is_context_diff && $diff_lines[$idx + 1] =~ /^[-\*]{3} [0-9]/) {
|
while ($idx <= $#diff_lines && $is_context_diff
|
||||||
++$idx;
|
&& $diff_lines[$idx + 1] =~ /^[-\*]{3} [0-9]/) {
|
||||||
}
|
++$idx;
|
||||||
|
}
|
||||||
# Check all lines till the first change
|
# Check all lines till the first change
|
||||||
# for the presence of really changed function
|
# for the presence of really changed function
|
||||||
do {
|
do {
|
||||||
++$idx;
|
++$idx;
|
||||||
$no_real_change = is_top_level ($diff_lines[$idx], $is_context_diff);
|
$no_real_change = $idx > $#diff_lines
|
||||||
} while (!$no_real_change && ($diff_lines[$idx] !~ /^[-+!]/))
|
|| is_top_level ($diff_lines[$idx], $is_context_diff);
|
||||||
}
|
} while (!$no_real_change && ($diff_lines[$idx] !~ /^[-+!]/));
|
||||||
if ($fn && !$seen_names{$fn} && !$no_real_change) {
|
if ($fn && !$seen_names{$fn} && !$no_real_change) {
|
||||||
# If this is the first function in the file, we display it next
|
# If this is the first function in the file, we display it next
|
||||||
# to the filename, so we need an extra space before the opening
|
# to the filename, so we need an extra space before the opening
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue