I would like to implement a filter for warnings from gfortran using --fdiagnostics-format=json . To print out the warnings in the way gfortran does normally I would need a way to convert them to text which should be the same as what --fdiagnostics-format=json produces. Since gfortran itself knows best how to print its warnings - could you provide that functionality?
Disclaimer: I posted a request for help regarding this exact feature on the gcc-help list. (https://gcc.gnu.org/pipermail/gcc-help/2020-July/139110.html) After reading through the list I came to the conclusion that this is not implemented and probably a feature request would be more appropriate.
Fixed in GCC 9 with r9-4156. See PR 19165 too. *** This bug has been marked as a duplicate of bug 19165 ***
(In reply to Andrew Pinski from comment #2) > Fixed in GCC 9 with r9-4156. See PR 19165 too. > > *** This bug has been marked as a duplicate of bug 19165 *** Bug 19165 covers adding JSON *output*; what this bug is asking for is a way to read in JSON as input, and instead generate the usual textual output (or, indeed other output formats). Ideally we'd be able to "round trip" the diagnostic data through JSON. Reopening; it seems like a useful thing for GCC to be able to do. Similarly, it would be good to be able to use SARIF as an input format (and output format), and ideally roundtrip through SARIF - but that's another RFE.
I posted a prototype implementation of this here: "[PATCH 00/12] RFC: Replay of serialized diagnostics" https://gcc.gnu.org/pipermail/gcc-patches/2022-June/597051.html (doesn't fully work; see the many caveats in that post)