Bugs item #2984343, was opened at 2010-04-09 00:54
Message generated for change (Comment added) made by progmei
You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=104664&aid=2984343&group_id=4664

Please note that this message will contain a full copy of the comment thread,
including the initial issue submission, for this request,
not just the latest update.
Category: C lexer/parser
Group: None
Status: Open
Resolution: None
Priority: 5
Private: No
Submitted By: Paul Hughes (dwv7j5x690)
Assigned to: Hans-Bernhard Broeker (broeker)
Summary: c++ namespace key word not supported

Initial Comment:
If a class is declared inside a namespace then cscope cannot find the 
declarations of those functions.
Also functions declared in anonymous namespace cscope does not index those 
functions.

Suggested fix:

x@t60>cvs diff src/fscanner.l
Index: src/fscanner.l
===================================================================
RCS file: /cvsroot/cscope/cscope/src/fscanner.l,v
retrieving revision 1.15
diff -r1.15 fscanner.l
479c479
< class{wsnl}+{identifier}({wsnl}|{identifier}|[():])*\{        {       /* 
class definition */
---
> ("namespace"|"class"){wsnl}+{identifier}({wsnl}|{identifier}|[():])*\{        
> {       /* class definition */
487a488,497
> namespace{wsnl}+\{    {       /* anonymous namespace */
>                       classdef = YES;
>                       tagdef =  'c';
>                       yyless(9);              /* eat up 'namespace', and 
> re-scan */
>                       yy_set_bol(0);
>                       goto more;
>                       /* NOTREACHED */
>               }
> 
> 


A similar change would also be required in src/scanner.l for those who use lex. 
I don't have a server with lex installed available to test.

----------------------------------------------------------------------

Comment By: progmei (progmei)
Date: 2012-11-14 05:28

Message:
As for the C++ is used more widely, but the C language seems no long
popular. Now most project in our product uses C++, and encourge us to use
the C++ and it's features, such as virtual function, namespace,template,
etc...
I don't think cscope not to completely support C++ is a good idea.


----------------------------------------------------------------------

Comment By: Hans-Bernhard Broeker (broeker)
Date: 2012-08-02 14:27

Message:
> There are 3 problems with cscope and c++

That's three you're aware of.  Whereas I'm convinced that this is actually
a bottomless pit, which I refuse to jump into.

People are having a hell of a time getting modern full-featured C++ code to
parse with a lexer and generated parser, plus lots of tacked-on extra
gizmos.  Expecting to do it with a lexer and just a little bit of state
machine on top, like cscope does it, is doomed to disappointment.

So, like I said before, we'll always fail at parsing C++ in some way that
somebody out there will find crucially limiting.  And if we managed to
kinda-sorta parse it, we would be getting flack for the result lacking
enough scoping information (namespaces, template hierarchies, ...) as to be
virtually useless. E.g. a standard STL has members whose names a single one
of, "correctly" displayed, would fill our output window all by themselves. 
This is a fight that cannot be won.  So I won't go there.

----------------------------------------------------------------------

Comment By: Paul Hughes (dwv7j5x690)
Date: 2012-08-01 16:07

Message:

It is disappointing that you are so hostile to C++.  Your project could
have many more users if you made some minor changes.

I even gave you exact code to fix the problem! 

There are 3 problems with cscope and c++

namespaces
functions with namespace specifiers eg function(std::string &arg)
functions with template args eg function(vector<myclass> &arg)

All of which can be fixed with minor changes to fscanner.l and scanner.l

After that cscope works well on my very large (1,000,000+ lines)  c and c++
project.



----------------------------------------------------------------------

Comment By: Jud P (judp)
Date: 2012-08-01 12:52

Message:
Bummer. Disappointing as I think this is the only issue holding back use in
my C++ project. Well thanks for the quick response at least!

----------------------------------------------------------------------

Comment By: Hans-Bernhard Broeker (broeker)
Date: 2012-08-01 11:36

Message:
For this to get fixed, it would have to be broken first.  I don't consider
it to be.  This is still cscope, not c++scope.  cscope will _always_ fail
to parse C++ code in some way --- the syntax of that language is just way
too bizarre for that.

----------------------------------------------------------------------

Comment By: Jud P (judp)
Date: 2012-08-01 11:23

Message:
Any chance this will get fixed? I'd love to start using cscope, but I'm
running into this issue and it makes cscope fairly useless for my project.

----------------------------------------------------------------------

You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=104664&aid=2984343&group_id=4664

------------------------------------------------------------------------------
Monitor your physical, virtual and cloud infrastructure from a single
web console. Get in-depth insight into apps, servers, databases, vmware,
SAP, cloud infrastructure, etc. Download 30-day Free Trial.
Pricing starts from $795 for 25 servers or applications!
http://p.sf.net/sfu/zoho_dev2dev_nov
_______________________________________________
Cscope-devel mailing list
Cscope-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/cscope-devel

Reply via email to