public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
* [COMMITTED] ada: Fix unescaped quotes when combining fdiagnostics-format=json and gnatdJ
@ 2023-01-03  9:36 Marc Poulhiès
  0 siblings, 0 replies; only message in thread
From: Marc Poulhiès @ 2023-01-03  9:36 UTC (permalink / raw)
  To: gcc-patches; +Cc: Ghjuvan Lacambre

From: Ghjuvan Lacambre <lacambre@adacore.com>

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.

Tested on x86_64-pc-linux-gnu, committed on master.

---
 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 ("}");
-- 
2.34.1


^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2023-01-03  9:36 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-01-03  9:36 [COMMITTED] ada: Fix unescaped quotes when combining fdiagnostics-format=json and gnatdJ Marc Poulhiès

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).