News:

As usual while waiting for the next release - don't forget to check the nightly builds in the forum.

Main Menu

Clang CC

Started by yvesdm3000, October 02, 2015, 07:44:04 PM

Previous topic - Next topic

teto

Very interesting work. Wanted to give it a try: cloned on linux and opened the cbp project. It seems configured for windows only. Anyone tried on linux? else I will wait for it to land into the core. keep up the good work :)

yvesdm3000

You need to use the 'unix' project file.

Main development is done on Linux btw and I should test more on Windows...

Yves
Clang based code completion for Code::Blocks:   [url="http://github.com/yvesdm3000/ClangLib"]http://github.com/yvesdm3000/ClangLib[/url]

teto

#137
Thanks. Thread is long so it might be a good idea to sum up some info in the first message or in the README. From git log, I gather that master is the active branch.
I had to comment out jus tthis line to compile: "assert( first.m_id == second.m_Id );". When I tried to load the plugin, codeblocks said the SDK was incompatible (I got cb 16.01 with SDK 1.29 while Clang expects 1.30).  Thus I  tried to compile the plugin against codeblocks  3b88b40f9f818607795a90cfd2120a202a8ccec3 but I get this warning even though I compile with "-std=c++11" (tried with C++0x, which was already enabled in the .cbp):

g++ -DBUILDING_PLUGIN -DNOPCH -Wextra -Wall -std=c++11 -ansi -fPIC -g -I/usr/lib/x86_64-linux-gnu/wx/include/gtk2-unicode-release-2.8 -I/usr/include/wx-2.8 -D_FILE_OFFSET_BITS=64 -D_LARGE_FILES -D__WXGTK__ -pthread -I/usr/lib/llvm-3.6/include -fmessage-length=0 -fexceptions -Winvalid-pch -pthread -I/mnt/ntfs/teto/codeblocks_sf/install/include/codeblocks -I/mnt/ntfs/teto/codeblocks_sf/install/include/codeblocks/tinyxml -I/mnt/ntfs/teto/codeblocks_sf/install/include/codeblocks/scripting/include -I/mnt/ntfs/teto/codeblocks_sf/install/include/codeblocks/scripting/bindings -I/mnt/ntfs/teto/codeblocks_sf/install/include/codeblocks/scripting/sqplus -I/mnt/ntfs/teto/codeblocks_sf/install/include/codeblocks/wxscintilla/include -DcbDEBUG -I. -c /home/teto/ClangLib/cclogger.cpp -o .objs/plugins/clanglib/cclogger.o
In file included from /mnt/ntfs/teto/codeblocks_sf/install/include/codeblocks/sdk_events.h:12:0,
                 from /mnt/ntfs/teto/codeblocks_sf/install/include/codeblocks/manager.h:21,
                 from /mnt/ntfs/teto/codeblocks_sf/install/include/codeblocks/logmanager.h:9,
                 from /home/teto/ClangLib/cclogger.h:15,
                 from /home/teto/ClangLib/cclogger.cpp:10:
/mnt/ntfs/teto/codeblocks_sf/install/include/codeblocks/prep.h:96:1: warning: identifier 'nullptr' is a keyword in C++11 [-Wc++0x-compat]
template<typename T>inline void Delete(T*& p){delete p; p = nullptr;}
^
/mnt/ntfs/teto/codeblocks_sf/install/include/codeblocks/prep.h: In function 'void Delete(T*&)':
/mnt/ntfs/teto/codeblocks_sf/install/include/codeblocks/prep.h:96:61: error: 'nullptr' was not declared in this scope
template<typename T>inline void Delete(T*& p){delete p; p = nullptr;}


yvesdm3000

Maybe  we should revert back to using NULL ?

Yves
Clang based code completion for Code::Blocks:   [url="http://github.com/yvesdm3000/ClangLib"]http://github.com/yvesdm3000/ClangLib[/url]

oBFusCATed

No, use nullptr and build in c++11 mode.
Since sometime master is using c++11 and a few days ago, I've removed our old implementation of nullptr/nullptr_t.
(most of the time I ignore long posts)
[strangers don't send me private messages, I'll ignore them; post a topic in the forum, but first read the rules!]

l_inc

QuoteNo, use nullptr and build in c++11 mode.
Since sometime master is using c++11
Hooray :-). I'm looking forward to seeing good use of shared_ptr's, unique_ptr's, compiler-enforced move semantics, etc. and a cleanup from the nasty support of older standards. Some things in the plugin just seemed too counter-natural without C++11.

teto

If I move the -std=c++0x flags to the end of the compilation line, it works. Thus I had to ruse with Codeblocks options to append -std=C++0x to compiler options without checking the box. Same with clang++.
Then I hit another error:

/home/teto/ClangLib/clangproxy.cpp: In member function 'void ClangProxy::RemoveTranslationUnit(ClTranslUnitId)':
/home/teto/ClangLib/clangproxy.cpp:761:33: error: use of deleted function 'ClTranslationUnit& ClTranslationUnit::operator=(const ClTranslationUnit&)'
     m_TranslUnits[translUnitId] = ClTranslationUnit(translUnitId, nullptr);

Is master supposed to compile at all times or should I check a specific commit ?

oBFusCATed

Please use -std=c++11 or gnu++11, c++0x is not supported!
If your compiler doesn't have full c++11 support, then this compiler is not supported by us (you won't get any help for problems you encounter, nor we'll apply patches to support your compiler).
You'll have to upgrade it!
(most of the time I ignore long posts)
[strangers don't send me private messages, I'll ignore them; post a topic in the forum, but first read the rules!]

teto

I use gcc version 5.2.1 (full support for C++11 as claimed here https://gcc.gnu.org/gcc-5/changes.html) which supports std=C++11 but even with it I have the same error. Could you share your setup ? If you use llvm I will switch to llvm though if g++ claims there is an error, it may be best to fix it (I shall even propose a patch if confirmed) rather than ignore it.

oBFusCATed

I'm not talking about the plugin, but codeblocks in general. I've not tried the plugin yet.
(most of the time I ignore long posts)
[strangers don't send me private messages, I'll ignore them; post a topic in the forum, but first read the rules!]

teto

My codeblocks compiles fine (from your git remote), the error appears while compiling the plugin.

yvesdm3000

If CodeBlocks is now moved to C++11, then I'll move the plugin to C++11 too and git rid of some ugly code in the process.

I pushed some compile fixes for C++11

Yves
Clang based code completion for Code::Blocks:   [url="http://github.com/yvesdm3000/ClangLib"]http://github.com/yvesdm3000/ClangLib[/url]

yvesdm3000

I however don't want to bypass the original author Alpha about going to C++11 as minimum requirement since he did the original code.
Maybe Alpha can give his point of view on this before I start removing code ?

Yves
Clang based code completion for Code::Blocks:   [url="http://github.com/yvesdm3000/ClangLib"]http://github.com/yvesdm3000/ClangLib[/url]

teto

Thansk for the fix yves, I managed to compile and load it.

I haven't looked at the code yet, do I need to do anything else apart from installing the plugin to enable it (like disabling old CC) ? Any advice on how to stresstest it ?

Cheers

Alpha

Quote from: yvesdm3000 on April 05, 2016, 01:51:04 PM
I however don't want to bypass the original author Alpha about going to C++11 as minimum requirement since he did the original code.
Maybe Alpha can give his point of view on this before I start removing code ?
I had intended to migrate the code to C++11 once core C::B made the switch.  So, green light to go ahead on the change now.