bug-global
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

No forward definitions of classes


From: polzin_spamprotect_
Subject: No forward definitions of classes
Date: Wed, 26 Sep 2007 15:01:29 +0200

Thanks for global/gtags!

I patched the gtags-parser/Cpp so that it does not record forward definitions of classes (e.g. "class myClass;"), because in bigger projects forward definitions may be used very extensively to reduce compile times, and gtags would report a lot "false-positive" matches.

I have not come across a disadvantage of this. Perhaps it could be interesting for forward definitions of functions as well.

Anyway, feel free to include the idea in the global sourcetree, if you want.

Regards,
  Tobias Polzin

patch:

-----------------------------------------------------------------------------------------------
diff -c -r1.1.1.2 Cpp.c
*** gtags-parser/Cpp.c  10 Aug 2007 23:18:07 -0000      1.1.1.2
--- gtags-parser/Cpp.c  26 Sep 2007 12:56:17 -0000
***************
*** 190,199 ****
                        DBG_PRINT(level, "class");
                        if ((c = nexttoken(interested, cpp_reserved_word)) == SYMBOL) {
                                strlimcpy(classname, token, sizeof(classname));
-                               if (target == DEF)
-                                       PUT(token, lineno, sp);
                                if (peekc(0) != ';')
                                        startclass = 1;
                        }
                        break;
                case '{':  /* } */
--- 190,201 ----
                        DBG_PRINT(level, "class");
                        if ((c = nexttoken(interested, cpp_reserved_word)) == SYMBOL) {
                                strlimcpy(classname, token, sizeof(classname));
                                if (peekc(0) != ';')
+                               {
                                        startclass = 1;
+                                       if (target == DEF)
+                                         PUT(token, lineno, sp);
+                               }
                        }
                        break;
                case '{':  /* } */
-----------------------------------------------------------------------------------------------


reply via email to

[Prev in Thread] Current Thread [Next in Thread]