Author Topic: Clang CC  (Read 249998 times)

Offline teto

  • Almost regular
  • **
  • Posts: 127
Re: Clang CC
« Reply #135 on: April 02, 2016, 10:04:42 pm »
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 :)

Offline yvesdm3000

  • Almost regular
  • **
  • Posts: 225
Re: Clang CC
« Reply #136 on: April 04, 2016, 08:02:00 am »
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:   http://github.com/yvesdm3000/ClangLib

Offline teto

  • Almost regular
  • **
  • Posts: 127
Re: Clang CC
« Reply #137 on: April 04, 2016, 05:29:11 pm »
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):
Code
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;}
« Last Edit: April 04, 2016, 05:38:10 pm by teto »

Offline yvesdm3000

  • Almost regular
  • **
  • Posts: 225
Re: Clang CC
« Reply #138 on: April 04, 2016, 08:36:30 pm »
Maybe  we should revert back to using NULL ?

Yves
Clang based code completion for Code::Blocks:   http://github.com/yvesdm3000/ClangLib

Offline oBFusCATed

  • Developer
  • Lives here!
  • *****
  • Posts: 13413
    • Travis build status
Re: Clang CC
« Reply #139 on: April 04, 2016, 08:38:00 pm »
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!]

Offline l_inc

  • Multiple posting newcomer
  • *
  • Posts: 56
Re: Clang CC
« Reply #140 on: April 04, 2016, 09:55:47 pm »
Quote
No, 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.

Offline teto

  • Almost regular
  • **
  • Posts: 127
Re: Clang CC
« Reply #141 on: April 04, 2016, 11:11:57 pm »
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:
Code
/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 ?

Offline oBFusCATed

  • Developer
  • Lives here!
  • *****
  • Posts: 13413
    • Travis build status
Re: Clang CC
« Reply #142 on: April 04, 2016, 11:48:47 pm »
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!]

Offline teto

  • Almost regular
  • **
  • Posts: 127
Re: Clang CC
« Reply #143 on: April 05, 2016, 12:22:06 am »
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.

Offline oBFusCATed

  • Developer
  • Lives here!
  • *****
  • Posts: 13413
    • Travis build status
Re: Clang CC
« Reply #144 on: April 05, 2016, 12:40:20 am »
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!]

Offline teto

  • Almost regular
  • **
  • Posts: 127
Re: Clang CC
« Reply #145 on: April 05, 2016, 12:43:28 am »
My codeblocks compiles fine (from your git remote), the error appears while compiling the plugin.

Offline yvesdm3000

  • Almost regular
  • **
  • Posts: 225
Re: Clang CC
« Reply #146 on: April 05, 2016, 06:47:23 am »
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:   http://github.com/yvesdm3000/ClangLib

Offline yvesdm3000

  • Almost regular
  • **
  • Posts: 225
Re: Clang CC
« Reply #147 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 ?

Yves
Clang based code completion for Code::Blocks:   http://github.com/yvesdm3000/ClangLib

Offline teto

  • Almost regular
  • **
  • Posts: 127
Re: Clang CC
« Reply #148 on: April 05, 2016, 03:50:58 pm »
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

Offline Alpha

  • Developer
  • Lives here!
  • *****
  • Posts: 1513
Re: Clang CC
« Reply #149 on: April 05, 2016, 04:34:47 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.