Code::Blocks Forums

Developer forums (C::B DEVELOPMENT STRICTLY!) => Development => CodeCompletion redesign => Topic started by: Alpha on April 10, 2013, 08:15:53 pm

Title: using namespace
Post by: Alpha on April 10, 2013, 08:15:53 pm
While going through this patch (http://forums.codeblocks.org/index.php/topic,17130.msg120875.html#msg120875), I noticed that using namespace is only (or at least, seems to be only) parsed in the global scope.  Is this a known problem?  Is it supposed to work (currently)?
Title: Re: using namespace
Post by: ollydbg on April 11, 2013, 02:15:32 am
While going through this patch (http://forums.codeblocks.org/index.php/topic,17130.msg120875.html#msg120875), I noticed that using namespace is only (or at least, seems to be only) parsed in the global scope.  Is this a known problem?
Note that parser in batch mode (parsing local files) has no need to handle "using namespace" statements in function bodies.
There is another function:bool ParserThread::ParseBufferForUsingNamespace(const wxString& buffer, wxArrayString& result) which handle local using namespace statements.

Another thing: I think TokenIdxSet is better than "std::vector<int>" in the patch.
Title: Re: using namespace
Post by: Alpha on April 11, 2013, 04:36:36 pm
There is another function:bool ParserThread::ParseBufferForUsingNamespace(const wxString& buffer, wxArrayString& result) which handle local using namespace statements.
Yes, however on line 414, function bodies are skipped.  (I think I have a solution though.)
Code
        else if (token==ParserConsts::opbrace)
        {
            SkipBlock();
        }

Another thing: I think TokenIdxSet is better than "std::vector<int>" in the patch.
Yes (I have a few other local modifications also).
Title: Re: using namespace
Post by: MortenMacFly on April 11, 2013, 04:55:10 pm
Another thing: I think TokenIdxSet is better than "std::vector<int>" in the patch.
Yes. This patch needs a clean-up. I did it in my local copy as well...
Title: Re: using namespace
Post by: Alpha on April 12, 2013, 04:49:05 pm
Attached patch includes tidied up version of the previous patch (by p2rkw), and parsing of function bodies for using namespace directives.
Feedback appreciated.
Title: Re: using namespace
Post by: Alpha on April 13, 2013, 07:12:16 pm
Committed.

(By the way, I tested a full rebuild of CodeBlocks-unix.cbp on my new computer I just assembled... total time: 39 seconds!!)
Title: Re: using namespace
Post by: MortenMacFly on April 13, 2013, 08:09:55 pm
total time: 39 seconds!!)
Really seconds?  :o

Specs please!
Title: Re: using namespace
Post by: jens on April 13, 2013, 09:39:41 pm
Quote
codeblocks --rebuild CodeBlocks-unix.cbp
-------------- Clean: tinyXML in Code::Blocks wx2.8.x - Unix (compiler: GNU GCC Compiler)---------------
[...]
-------------- Clean: To-do in Code::Blocks wx2.8.x - Unix (compiler: GNU GCC Compiler)---------------
-------------- Build: tinyXML in Code::Blocks wx2.8.x - Unix (compiler: GNU GCC Compiler)---------------
ccache-g++ -Wall -g -fmessage-length=0 -fexceptions -Winvalid-pch -Ulinux -Uunix -fPIC -I/usr/lib64/wx/include/gtk2-unicode-release-2.8 -I/usr/include/wx-2.8 -D_FILE_OFFSET_BITS=64 -D_LARGE_
[...]
Process terminated with status 0 (0 minute(s), 38 second(s))
0 error(s), 0 warning(s) (0 minute(s), 38 second(s))
Core i7 quadcore (8 virtual cores), 32 GB Ram, parallel build with 9 threads, build with ccache, with pure g++/gcc it needs 1 minute 46 seconds .
Title: Re: using namespace
Post by: Alpha on April 13, 2013, 10:59:17 pm
39 seconds was with pure GCC.  Adding ccache reduces my time to 31 seconds.

Specs please!
Dual SSD's in RAID 0, 16 GB RAM, and i7-3970X (hexacore, 12 virtual cores, 4.2 GHz).
Title: Re: using namespace
Post by: MortenMacFly on April 15, 2013, 06:48:49 am
...I won't tell you mine then. :'(
Title: Re: using namespace
Post by: Alpha on April 16, 2013, 12:03:46 am
...I won't tell you mine then. :'(
:D

I am sure you will get a new computer in a year or two with whatever the newest processor architecture will be, that will blow away the rest of our statistics ;).