[gcc r17-168] json: move pp_markup::quoted_json_pointer to its own header
David Malcolm
dmalcolm@gcc.gnu.org
Tue Apr 28 23:12:29 GMT 2026
https://gcc.gnu.org/g:ec6ac8c35d1faec6128bdeb44d107d4121771c1e
commit r17-168-gec6ac8c35d1faec6128bdeb44d107d4121771c1e
Author: David Malcolm <dmalcolm@redhat.com>
Date: Tue Feb 24 17:41:17 2026 -0500
json: move pp_markup::quoted_json_pointer to its own header
gcc/ChangeLog:
* json-diagnostic.cc: Include "pretty-print-markup-json.h".
(class pp_markup::quoted_json_pointer): Move to...
* pretty-print-markup-json.h: ...this new file.
Signed-off-by: David Malcolm <dmalcolm@redhat.com>
Diff:
---
gcc/json-diagnostic.cc | 27 +---------------------
gcc/pretty-print-markup-json.h | 51 ++++++++++++++++++++++++++++++++++++++++++
2 files changed, 52 insertions(+), 26 deletions(-)
diff --git a/gcc/json-diagnostic.cc b/gcc/json-diagnostic.cc
index bf61cd0007ec..fced0a48ecb5 100644
--- a/gcc/json-diagnostic.cc
+++ b/gcc/json-diagnostic.cc
@@ -34,6 +34,7 @@ along with GCC; see the file COPYING3. If not see
#include "diagnostics/text-sink.h"
#include "diagnostics/physical-location-maker.h"
#include "pretty-print-markup.h"
+#include "pretty-print-markup-json.h"
static bool
emit_json_diagnostic (gcc_json_context &ctxt,
@@ -184,32 +185,6 @@ private:
const json::value &m_js_val;
};
-namespace pp_markup {
-
-/* Print the JSON Pointer of a given json::value in quotes. */
-
-class quoted_json_pointer : public pp_element
-{
-public:
- quoted_json_pointer (const json::value &js_val)
- : m_js_val (js_val)
- {
- }
-
- void
- add_to_phase_2 (context &ctxt) final override
- {
- ctxt.begin_quote ();
- m_js_val.print_pointer (&ctxt.m_pp);
- ctxt.end_quote ();
- }
-
-private:
- const json::value &m_js_val;
-};
-
-} // namespace pp_markup
-
/* text_sink starter for diagnostics relating to JSON. */
static void
diff --git a/gcc/pretty-print-markup-json.h b/gcc/pretty-print-markup-json.h
new file mode 100644
index 000000000000..d10e9fb40531
--- /dev/null
+++ b/gcc/pretty-print-markup-json.h
@@ -0,0 +1,51 @@
+/* Copyright (C) 2026 Free Software Foundation, Inc.
+ Contributed by David Malcolm <dmalcolm@redhat.com>
+
+This file is part of GCC.
+
+GCC is free software; you can redistribute it and/or modify it under
+the terms of the GNU General Public License as published by the Free
+Software Foundation; either version 3, or (at your option) any later
+version.
+
+GCC is distributed in the hope that it will be useful, but WITHOUT ANY
+WARRANTY; without even the implied warranty of MERCHANTABILITY or
+FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+for more details.
+
+You should have received a copy of the GNU General Public License
+along with GCC; see the file COPYING3. If not see
+<http://www.gnu.org/licenses/>. */
+
+#ifndef GCC_PRETTY_PRINT_MARKUP_JSON_H
+#define GCC_PRETTY_PRINT_MARKUP_JSON_H
+
+#include "pretty-print-markup.h"
+
+namespace pp_markup {
+
+/* Print the JSON Pointer of a given json::value in quotes. */
+
+class quoted_json_pointer : public pp_element
+{
+public:
+ quoted_json_pointer (const json::value &js_val)
+ : m_js_val (js_val)
+ {
+ }
+
+ void
+ add_to_phase_2 (context &ctxt) final override
+ {
+ ctxt.begin_quote ();
+ m_js_val.print_pointer (&ctxt.m_pp);
+ ctxt.end_quote ();
+ }
+
+private:
+ const json::value &m_js_val;
+};
+
+} // namespace pp_markup
+
+#endif /* GCC_PRETTY_PRINT_MARKUP_JSON_H */
More information about the Gcc-cvs
mailing list