gcc/c-family/
[official-gcc.git] / gcc / diagnostic-color.h
blobe643e5188c011eab2e376cb3177112dd88251940
1 /* Copyright (C) 2013 Free Software Foundation, Inc.
2 Contributed by Manuel Lopez-Ibanez <manu@gcc.gnu.org>
4 This file is part of GCC.
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.
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.
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/>. */
20 /* Based on code from: */
21 /* grep.c - main driver file for grep.
22 Copyright (C) 1992, 1997-2002, 2004-2013 Free Software Foundation, Inc.
24 This program is free software; you can redistribute it and/or modify
25 it under the terms of the GNU General Public License as published by
26 the Free Software Foundation; either version 3, or (at your option)
27 any later version.
29 This program is distributed in the hope that it will be useful,
30 but WITHOUT ANY WARRANTY; without even the implied warranty of
31 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
32 GNU General Public License for more details.
34 You should have received a copy of the GNU General Public License
35 along with this program; if not, write to the Free Software
36 Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA
37 02110-1301, USA.
39 Written July 1992 by Mike Haertel. */
41 #ifndef GCC_DIAGNOSTIC_COLOR_H
42 #define GCC_DIAGNOSTIC_COLOR_H
44 /* How often diagnostics are prefixed by their locations:
45 o DIAGNOSTICS_SHOW_PREFIX_NEVER: never - not yet supported;
46 o DIAGNOSTICS_SHOW_PREFIX_ONCE: emit only once;
47 o DIAGNOSTICS_SHOW_PREFIX_EVERY_LINE: emit each time a physical
48 line is started. */
49 typedef enum
51 DIAGNOSTICS_COLOR_NO = 0,
52 DIAGNOSTICS_COLOR_YES = 1,
53 DIAGNOSTICS_COLOR_AUTO = 2
54 } diagnostic_color_rule_t;
56 const char *colorize_start (bool, const char *, size_t);
57 const char *colorize_stop (bool);
58 bool colorize_init (diagnostic_color_rule_t);
60 inline const char *
61 colorize_start (bool show_color, const char *name)
63 return colorize_start (show_color, name, strlen (name));
66 #endif /* ! GCC_DIAGNOSTIC_COLOR_H */