diffutils: C labels misdetected as functions (Was: [PATCH 1/2] runscripts/Lindent on it to match Documentation/CodingStyle)

From: Simon Arlott
Date: Sat Jul 21 2007 - 15:18:19 EST


(Bcc: bug-gnu-utils@xxxxxxx)
The patch below stops diffutils treating C labels starting in column 1 as function names.

On 21/07/07 14:52, Matthew Wilcox wrote:
> On Sat, Jul 21, 2007 at 07:11:01AM +0100, Simon Arlott wrote:
>> Changing the code to fix a utility bug is madness. I think it's been
>> fixed too...
>
> I just downloaded the source from CVS and it hasn't:
>
> --- test1.c 2007-07-21 09:49:02.000000000 -0400
> +++ test2.c 2007-07-21 09:49:12.000000000 -0400
> @@ -8,5 +8,4 @@ flibble:
> zero
> one
> - two
> three
> }
>
> Tell you what, why don't you fix it? Here's how to get the source:
> cvs -d:pserver:anonymous@xxxxxxxxxxxxxx:/sources/diffutils co diffutils
>
> I'm sure you'll figure it out from there.
>

---
Index: diff.c
===================================================================
RCS file: /sources/diffutils/diffutils/src/diff.c,v
retrieving revision 1.45
diff -U 4 -r1.45 diff.c
--- diff.c 19 Jul 2007 17:45:29 -0000 1.45
+++ diff.c 21 Jul 2007 19:13:23 -0000
@@ -430,9 +430,9 @@
break;

case 'p':
show_c_function = true;
- add_regexp (&function_regexp_list, "^[[:alpha:]$_]");
+ add_regexp (&function_regexp_list, "^[[:alpha:]$_](|.*[^:])$");
break;

case 'P':
unidirectional_new_file = true;


--
Simon Arlott
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/