* [PATCH] Fix for mklog
@ 2014-11-06 8:00 Marat Zakirov
2014-11-06 9:07 ` Yury Gribov
2014-11-06 17:24 ` Diego Novillo
0 siblings, 2 replies; 6+ messages in thread
From: Marat Zakirov @ 2014-11-06 8:00 UTC (permalink / raw)
To: gcc-patches, dnovillo, Yury Gribov
[-- Attachment #1: Type: text/plain, Size: 747 bytes --]
Hi all,
Current mklog in some cases do not checks whether function have real
changes or not. I fixed it by removing $doubtfunc and adding protection
against EOF.
Example:
diff --git a/gcc/cfg.c b/gcc/cfg.c
index 6070d9e..cb3dfd9 100644
--- a/gcc/cfg.c
+++ b/gcc/cfg.c
@@ -555,10 +555,10 @@ alloc_aux_for_block (basic_block bb, int size)
}
+void
+free_aux_for_edges (void)
+{
+ free_aux_for_edges (cfun);
+}
+
DEBUG_FUNCTION void
debug_bb (basic_block bb)
{
Current mklog output, function debug_bb is reported but it does not have
any changes within.
gcc/ChangeLog:
DATE
* cfg.c (free_aux_for_edges):
(debug_bb):
Patched mklog output:
gcc/ChangeLog:
DATE
* cfg.c (free_aux_for_edges):
Ok to commit?
--Marat
[-- Attachment #2: mavdt-10_3.diff --]
[-- Type: text/x-patch, Size: 2728 bytes --]
contrib/ChangeLog:
2014-11-05 Marat Zakirov <m.zakirov@samsung.com>
* mklog: Always doubt in functions.
Add EOF protection.
diff --git a/contrib/mklog b/contrib/mklog
index 6ed4c6e..8e3c6b6 100755
--- a/contrib/mklog
+++ b/contrib/mklog
@@ -108,10 +108,22 @@ sub remove_suffixes ($) {
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.
# TODO: ignore preprocessor directives except maybe #define ?
sub is_top_level {
my ($function, $is_context_diff) = (@_);
+ if (is_unified_hunk_start ($function)
+ || is_context_hunk_start ($function)) {
+ return 1;
+ }
if ($is_context_diff) {
$function =~ s/^..//;
} else {
@@ -200,14 +212,10 @@ foreach (@diff_lines) {
$look_for_funs = 0;
}
- # Mark if we met doubtfully changed function.
- $doubtfunc = 0;
- if ($diff_lines[$line_idx] =~ /^@@ .* @@ ([a-zA-Z0-9_].*)/) {
- $doubtfunc = 1;
+ if (is_unified_hunk_start ($diff_lines[$line_idx])) {
$is_context_diff = 0;
}
- elsif ($diff_lines[$line_idx] =~ /^\*\*\*\*\*\** ([a-zA-Z0-9_].*)/) {
- $doubtfunc = 1;
+ elsif (is_context_hunk_start ($diff_lines[$line_idx])) {
$is_context_diff = 1;
}
@@ -222,7 +230,6 @@ foreach (@diff_lines) {
#
# The third pattern looks for the starts of functions or classes
# within a diff block both for context and unified diff files.
-
if ($look_for_funs
&& (/^\*\*\*\*\*\** ([a-zA-Z0-9_].*)/
|| /^@@ .* @@ ([a-zA-Z0-9_].*)/
@@ -249,19 +256,19 @@ foreach (@diff_lines) {
}
# Check is function really modified
$no_real_change = 0;
- if ($doubtfunc) {
- $idx = $line_idx;
+ $idx = $line_idx;
# Skip line info in context diffs.
- while ($is_context_diff && $diff_lines[$idx + 1] =~ /^[-\*]{3} [0-9]/) {
- ++$idx;
- }
+ while ($idx <= $#diff_lines && $is_context_diff
+ && $diff_lines[$idx + 1] =~ /^[-\*]{3} [0-9]/) {
+ ++$idx;
+ }
# Check all lines till the first change
# for the presence of really changed function
- do {
- ++$idx;
- $no_real_change = is_top_level ($diff_lines[$idx], $is_context_diff);
- } while (!$no_real_change && ($diff_lines[$idx] !~ /^[-+!]/))
- }
+ do {
+ ++$idx;
+ $no_real_change = $idx > $#diff_lines
+ || 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 this is the first function in the file, we display it next
# to the filename, so we need an extra space before the opening
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH] Fix for mklog
2014-11-06 8:00 [PATCH] Fix for mklog Marat Zakirov
@ 2014-11-06 9:07 ` Yury Gribov
2014-11-06 9:27 ` Yury Gribov
2014-11-06 17:24 ` Diego Novillo
1 sibling, 1 reply; 6+ messages in thread
From: Yury Gribov @ 2014-11-06 9:07 UTC (permalink / raw)
To: Marat Zakirov, gcc-patches, dnovillo
On 11/06/2014 11:00 AM, Marat Zakirov wrote:
> - if ($doubtfunc) {
> - $idx = $line_idx;
> + $idx = $line_idx;
> # Skip line info in context diffs.
> - while ($is_context_diff && $diff_lines[$idx + 1] =~ /^[-\*]{3} [0-9]/) {
> - ++$idx;
> - }
> + while ($idx <= $#diff_lines && $is_context_diff
> + && $diff_lines[$idx + 1] =~ /^[-\*]{3} [0-9]/) {
> + ++$idx;
> + }
In original mklog this part was only run immediately after start of new
hunk (which is correct) whereas with your patch it can now run in the
middle of hunk.
-Y
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH] Fix for mklog
2014-11-06 9:07 ` Yury Gribov
@ 2014-11-06 9:27 ` Yury Gribov
0 siblings, 0 replies; 6+ messages in thread
From: Yury Gribov @ 2014-11-06 9:27 UTC (permalink / raw)
To: Marat Zakirov, gcc-patches, dnovillo
On 11/06/2014 12:07 PM, Yury Gribov wrote:
> On 11/06/2014 11:00 AM, Marat Zakirov wrote:
>> - if ($doubtfunc) {
>> - $idx = $line_idx;
>> + $idx = $line_idx;
>> # Skip line info in context diffs.
>> - while ($is_context_diff && $diff_lines[$idx + 1] =~
>> /^[-\*]{3} [0-9]/) {
>> - ++$idx;
>> - }
>> + while ($idx <= $#diff_lines && $is_context_diff
>> + && $diff_lines[$idx + 1] =~ /^[-\*]{3} [0-9]/) {
>> + ++$idx;
>> + }
>
> In original mklog this part was only run immediately after start of new
> hunk (which is correct) whereas with your patch it can now run in the
> middle of hunk.
Ok, I've inspected the context diff format and it seems that I was wrong
- line markers (^--- and ^***) can appear inside hunks.
So patch LGTM but you need to wait for maintainer's (i.e. Diego's)
approval.
-Y
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH] Fix for mklog
2014-11-06 8:00 [PATCH] Fix for mklog Marat Zakirov
2014-11-06 9:07 ` Yury Gribov
@ 2014-11-06 17:24 ` Diego Novillo
1 sibling, 0 replies; 6+ messages in thread
From: Diego Novillo @ 2014-11-06 17:24 UTC (permalink / raw)
To: Marat Zakirov, gcc-patches, Yury Gribov
On 11/06/14 03:00, Marat Zakirov wrote:
> Ok to commit?
OK. Thanks.
Diego.
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH] Fix for mklog
2014-11-11 14:47 Marat Zakirov
@ 2014-11-11 14:52 ` Diego Novillo
0 siblings, 0 replies; 6+ messages in thread
From: Diego Novillo @ 2014-11-11 14:52 UTC (permalink / raw)
To: Marat Zakirov, gcc-patches, Yury Gribov
On 11/11/14 09:46, Marat Zakirov wrote:
>
> Attached patch make mklog to stop search for changes inside function
> once '}' occur.
>
> Ok, to commit?
OK. Thanks.
Diego.
^ permalink raw reply [flat|nested] 6+ messages in thread
* [PATCH] Fix for mklog
@ 2014-11-11 14:47 Marat Zakirov
2014-11-11 14:52 ` Diego Novillo
0 siblings, 1 reply; 6+ messages in thread
From: Marat Zakirov @ 2014-11-11 14:47 UTC (permalink / raw)
To: gcc-patches, dnovillo, Yury Gribov
[-- Attachment #1: Type: text/plain, Size: 852 bytes --]
Hi all!
I found another issue of mklog.
Example:
--- a/gcc/asan.h
+++ b/gcc/asan.h
@@ -103,4 +103,14 @@ asan_intercepted_p (enum built_in_function fcode)
|| fcode == BUILT_IN_STRNCMP
|| fcode == BUILT_IN_STRNCPY;
}
+
+/* Convert LEN to HOST_WIDE_INT if possible.
+ Returns -1 otherwise. */
+
+static inline HOST_WIDE_INT
+maybe_tree_to_shwi (tree len)
+{
+ return tree_fits_shwi_p (len) ? tree_to_shwi (len) : -1;
+}
+
#endif /* TREE_ASAN */
mklog output:
gcc/ChangeLog:
DATE
* asan.h (asan_intercepted_p):
(maybe_tree_to_shwi):
Currently mklog finds some changes for asan_intercepted_p which are do
not exist.
Patched mklog output:
gcc/ChangeLog:
DATE
* asan.h (maybe_tree_to_shwi):
Attached patch make mklog to stop search for changes inside function
once '}' occur.
Ok, to commit?
--Marat
[-- Attachment #2: mavdt-98.diff --]
[-- Type: text/x-patch, Size: 482 bytes --]
contrib/ChangeLog:
2014-11-06 Marat Zakirov <m.zakirov@samsung.com>
* mklog: Symbol '}' stops search for changes.
diff --git a/contrib/mklog b/contrib/mklog
index 6ed4c6e..7de485d 100755
--- a/contrib/mklog
+++ b/contrib/mklog
@@ -117,7 +117,7 @@ sub is_top_level {
} else {
$function =~ s/^.//;
}
- return $function && $function !~ /^[\s{}]/;
+ return $function && $function !~ /^[\s{]/;
}
# For every file in the .diff print all the function names in ChangeLog
^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~2014-11-11 14:52 UTC | newest]
Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-11-06 8:00 [PATCH] Fix for mklog Marat Zakirov
2014-11-06 9:07 ` Yury Gribov
2014-11-06 9:27 ` Yury Gribov
2014-11-06 17:24 ` Diego Novillo
2014-11-11 14:47 Marat Zakirov
2014-11-11 14:52 ` Diego Novillo
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).