[SAOC 2024] Improve D Error Messages - Weekly Update #5

Johan j at j.nl
Mon Oct 21 19:46:56 UTC 2024


On Monday, 21 October 2024 at 08:44:29 UTC, Royal Simpson Pinto 
wrote:
> ## Summary of Progress (October 14 – October 20)
>
> This week, I focused on addressing feedback and adding tests 
> for SARIF (Static Analysis Results Interchange Format) support 
> in the DMD compiler. The current PR introduces a `--sarif` 
> compiler flag to generate structured SARIF output for error 
> messages.

Hi,
   It's nice that you are working on this!

I'd like to strongly urge you to put priority on these two things:
- Commandline interface. Please make this the same as GCC and 
Clang, such that tools do not have to implement a D-specific 
interface, and in may "just work" without any change needing in 
tooling. This includes having the option to output SARIF to a 
file.
- Output format. Mimic GCC and Clang as much as possible in what 
you output. Changes needed: (a) do not output errors to the same 
output stream as both normal and SARIF formats, because that 
immediately breaks tooling compatibility. (b) specify SARIF 
schema and adhere to it [1]. The output of your PR is not valid 
SARIF output [2]. For example, "invocation" is used wrong (should 
be inside a "runs" list).

The reason for this priority over anything else, is that both 
these are likely necessary to actually be able to use dlang+SARIF 
with external tools. So whatever other work you'll do will only 
be usable _after_ these two items are done.

cheers,
   Johan

[1] I again strongly advise to do what clang and GCC do, because 
it means that tooling will at least support that schema. They are 
using version 2.1.0 apparently. 
(https://docs.oasis-open.org/sarif/sarif/v2.1.0/cos02/schemas/sarif-schema-2.1.0.json)

[2] https://sarifweb.azurewebsites.net/Validation




More information about the Digitalmars-d mailing list