On Fri, 2023-01-06 at 12:33 +0100, Martin Liška wrote:
> Patch can bootstrap on x86_64-linux-gnu and survives regression
> tests.

Thanks for the patch.

I noticed that you marked PR 108307 as a dup of this, which covers
-fdiagnostics-format=sarif-file (and a .S file as input).

The patch doesn't add any test coverage (for either of the diagnostic
formats).

If we try to emit a diagnostic and base_file_name is NULL, and the user
requested one of -fdiagnostics-format={json,sarif}-file, where do the
diagnostics go?  Where should they go?


Dave



> 
> Ready to be installed?
> Thanks,
> Martin
> 
>         PR middle-end/106133
> 
> gcc/ChangeLog:
> 
>         * diagnostic.cc (diagnostic_output_format_init): If
>         -fdiagnostics-format=json-file and -E is used, then
>         base_file_name is null and we should not emit anything.
> ---
>  gcc/diagnostic.cc | 3 +++
>  1 file changed, 3 insertions(+)
> 
> diff --git a/gcc/diagnostic.cc b/gcc/diagnostic.cc
> index c90c14e993e..fe7d121e340 100644
> --- a/gcc/diagnostic.cc
> +++ b/gcc/diagnostic.cc
> @@ -2277,6 +2277,9 @@ diagnostic_output_format_init
> (diagnostic_context *context,
>                                const char *base_file_name,
>                                enum diagnostics_output_format format)
>  {
> +  if (base_file_name == NULL)
> +    return;
> +
>    switch (format)
>      {
>      default:

Reply via email to