GCC Middle and Back End API Reference
json-diagnostic.h
Go to the documentation of this file.
1/* Diagnostics relating to JSON values.
2 Copyright (C) 2026 Free Software Foundation, Inc.
3 Contributed by David Malcolm <dmalcolm@redhat.com>.
4
5This file is part of GCC.
6
7GCC is free software; you can redistribute it and/or modify it under
8the terms of the GNU General Public License as published by the Free
9Software Foundation; either version 3, or (at your option) any later
10version.
11
12GCC is distributed in the hope that it will be useful, but WITHOUT ANY
13WARRANTY; without even the implied warranty of MERCHANTABILITY or
14FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
15for more details.
16
17You should have received a copy of the GNU General Public License
18along with GCC; see the file COPYING3. If not see
19<http://www.gnu.org/licenses/>. */
20
21#ifndef GCC_JSON_DIAGNOSTIC_H
22#define GCC_JSON_DIAGNOSTIC_H
23
24#include "json-parsing.h"
25
26/* Implementation of json::location_map for use with
27 GCC diagnostics.
28 Stores location information for json::value * from parsing, and
29 can generate location_t values for the. */
30
32{
33public:
34 gcc_json_context (const char *filename)
35 : m_filename (filename)
36 {
37 }
38
39 location_t
41
42 location_t
44
45private:
46 const char *m_filename;
47};
48
49/* Emit an error on gcc's global_dc relating to JS_VAL. */
50
51extern void
53 const json::value &js_val,
54 const char *gmsgid, ...)
56
57/* Emit a warning on gcc's global_dc relating to JS_VAL. */
58
59extern bool
61 const json::value &js_val,
62 diagnostics::option_id option_id,
63 const char *gmsgid, ...)
65
66/* Emit a note on gcc's global_dc relating to JS_VAL. */
67
68extern void
70 const json::value &js_val,
71 const char *gmsgid, ...)
73
74#endif /* GCC_JSON_DIAGNOSTIC_H */
Definition json-diagnostic.h:32
location_t make_location_for_range(const json::location_map::range &)
Definition json-diagnostic.cc:264
const char * m_filename
Definition json-diagnostic.h:46
gcc_json_context(const char *filename)
Definition json-diagnostic.h:34
location_t make_location_for_point(const json::location_map::point &)
Definition json-diagnostic.cc:255
Definition json-parsing.h:61
Definition json.h:161
#define ATTRIBUTE_GCC_DIAG(m, n)
Definition diagnostic-core.h:71
void json_note(gcc_json_context &ctxt, const json::value &js_val, const char *gmsgid,...)
Definition json-diagnostic.cc:363
bool json_warning(gcc_json_context &ctxt, const json::value &js_val, diagnostics::option_id option_id, const char *gmsgid,...)
Definition json-diagnostic.cc:345
void json_error(gcc_json_context &ctxt, const json::value &js_val, const char *gmsgid,...) ATTRIBUTE_GCC_DIAG(3
Definition cfghooks.h:26
Definition cfghooks.h:27
Definition json-parsing.h:39
Definition json-parsing.h:48