Re: [RFC/PATCH] diff: simplify cpp funcname regex

2014-03-18 Thread Johannes Sixt
Cc René; do you have any comments regarding grep --function-context? Am 3/18/2014 6:24, schrieb Jeff King: On Fri, Mar 14, 2014 at 07:56:46AM +0100, Johannes Sixt wrote: Consider this code: void above() {} static int Y; static int A; int bar() { return X; } void

Re: [RFC/PATCH] diff: simplify cpp funcname regex

2014-03-18 Thread René Scharfe
Am 18.03.2014 09:02, schrieb Johannes Sixt: Cc René; do you have any comments regarding grep --function-context? Am 3/18/2014 6:24, schrieb Jeff King: On Fri, Mar 14, 2014 at 07:56:46AM +0100, Johannes Sixt wrote: Consider this code: void above() {} static int Y; static int A;

Re: [RFC/PATCH] diff: simplify cpp funcname regex

2014-03-17 Thread Jeff King
On Fri, Mar 14, 2014 at 07:56:46AM +0100, Johannes Sixt wrote: Consider this code: void above() {} static int Y; static int A; int bar() { return X; } void below() {} Thanks, this example is very helpful. When you 'git grep --function-context X', then you get

Re: [RFC/PATCH] diff: simplify cpp funcname regex

2014-03-14 Thread Johannes Sixt
Am 3/14/2014 4:54, schrieb Jeff King: On Fri, Mar 07, 2014 at 08:23:05AM +0100, Johannes Sixt wrote: No, I meant lines like static double var; -static int old; +static int new; The motivation is to show hints where in a file the change is located: Anything that could be of

Re: [RFC/PATCH] diff: simplify cpp funcname regex

2014-03-13 Thread Jeff King
On Fri, Mar 07, 2014 at 08:23:05AM +0100, Johannes Sixt wrote: No, I meant lines like static double var; -static int old; +static int new; The motivation is to show hints where in a file the change is located: Anything that could be of significance for the author should be

Re: [RFC/PATCH] diff: simplify cpp funcname regex

2014-03-06 Thread Jeff King
On Wed, Mar 05, 2014 at 08:58:26AM +0100, Johannes Sixt wrote: Here is a patch that I'm carrying around since... a while. What do you think? The pattern I chose also catches variable definition, not just functions. That is what I need, but it hurts grep --function-context That's the reason

Re: [RFC/PATCH] diff: simplify cpp funcname regex

2014-03-06 Thread Johannes Sixt
Am 3/6/2014 22:28, schrieb Jeff King: On Wed, Mar 05, 2014 at 08:58:26AM +0100, Johannes Sixt wrote: The pattern I chose also catches variable definition, not just functions. That is what I need, but it hurts grep --function-context That's the reason I didn't forward the patch, yet. If by

Re: [RFC/PATCH] diff: simplify cpp funcname regex

2014-03-05 Thread Junio C Hamano
Jeff King p...@peff.net writes: types, we simply look for an identifier at the start of the line that contains a (, meaning it is either a function definition or a function call, and then not containing ; which would indicate it is a call or declaration. It is not worth worrying about:

Re: [RFC/PATCH] diff: simplify cpp funcname regex

2014-03-04 Thread Johannes Sixt
Am 3/5/2014 1:36, schrieb Jeff King: The current funcname matcher for C files requires one or more words before the function name, like: static int foo(int arg) { However, some coding styles look like this: static int foo(int arg) { and we do not match, even though the