Classic text-based output of diagnostics.
Copyright (C) 2023-2024 Free Software Foundation, Inc.
Contributed by David Malcolm <dmalcolm@redhat.com>.
This file is part of GCC.
GCC 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.
GCC 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 GCC; see the file COPYING3. If not see
<http://www.gnu.org/licenses/>.
Subclass of diagnostic_output_format for classic text-based output
to stderr.
Uses diagnostic_context.m_text_callbacks to provide client-specific
textual output (e.g. include paths, macro expansions, etc).
void diagnostic_text_output_format::print_any_cwe |
( |
const diagnostic_info & | diagnostic | ) |
|
|
private |
If DIAGNOSTIC has a CWE identifier, print it.
For example, if the diagnostic metadata associates it with CWE-119,
" [CWE-119]" will be printed, suitably colorized, and with a URL of a
description of the security issue.
References colorize_start(), colorize_stop(), diagnostic_get_color_for_kind(), free(), diagnostic_metadata::get_cwe(), get_cwe_url(), diagnostic_info::kind, diagnostic_output_format::m_context, diagnostic_info::metadata, NULL, pp_begin_url(), pp_character(), pp_end_url(), pp_printf(), pp_set_prefix(), pp_show_color(), pp_string(), pp_take_prefix(), diagnostic_context::printer, and pretty_printer::supports_urls_p().
Referenced by on_report_diagnostic().
void diagnostic_text_output_format::print_any_rules |
( |
const diagnostic_info & | diagnostic | ) |
|
|
private |
If DIAGNOSTIC has any rules associated with it, print them.
For example, if the diagnostic metadata associates it with a rule
named "STR34-C", then " [STR34-C]" will be printed, suitably colorized,
with any URL provided by the rule.
References colorize_start(), colorize_stop(), diagnostic_get_color_for_kind(), free(), diagnostic_metadata::get_num_rules(), diagnostic_metadata::get_rule(), diagnostic_info::kind, diagnostic_output_format::m_context, diagnostic_metadata::rule::make_description(), diagnostic_metadata::rule::make_url(), diagnostic_info::metadata, NULL, pp_begin_url(), pp_character(), pp_end_url(), pp_set_prefix(), pp_show_color(), pp_string(), pp_take_prefix(), diagnostic_context::printer, and pretty_printer::supports_urls_p().
Referenced by on_report_diagnostic().