This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [PATCH] Skip preprocessor directives in mklog


On 21-04-15 13:26, Yury Gribov wrote:
Hi all,

Contrib/mklog is currently faked by preprocessor directives inside functions to
produce invalid ChangeLog.

Hi Yury,

The effect of the patch on the mklog output using the pastebin input is:
...
@@ -2,11 +2,13 @@

 2015-04-21  x  <y@z>

-       * builtins.c:
+       * builtins.c (expand_builtin):
        * defaults.h:
-       * df-scan.c:
+       * df-scan.c (df_bb_refs_collect):
+       (df_get_exit_block_use_set):
        * except.c:
-       * haifa-sched.c:
-       * ira-lives.c:
-       * lra-lives.c:
+       * haifa-sched.c (initiate_bb_reg_pressure_info):
+       * ira-lives.c (process_bb_node_lives):
+       * lra-lives.c (process_bb_lives):
...


So, for f.i. this patch hunk:
...
diff --git a/gcc/builtins.c b/gcc/builtins.c
index 9263777..028d793 100644
--- a/gcc/builtins.c
+++ b/gcc/builtins.c
@@ -6510,10 +6510,8 @@ expand_builtin (tree exp, rtx target, rtx subtarget, machine_mode mode,
       expand_builtin_eh_return (CALL_EXPR_ARG (exp, 0),
 				CALL_EXPR_ARG (exp, 1));
       return const0_rtx;
-#ifdef EH_RETURN_DATA_REGNO
     case BUILT_IN_EH_RETURN_DATA_REGNO:
       return expand_builtin_eh_return_data_regno (exp);
-#endif
     case BUILT_IN_EXTEND_POINTER:
       return expand_builtin_extend_pointer (CALL_EXPR_ARG (exp, 0));
     case BUILT_IN_EH_POINTER:
...

with the patch we output:
...
       * builtins.c (expand_builtin):
...

instead of:
...
       * builtins.c:
...

That looks like an improvement to me.

Thanks,
- Tom

 The attached patch fixes this.

Tested with my local mklog testsuite and http://paste.debian.net/167999/ .  Ok
to commit?

-Y

mklog-1.diff


commit 23a738d05393676e72db82cb527d5fb1b3060e2f
Author: Yury Gribov<y.gribov@samsung.com>
Date:   Tue Apr 21 14:17:23 2015 +0300

     2015-04-21  Yury Gribov<y.gribov@samsung.com>

     	* mklog: Ignore preprocessor directives.

diff --git a/contrib/mklog b/contrib/mklog
index f7974a7..455614b 100755
--- a/contrib/mklog
+++ b/contrib/mklog
@@ -131,7 +131,6 @@ sub is_unified_hunk_start {
  }

  # 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)
@@ -143,7 +142,7 @@ sub is_top_level {
  	} else {
  		$function =~ s/^.//;
  	}
-	return $function && $function !~ /^[\s{]/;
+	return $function && $function !~ /^[\s{#]/;
  }

  # Read contents of .diff file



Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]