All of lore.kernel.org
 help / color / mirror / Atom feed
From: Simon Arlott <simon@fire.lp0.eu>
To: Paul Eggert <eggert@CS.UCLA.EDU>
Cc: Matthew Wilcox <matthew@wil.cx>, Denis Cheng <crquan@gmail.com>,
	kernel-janitors@vger.kernel.org, linux-kernel@vger.kernel.org,
	git@vger.kernel.org
Subject: Re: diffutils: C labels misdetected as functions
Date: Sun, 22 Jul 2007 19:16:23 +0000	[thread overview]
Message-ID: <46A3AD07.1070504@simon.arlott.org.uk> (raw)
In-Reply-To: <87abtogu6u.fsf@penguin.cs.ucla.edu>

On 22/07/07 19:38, Paul Eggert wrote:
> Simon Arlott <simon@fire.lp0.eu> writes:
> 
>> The patch below stops diffutils treating C labels starting in column 1 as function names.
> 
> That patch alone wouldn't suffice, since -p is documented as implying
> -F '^[[:alpha:]$_]'.  If the behavior changes, we'd also have to
> change the documentation to match.

Ok.

> I'm not sure the change is a good idea.  It would complicate the
> documentation and therefore the user interface, without that much

Complicated documentation means a bug shouldn't be fixed?

> benefit.  And it wouldn't suffice in general, since it would still
> mishandle labels followed by comments or by white space.

Yes, the regexp needs changing further to ignore comments...

"[[:alpha:]$_][^:]*$" perhaps? Although that ignores functions with
comments on the same line containing a :.

> Also, for long C functions some people might rather see a top-level
> (unindented) label highlighted than the function name highlighted, so
> they might prefer the current behavior.

"-p  --show-c-function  Show which C function each change is in."

It's not "--show-c-function-or-label".

> Anyway, to work around your problem without changing "diff", you can
> use "diff -u -F '^[[:alpha:]$_](|.*[^:])$'" instead of "diff -u -p".

Perhaps git could do this (or similar) as a workaround? (Cc:ed)

> Or you can put a single space before the labels in question: they'll
> still stand out plenty.

The code should definitely not need to be modified to work around a
diff bug.

-- 
Simon Arlott

WARNING: multiple messages have this Message-ID (diff)
From: Simon Arlott <simon@fire.lp0.eu>
To: Paul Eggert <eggert@CS.UCLA.EDU>
Cc: Matthew Wilcox <matthew@wil.cx>, Denis Cheng <crquan@gmail.com>,
	kernel-janitors@vger.kernel.org, linux-kernel@vger.kernel.org,
	git@vger.kernel.org
Subject: Re: diffutils: C labels misdetected as functions
Date: Sun, 22 Jul 2007 20:16:23 +0100	[thread overview]
Message-ID: <46A3AD07.1070504@simon.arlott.org.uk> (raw)
In-Reply-To: <87abtogu6u.fsf@penguin.cs.ucla.edu>

On 22/07/07 19:38, Paul Eggert wrote:
> Simon Arlott <simon@fire.lp0.eu> writes:
> 
>> The patch below stops diffutils treating C labels starting in column 1 as function names.
> 
> That patch alone wouldn't suffice, since -p is documented as implying
> -F '^[[:alpha:]$_]'.  If the behavior changes, we'd also have to
> change the documentation to match.

Ok.

> I'm not sure the change is a good idea.  It would complicate the
> documentation and therefore the user interface, without that much

Complicated documentation means a bug shouldn't be fixed?

> benefit.  And it wouldn't suffice in general, since it would still
> mishandle labels followed by comments or by white space.

Yes, the regexp needs changing further to ignore comments...

"[[:alpha:]$_][^:]*$" perhaps? Although that ignores functions with
comments on the same line containing a :.

> Also, for long C functions some people might rather see a top-level
> (unindented) label highlighted than the function name highlighted, so
> they might prefer the current behavior.

"-p  --show-c-function  Show which C function each change is in."

