GCC Middle and Back End API Reference
json-diagnostic.cc File Reference
#include "config.h"
#include "system.h"
#include "coretypes.h"
#include "intl.h"
#include "diagnostic.h"
#include "json-diagnostic.h"
#include "diagnostics/dumping.h"
#include "diagnostics/logging.h"
#include "diagnostics/logical-locations.h"
#include "diagnostics/client-data-hooks.h"
#include "diagnostics/text-sink.h"
#include "diagnostics/physical-location-maker.h"
#include "pretty-print-markup.h"
Include dependency graph for json-diagnostic.cc:

Data Structures

class  json_logical_location_manager
class  json_client_data_hooks
class  pp_markup::quoted_json_pointer

Namespaces

namespace  pp_markup

Macros

#define INCLUDE_MAP
#define INCLUDE_STRING
#define INCLUDE_VECTOR

Functions

static bool emit_json_diagnostic (gcc_json_context &ctxt, enum diagnostics::kind kind, const json::value &js_val, diagnostics::option_id option_id, const char *gmsgid, va_list *ap) ATTRIBUTE_GCC_DIAG(5
static void json_text_starter (diagnostics::text_sink &sink, const diagnostics::diagnostic_info *diagnostic)
void json_error (gcc_json_context &ctxt, const json::value &js_val, const char *gmsgid,...)
bool json_warning (gcc_json_context &ctxt, const json::value &js_val, diagnostics::option_id option_id, const char *gmsgid,...)
void json_note (gcc_json_context &ctxt, const json::value &js_val, const char *gmsgid,...)

Macro Definition Documentation

◆ INCLUDE_MAP

#define INCLUDE_MAP
Diagnostics relating to JSON values.
   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/>.   

◆ INCLUDE_STRING

#define INCLUDE_STRING

◆ INCLUDE_VECTOR

#define INCLUDE_VECTOR

Function Documentation

◆ emit_json_diagnostic()

bool emit_json_diagnostic ( gcc_json_context & ctxt,
enum diagnostics::kind kind,
const json::value & js_val,
diagnostics::option_id option_id,
const char * gmsgid,
va_list * ap )
static
Emit a diagnostic on global_dc of the relevant KIND relating to JS_VAL,
using CTXT to get at file/line/column info.

Temporarily override global_dc's logical location to refer to JS_VAL
and the text_sink starter and finalizer to be suitable for handling
reporting within a JSON file.   

References ap, diagnostics::default_text_finalizer(), json::simple_location_map::get_range_for_value(), global_dc, json_text_starter(), line_table, diagnostics::logging::log_function_params::log_param_option_id(), diagnostics::logging::log_function_params::log_param_string(), and gcc_json_context::make_location_for_range().

Referenced by json_error(), json_note(), and json_warning().

◆ json_error()

void json_error ( gcc_json_context & ctxt,
const json::value & js_val,
const char * gmsgid,
... )
Emit an error on gcc's global_dc relating to JS_VAL.   

References ap, and emit_json_diagnostic().

◆ json_note()

void json_note ( gcc_json_context & ctxt,
const json::value & js_val,
const char * gmsgid,
... )
Emit a note on gcc's global_dc relating to JS_VAL.   

References ap, and emit_json_diagnostic().

Referenced by json_note().

◆ json_text_starter()

◆ json_warning()

bool json_warning ( gcc_json_context & ctxt,
const json::value & js_val,
diagnostics::option_id option_id,
const char * gmsgid,
... )
Emit a warning on gcc's global_dc relating to JS_VAL.   

References ap, and emit_json_diagnostic().

Referenced by json_warning().