r/cpp • u/dmalcolm GCC Developer • Mar 08 '19
Usability improvements in GCC 9
https://developers.redhat.com/blog/2019/03/08/usability-improvements-in-gcc-9/51
u/AlexAlabuzhev Mar 08 '19
There are now fix-it hints [...] for when the compiler needs a typename
Good news though.
22
u/strudlzrout gcc developer Mar 08 '19
In C++20, you won't need typename as much as before. I've implemented http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2018/p0634r3.html for GCC 9.
8
u/-dag- Mar 08 '19
The compiler doesn't always know it's a type. It's likely to be but in unusual cases may not be.
5
u/memyselfandlapin Mar 08 '19
Feels rust-y.
35
u/dmalcolm GCC Developer Mar 08 '19
I hope that's a good thing. I definitely took some inspiration from Rust when implementing this (and Elm, which is where I believe Rust took theirs from).
10
Mar 08 '19
When I tried rust for the first time and the errors didn't have highlighting (unlike the examples in the article) they looked like a ton of noise and I actually wished for C++ errors. However, with the highlighting as in the article, it's definitely more readable than what we have today.
12
u/Wh00ster Mar 08 '19
C++ errors without highlighting also look like a bunch of noise to the uninitiated. I think one just becomes accustomed to knowing where to look, after a while.
3
-20
u/memyselfandlapin Mar 08 '19
As long as we can get the safety of Rust.
0
Mar 08 '19
[deleted]
6
0
8
Mar 08 '19
[removed] — view removed comment
-3
u/bumblebritches57 Ocassionally Clang Mar 09 '19
SmallVec has memory overflows in rust lmao.
6
u/mgostIH Mar 09 '19
How long will you keep on bragging about this when it's been months it has been fixed and you got told countless times, even by Steve Klabnik? https://old.reddit.com/r/programming/comments/avuwl0/announcing_rust_1330/ehi69e3/
9
7
u/ThePillsburyPlougher Mar 08 '19
Awesome! The JSON format and the improvements to optimization info are particularly exciting
6
u/robin-m Mar 08 '19
I already noticed your work 1 month ago when I was playing with gcc9 (to have some nice C++20 features than were just release) and I really liked the new annotations.
3
u/ChatFrais Mar 08 '19
This looks very nice. It should helps a lot. The only thing I often miss on the errors is a number like error messages from databases or visualc. It's really easier to search for explanations on blog or stackoverflow with a code than using the text message.
3
u/ShakaUVM i+++ ++i+i[arr] Mar 09 '19
Any word on if we can finally get a flag to turn off printing 900 lines of candidates on a template substitution failure?
1
u/NeroBurner Mar 09 '19
With a few system libraries as dependency on Ubuntu. How can I use an up to date gcc? Do I have to compile those libraries myself?
3
u/jwakely libstdc++ tamer, LWG chair Mar 12 '19
2
u/TemplateRex Mar 12 '19
Personal pet peeve: An equivalent to apt.llvm.org with nightly builds would be great for both gcc users and developers. Just think of how much more early feedback you’d get if people start compiling their projects in Travis CI with gcc tip-of-trunk. Currently only toy examples will be tested on godbolt or wandbox.
2
u/jwakely libstdc++ tamer, LWG chair Mar 12 '19 edited Mar 14 '19
I'm not going to create Ubuntu packages but I just created
https://copr.fedorainfracloud.org/coprs/jwakely/gcc-trunk/(replaced with https://copr.fedorainfracloud.org/coprs/jwakely/gcc-latest/ instead)Edit:
apt.llvm.org doesn't look nightly, seems to be about two weeks old right now.And it's not at all true that trunk only gets tested in godbolt and wandbox. Entire GNU/Linux distros have been built with it, and large applications like LLVM, Firefox and Chromium are built with it routinely and problems found and reported. More testing is always good though. I'll try to update the COPR above for each weekly snapshot, but no promises.1
u/TemplateRex Mar 12 '19
Thank you, this is much appreciated! I downloaded and installed the .rpm on Ubuntu using the
alientool. Usingupdate-alternativesI managed to select the gcc-trunk as compiler and check the version.However, there are some errors about missing libraries (libmpfr.so.4), which are no longer installable on Ubuntu 18.04. Could it be that your gcc-trunk defaults to 32-bit address mode? Or is my Ubuntu system tricked by the /opt install directory? I'll try and set up a VM with Ubuntu 16.04 to see if it works there (which is the Travis CI distro).
BTW, http://apt.llvm.org/bionic/dists/ has the dates: the unnumbered toolchain corresponds to tip-of-trunk and is updated almost daily (yesterday last time). The numbered toolchains are stable release (8 coming out any time).
2
u/jwakely libstdc++ tamer, LWG chair Mar 12 '19 edited Mar 14 '19
It's a fedora package, I don't expect it to work on Ubuntu, at all.
Edit: But the
.debat https://jwakely.github.io/pkg-gcc-latest/ should work, could you try it please?
48
u/Morwenn Mar 08 '19
The JSON output with nesting looks like an excellent tool to improve IDEs. I would really like foldable error messages for nested substitution failure diagnostics in the future :)