Hi. I encountered the funny behavior in using GLOGAL. Then I tried to patch it. Please check it.
------------------------------------------------ What is your environment (OS)? $ uname -a CYGWIN_NT-10.0-WOW muse 2.2.1(0.289/5/3) 2015-08-20 11:40 i686 Cygwin ------------------------------------------------ Which version of GLOBAL are you using? $ global --version global (GNU GLOBAL) 6.5.7 Copyright (c) 1996-2017 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. ------------------------------------------------ What did you do? (command line) On the directory tree below: TestGtags | +-- Include | | | +-- TestGtags.h | +------------------------ | 1|enum A_MODE { | 2| a0, | 3| a1, | 4| a2, | 5|}; | +------------------------ +-- Src | +-- TestGtags.cpp +------------------------ 1|#include <stdio.h> 2|#include "TestGtags.h" 3| 4|void func() 5|{ 6| A_MODE a_mode = a0; 7| printf("a_mode=%d\n", a_mode); 8|} 9| 10|int main(int argc, char* argv[]) 11|{ 12| func(); 13| 14| A_MODE a_Mode = a1; 15| printf("a_Mode=%d\n", a_Mode); 16| 17| return 0; 18|} +------------------------ $ cd TestGtags $ gtags $ global -xsi a_mode ------------------------------------------------ What did you expect from it? I expect global print locations like followings. a_Mode 14 Src/TestGtags.cpp A_MODE a_Mode = a1; a_Mode 15 Src/TestGtags.cpp printf("a_Mode=%d\n", a_Mode); a_mode 6 Src/TestGtags.cpp A_MODE a_mode = a0; a_mode 7 Src/TestGtags.cpp printf("a_mode=%d\n", a_mode); ------------------------------------------------ What was occurred? (as is) Never print. ------------------------------------------------ Patch I thought that -i option is not work correctly. So, I wrote sample patch. Please check it. $ diff -up libutil/gtagsop.c.6.5.7 libutil/gtagsop.c --- libutil/gtagsop.c.6.5.7 2017-10-15 17:40:54.699199600 +0900 +++ libutil/gtagsop.c 2017-10-15 14:28:55.161333500 +0900 @@ -878,7 +878,17 @@ again1: else strhash_reset(gtop->path_hash); again2: +#if 0 tagline = dbop_first(gtop->dbop, gtop->key, gtop->preg, gtop->dbflags); +#else + for (tagline = dbop_first(gtop->dbop, gtop->key, gtop->preg, gtop->dbflags); + tagline != NULL; + tagline = dbop_next(gtop->dbop)) + { + VIRTUAL_GRTAGS_GSYMS_PROCESSING(gtop); + break; + } +#endif if (tagline == NULL) { if (gtop->prefix && gtags_restart(gtop)) goto again2; Thanks. -- Motoki NODA _______________________________________________ Bug-global mailing list [email protected] https://lists.gnu.org/mailman/listinfo/bug-global
