Re: global c++ parser misses C++11 type alias (using)
Shigio YAMAGUCHI <[email protected]>
| Newsgroups | gmane.comp.gnu.global.bugs |
|---|---|
| Message-ID | <CADJmJYp-k7L0TuN9RE2THHVcP97LYF_JmZa8=z3BUoyWE2Xj5w@mail.gmail.com> |
Hi, Thank you for the patch. I corrected the bug by a little different method. When you can test, it's lucky. Regards, Shigio 2015-07-08 20:16 GMT+09:00 Evghenii Gaburov <[email protected]>: > OS: Linux Ubuntu 14.04LTS & Mac OS X 10.10.2 > GLOBAL: v6.5, built from source via configure && make && make install > COMMAND : gtags -v > EXPECT: detect C++11 type alias (using A = B;) > RESULT: C++11 type alias is not tagged > > Here is the reproducer: > ————————————— > $ cat > cvt.cpp > using my_type1 = double; > typedef float my_type2; > > my_type2 cvt(my_type1 x) > { > return static_cast<my_type2>(x); > } > ^C > $ gtags --version > gtags (GNU GLOBAL) 6.5 > Copyright (c) 2015 Tama Communications Corporation > License GPLv3+: GNU GPL version 3 or later < > http://www.gnu.org/licenses/gpl.html> > This is free software; you are free to change and redistribute it. > There is NO WARRANTY, to the extent permitted by law. > $ gtags -v > [Wed Jul 08 13:11:29 CEST 2015] Gtags started. > [Wed Jul 08 13:11:29 CEST 2015] Creating 'GTAGS' and 'GRTAGS'. > [1] extracting tags of cvt.cpp > [Wed Jul 08 13:11:29 CEST 2015] Done. > $ global -x my_type1 > $ global -x my_type2 > my_type2 2 cvt.cpp typedef float my_type2; > $ > > Attached is a simple patch [by no means complete] that seems to fix the > problem: > ————————————————— > $ patch -p1 < global-6.5-using.patch > patching file libparser/Cpp.c > $ make && make install > $ rm -rf G* > $ gtags -v > [Wed Jul 08 13:14:09 CEST 2015] Gtags started. > [Wed Jul 08 13:14:09 CEST 2015] Creating 'GTAGS' and 'GRTAGS'. > [1] extracting tags of cvt.cpp > [Wed Jul 08 13:14:09 CEST 2015] Done. > $ global -x my_type1 > my_type1 1 cvt.cpp using my_type1 = double; > $ global -x my_type2 > my_type2 2 cvt.cpp typedef float my_type2; > > > Cheers, > Evghenii > > > > _______________________________________________ > Bug-global mailing list > [email protected] > https://lists.gnu.org/mailman/listinfo/bug-global > > -- Shigio YAMAGUCHI <[email protected]> PGP fingerprint: D1CB 0B89 B346 4AB6 5663 C4B6 3CA5 BBB3 57BE DDA3 _______________________________________________ Bug-global mailing list [email protected] https://lists.gnu.org/mailman/listinfo/bug-global
using-fix.diff
(text/plain, 1.5 KB)
Index: libparser/Cpp.c
===================================================================
RCS file: /sources/global/global/libparser/Cpp.c,v
retrieving revision 1.17
diff -c -r1.17 Cpp.c
*** libparser/Cpp.c 30 Jun 2015 23:20:14 -0000 1.17
--- libparser/Cpp.c 14 Jul 2015 02:24:24 -0000
***************
*** 129,134 ****
--- 129,135 ----
}
break;
case CPP_USING:
+ crflag = 0;
/*
* using namespace name;
* using ...;
***************
*** 141,148 ****
warning("missing namespace name. [+%d %s].", lineno, curfile);
pushbacktoken();
}
! } else
pushbacktoken();
break;
case CPP_NAMESPACE:
crflag = 0;
--- 142,168 ----
warning("missing namespace name. [+%d %s].", lineno, curfile);
pushbacktoken();
}
! } else if (c == SYMBOL) {
! char savetok[MAXTOKEN], *saveline;
! int savelineno = lineno;
!
! strlimcpy(savetok, token, sizeof(savetok));
! strbuf_reset(sb);
! strbuf_puts(sb, sp);
! saveline = strbuf_value(sb);
! if ((c = nexttoken(interested, cpp_reserved_word)) == '=') {
! PUT(PARSER_DEF, savetok, savelineno, saveline);
! } else {
! PUT(PARSER_REF_SYM, savetok, savelineno, saveline);
! while (c == SYMBOL) {
! PUT(PARSER_REF_SYM, token, lineno, sp);
! c = nexttoken(interested, cpp_reserved_word);
! }
! }
! } else {
pushbacktoken();
+ }
+ crflag = 1;
break;
case CPP_NAMESPACE:
crflag = 0;