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] Add a new warning flag -Wself-assign


On Wed, Jun 09, 2010 at 11:43:01AM -0700, Le-Chun Wu wrote:
> Thanks for the comments. And yes, I know the change logs would go in
> different subdirectories and the prefix is not needed. What I normally
> did in the past (and found some of the other people also do the same)
> is to send out an aggregated ChangeLog for review. And after the patch
> is approved, I will split it up, remove the unnecessary prefix, and
> submit them to their respective locations. That being said, when I
> send out a revised patch later, I will split up the ChangeLog.

It might be easier to make sure all the ChangeLog entries are in the
correct place first and then aggregate them all for patch submission.
That way you won't make any errors with cut-and-paste etc.  I use the
following script for nicely-formatted multi-directory patches:

#!/bin/bash

for dir in "$@"
do
    echo $dir/
    log=$(svn status $dir/ChangeLog* | egrep '^M'|tail -n 1 | awk '{print $2}')
    cl-head $log
    echo
done

Of course, you need cl-head as well, which is a little rough and doesn't
quite work for multi-author patches, but it's pretty close:

#!/usr/bin/gawk -f

BEGIN {
  printing_log = 0;             # whether we are printing an entry
  holding_blank_line = 0;       # whether previous line was a blank line
}

# We start printing at the first bullet or after the first blank line.
/^[[:space:]]+./ {
  if (!printing_log)
  {
    printing_log = 1;
    holding_blank_line = 0;
  }

  if (printing_log)
  {
    if (holding_blank_line)
    {
      print "";
      holding_blank_line = 0;
    }
    print;
  }
}

# We wait to output blank lines because there's a blank line at the end
# of every entry and we don't want to stick that into our log message.
/^$/ { holding_blank_line = 1; }

# A line with non-whitespace in the first column is the start of the next
# entry.  So we can stop if we were printing the log.
/^[^[:space:]]/ { if (printing_log) exit; }

With both of these, you can simply invoke:

  multi-dir-cl-head gcc gcc/cp gcc/testsuite

and get the desired output:

gcc/
	* file.c (function): Message.

gcc/cp/
	* file2.c (function2): Likewise.

gcc/testsuite/
	* file3.c (function3): Likewise.

Extending multi-dir-cl-head so that it does the right thing from 'svn
status' or similar is left as an exercise for the reader. :)

HTH,
-Nathan


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