| 1 | /* Declare enums for diagnostics::context and related types. |
| 2 | Copyright (C) 2000-2026 Free Software Foundation, Inc. |
| 3 | |
| 4 | This file is part of GCC. |
| 5 | |
| 6 | GCC is free software; you can redistribute it and/or modify it under |
| 7 | the terms of the GNU General Public License as published by the Free |
| 8 | Software Foundation; either version 3, or (at your option) any later |
| 9 | version. |
| 10 | |
| 11 | GCC is distributed in the hope that it will be useful, but WITHOUT ANY |
| 12 | WARRANTY; without even the implied warranty of MERCHANTABILITY or |
| 13 | FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License |
| 14 | for more details. |
| 15 | |
| 16 | You should have received a copy of the GNU General Public License |
| 17 | along with GCC; see the file COPYING3. If not see |
| 18 | <http://www.gnu.org/licenses/>. */ |
| 19 | |
| 20 | #ifndef GCC_DIAGNOSTICS_CONTEXT_OPTIONS_H |
| 21 | #define GCC_DIAGNOSTICS_CONTEXT_OPTIONS_H |
| 22 | |
| 23 | /* An enum for controlling what units to use for the column number |
| 24 | when diagnostics are output, used by the -fdiagnostics-column-unit option. |
| 25 | Tabs will be expanded or not according to the value of -ftabstop. The origin |
| 26 | (default 1) is controlled by -fdiagnostics-column-origin. */ |
| 27 | |
| 28 | enum diagnostics_column_unit |
| 29 | { |
| 30 | /* The default from GCC 11 onwards: display columns. */ |
| 31 | DIAGNOSTICS_COLUMN_UNIT_DISPLAY, |
| 32 | |
| 33 | /* The behavior in GCC 10 and earlier: simple bytes. */ |
| 34 | DIAGNOSTICS_COLUMN_UNIT_BYTE |
| 35 | }; |
| 36 | |
| 37 | /* An enum for controlling how to print non-ASCII characters/bytes when |
| 38 | a diagnostic suggests escaping the source code on output. */ |
| 39 | |
| 40 | enum diagnostics_escape_format |
| 41 | { |
| 42 | /* Escape non-ASCII Unicode characters in the form <U+XXXX> and |
| 43 | non-UTF-8 bytes in the form <XX>. */ |
| 44 | DIAGNOSTICS_ESCAPE_FORMAT_UNICODE, |
| 45 | |
| 46 | /* Escape non-ASCII bytes in the form <XX> (thus showing the underlying |
| 47 | encoding of non-ASCII Unicode characters). */ |
| 48 | DIAGNOSTICS_ESCAPE_FORMAT_BYTES |
| 49 | }; |
| 50 | |
| 51 | /* Enum for overriding the standard output format. */ |
| 52 | |
| 53 | enum diagnostics_output_format |
| 54 | { |
| 55 | /* The default: textual output. */ |
| 56 | DIAGNOSTICS_OUTPUT_FORMAT_TEXT, |
| 57 | |
| 58 | /* SARIF-based output, as JSON to stderr. */ |
| 59 | DIAGNOSTICS_OUTPUT_FORMAT_SARIF_STDERR, |
| 60 | |
| 61 | /* SARIF-based output, to a JSON file. */ |
| 62 | DIAGNOSTICS_OUTPUT_FORMAT_SARIF_FILE |
| 63 | }; |
| 64 | |
| 65 | /* An enum for controlling how diagnostic paths should be printed. */ |
| 66 | enum diagnostic_path_format |
| 67 | { |
| 68 | /* Don't print diagnostic paths. */ |
| 69 | DPF_NONE, |
| 70 | |
| 71 | /* Print diagnostic paths by emitting a separate "note" for every event |
| 72 | in the path. */ |
| 73 | DPF_SEPARATE_EVENTS, |
| 74 | |
| 75 | /* Print diagnostic paths by consolidating events together where they |
| 76 | are close enough, and printing such runs of events with multiple |
| 77 | calls to diagnostic_show_locus, showing the individual events in |
| 78 | each run via labels in the source. */ |
| 79 | DPF_INLINE_EVENTS |
| 80 | }; |
| 81 | |
| 82 | /* An enum for capturing values of GCC_EXTRA_DIAGNOSTIC_OUTPUT, |
| 83 | and for -fdiagnostics-parseable-fixits. */ |
| 84 | |
| 85 | enum |
| 86 | { |
| 87 | /* No extra output, or an unrecognized value. */ |
| 88 | , |
| 89 | |
| 90 | /* Emit fix-it hints using the "fixits-v1" format, equivalent to |
| 91 | -fdiagnostics-parseable-fixits. */ |
| 92 | , |
| 93 | |
| 94 | /* Emit fix-it hints using the "fixits-v2" format. */ |
| 95 | |
| 96 | }; |
| 97 | |
| 98 | /* Values for -fdiagnostics-text-art-charset=. */ |
| 99 | |
| 100 | enum diagnostic_text_art_charset |
| 101 | { |
| 102 | /* No text art diagrams shall be emitted. */ |
| 103 | DIAGNOSTICS_TEXT_ART_CHARSET_NONE, |
| 104 | |
| 105 | /* Use pure ASCII for text art diagrams. */ |
| 106 | DIAGNOSTICS_TEXT_ART_CHARSET_ASCII, |
| 107 | |
| 108 | /* Use ASCII + conservative use of other unicode characters |
| 109 | in text art diagrams. */ |
| 110 | DIAGNOSTICS_TEXT_ART_CHARSET_UNICODE, |
| 111 | |
| 112 | /* Use Emoji. */ |
| 113 | DIAGNOSTICS_TEXT_ART_CHARSET_EMOJI |
| 114 | }; |
| 115 | |
| 116 | #endif /* ! GCC_DIAGNOSTICS_CONTEXT_OPTIONS_H */ |
| 117 | |