1 /* Copyright (C) 2013-2018 Free Software Foundation, Inc. 2 Contributed by Manuel Lopez-Ibanez <manu@gcc.gnu.org> 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 /* Based on code from: */ 21 /* grep.c - main driver file for grep. 22 Copyright (C) 1992-2018 Free Software Foundation, Inc. 23 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. 28 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. 33 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. 38 39 Written July 1992 by Mike Haertel. */ 40 41 #ifndef GCC_DIAGNOSTIC_COLOR_H 42 #define GCC_DIAGNOSTIC_COLOR_H 43 44 /* Whether to add color to diagnostics: 45 o DIAGNOSTICS_COLOR_NO: never 46 o DIAGNOSTICS_COLOR_YES: always 47 o DIAGNOSTICS_COLOR_AUTO: depending on the output stream. */ 48 typedef enum 49 { 50 DIAGNOSTICS_COLOR_NO = 0, 51 DIAGNOSTICS_COLOR_YES = 1, 52 DIAGNOSTICS_COLOR_AUTO = 2 53 } diagnostic_color_rule_t; 54 55 const char *colorize_start (bool, const char *, size_t); 56 const char *colorize_stop (bool); 57 bool colorize_init (diagnostic_color_rule_t); 58 59 inline const char * 60 colorize_start (bool show_color, const char *name) 61 { 62 return colorize_start (show_color, name, strlen (name)); 63 } 64 65 #endif /* ! GCC_DIAGNOSTIC_COLOR_H */ 66