News:

When registered with our forums, feel free to send a "here I am" post here to differ human beings from SPAM bots.

Main Menu

using namespace

Started by Alpha, April 10, 2013, 08:15:53 PM

Previous topic - Next topic

Alpha

While going through this patch, 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)?

ollydbg

Quote from: Alpha on April 10, 2013, 08:15:53 PM
While going through this patch, 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.
If some piece of memory should be reused, turn them to variables (or const variables).
If some piece of operations should be reused, turn them to functions.
If they happened together, then turn them to classes.

Alpha

Quote from: ollydbg on April 11, 2013, 02:15:32 AM
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.)

        else if (token==ParserConsts::opbrace)
        {
            SkipBlock();
        }


Quote from: ollydbg on April 11, 2013, 02:15:32 AM
Another thing: I think TokenIdxSet is better than "std::vector<int>" in the patch.
Yes (I have a few other local modifications also).

MortenMacFly

Quote from: ollydbg on April 11, 2013, 02:15:32 AM
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...
Compiler logging: Settings->Compiler & Debugger->tab "Other"->Compiler logging="Full command line"
C::B Manual: [url="https://www.codeblocks.org/docs/main_codeblocks_en.html"]https://www.codeblocks.org/docs/main_codeblocks_en.html[/url]
C::B FAQ: [url="https://wiki.codeblocks.org/index.php?title=FAQ"]https://wiki.codeblocks.org/index.php?title=FAQ[/url]

Alpha

Attached patch includes tidied up version of the previous patch (by p2rkw), and parsing of function bodies for using namespace directives.
Feedback appreciated.

Alpha

Committed.

(By the way, I tested a full rebuild of CodeBlocks-unix.cbp on my new computer I just assembled... total time: 39 seconds!!)

MortenMacFly

Quote from: Alpha on April 13, 2013, 07:12:16 PM
total time: 39 seconds!!)
Really seconds?  :o

Specs please!
Compiler logging: Settings->Compiler & Debugger->tab "Other"->Compiler logging="Full command line"
C::B Manual: [url="https://www.codeblocks.org/docs/main_codeblocks_en.html"]https://www.codeblocks.org/docs/main_codeblocks_en.html[/url]
C::B FAQ: [url="https://wiki.codeblocks.org/index.php?title=FAQ"]https://wiki.codeblocks.org/index.php?title=FAQ[/url]

Jenna

Quotecodeblocks --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 .

Alpha

#8
39 seconds was with pure GCC.  Adding ccache reduces my time to 31 seconds.

Quote from: MortenMacFly on April 13, 2013, 08:09:55 PM
Specs please!
Dual SSD's in RAID 0, 16 GB RAM, and i7-3970X (hexacore, 12 virtual cores, 4.2 GHz).

MortenMacFly

...I won't tell you mine then. :'(
Compiler logging: Settings->Compiler & Debugger->tab "Other"->Compiler logging="Full command line"
C::B Manual: [url="https://www.codeblocks.org/docs/main_codeblocks_en.html"]https://www.codeblocks.org/docs/main_codeblocks_en.html[/url]
C::B FAQ: [url="https://wiki.codeblocks.org/index.php?title=FAQ"]https://wiki.codeblocks.org/index.php?title=FAQ[/url]

Alpha

Quote from: MortenMacFly on April 15, 2013, 06:48:49 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 ;).