Re: unable to determine cause of wrong multiple definitions generated via gtags
Jason Hood <[email protected]>
| Newsgroups | gmane.comp.gnu.global.bugs |
|---|---|
| Message-ID | <[email protected]> |
It was caused by gtags interpreting the token before the comma within the template as a definition; attached is a patch to treat it as a reference (assuming '<' & '>' are only used for templates, not relations or shifts, and I haven't broken anything else, like the last time I tried to fix templates...). -- Jason. _______________________________________________ Bug-global mailing list [email protected] https://lists.gnu.org/mailman/listinfo/bug-global
template.txt
(text/plain, 1.3 KB)
diff -urp global-6.5/libparser/Cpp.c global-6-5/libparser/Cpp.c
--- global-6.5/libparser/Cpp.c 2015-06-10 11:45:09 +1000
+++ global-6-5/libparser/Cpp.c 2015-08-22 22:43:39 +1000
@@ -426,6 +426,7 @@ Cpp(const struct parser_param *param)
char savetok[MAXTOKEN];
int savelineno = 0;
int typedef_savelevel = level;
+ int templates = 0;
savetok[0] = 0;
@@ -502,7 +503,7 @@ Cpp(const struct parser_param *param)
PUT(PARSER_REF_SYM, token, lineno, sp);
}
savetok[0] = 0;
- while ((c = nexttoken("(),;", cpp_reserved_word)) != EOF) {
+ while ((c = nexttoken("()<>,;", cpp_reserved_word)) != EOF) {
switch (c) {
case SHARP_IFDEF:
case SHARP_IFNDEF:
@@ -519,6 +520,10 @@ Cpp(const struct parser_param *param)
level++;
else if (c == ')')
level--;
+ else if (c == '<')
+ templates++;
+ else if (c == '>')
+ templates--;
else if (c == SYMBOL) {
if (level > typedef_savelevel) {
PUT(PARSER_REF_SYM, token, lineno, sp);
@@ -533,7 +538,7 @@ Cpp(const struct parser_param *param)
}
} else if (c == ',' || c == ';') {
if (savetok[0]) {
- PUT(PARSER_DEF, savetok, lineno, sp);
+ PUT(templates ? PARSER_REF_SYM : PARSER_DEF, savetok, lineno, sp);
savetok[0] = 0;
}
}