It's not "--show-c-function-or-label".

> Anyway, to work around your problem without changing "diff", you can
> use "diff -u -F '^[[:alpha:]$_](|.*[^:])$'" instead of "diff -u -p".

Perhaps git could do this (or similar) as a workaround? (Cc:ed)

> Or you can put a single space before the labels in question: they'll
> still stand out plenty.

The code should definitely not need to be modified to work around a
diff bug.

-- 
Simon Arlott

  reply	other threads:[~2007-07-22 19:16 UTC|newest]

Thread overview: 40+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-07-15  8:52 [PATCH 1/2] run scripts/Lindent on it to match Documentation/CodingStyle Denis Cheng
2007-07-15  8:52 ` Denis Cheng
2007-07-15  8:52 ` [PATCH 2/2] add static delaration and init_module fixes Denis Cheng
2007-07-15  8:52   ` Denis Cheng
2007-07-15  9:20 ` [PATCH 1/2] run scripts/Lindent on it to match Documentation/CodingStyle Christoph Hellwig
2007-07-15  9:20   ` Christoph Hellwig
2007-07-15  9:53 ` Simon Arlott
2007-07-15  9:53   ` Simon Arlott
2007-07-20 17:07   ` Matthew Wilcox
2007-07-20 17:07     ` Matthew Wilcox
2007-07-20 17:36     ` Simon Arlott
2007-07-20 17:36       ` Simon Arlott
2007-07-20 18:00       ` Matthew Wilcox
2007-07-20 18:00         ` Matthew Wilcox
2007-07-21  6:11         ` Simon Arlott
2007-07-21  6:11           ` Simon Arlott
2007-07-21 13:47           ` rae l
2007-07-21 13:47             ` rae l
2007-07-21 13:52           ` Matthew Wilcox
2007-07-21 13:52             ` Matthew Wilcox
2007-07-21 19:17             ` diffutils: C labels misdetected as functions (Was: [PATCH 1/2] run Simon Arlott
2007-07-21 19:17               ` diffutils: C labels misdetected as functions (Was: [PATCH 1/2] run scripts/Lindent on it to match Documentation/CodingStyle) Simon Arlott
2007-07-22 18:38               ` diffutils: C labels misdetected as functions Paul Eggert
2007-07-22 18:38                 ` Paul Eggert
2007-07-22 19:16                 ` Simon Arlott [this message]
2007-07-22 19:16                   ` Simon Arlott
2007-07-22 21:30                   ` Junio C Hamano
2007-07-22 21:30                     ` Junio C Hamano
2007-07-21  6:12         ` [PATCH 1/2] run scripts/Lindent on it to match Documentation/CodingStyle Simon Arlott
2007-07-21  6:12           ` Simon Arlott
2007-07-20 20:50     ` Oleg Verych
2007-07-20 20:50       ` Oleg Verych
2007-07-20 20:54       ` Matthew Wilcox
2007-07-20 20:54         ` Matthew Wilcox
2007-07-21  4:32         ` Fixing lables after GNU indent (Re: [PATCH 1/2] run scripts/Lindent on it to match Documentation/Cod Oleg Verych
2007-07-21  4:32           ` Fixing lables after GNU indent (Re: [PATCH 1/2] run scripts/Lindent on it to match Documentation/CodingStyle) Oleg Verych
2007-07-21 16:17     ` [PATCH 1/2] run scripts/Lindent on it to match Documentation/CodingStyle Jan Engelhardt
2007-07-21 16:17       ` Jan Engelhardt
2007-07-20 17:33   ` Matthew Wilcox
2007-07-20 17:33     ` Matthew Wilcox

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=46A3AD07.1070504@simon.arlott.org.uk \
    --to=simon@fire.lp0.eu \
    --cc=crquan@gmail.com \
    --cc=eggert@CS.UCLA.EDU \
    --cc=git@vger.kernel.org \
    --cc=kernel-janitors@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=matthew@wil.cx \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.