Use GCC's JSON diagnostics output
Currently GHC parses GCC's error output to provide error diagnostics in GHC format. However, this is fragile and has some slightly quirky behavior (e.g. we don't distinguish between errors and warnings). @Phyx helpfully pointed out on ghc-devs
that GCC 9 now offers -fdiagnostics-format=json
. Ideally we would use this instead of parsing textual errors.
However, there are some challenges here. Specifically, it's unclear how we can cheaply detect whether user's gcc
supports this. Probing at runtime seems like a very bad option due to the compile-time impact.