GNOME Bugzilla – Bug 782341
meson: gcc/clang std flags are not extracted from build system targets
Last modified: 2017-05-09 08:03:07 UTC
As a C++11 developer I'd like to user curly braces initializaton constructor introduced in C++11. As it is said at http://stackoverflow.com/questions/18222926/why-is-list-initialization-using-curly-braces-better-than-the-alternatives it is the recomended initialization way.
It's not clear to me what exactly it is you're asking for. Do you mean the syntax highlighting? Or is it the auto-indenter?
I mean, I want gnome-builder not to show errors or warnings when I use a C++11 feature like list initialization: http://en.cppreference.com/w/cpp/language/list_initialization To reproduce that error highlighting you can just try to write in a cpp file something like: std::string s1{'a', 'b', 'c', 'd'}; // initializer-list constructor call A more complex example where C++11 syntax highlighting is not working in my gnome-builder: http://coliru.stacked-crooked.com/view?id=29a4f219c6db1134 It might be my gnome-builder doesn't have C++11 code highlighting enabled, but I cannot find where to enable it.
If it's showing you an error for C++11, then it is because Clang is not being passed the proper -std=c++11 flat. If you use autotools, we should be discovering that automatically. If you are using another build system, we might be failing to enable that correctly. If you aren't using any build system, you'll need to set CXXFLAGS in the build preferences to include -std=c++11.
I am using meson build system. I've created meson project from scratch using gnome builder. Then I modified meson file to be c++11 compatible as it is described here: http://mesonbuild.com/howtox.html#set-default-cc-language-version project('myproj', 'cpp', default_options : ['cpp_std=c++11']) So I guess, the issue is that gnome-builder is not able to understand that meson syntax.
This should fix it. I'll merge to 3.24 branch. Sadly it missed our 3.24.2 release today.
Created attachment 351409 [details] [review] meson: include -std from GCC/Clang options We need to keep parity with the autotools flags extractor, which also supports -std=(gnu11,c++11,etc). libclang uses this to determine which C and C++ features can be used.