GCC Middle and Back End API Reference
diagnostic.h
Go to the documentation of this file.
1/* Various declarations for language-independent diagnostics subroutines.
2 Copyright (C) 2000-2024 Free Software Foundation, Inc.
3 Contributed by Gabriel Dos Reis <gdr@codesourcery.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_DIAGNOSTIC_H
22#define GCC_DIAGNOSTIC_H
23
24#include "rich-location.h"
25#include "pretty-print.h"
26#include "diagnostic-core.h"
27
28namespace text_art
29{
30 class theme;
31} // namespace text_art
32
33/* An enum for controlling what units to use for the column number
34 when diagnostics are output, used by the -fdiagnostics-column-unit option.
35 Tabs will be expanded or not according to the value of -ftabstop. The origin
36 (default 1) is controlled by -fdiagnostics-column-origin. */
37
39{
40 /* The default from GCC 11 onwards: display columns. */
42
43 /* The behavior in GCC 10 and earlier: simple bytes. */
45};
46
47/* An enum for controlling how to print non-ASCII characters/bytes when
48 a diagnostic suggests escaping the source code on output. */
49
51{
52 /* Escape non-ASCII Unicode characters in the form <U+XXXX> and
53 non-UTF-8 bytes in the form <XX>. */
55
56 /* Escape non-ASCII bytes in the form <XX> (thus showing the underlying
57 encoding of non-ASCII Unicode characters). */
59};
60
61/* Enum for overriding the standard output format. */
62
64{
65 /* The default: textual output. */
67
68 /* JSON-based output, to stderr. */
70
71 /* JSON-based output, to a file. */
73
74 /* SARIF-based output, to stderr. */
76
77 /* SARIF-based output, to a file. */
79};
80
81/* An enum for controlling how diagnostic_paths should be printed. */
83{
84 /* Don't print diagnostic_paths. */
86
87 /* Print diagnostic_paths by emitting a separate "note" for every event
88 in the path. */
90
91 /* Print diagnostic_paths by consolidating events together where they
92 are close enough, and printing such runs of events with multiple
93 calls to diagnostic_show_locus, showing the individual events in
94 each run via labels in the source. */
96};
97
98/* An enum for capturing values of GCC_EXTRA_DIAGNOSTIC_OUTPUT,
99 and for -fdiagnostics-parseable-fixits. */
100
102{
103 /* No extra output, or an unrecognized value. */
105
106 /* Emit fix-it hints using the "fixits-v1" format, equivalent to
107 -fdiagnostics-parseable-fixits. */
109
110 /* Emit fix-it hints using the "fixits-v2" format. */
113
114/* Values for -fdiagnostics-text-art-charset=. */
115
117{
118 /* No text art diagrams shall be emitted. */
120
121 /* Use pure ASCII for text art diagrams. */
123
124 /* Use ASCII + conservative use of other unicode characters
125 in text art diagrams. */
127
128 /* Use Emoji. */
131
132/* A diagnostic is described by the MESSAGE to send, the FILE and LINE of
133 its context and its KIND (ice, error, warning, note, ...) See complete
134 list in diagnostic.def. */
136{
138 : message (), richloc (), metadata (), x_data (), kind (), option_index (),
139 m_iinfo ()
140 { }
141
142 /* Text to be formatted. */
144
145 /* The location at which the diagnostic is to be reported. */
146 rich_location *richloc;
147
148 /* An optional bundle of metadata associated with the diagnostic
149 (or NULL). */
151
152 /* Auxiliary data for client. */
153 void *x_data;
154 /* The kind of diagnostic it is about. */
156 /* Which OPT_* directly controls this diagnostic. */
158
159 /* Inlining context containing locations for each call site along
160 the inlining stack. */
162 {
163 /* Locations along the inlining stack. */
165 /* The abstract origin of the location. */
166 void *m_ao;
167 /* Set if every M_ILOCS element is in a system header. */
170};
171
172/* Forward declarations. */
174 const diagnostic_info *);
175
177 expanded_location);
178
180 const diagnostic_info *,
182
183typedef int (*diagnostic_option_enabled_cb) (int, unsigned, void *);
184typedef char *(*diagnostic_make_option_name_cb) (const diagnostic_context *,
185 int,
188typedef char *(*diagnostic_make_option_url_cb) (const diagnostic_context *,
189 int,
190 unsigned);
191
192class edit_context;
193namespace json { class value; }
195class logical_location;
198
199/* Abstract base class for a particular output format for diagnostics;
200 each value of -fdiagnostics-output-format= will have its own
201 implementation. */
202
204{
205public:
207
208 virtual void on_begin_group () = 0;
209 virtual void on_end_group () = 0;
210 virtual void on_begin_diagnostic (const diagnostic_info &) = 0;
211 virtual void on_end_diagnostic (const diagnostic_info &,
212 diagnostic_t orig_diag_kind) = 0;
213 virtual void on_diagram (const diagnostic_diagram &diagram) = 0;
214 virtual bool machine_readable_stderr_p () const = 0;
215
216protected:
218 : m_context (context)
219 {}
220
222};
223
224/* Subclass of diagnostic_output_format for classic text-based output
225 to stderr.
226
227 Uses diagnostic_context.m_text_callbacks to provide client-specific
228 textual output (e.g. include paths, macro expansions, etc). */
229
231{
232public:
237 void on_begin_group () override {}
238 void on_end_group () override {}
239 void on_begin_diagnostic (const diagnostic_info &) override;
241 diagnostic_t orig_diag_kind) override;
242 void on_diagram (const diagnostic_diagram &diagram) override;
243 bool machine_readable_stderr_p () const final override
244 {
245 return false;
246 }
247};
248
249/* A stack of sets of classifications: each entry in the stack is
250 a mapping from option index to diagnostic severity that can be changed
251 via pragmas. The stack can be pushed and popped. */
252
254{
255public:
256 void init (int n_opts);
257 void fini ();
258
259 /* Save all diagnostic classifications in a stack. */
260 void push ();
261
262 /* Restore the topmost classification set off the stack. If the stack
263 is empty, revert to the state based on command line parameters. */
264 void pop (location_t where);
265
266 bool option_unspecified_p (int opt) const
267 {
268 return get_current_override (opt) == DK_UNSPECIFIED;
269 }
270
272 {
273 gcc_assert (opt < m_n_opts);
274 return m_classify_diagnostic[opt];
275 }
276
279 int option_index,
280 diagnostic_t new_kind,
281 location_t where);
282
285
286private:
287 /* Each time a diagnostic's classification is changed with a pragma,
288 we record the change and the location of the change in an array of
289 these structs. */
296
298
299 /* For each option index that can be passed to warning() et al
300 (OPT_* from options.h when using this code with the core GCC
301 options), this array may contain a new kind that the diagnostic
302 should be changed to before reporting, or DK_UNSPECIFIED to leave
303 it as the reported kind, or DK_IGNORED to not report it at
304 all. */
306
307 /* History of all changes to the classifications above. This list
308 is stored in location-order, so we can search it, either
309 binary-wise or end-to-front, to find the most recent
310 classification for a given diagnostic, given the location of the
311 diagnostic. */
313
314 /* The size of the above array. */
316
317 /* For pragma push/pop. */
320};
321
322/* A bundle of options relating to printing the user's source code
323 (potentially with a margin, underlining, labels, etc). */
324
326{
327 /* True if we should print the source line with a caret indicating
328 the location.
329 Corresponds to -fdiagnostics-show-caret. */
331
332 /* Maximum width of the source line printed. */
334
335 /* Character used at the caret when printing source locations. */
336 char caret_chars[rich_location::STATICALLY_ALLOCATED_RANGES];
337
338 /* When printing source code, should the characters at carets and ranges
339 be colorized? (assuming colorization is on at all).
340 This should be true for frontends that generate range information
341 (so that the ranges of code are colorized),
342 and false for frontends that merely specify points within the
343 source code (to avoid e.g. colorizing just the first character in
344 a token, which would look strange). */
346
347 /* When printing source code, should labelled ranges be printed?
348 Corresponds to -fdiagnostics-show-labels. */
350
351 /* When printing source code, should there be a left-hand margin
352 showing line numbers?
353 Corresponds to -fdiagnostics-show-line-numbers. */
355
356 /* If printing source code, what should the minimum width of the margin
357 be? Line numbers will be right-aligned, and padded to this width.
358 Corresponds to -fdiagnostics-minimum-margin-width=VALUE. */
360
361 /* Usable by plugins; if true, print a debugging ruler above the
362 source output. */
364
365 /* When printing events in an inline path, should we print lines
366 visualizing links between related events (e.g. for CFG paths)?
367 Corresponds to -fdiagnostics-show-event-links. */
369};
370
371/* This data structure bundles altogether any information relevant to
372 the context of a diagnostic message. */
374{
375public:
376 /* Give access to m_text_callbacks. */
377 friend diagnostic_starter_fn &
383
387
388 void initialize (int n_opts);
389 void color_init (int value);
390 void urls_init (int value);
391
392 void finish ();
393
398
399 void
401 bool should_skip_bom);
402
403 void begin_group ();
404 void end_group ();
405
406 bool warning_enabled_at (location_t loc, int opt);
407
408 bool option_unspecified_p (int opt) const
409 {
411 }
412
414
415 void report_current_module (location_t where);
416
417 void check_max_errors (bool flush);
418 void action_after_output (diagnostic_t diag_kind);
419
421 classify_diagnostic (int option_index,
422 diagnostic_t new_kind,
423 location_t where)
424 {
426 option_index,
427 new_kind,
428 where);
429 }
430
431 void push_diagnostics (location_t where ATTRIBUTE_UNUSED)
432 {
434 }
435 void pop_diagnostics (location_t where)
436 {
437 m_option_classifier.pop (where);
438 }
439
440 void maybe_show_locus (const rich_location &richloc,
441 diagnostic_t diagnostic_kind,
442 pretty_printer *pp,
443 diagnostic_source_effect_info *effect_info);
444
445 void emit_diagram (const diagnostic_diagram &diagram);
446
448 {
449 return m_output_format;
450 }
451
452 /* Various setters for use by option-handling logic. */
453 void set_output_format (diagnostic_output_format *output_format);
456 void set_urlifier (urlifier *);
457 void create_edit_context ();
459 {
461 }
462 void set_report_bug (bool val) { m_report_bug = val; }
467 void set_show_cwe (bool val) { m_show_cwe = val; }
468 void set_show_rules (bool val) { m_show_rules = val; }
470 {
471 m_path_format = val;
472 }
473 void set_show_path_depths (bool val) { m_show_path_depths = val; }
475 void set_max_errors (int val) { m_max_errors = val; }
477 {
478 m_escape_format = val;
479 }
484
485 /* Various accessors. */
487 {
489 }
490 bool show_path_depths_p () const { return m_show_path_depths; }
493 {
494 return m_escape_format;
495 }
496
497 file_cache &
499 {
501 return *m_file_cache;
502 }
503
505 {
506 return m_edit_context_ptr;
507 }
512 text_art::theme *get_diagram_theme () const { return m_diagrams.m_theme; }
513
514 int converted_column (expanded_location s) const;
515
517 {
518 return m_diagnostic_count[kind];
519 }
520
521 /* Option-related member functions. */
522 inline bool option_enabled_p (int option_index) const
523 {
524 if (!m_option_callbacks.m_option_enabled_cb)
525 return true;
526 return m_option_callbacks.m_option_enabled_cb
527 (option_index,
528 m_option_callbacks.m_lang_mask,
529 m_option_callbacks.m_option_state);
530 }
531
532 inline char *make_option_name (int option_index,
533 diagnostic_t orig_diag_kind,
534 diagnostic_t diag_kind) const
535 {
536 if (!m_option_callbacks.m_make_option_name_cb)
537 return nullptr;
538 return m_option_callbacks.m_make_option_name_cb (this, option_index,
539 orig_diag_kind,
540 diag_kind);
541 }
542
543 inline char *make_option_url (int option_index) const
544 {
545 if (!m_option_callbacks.m_make_option_url_cb)
546 return nullptr;
547 return m_option_callbacks.m_make_option_url_cb (this, option_index,
548 get_lang_mask ());
549 }
550
551 void
553 void *option_state,
554 diagnostic_make_option_name_cb make_option_name_cb,
555 diagnostic_make_option_url_cb make_option_url_cb,
556 unsigned lang_mask);
557
558 unsigned get_lang_mask () const
559 {
560 return m_option_callbacks.m_lang_mask;
561 }
562
563 label_text get_location_text (const expanded_location &s) const;
564
565 bool diagnostic_impl (rich_location *, const diagnostic_metadata *,
566 int, const char *,
567 va_list *, diagnostic_t) ATTRIBUTE_GCC_DIAG(5,0);
568 bool diagnostic_n_impl (rich_location *, const diagnostic_metadata *,
569 int, unsigned HOST_WIDE_INT,
570 const char *, const char *, va_list *,
572
573private:
574 bool includes_seen_p (const line_map_ordinary *map);
575
576 void print_any_cwe (const diagnostic_info &diagnostic);
577 void print_any_rules (const diagnostic_info &diagnostic);
578 void print_option_information (const diagnostic_info &diagnostic,
579 diagnostic_t orig_diag_kind);
580
581 void show_any_path (const diagnostic_info &diagnostic);
582
584
585 bool diagnostic_enabled (diagnostic_info *diagnostic);
586
587 void get_any_inlining_info (diagnostic_info *diagnostic);
588
589 void show_locus (const rich_location &richloc,
590 diagnostic_t diagnostic_kind,
591 pretty_printer *pp,
592 diagnostic_source_effect_info *effect_info);
593
594 void print_path (const diagnostic_path &path);
595
596 /* Data members.
597 Ideally, all of these would be private and have "m_" prefixes. */
598
599public:
600 /* Where most of the diagnostic formatting work is done. */
602
603private:
604 /* Cache of source code. */
606
607 /* The number of times we have issued diagnostics. */
609
610 /* True if it has been requested that warnings be treated as errors. */
612
613 /* The number of option indexes that can be passed to warning() et
614 al. */
616
617 /* The stack of sets of overridden diagnostic option severities. */
619
620 /* True if we should print any CWE identifiers associated with
621 diagnostics. */
623
624 /* True if we should print any rules associated with diagnostics. */
626
627 /* How should diagnostic_path objects be printed. */
629
630 /* True if we should print stack depths when printing diagnostic paths. */
632
633 /* True if we should print the command line option which controls
634 each diagnostic, if known. */
636
637public:
638 /* True if we should raise a SIGABRT on errors. */
640
641 /* True if we should show the column number on diagnostics. */
643
644 /* True if pedwarns are errors. */
646
647 /* True if permerrors are warnings. */
649
650 /* The index of the option to associate with turning permerrors into
651 warnings. */
653
654 /* True if errors are fatal. */
656
657 /* True if all warnings should be disabled. */
659
660 /* True if warnings should be given in system headers. */
662
663private:
664 /* Maximum number of errors to report. */
666
667 /* Client-supplied callbacks for use in text output. */
668 struct {
669 /* This function is called before any message is printed out. It is
670 responsible for preparing message prefix and such. For example, it
671 might say:
672 In file included from "/usr/local/include/curses.h:5:
673 from "/home/gdr/src/nifty_printer.h:56:
674 ...
675 */
677
678 /* This function is called by diagnostic_show_locus in between
679 disjoint spans of source code, so that the context can print
680 something to indicate that a new span of source code has begun. */
682
683 /* This function is called after the diagnostic message is printed. */
686
687public:
688 /* Client hook to report an internal error. */
689 void (*m_internal_error) (diagnostic_context *, const char *, va_list *);
690
691private:
692 /* Client-supplied callbacks for working with options. */
693 struct {
694 /* Client hook to say whether the option controlling a diagnostic is
695 enabled. Returns nonzero if enabled, zero if disabled. */
697
698 /* Client information to pass as second argument to
699 m_option_enabled_cb. */
701
702 /* Client hook to return the name of an option that controls a
703 diagnostic. Returns malloced memory. The first diagnostic_t
704 argument is the kind of diagnostic before any reclassification
705 (of warnings as errors, etc.); the second is the kind after any
706 reclassification. May return NULL if no name is to be printed.
707 May be passed 0 as well as the index of a particular option. */
709
710 /* Client hook to return a URL describing the option that controls
711 a diagnostic. Returns malloced memory. May return NULL if no URL
712 is available. May be passed 0 as well as the index of a
713 particular option. */
715
716 /* A copy of lang_hooks.option_lang_mask (). */
717 unsigned m_lang_mask;
719
720 /* An optional hook for adding URLs to quoted text strings in
721 diagnostics. Only used for the main diagnostic message. */
723
724public:
725 /* Auxiliary data for client. */
727
728 /* Used to detect that the last caret was printed at the same location. */
729 location_t m_last_location;
730
731private:
732 /* Used to detect when the input file stack has changed since last
733 described. */
734 const line_map_ordinary *m_last_module;
735
737
738public:
740
742
743private:
744 /* True if -freport-bug option is used. */
746
747 /* Used to specify additional diagnostic output to be emitted after the
748 rest of the diagnostic. This is for implementing
749 -fdiagnostics-parseable-fixits and GCC_EXTRA_DIAGNOSTIC_OUTPUT. */
751
752public:
753 /* What units to use when outputting the column number. */
755
756 /* The origin for the column number (1-based or 0-based typically). */
758
759 /* The size of the tabstop for tab expansion. */
761
762private:
763 /* How should non-ASCII/non-printable bytes be escaped when
764 a diagnostic suggests escaping the source code on output. */
766
767 /* If non-NULL, an edit_context to which fix-it hints should be
768 applied, for generating patches. */
770
771 /* Fields relating to diagnostic groups. */
772 struct {
773 /* How many diagnostic_group instances are currently alive. */
775
776 /* How many diagnostics have been emitted since the bottommost
777 diagnostic_group was pushed. */
780
781 /* How to output diagnostics (text vs a structured format such as JSON).
782 Must be non-NULL; owned by context. */
784
785 /* Callback to set the locations of call sites along the inlining
786 stack corresponding to a diagnostic location. Needed to traverse
787 the BLOCK_SUPERCONTEXT() chain hanging off the LOCATION_BLOCK()
788 of a diagnostic's location. */
790
791 /* Optional callback for attempting to handle ICEs gracefully. */
793
794 /* Include files that diagnostic_report_current_module has already listed the
795 include path for. */
797
798 /* A bundle of hooks for providing data to the context about its client
799 e.g. version information, plugins, etc.
800 Used by SARIF output to give metadata about the client that's
801 producing diagnostics. */
803
804 /* Support for diagrams. */
805 struct
806 {
807 /* Theme to use when generating diagrams.
808 Can be NULL (if text art is disabled). */
809 text_art::theme *m_theme;
810
812};
813
814inline void
816{
817 context->m_inhibit_notes_p = true;
818}
819
820
821/* Client supplied function to announce a diagnostic
822 (for text-based diagnostic output). */
828
829/* Client supplied function called between disjoint spans of source code,
830 so that the context can print
831 something to indicate that a new span of source code has begun. */
837
838/* Client supplied function called after a diagnostic message is
839 displayed (for text-based diagnostic output). */
845
846/* Extension hooks for client. */
847#define diagnostic_context_auxiliary_data(DC) (DC)->m_client_aux_data
848#define diagnostic_info_auxiliary_data(DI) (DI)->x_data
849
850/* Same as pp_format_decoder. Works on 'diagnostic_context *'. */
851#define diagnostic_format_decoder(DC) pp_format_decoder ((DC)->printer)
852
853/* Same as pp_prefixing_rule. Works on 'diagnostic_context *'. */
854#define diagnostic_prefixing_rule(DC) pp_prefixing_rule ((DC)->printer)
855
856/* Raise SIGABRT on any diagnostic of severity DK_ERROR or higher. */
857inline void
859{
860 context->m_abort_on_error = true;
861}
862
863/* This diagnostic_context is used by front-ends that directly output
864 diagnostic messages without going through `error', `warning',
865 and similar functions. */
867
868/* Returns whether the diagnostic framework has been intialized already and is
869 ready for use. */
870inline bool
872{
873 return global_dc->printer != nullptr;
874}
875
876/* The number of errors that have been issued so far. Ideally, these
877 would take a diagnostic_context as an argument. */
878#define errorcount global_dc->diagnostic_count (DK_ERROR)
879/* Similarly, but for warnings. */
880#define warningcount global_dc->diagnostic_count (DK_WARNING)
881/* Similarly, but for warnings promoted to errors. */
882#define werrorcount global_dc->diagnostic_count (DK_WERROR)
883/* Similarly, but for sorrys. */
884#define sorrycount global_dc->diagnostic_count (DK_SORRY)
885
886/* Returns nonzero if warnings should be emitted. */
887#define diagnostic_report_warnings_p(DC, LOC) \
888 (!(DC)->m_inhibit_warnings \
889 && !(in_system_header_at (LOC) && !(DC)->m_warn_system_headers))
890
891/* Override the option index to be used for reporting a
892 diagnostic. */
893
894inline void
896{
897 info->option_index = optidx;
898}
899
900/* Diagnostic related functions. */
901
902inline void
904{
905 context->initialize (n_opts);
906}
907
908inline void
910{
911 context->color_init (value);
912}
913
914inline void
915diagnostic_urls_init (diagnostic_context *context, int value = -1)
916{
917 context->urls_init (value);
918}
919
920inline void
922{
923 context->finish ();
924}
925
926inline void
928 location_t where)
929{
930 context->report_current_module (where);
931}
932
933inline void
935 rich_location *richloc,
936 diagnostic_t diagnostic_kind,
937 pretty_printer *pp = nullptr,
938 diagnostic_source_effect_info *effect_info = nullptr)
939{
940 gcc_assert (richloc);
941 context->maybe_show_locus (*richloc, diagnostic_kind, pp, effect_info);
942}
943
944/* Because we read source files a second time after the frontend did it the
945 first time, we need to know how the frontend handled things like character
946 set conversion and UTF-8 BOM stripping, in order to make everything
947 consistent. This function needs to be called by each frontend that requires
948 non-default behavior, to inform the diagnostics infrastructure how input is
949 to be processed. The default behavior is to do no conversion and not to
950 strip a UTF-8 BOM.
951
952 The callback should return the input charset to be used to convert the given
953 file's contents to UTF-8, or it should return NULL if no conversion is needed
954 for this file. SHOULD_SKIP_BOM only applies in case no conversion was
955 performed, and if true, it will cause a UTF-8 BOM to be skipped at the
956 beginning of the file. (In case a conversion was performed, the BOM is
957 rather skipped as part of the conversion process.) */
958
959inline void
962 bool should_skip_bom)
963{
964 context->initialize_input_context (ccb, should_skip_bom);
965}
966
967/* Force diagnostics controlled by OPTIDX to be kind KIND. */
968inline diagnostic_t
970 int optidx,
971 diagnostic_t kind,
972 location_t where)
973{
974 return context->classify_diagnostic (optidx, kind, where);
975}
976
977inline void
979 location_t where)
980{
981 context->push_diagnostics (where);
982}
983inline void
985 location_t where)
986{
987 context->pop_diagnostics (where);
988}
989
990/* Report a diagnostic message (an error or a warning) as specified by
991 DC. This function is *the* subroutine in terms of which front-ends
992 should implement their specific diagnostic handling modules. The
993 front-end independent format specifiers are exactly those described
994 in the documentation of output_format.
995 Return true if a diagnostic was printed, false otherwise. */
996
997inline bool
999 diagnostic_info *diagnostic)
1000{
1001 return context->report_diagnostic (diagnostic);
1002}
1003
1004#ifdef ATTRIBUTE_GCC_DIAG
1005extern void diagnostic_set_info (diagnostic_info *, const char *, va_list *,
1006 rich_location *, diagnostic_t) ATTRIBUTE_GCC_DIAG(2,0);
1008 va_list *, rich_location *,
1010 ATTRIBUTE_GCC_DIAG(2,0);
1012 const char *, ...) ATTRIBUTE_GCC_DIAG(3,4);
1013#endif
1017 expanded_location);
1019 const diagnostic_info *,
1020 diagnostic_t);
1021void diagnostic_set_caret_max_width (diagnostic_context *context, int value);
1022
1023inline void
1025 diagnostic_t diag_kind)
1026{
1027 context->action_after_output (diag_kind);
1028}
1029
1030inline void
1032{
1033 context->check_max_errors (flush);
1034}
1035
1036int get_terminal_width (void);
1037
1038/* Return the location associated to this diagnostic. Parameter WHICH
1039 specifies which location. By default, expand the first one. */
1040
1041inline location_t
1042diagnostic_location (const diagnostic_info * diagnostic, int which = 0)
1043{
1044 return diagnostic->message.get_location (which);
1045}
1046
1047/* Return the number of locations to be printed in DIAGNOSTIC. */
1048
1049inline unsigned int
1051{
1052 return diagnostic->message.m_richloc->get_num_locations ();
1053}
1054
1055/* Expand the location of this diagnostic. Use this function for
1056 consistency. Parameter WHICH specifies which location. By default,
1057 expand the first one. */
1058
1059inline expanded_location
1060diagnostic_expand_location (const diagnostic_info * diagnostic, int which = 0)
1061{
1062 return diagnostic->richloc->get_expanded_location (which);
1063}
1064
1065/* This is somehow the right-side margin of a caret line, that is, we
1066 print at least these many characters after the position pointed at
1067 by the caret. */
1068const int CARET_LINE_MARGIN = 10;
1069
1070/* Return true if the two locations can be represented within the same
1071 caret line. This is used to build a prefix and also to determine
1072 whether to print one or two caret lines. */
1073
1074inline bool
1076 expanded_location s1, expanded_location s2)
1077{
1078 return (s2.column && s1.line == s2.line
1080 > abs (s1.column - s2.column)));
1081}
1082
1083extern const char *diagnostic_get_color_for_kind (diagnostic_t kind);
1084
1085/* Pure text formatting support functions. */
1086extern char *file_name_as_prefix (diagnostic_context *, const char *);
1087
1088extern char *build_message_string (const char *, ...) ATTRIBUTE_PRINTF_1;
1089
1091 const char *main_input_filename_,
1092 const char *base_file_name,
1094 bool json_formatting);
1096 bool formatted);
1098 bool formatted,
1099 const char *base_file_name);
1101 const char *main_input_filename_,
1102 bool formatted);
1104 const char *main_input_filename_,
1105 bool formatted,
1106 const char *base_file_name);
1108 const char *main_input_filename_,
1109 bool formatted,
1110 FILE *stream);
1111
1112/* Compute the number of digits in the decimal representation of an integer. */
1113extern int num_digits (int);
1114
1115extern json::value *json_from_expanded_location (diagnostic_context *context,
1116 location_t loc);
1117
1118inline bool
1119warning_enabled_at (location_t loc, int opt)
1120{
1121 return global_dc->warning_enabled_at (loc, opt);
1122}
1123
1124inline bool
1126{
1127 return global_dc->option_unspecified_p (opt);
1128}
1129
1130extern char *get_cwe_url (int cwe);
1131
1132extern const char *get_diagnostic_kind_text (diagnostic_t kind);
1133
1134#endif /* ! GCC_DIAGNOSTIC_H */
Definition vec.h:1656
Definition diagnostic-client-data-hooks.h:31
Definition diagnostic.h:374
void action_after_output(diagnostic_t diag_kind)
Definition diagnostic.cc:733
int m_tabstop
Definition diagnostic.h:760
void initialize(int n_opts)
Definition diagnostic.cc:191
file_cache * m_file_cache
Definition diagnostic.h:605
void set_show_rules(bool val)
Definition diagnostic.h:468
void get_any_inlining_info(diagnostic_info *diagnostic)
Definition diagnostic.cc:1115
enum diagnostic_path_format m_path_format
Definition diagnostic.h:628
void finish()
Definition diagnostic.cc:346
void show_any_path(const diagnostic_info &diagnostic)
Definition diagnostic.cc:903
void end_group()
Definition diagnostic.cc:1737
void error_recursion() ATTRIBUTE_NORETURN
Definition diagnostic.cc:1669
void report_current_module(location_t where)
Definition diagnostic.cc:833
void set_option_hooks(diagnostic_option_enabled_cb option_enabled_cb, void *option_state, diagnostic_make_option_name_cb make_option_name_cb, diagnostic_make_option_url_cb make_option_url_cb, unsigned lang_mask)
Definition diagnostic.cc:408
void set_escape_format(enum diagnostics_escape_format val)
Definition diagnostic.h:476
bool diagnostic_enabled(diagnostic_info *diagnostic)
Definition diagnostic.cc:1311
void(* set_locations_callback_t)(diagnostic_context *, diagnostic_info *)
Definition diagnostic.h:385
bool m_show_option_requested
Definition diagnostic.h:635
void show_locus(const rich_location &richloc, diagnostic_t diagnostic_kind, pretty_printer *pp, diagnostic_source_effect_info *effect_info)
Definition diagnostic-show-locus.cc:3217
void set_set_locations_callback(set_locations_callback_t cb)
Definition diagnostic.h:394
bool m_report_bug
Definition diagnostic.h:745
bool bool diagnostic_n_impl(rich_location *, const diagnostic_metadata *, int, unsigned HOST_WIDE_INT, const char *, const char *, va_list *, diagnostic_t) ATTRIBUTE_GCC_DIAG(7
Definition diagnostic.cc:1624
void maybe_show_locus(const rich_location &richloc, diagnostic_t diagnostic_kind, pretty_printer *pp, diagnostic_source_effect_info *effect_info)
Definition diagnostic-show-locus.cc:3184
edit_context * get_edit_context() const
Definition diagnostic.h:504
void set_path_format(enum diagnostic_path_format val)
Definition diagnostic.h:469
void set_max_errors(int val)
Definition diagnostic.h:475
diagnostic_start_span_fn m_start_span
Definition diagnostic.h:681
struct diagnostic_context::@19 m_diagrams
enum diagnostics_extra_output_kind m_extra_output_kind
Definition diagnostic.h:750
hash_set< location_t, false, location_hash > * m_includes_seen
Definition diagnostic.h:796
bool m_inhibit_warnings
Definition diagnostic.h:658
int m_emission_count
Definition diagnostic.h:778
bool m_show_column
Definition diagnostic.h:642
void set_urlifier(urlifier *)
Definition diagnostic.cc:422
const line_map_ordinary * m_last_module
Definition diagnostic.h:734
int converted_column(expanded_location s) const
Definition diagnostic.cc:515
diagnostic_option_classifier m_option_classifier
Definition diagnostic.h:618
bool m_show_path_depths
Definition diagnostic.h:631
int & diagnostic_count(diagnostic_t kind)
Definition diagnostic.h:516
void push_diagnostics(location_t where)
Definition diagnostic.h:431
void begin_group()
Definition diagnostic.cc:1731
diagnostic_output_format * m_output_format
Definition diagnostic.h:783
enum diagnostics_escape_format m_escape_format
Definition diagnostic.h:765
set_locations_callback_t m_set_locations_cb
Definition diagnostic.h:789
friend diagnostic_starter_fn & diagnostic_starter(diagnostic_context *context)
Definition diagnostic.h:824
diagnostic_t classify_diagnostic(int option_index, diagnostic_t new_kind, location_t where)
Definition diagnostic.h:421
void print_any_cwe(const diagnostic_info &diagnostic)
Definition diagnostic.cc:1203
void set_show_path_depths(bool val)
Definition diagnostic.h:473
const diagnostic_client_data_hooks * get_client_data_hooks()
Definition diagnostic.h:508
void print_option_information(const diagnostic_info &diagnostic, diagnostic_t orig_diag_kind)
Definition diagnostic.cc:1280
diagnostic_make_option_url_cb m_make_option_url_cb
Definition diagnostic.h:714
urlifier * m_urlifier
Definition diagnostic.h:722
bool m_warn_system_headers
Definition diagnostic.h:661
enum diagnostic_path_format get_path_format() const
Definition diagnostic.h:491
diagnostic_client_data_hooks * m_client_data_hooks
Definition diagnostic.h:802
bool diagnostic_impl(rich_location *, const diagnostic_metadata *, int, const char *, va_list *, diagnostic_t) ATTRIBUTE_GCC_DIAG(5
Definition diagnostic.cc:1599
diagnostic_starter_fn m_begin_diagnostic
Definition diagnostic.h:676
void(* m_internal_error)(diagnostic_context *, const char *, va_list *)
Definition diagnostic.h:689
bool m_show_cwe
Definition diagnostic.h:622
void(* ice_handler_callback_t)(diagnostic_context *)
Definition diagnostic.h:384
void set_client_data_hooks(diagnostic_client_data_hooks *hooks)
Definition diagnostic.cc:399
char * make_option_name(int option_index, diagnostic_t orig_diag_kind, diagnostic_t diag_kind) const
Definition diagnostic.h:532
void * m_client_aux_data
Definition diagnostic.h:726
void set_warning_as_error_requested(bool val)
Definition diagnostic.h:458
location_t m_last_location
Definition diagnostic.h:729
label_text get_location_text(const expanded_location &s) const
Definition diagnostic.cc:549
void check_max_errors(bool flush)
Definition diagnostic.cc:710
void print_path(const diagnostic_path &path)
Definition diagnostic-path.cc:1066
friend diagnostic_start_span_fn & diagnostic_start_span(diagnostic_context *context)
Definition diagnostic.h:833
diagnostic_finalizer_fn m_end_diagnostic
Definition diagnostic.h:684
ice_handler_callback_t m_ice_handler_cb
Definition diagnostic.h:792
bool includes_seen_p(const line_map_ordinary *map)
Definition diagnostic.cc:810
unsigned get_lang_mask() const
Definition diagnostic.h:558
enum diagnostics_escape_format get_escape_format() const
Definition diagnostic.h:492
void set_text_art_charset(enum diagnostic_text_art_charset charset)
Definition diagnostic.cc:1849
text_art::theme * m_theme
Definition diagnostic.h:809
bool m_inhibit_notes_p
Definition diagnostic.h:739
bool show_path_depths_p() const
Definition diagnostic.h:490
void * m_option_state
Definition diagnostic.h:700
void color_init(int value)
Definition diagnostic.cc:282
bool m_warning_as_error_requested
Definition diagnostic.h:611
pretty_printer * printer
Definition diagnostic.h:601
friend diagnostic_finalizer_fn & diagnostic_finalizer(diagnostic_context *context)
Definition diagnostic.h:841
bool option_unspecified_p(int opt) const
Definition diagnostic.h:408
bool option_enabled_p(int option_index) const
Definition diagnostic.h:522
void set_show_option_requested(bool val)
Definition diagnostic.h:474
void urls_init(int value)
Definition diagnostic.cc:309
bool report_diagnostic(diagnostic_info *)
Definition diagnostic.cc:1376
int m_n_opts
Definition diagnostic.h:615
int m_diagnostic_count[DK_LAST_DIAGNOSTIC_KIND]
Definition diagnostic.h:608
void print_any_rules(const diagnostic_info &diagnostic)
Definition diagnostic.cc:1238
file_cache & get_file_cache() const
Definition diagnostic.h:498
void pop_diagnostics(location_t where)
Definition diagnostic.h:435
diagnostic_make_option_name_cb m_make_option_name_cb
Definition diagnostic.h:708
struct diagnostic_context::@18 m_diagnostic_groups
bool m_pedantic_errors
Definition diagnostic.h:645
text_art::theme * get_diagram_theme() const
Definition diagnostic.h:512
int m_column_origin
Definition diagnostic.h:757
bool m_fatal_errors
Definition diagnostic.h:655
bool m_permissive
Definition diagnostic.h:648
const diagnostic_output_format * get_output_format() const
Definition diagnostic.h:447
struct diagnostic_context::@16 m_text_callbacks
unsigned m_lang_mask
Definition diagnostic.h:717
void create_edit_context()
Definition diagnostic.cc:430
enum diagnostics_column_unit m_column_unit
Definition diagnostic.h:754
int m_nesting_depth
Definition diagnostic.h:774
void emit_diagram(const diagnostic_diagram &diagram)
Definition diagnostic.cc:1654
int m_lock
Definition diagnostic.h:736
void set_ice_handler_callback(ice_handler_callback_t cb)
Definition diagnostic.h:480
diagnostic_option_enabled_cb m_option_enabled_cb
Definition diagnostic.h:696
void set_report_bug(bool val)
Definition diagnostic.h:462
struct diagnostic_context::@17 m_option_callbacks
bool m_show_rules
Definition diagnostic.h:625
void set_show_cwe(bool val)
Definition diagnostic.h:467
int m_max_errors
Definition diagnostic.h:665
bool m_abort_on_error
Definition diagnostic.h:639
bool warning_enabled_at(location_t loc, int opt)
Definition diagnostic.cc:1355
edit_context * m_edit_context_ptr
Definition diagnostic.h:769
diagnostic_source_printing_options m_source_printing
Definition diagnostic.h:741
int m_opt_permissive
Definition diagnostic.h:652
bool warning_as_error_requested_p() const
Definition diagnostic.h:486
void set_extra_output_kind(enum diagnostics_extra_output_kind kind)
Definition diagnostic.h:463
void set_output_format(diagnostic_output_format *output_format)
Definition diagnostic.cc:391
char * make_option_url(int option_index) const
Definition diagnostic.h:543
void initialize_input_context(diagnostic_input_charset_callback ccb, bool should_skip_bom)
Definition diagnostic.cc:337
Definition diagnostic-diagram.h:33
Definition diagnostic-metadata.h:33
Definition diagnostic.h:254
void push()
Definition diagnostic.cc:159
diagnostic_t update_effective_level_from_pragmas(diagnostic_info *diagnostic) const
Definition diagnostic.cc:1144
void fini()
Definition diagnostic.cc:148
int m_n_opts
Definition diagnostic.h:297
void pop(location_t where)
Definition diagnostic.cc:169
bool option_unspecified_p(int opt) const
Definition diagnostic.h:266
diagnostic_t * m_classify_diagnostic
Definition diagnostic.h:305
diagnostic_t get_current_override(int opt) const
Definition diagnostic.h:271
diagnostic_classification_change_t * m_classification_history
Definition diagnostic.h:312
int * m_push_list
Definition diagnostic.h:318
int m_n_classification_history
Definition diagnostic.h:315
diagnostic_t classify_diagnostic(const diagnostic_context *context, int option_index, diagnostic_t new_kind, location_t where)
Definition diagnostic.cc:975
void init(int n_opts)
Definition diagnostic.cc:137
int m_n_push
Definition diagnostic.h:319
Definition diagnostic.h:204
virtual void on_end_group()=0
virtual bool machine_readable_stderr_p() const =0
diagnostic_output_format(diagnostic_context &context)
Definition diagnostic.h:217
virtual void on_diagram(const diagnostic_diagram &diagram)=0
virtual void on_begin_group()=0
virtual ~diagnostic_output_format()
Definition diagnostic.h:206
virtual void on_end_diagnostic(const diagnostic_info &, diagnostic_t orig_diag_kind)=0
virtual void on_begin_diagnostic(const diagnostic_info &)=0
diagnostic_context & m_context
Definition diagnostic.h:221
Definition diagnostic-path.h:186
Definition diagnostic-label-effects.h:41
Definition diagnostic.h:231
void on_begin_diagnostic(const diagnostic_info &) override
Definition diagnostic.cc:1772
void on_begin_group() override
Definition diagnostic.h:237
void on_end_diagnostic(const diagnostic_info &, diagnostic_t orig_diag_kind) override
Definition diagnostic.cc:1778
bool machine_readable_stderr_p() const final override
Definition diagnostic.h:243
void on_end_group() override
Definition diagnostic.h:238
diagnostic_text_output_format(diagnostic_context &context)
Definition diagnostic.h:233
~diagnostic_text_output_format()
Definition diagnostic.cc:1752
void on_diagram(const diagnostic_diagram &diagram) override
Definition diagnostic.cc:1786
Definition edit-context.h:44
Definition input.h:136
Definition hash-set.h:37
Definition json.h:79
Definition logical-location.h:55
Definition pretty-print.h:255
Definition pretty-print-urlifier.h:27
const char *(* diagnostic_input_charset_callback)(const char *)
Definition coretypes.h:164
static struct string2counter_map map[debug_counter_number_of_counters]
Definition dbgcnt.cc:39
void ATTRIBUTE_NORETURN
Definition diagnostic-core.h:72
diagnostic_t
Definition diagnostic-core.h:29
@ DK_LAST_DIAGNOSTIC_KIND
Definition diagnostic-core.h:33
#define ATTRIBUTE_GCC_DIAG(m, n)
Definition diagnostic-core.h:67
void diagnostic_set_caret_max_width(diagnostic_context *context, int value)
Definition diagnostic.cc:123
void diagnostic_set_info(diagnostic_info *, const char *, va_list *, rich_location *, diagnostic_t) ATTRIBUTE_GCC_DIAG(2
char * get_cwe_url(int cwe)
Definition diagnostic.cc:1191
location_t diagnostic_location(const diagnostic_info *diagnostic, int which=0)
Definition diagnostic.h:1042
const int CARET_LINE_MARGIN
Definition diagnostic.h:1068
diagnostics_escape_format
Definition diagnostic.h:51
@ DIAGNOSTICS_ESCAPE_FORMAT_BYTES
Definition diagnostic.h:58
@ DIAGNOSTICS_ESCAPE_FORMAT_UNICODE
Definition diagnostic.h:54
void diagnostic_output_format_init_json_file(diagnostic_context *context, bool formatted, const char *base_file_name)
Definition diagnostic-format-json.cc:421
char *(* diagnostic_make_option_url_cb)(const diagnostic_context *, int, unsigned)
Definition diagnostic.h:188
void void void diagnostic_append_note(diagnostic_context *, location_t, const char *,...) ATTRIBUTE_GCC_DIAG(3
char * file_name_as_prefix(diagnostic_context *, const char *)
Definition diagnostic.cc:88
int(* diagnostic_option_enabled_cb)(int, unsigned, void *)
Definition diagnostic.h:183
void void void char * diagnostic_build_prefix(diagnostic_context *, const diagnostic_info *)
Definition diagnostic.cc:588
void diagnostic_report_current_module(diagnostic_context *context, location_t where)
Definition diagnostic.h:927
diagnostic_text_art_charset
Definition diagnostic.h:117
@ DIAGNOSTICS_TEXT_ART_CHARSET_ASCII
Definition diagnostic.h:122
@ DIAGNOSTICS_TEXT_ART_CHARSET_NONE
Definition diagnostic.h:119
@ DIAGNOSTICS_TEXT_ART_CHARSET_UNICODE
Definition diagnostic.h:126
@ DIAGNOSTICS_TEXT_ART_CHARSET_EMOJI
Definition diagnostic.h:129
diagnostic_path_format
Definition diagnostic.h:83
@ DPF_NONE
Definition diagnostic.h:85
@ DPF_SEPARATE_EVENTS
Definition diagnostic.h:89
@ DPF_INLINE_EVENTS
Definition diagnostic.h:95
void diagnostic_initialize_input_context(diagnostic_context *context, diagnostic_input_charset_callback ccb, bool should_skip_bom)
Definition diagnostic.h:960
diagnostics_extra_output_kind
Definition diagnostic.h:102
@ EXTRA_DIAGNOSTIC_OUTPUT_none
Definition diagnostic.h:104
@ EXTRA_DIAGNOSTIC_OUTPUT_fixits_v2
Definition diagnostic.h:111
@ EXTRA_DIAGNOSTIC_OUTPUT_fixits_v1
Definition diagnostic.h:108
void default_diagnostic_start_span_fn(diagnostic_context *, expanded_location)
Definition diagnostic.cc:948
diagnostics_output_format
Definition diagnostic.h:64
@ DIAGNOSTICS_OUTPUT_FORMAT_SARIF_FILE
Definition diagnostic.h:78
@ DIAGNOSTICS_OUTPUT_FORMAT_JSON_STDERR
Definition diagnostic.h:69
@ DIAGNOSTICS_OUTPUT_FORMAT_TEXT
Definition diagnostic.h:66
@ DIAGNOSTICS_OUTPUT_FORMAT_SARIF_STDERR
Definition diagnostic.h:75
@ DIAGNOSTICS_OUTPUT_FORMAT_JSON_FILE
Definition diagnostic.h:72
void diagnostic_urls_init(diagnostic_context *context, int value=-1)
Definition diagnostic.h:915
void diagnostic_abort_on_error(diagnostic_context *context)
Definition diagnostic.h:858
void diagnostic_inhibit_notes(diagnostic_context *context)
Definition diagnostic.h:815
int get_terminal_width(void)
Definition diagnostic.cc:102
void default_diagnostic_finalizer(diagnostic_context *, const diagnostic_info *, diagnostic_t)
Definition diagnostic.cc:957
diagnostic_t diagnostic_classify_diagnostic(diagnostic_context *context, int optidx, diagnostic_t kind, location_t where)
Definition diagnostic.h:969
diagnostic_starter_fn & diagnostic_starter(diagnostic_context *context)
Definition diagnostic.h:824
const char * diagnostic_get_color_for_kind(diagnostic_t kind)
Definition diagnostic.cc:477
void(* diagnostic_start_span_fn)(diagnostic_context *, expanded_location)
Definition diagnostic.h:176
bool option_unspecified_p(int opt)
Definition diagnostic.h:1125
void(* diagnostic_finalizer_fn)(diagnostic_context *, const diagnostic_info *, diagnostic_t)
Definition diagnostic.h:179
void diagnostic_output_format_init_sarif_file(diagnostic_context *context, const char *main_input_filename_, bool formatted, const char *base_file_name)
Definition diagnostic-format-sarif.cc:2057
bool diagnostic_ready_p()
Definition diagnostic.h:871
diagnostics_column_unit
Definition diagnostic.h:39
@ DIAGNOSTICS_COLUMN_UNIT_BYTE
Definition diagnostic.h:44
@ DIAGNOSTICS_COLUMN_UNIT_DISPLAY
Definition diagnostic.h:41
expanded_location diagnostic_expand_location(const diagnostic_info *diagnostic, int which=0)
Definition diagnostic.h:1060
void diagnostic_action_after_output(diagnostic_context *context, diagnostic_t diag_kind)
Definition diagnostic.h:1024
diagnostic_start_span_fn & diagnostic_start_span(diagnostic_context *context)
Definition diagnostic.h:833
const char * get_diagnostic_kind_text(diagnostic_t kind)
Definition diagnostic.cc:579
int num_digits(int)
Definition diagnostic.cc:1518
json::value * json_from_expanded_location(diagnostic_context *context, location_t loc)
Definition diagnostic-format-json.cc:98
void diagnostic_output_format_init(diagnostic_context *, const char *main_input_filename_, const char *base_file_name, enum diagnostics_output_format, bool json_formatting)
Definition diagnostic.cc:1803
diagnostic_finalizer_fn & diagnostic_finalizer(diagnostic_context *context)
Definition diagnostic.h:841
char * build_message_string(const char *,...) ATTRIBUTE_PRINTF_1
Definition diagnostic.cc:74
char *(* diagnostic_make_option_name_cb)(const diagnostic_context *, int, diagnostic_t, diagnostic_t)
Definition diagnostic.h:184
void diagnostic_finish(diagnostic_context *context)
Definition diagnostic.h:921
diagnostic_context * global_dc
Definition diagnostic-global-context.cc:33
void(* diagnostic_starter_fn)(diagnostic_context *, const diagnostic_info *)
Definition diagnostic.h:173
void diagnostic_output_format_init_sarif_stderr(diagnostic_context *context, const char *main_input_filename_, bool formatted)
Definition diagnostic-format-sarif.cc:2041
void diagnostic_output_format_init_sarif_stream(diagnostic_context *context, const char *main_input_filename_, bool formatted, FILE *stream)
Definition diagnostic-format-sarif.cc:2073
void diagnostic_check_max_errors(diagnostic_context *context, bool flush=false)
Definition diagnostic.h:1031
unsigned int diagnostic_num_locations(const diagnostic_info *diagnostic)
Definition diagnostic.h:1050
void diagnostic_initialize(diagnostic_context *context, int n_opts)
Definition diagnostic.h:903
void default_diagnostic_starter(diagnostic_context *, const diagnostic_info *)
Definition diagnostic.cc:939
void diagnostic_color_init(diagnostic_context *context, int value=-1)
Definition diagnostic.h:909
bool warning_enabled_at(location_t loc, int opt)
Definition diagnostic.h:1119
void void diagnostic_set_info_translated(diagnostic_info *, const char *, va_list *, rich_location *, diagnostic_t) ATTRIBUTE_GCC_DIAG(2
void diagnostic_pop_diagnostics(diagnostic_context *context, location_t where)
Definition diagnostic.h:984
void diagnostic_show_locus(diagnostic_context *context, rich_location *richloc, diagnostic_t diagnostic_kind, pretty_printer *pp=nullptr, diagnostic_source_effect_info *effect_info=nullptr)
Definition diagnostic.h:934
void diagnostic_push_diagnostics(diagnostic_context *context, location_t where)
Definition diagnostic.h:978
bool diagnostic_same_line(const diagnostic_context *context, expanded_location s1, expanded_location s2)
Definition diagnostic.h:1075
bool diagnostic_report_diagnostic(diagnostic_context *context, diagnostic_info *diagnostic)
Definition diagnostic.h:998
void diagnostic_override_option_index(diagnostic_info *info, int optidx)
Definition diagnostic.h:895
void diagnostic_output_format_init_json_stderr(diagnostic_context *context, bool formatted)
Definition diagnostic-format-json.cc:409
void final(rtx_insn *first, FILE *file, int optimize_p)
Definition final.cc:2002
static const char * base_file_name(const char *file_name)
Definition genautomata.cc:9224
Definition diagnostic.h:193
Definition diagnostic-diagram.h:25
Definition diagnostic.h:162
void * m_ao
Definition diagnostic.h:166
auto_vec< location_t, 8 > m_ilocs
Definition diagnostic.h:164
bool m_allsyslocs
Definition diagnostic.h:168
Definition diagnostic.h:136
const diagnostic_metadata * metadata
Definition diagnostic.h:150
diagnostic_info()
Definition diagnostic.h:137
void * x_data
Definition diagnostic.h:153
diagnostic_t kind
Definition diagnostic.h:155
int option_index
Definition diagnostic.h:157
struct diagnostic_info::inlining_info m_iinfo
text_info message
Definition diagnostic.h:143
rich_location * richloc
Definition diagnostic.h:146
Definition diagnostic.h:326
bool enabled
Definition diagnostic.h:330
bool show_line_numbers_p
Definition diagnostic.h:354
bool show_event_links_p
Definition diagnostic.h:368
int max_width
Definition diagnostic.h:333
char caret_chars[rich_location::STATICALLY_ALLOCATED_RANGES]
Definition diagnostic.h:336
bool show_ruler_p
Definition diagnostic.h:363
bool show_labels_p
Definition diagnostic.h:349
bool colorize_source_p
Definition diagnostic.h:345
int min_margin_width
Definition diagnostic.h:359
Definition pretty-print.h:34
location_t get_location(unsigned int index_of_location) const
Definition pretty-print.cc:722
rich_location * m_richloc
Definition pretty-print.h:57
#define gcc_assert(EXPR)
Definition system.h:821