r/cpp • u/dmalcolm GCC Developer • Apr 28 '26
New features in GCC 16: Improved error messages and SARIF output
https://developers.redhat.com/articles/2026/04/28/gcc-16-improved-error-messages-sarif-output
114
Upvotes
102
u/Tumaix Apr 28 '26
that means the other versions of gcc are sans-sarif
27
u/inco100 Apr 28 '26
FYI
The Static Analysis Results Interchange Format (SARIF) is "an industry standard format for the output of static analysis tools" i.e. a machine-readable file format that can represent compiler diagnostics.
6
u/_bstaletic Apr 28 '26
I have been using gcc 16 for a while now and have only good things to say about the new error messages.
Yes, the initial reaction is "argh... why is this so long?!", however that's really just a kneejerk reaction after being very used to the old format. "No viable candidate for function call" errors are indisputably easier to read/navigate.
I really appreciate the efforts that went into this.
2
u/marcusmors May 09 '26
Genuine question, what tools use sharif and how it improves error catching or debugging? I use static linters in vscode, and even configured them, but it's a first time hearing about SARIF format.
11
u/ludvary Apr 28 '26
im so happy!
2
u/User_Deprecated Apr 28 '26
This is better. "More verbose" isn't really the problem if the output is easier to scan.
Still wish it'd put the first actual mismatch right at the top though, then expand below.
1
u/FlyingRhenquest Apr 28 '26
That reminds me, time to clone and rebuild gcc16 again :-)
If anyone else wants to do this, I have a script to build it in an out-of-the-way location on a Linux system, as well as CMake toolchain files to build with it in this project. You can just clone the source down and follow the instructions in the scripts directory to build it. If you already have a C++ compiler you can add "--disable-bootstrap" to the configure line and it'll build a lot faster. The instructions at the top level tell you how to use CMake to build your projects after that. My autocereal and autocrud projects do some fairly useful things with reflection and annotations if you need some examples of how that works. I don't guarantee the module stuff will work, though, as it was contributed by a third party. I really should move all that to separate branches until I can test it extensively.
5
u/[deleted] Apr 28 '26
[removed] — view removed comment