Patch can bootstrap on x86_64-linux-gnu and survives regression tests.

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:
-- 
2.39.0

Reply via email to