GCC Middle and Back End API Reference
diagnostic-highlight-colors.h
Go to the documentation of this file.
1/* Symbolic names for highlighting colors in diagnostics.
2 Copyright (C) 2024 Free Software Foundation, Inc.
3
4This file is part of GCC.
5
6GCC is free software; you can redistribute it and/or modify it under
7the terms of the GNU General Public License as published by the Free
8Software Foundation; either version 3, or (at your option) any later
9version.
10
11GCC is distributed in the hope that it will be useful, but WITHOUT ANY
12WARRANTY; without even the implied warranty of MERCHANTABILITY or
13FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
14for more details.
15
16You should have received a copy of the GNU General Public License
17along with GCC; see the file COPYING3. If not see
18<http://www.gnu.org/licenses/>. */
19
20#ifndef GCC_DIAGNOSTIC_HIGHLIGHT_COLORS_H
21#define GCC_DIAGNOSTIC_HIGHLIGHT_COLORS_H
22
23/* Symbolic names for highlight colors in diagnostics, so that e.g.
24 in
25
26warning: format `%i' expects argument of type `int',
27 but argument 2 has type `const char *' [-Wformat=]
28 279 | printf("hello " INT_FMT " world", msg);
29 | ^~~~~~~~ ~~~
30 | |
31 | const char *
32note: format string is defined here
33 278 | #define INT_FMT "%i"
34 | ~^
35 | |
36 | int
37 | %s
38
39 we can refer to the color of "int" as highlight_colors::expected
40 and the color of "const char *" as highlight_colors::actual
41 to help get consistent contrasting colorization, both for the types
42 within the diagnostic messages, and the underlined ranges. */
43
45
46/* Color names for expressing "expected" vs "actual" values. */
47extern const char *const expected;
48extern const char *const actual;
49
50/* Color names for expressing "LHS" vs "RHS" values in a binary operation
51 or when we are listing two different things. */
52extern const char *const lhs;
53extern const char *const rhs;
54
55} // namespace highlight_colors
56
57#endif /* ! GCC_DIAGNOSTIC_HIGHLIGHT_COLORS_H */
Definition diagnostic-highlight-colors.h:44
const char *const lhs
Definition pretty-print.cc:3222
const char *const actual
Definition pretty-print.cc:3219
const char *const expected
Definition pretty-print.cc:3218
const char *const rhs
Definition pretty-print.cc:3223