This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
Re: Question for removing trailing whitespaces (not vertical tab) from source
- From: Bernd Jendrissek <berndj at prism dot co dot za>
- To: gcc at gcc dot gnu dot org
- Cc: Kai Tietz <Kai dot Tietz at onevision dot com>
- Date: Wed, 14 Mar 2007 11:40:51 +0200
- Subject: Re: Question for removing trailing whitespaces (not vertical tab) from source
- References: <45F6EA3F.C84CBDEB@dessent.net>
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
On Tue, Mar 13, 2007 at 11:15:27AM -0700, Brian Dessent wrote:
> Kai Tietz wrote:
> > Ok, I will try for this. I have to find a different editor, which is
> > not too smart as to remove trailing whitespaces ...
>
> Or just add -w to the diff options when generating the patch.
No, please don't. While -w is nice for generating diffs that are for
*human* consumption (reviewing changes), if you try to *apply* them you
will run into trouble. patch may not recognize the context so it won't
apply, or if it does apply, you can easily screw up the indentation of
the changed code. Consider what happens if the change you make is the
addition of an if () { ... } around an existing block of code. After
applying a -w patch, you'll end up with
....blah();
....if (cond)
......{
....hello();
....world();
......}
(blanks replaced by '.' to avoid MUA mangling)
BTW if you're going to do TAB->space conversion anyway, watch out for
sed expressions. I know there are a couple of those in the tree.
- --
Meetings are indispensable when you don't want to do anything.
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.6 (GNU/Linux)
iD8DBQFF98MRwyMv24BBd/gRAkiyAKCkxr3rkYUqJnx0NUq0uinfbNGaWwCfbPqo
jYhaKhK4BVP4bYwkxC0NbPQ=
=ZJm+
-----END PGP SIGNATURE-----