| 1 |
/* Symbolic names for highlighting colors in diagnostics. |
| 2 |
Copyright (C) 2024-2025 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_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 |
|
| 26 |
warning: 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 * |
| 32 |
note: 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 |
|
| 44 |
namespace highlight_colors { |
| 45 |
|
| 46 |
/* Color names for expressing "expected" vs "actual" values. */ |
| 47 |
extern const char *const expected; |
| 48 |
extern 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. */ |
| 52 |
extern const char *const lhs; |
| 53 |
extern const char *const rhs; |
| 54 |
|
| 55 |
} // namespace highlight_colors |
| 56 |
|
| 57 |
#endif /* ! GCC_DIAGNOSTIC_HIGHLIGHT_COLORS_H */ |