After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 782341 - meson: gcc/clang std flags are not extracted from build system targets
meson: gcc/clang std flags are not extracted from build system targets
Status: RESOLVED FIXED
Product: gnome-builder
Classification: Other
Component: editor
3.24.x
Other Linux
: Normal enhancement
: ---
Assigned To: GNOME Builder Maintainers
GNOME Builder Maintainers
Depends on:
Blocks:
 
 
Reported: 2017-05-08 16:25 UTC by carlosvin
Modified: 2017-05-09 08:03 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
meson: include -std from GCC/Clang options (1.15 KB, patch)
2017-05-09 08:02 UTC, Christian Hergert
committed Details | Review

Description carlosvin 2017-05-08 16:25:26 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.
Comment 1 Christian Hergert 2017-05-08 22:28:26 UTC
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?
Comment 2 carlosvin 2017-05-09 07:10:07 UTC
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.
Comment 3 Christian Hergert 2017-05-09 07:25:02 UTC
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.
Comment 4 carlosvin 2017-05-09 07:33:37 UTC
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.
Comment 5 Christian Hergert 2017-05-09 08:01:27 UTC
This should fix it. I'll merge to 3.24 branch. Sadly it missed our 3.24.2
release today.
Comment 6 Christian Hergert 2017-05-09 08:02:51 UTC
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.