[geany/geany] d40932: C++: mitigate matching error on generics containing an expression
Colomban Wendling
git-noreply at xxxxx
Thu Jan 23 13:17:43 UTC 2014
Branch: refs/heads/master
Author: Colomban Wendling <ban at herbesfolles.org>
Committer: Colomban Wendling <ban at herbesfolles.org>
Date: Thu, 23 Jan 2014 13:17:43 UTC
Commit: d40932ce4d05e57573a6d6c8f89f4aea8c42d4f3
https://github.com/geany/geany/commit/d40932ce4d05e57573a6d6c8f89f4aea8c42d4f3
Log Message:
-----------
C++: mitigate matching error on generics containing an expression
Mitigate parse error with generics like `foo<X<Y> x;` by avoiding
matching past a semicolon (";") or open curly brace ("{"), which
can't be part of the generic. This isn't a proper fix, but mitigates
the impact of such constructs.
Modified Paths:
--------------
tagmanager/ctags/c.c
tests/ctags/bug1563476.cpp.tags
Modified: tagmanager/ctags/c.c
10 files changed, 10 insertions(+), 0 deletions(-)
===================================================================
@@ -1650,6 +1650,16 @@ static void skipToMatch (const char *const pair)
break;
}
}
+ /* early out if matching "<>" and we encounter a ";" or "{" to mitigate
+ * match problems with C++ generics containing a static expression like
+ * foo<X<Y> bar;
+ * normally neither ";" nor "{" could appear inside "<>" anyway. */
+ else if (isLanguage (Lang_cpp) && begin == '<' &&
+ (c == ';' || c == '{'))
+ {
+ cppUngetc (c);
+ break;
+ }
}
if (c == EOF)
{
Modified: tests/ctags/bug1563476.cpp.tags
2 files changed, 2 insertions(+), 0 deletions(-)
===================================================================
@@ -1,3 +1,5 @@
# format=tagmanager
+IntroduceBitDefÌ2048Ö0
IntroduceBitDefÌ32768Ö0
+fÌ16Í()ÎIntroduceBitDefÖ0Ïint
gÌ16Í()Ö0Ïint
--------------
This E-Mail was brought to you by github_commit_mail.py (Source: https://github.com/geany/infrastructure).
More information about the Commits
mailing list