public inbox for gcc-cvs@sourceware.org
help / color / mirror / Atom feed
From: Marc Poulhi?s <dkm@gcc.gnu.org>
To: gcc-cvs@gcc.gnu.org
Subject: [gcc r13-4973] ada: Fix unescaped quotes when combining fdiagnostics-format=json and gnatdJ
Date: Tue,  3 Jan 2023 09:34:50 +0000 (GMT)	[thread overview]
Message-ID: <20230103093450.339673858C2D@sourceware.org> (raw)

https://gcc.gnu.org/g:201c21b0e847679645df1af3dd13459274f41047

commit r13-4973-g201c21b0e847679645df1af3dd13459274f41047
Author: Ghjuvan Lacambre <lacambre@adacore.com>
Date:   Mon Dec 12 14:54:47 2022 +0100

    ada: Fix unescaped quotes when combining fdiagnostics-format=json and gnatdJ
    
    This commit fixes a small bug where GNAT would emit unescaped quotes in
    its -fdiagnostics-format=json output when using -gnatdJ and emitting
    messages about operator functions (e.g. "=").
    
    gcc/ada/
    
            * errout.adb (Write_JSON_Span): Escape subprogram name.

Diff:
---
 gcc/ada/errout.adb | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/gcc/ada/errout.adb b/gcc/ada/errout.adb
index b30e8b51d15..261ba2e8033 100644
--- a/gcc/ada/errout.adb
+++ b/gcc/ada/errout.adb
@@ -2193,8 +2193,9 @@ package body Errout is
          end if;
 
          if Include_Subprogram_In_Messages then
-            Write_Str
-              (",""subprogram"":""" & Subprogram_Name_Ptr (Error.Node) & """");
+            Write_Str (",""subprogram"":""");
+            Write_JSON_Escaped_String (Subprogram_Name_Ptr (Error.Node));
+            Write_Str ("""");
          end if;
 
          Write_Str ("}");

                 reply	other threads:[~2023-01-03  9:34 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20230103093450.339673858C2D@sourceware.org \
    --to=dkm@gcc.gnu.org \
    --cc=gcc-cvs@gcc.gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).