public inbox for git@vger.kernel.org 
 help / color / mirror / Atom feed
From: Vadim Zeitlin <vz-git@zeitlins•org>
To: git@vger•kernel.org
Subject: [PATCH] Avoid false positives in label detection in cpp diff hunk header regex.
Date: Fri, 22 Mar 2013 13:43:52 +0000 (UTC)	[thread overview]
Message-ID: <loom.20130322T144107-601@post.gmane.org> (raw)

A C++ method start such as

        void
        foo::bar()

wasn't recognized by cpp diff driver as it mistakenly included "foo::bar" as a
label. However the colon in a label can't be followed by another colon, so
recognize this case specially to correctly detect C++ methods using this style.

Signed-off-by: Vadim Zeitlin <vz-git@zeitlins•org>
---
 userdiff.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/userdiff.c b/userdiff.c
index ea43a03..9415586 100644
--- a/userdiff.c
+++ b/userdiff.c
@@ -125,7 +125,7 @@ PATTERNS("tex",
"^(\\\\((sub)*section|chapter|part)\\*{0,1}\\{.*)$",
         "\\\\[a-zA-Z@]+|\\\\.|[a-zA-Z0-9\x80-\xff]+"),
 PATTERNS("cpp",
         /* Jump targets or access declarations */
-        "!^[ \t]*[A-Za-z_][A-Za-z_0-9]*:.*$\n"
+        "!^[ \t]*[A-Za-z_][A-Za-z_0-9]*:([^:].*$|$)\n"
         /* C/++ functions/methods at top level */
         "^([A-Za-z_][A-Za-z_0-9]*([ \t*]+[A-Za-z_][A-Za-z_0-9]*([ \t]*::[
\t]*[^[:space:]]+)?){1,}[ \t]*\\([^;]*)$\n"
         /* compound type at top level */
--
1.8.2.135.g7b592fa

             reply	other threads:[~2013-03-22 13:44 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-03-22 13:43 Vadim Zeitlin [this message]
2013-03-22 15:02 ` [PATCH] Avoid false positives in label detection in cpp diff hunk header regex Junio C Hamano
2013-03-22 17:27   ` Vadim Zeitlin
2013-03-22 21:55   ` Johannes Sixt
2013-03-22 22:32     ` Junio C Hamano
2013-03-22 23:11       ` Johannes Sixt
2013-03-23  0:38         ` Vadim Zeitlin
2013-03-23  8:31           ` Andreas Schwab
2013-03-23  9:48             ` Vadim Zeitlin

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=loom.20130322T144107-601@post.gmane.org \
    --to=vz-git@zeitlins$(echo .)org \
    --cc=git@vger$(echo .)kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox