diagnostic-color.h 2.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566
  1. /* Copyright (C) 2013-2015 Free Software Foundation, Inc.
  2. Contributed by Manuel Lopez-Ibanez <manu@gcc.gnu.org>
  3. This file is part of GCC.
  4. GCC is free software; you can redistribute it and/or modify it under
  5. the terms of the GNU General Public License as published by the Free
  6. Software Foundation; either version 3, or (at your option) any later
  7. version.
  8. GCC is distributed in the hope that it will be useful, but WITHOUT ANY
  9. WARRANTY; without even the implied warranty of MERCHANTABILITY or
  10. FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
  11. for more details.
  12. You should have received a copy of the GNU General Public License
  13. along with GCC; see the file COPYING3. If not see
  14. <http://www.gnu.org/licenses/>. */
  15. /* Based on code from: */
  16. /* grep.c - main driver file for grep.
  17. Copyright (C) 1992-2015 Free Software Foundation, Inc.
  18. This program is free software; you can redistribute it and/or modify
  19. it under the terms of the GNU General Public License as published by
  20. the Free Software Foundation; either version 3, or (at your option)
  21. any later version.
  22. This program is distributed in the hope that it will be useful,
  23. but WITHOUT ANY WARRANTY; without even the implied warranty of
  24. MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  25. GNU General Public License for more details.
  26. You should have received a copy of the GNU General Public License
  27. along with this program; if not, write to the Free Software
  28. Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA
  29. 02110-1301, USA.
  30. Written July 1992 by Mike Haertel. */
  31. #ifndef GCC_DIAGNOSTIC_COLOR_H
  32. #define GCC_DIAGNOSTIC_COLOR_H
  33. /* Whether to add color to diagnostics:
  34. o DIAGNOSTICS_COLOR_NO: never
  35. o DIAGNOSTICS_COLOR_YES: always
  36. o DIAGNOSTICS_COLOR_AUTO: depending on the output stream. */
  37. typedef enum
  38. {
  39. DIAGNOSTICS_COLOR_NO = 0,
  40. DIAGNOSTICS_COLOR_YES = 1,
  41. DIAGNOSTICS_COLOR_AUTO = 2
  42. } diagnostic_color_rule_t;
  43. const char *colorize_start (bool, const char *, size_t);
  44. const char *colorize_stop (bool);
  45. bool colorize_init (diagnostic_color_rule_t);
  46. inline const char *
  47. colorize_start (bool show_color, const char *name)
  48. {
  49. return colorize_start (show_color, name, strlen (name));
  50. }
  51. #endif /* ! GCC_DIAGNOSTIC_COLOR_H */