GCC Middle and Back End API Reference
|
#include "config.h"
#include "system.h"
#include "diagnostic-color.h"
#include "diagnostic-url.h"
#include "label-text.h"
#include "color-macros.h"
#include "selftest.h"
Data Structures | |
struct | color_default |
class | diagnostic_color_dict |
struct | diagnostic_color_dict::entry |
Macros | |
#define | INCLUDE_VECTOR |
Functions | |
const char * | colorize_start (bool show_color, const char *name, size_t name_len) |
const char * | colorize_stop (bool show_color) |
static bool | parse_gcc_colors () |
static bool | should_colorize (void) |
bool | colorize_init (diagnostic_color_rule_t rule) |
static diagnostic_url_format | parse_env_vars_for_urls () |
static bool | auto_enable_urls () |
diagnostic_url_format | determine_url_format (diagnostic_url_rule_t rule) |
Variables | |
static const color_default | gcc_color_defaults [] |
static diagnostic_color_dict * | g_color_dict |
#define INCLUDE_VECTOR |
Output colorization. Copyright (C) 2011-2024 Free Software Foundation, Inc. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 3, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA.
|
static |
Return true if we should use urls when in auto mode, false otherwise.
References NULL, and should_colorize().
Referenced by determine_url_format().
bool colorize_init | ( | diagnostic_color_rule_t | rule | ) |
References DIAGNOSTICS_COLOR_AUTO, DIAGNOSTICS_COLOR_NO, DIAGNOSTICS_COLOR_YES, g_color_dict, gcc_color_defaults, gcc_unreachable, parse_gcc_colors(), and should_colorize().
Referenced by diagnostic_context::color_init().
const char * colorize_start | ( | bool | show_color, |
const char * | name, | ||
size_t | name_len ) |
References g_color_dict, and diagnostic_color_dict::get_start_by_name().
Referenced by diagnostic_text_output_format::build_prefix(), colorize_start(), default_token_printer(), diagnostic_text_output_format::file_name_as_prefix(), diagnostic_column_policy::get_location_text(), pp_begin_quote(), diagnostic_text_output_format::print_any_cwe(), diagnostic_text_output_format::print_any_rules(), edited_file::print_diff(), edited_file::print_diff_hunk(), diagnostic_text_output_format::print_option_information(), and edited_file::print_run_of_changed_lines().
const char * colorize_stop | ( | bool | show_color | ) |
References SGR_RESET.
Referenced by diagnostic_text_output_format::build_prefix(), default_token_printer(), diagnostic_text_output_format::file_name_as_prefix(), diagnostic_column_policy::get_location_text(), pp_end_quote(), diagnostic_text_output_format::print_any_cwe(), diagnostic_text_output_format::print_any_rules(), edited_file::print_diff(), edited_file::print_diff_hunk(), diagnostic_text_output_format::print_option_information(), and edited_file::print_run_of_changed_lines().
diagnostic_url_format determine_url_format | ( | diagnostic_url_rule_t | rule | ) |
Determine if URLs should be enabled, based on RULE, and, if so, which format to use. This reuses the logic for colorization.
References auto_enable_urls(), DIAGNOSTICS_URL_AUTO, DIAGNOSTICS_URL_NO, DIAGNOSTICS_URL_YES, gcc_unreachable, parse_env_vars_for_urls(), and URL_FORMAT_NONE.
Referenced by diagnostic_context::urls_init().
|
static |
Return URL_FORMAT_XXX which tells how we should emit urls when in always mode. We use GCC_URLS and if that is not defined TERM_URLS. If neither is defined the feature is enabled by default.
References NULL, URL_FORMAT_BEL, URL_FORMAT_DEFAULT, URL_FORMAT_NONE, and URL_FORMAT_ST.
Referenced by determine_url_format().
|
static |
Parse GCC_COLORS. The default would look like: GCC_COLORS='error=01;31:warning=01;35:note=01;36:\ range1=32:range2=34:locus=01:quote=01:path=01;36:\ fixit-insert=32:fixit-delete=31:'\ diff-filename=01:diff-hunk=32:diff-delete=31:diff-insert=32:\ type-diff=01;32'.
References g_color_dict, and diagnostic_color_dict::parse_envvar_value().
Referenced by colorize_init().
|
static |
Return true if we should use color when in auto mode, false otherwise.
References NULL, and STDERR_FILENO.
Referenced by auto_enable_urls(), and colorize_init().
|
static |
Referenced by colorize_init(), colorize_start(), and parse_gcc_colors().
|
static |