GCC Middle and Back End API Reference
|
#include "config.h"
#include "system.h"
#include "coretypes.h"
#include "version.h"
#include "demangle.h"
#include "intl.h"
#include "backtrace.h"
#include "diagnostic.h"
#include "diagnostics/color.h"
#include "diagnostics/url.h"
#include "diagnostics/metadata.h"
#include "diagnostics/paths.h"
#include "diagnostics/client-data-hooks.h"
#include "diagnostics/diagram.h"
#include "diagnostics/sink.h"
#include "diagnostics/sarif-sink.h"
#include "diagnostics/text-sink.h"
#include "diagnostics/changes.h"
#include "selftest.h"
#include "diagnostics/selftest-context.h"
#include "opts.h"
#include "cpplib.h"
#include "text-art/theme.h"
#include "pretty-print-urlifier.h"
#include "diagnostics/logical-locations.h"
#include "diagnostics/buffering.h"
#include "diagnostics/file-cache.h"
#include "diagnostics/dumping.h"
#include "diagnostics/logging.h"
#include "diagnostics/kinds.def"
Namespaces | |
namespace | diagnostics |
Macros | |
#define | INCLUDE_VECTOR |
#define | DEFINE_DIAGNOSTIC_KIND(K, T, C) |
#define | DEFINE_DIAGNOSTIC_KIND(K, T, C) |
#define | DEFINE_DIAGNOSTIC_KIND(K, T, C) |
Functions | |
static void | real_abort (void) ATTRIBUTE_NORETURN |
char * | build_message_string (const char *msg,...) |
int | get_terminal_width (void) |
void | diagnostic_set_info_translated (diagnostics::diagnostic_info *diagnostic, const char *msg, va_list *args, rich_location *richloc, enum diagnostics::kind kind) |
void | diagnostic_set_info (diagnostics::diagnostic_info *diagnostic, const char *gmsgid, va_list *args, rich_location *richloc, enum diagnostics::kind kind) |
const char * | diagnostics::get_text_for_kind (enum kind kind) |
const char * | diagnostics::get_debug_string_for_kind (enum kind kind) |
const char * | diagnostics::get_color_for_kind (enum kind kind) |
static int | diagnostics::convert_column_unit (file_cache &fc, enum diagnostics_column_unit column_unit, int tabstop, expanded_location s) |
static int | bt_callback (void *data, uintptr_t pc, const char *filename, int lineno, const char *function) |
static void | bt_err_callback (void *data, const char *msg, int errnum) |
static void | diagnostics::print_escaped_string (pretty_printer *pp, const char *text) |
static void | diagnostics::print_parseable_fixits (file_cache &fc, pretty_printer *pp, rich_location *richloc, enum diagnostics_column_unit column_unit, int tabstop) |
char * | diagnostics::get_cwe_url (int cwe) |
int | diagnostics::num_digits (int) |
const char * | trim_filename (const char *name) |
void | fancy_abort (const char *file, int line, const char *function) |
void | diagnostics::output_format_init (context &dc, const char *main_input_filename_, const char *base_file_name, enum diagnostics_output_format format, bool json_formatting) |
Variables | |
const char * | progname |
static const char *const | diagnostics::diagnostic_kind_text [] |
static const char *const | diagnostics::diagnostic_kind_debug_text [] |
static const char *const | diagnostics::diagnostic_kind_color [] |
static const char *const | bt_stop [] |
#define DEFINE_DIAGNOSTIC_KIND | ( | K, | |
T, | |||
C ) |
#define DEFINE_DIAGNOSTIC_KIND | ( | K, | |
T, | |||
C ) |
#define DEFINE_DIAGNOSTIC_KIND | ( | K, | |
T, | |||
C ) |
#define INCLUDE_VECTOR |
Language-independent diagnostic subroutines for the GNU Compiler Collection Copyright (C) 1999-2025 Free Software Foundation, Inc. Contributed by Gabriel Dos Reis <gdr@codesourcery.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/>.
This file implements the language independent aspect of diagnostic message module.
|
static |
A callback function passed to the backtrace_full function.
References bt_stop, free(), and i.
Referenced by fancy_abort().
|
static |
A callback function passed to the backtrace_full function. This is called if backtrace_full has an error.
References msg.
Referenced by diagnostics::context::action_after_output(), and fancy_abort().
char * build_message_string | ( | const char * | msg, |
... ) |
Return a malloc'd string containing MSG formatted a la printf. The caller is responsible for freeing the memory.
Referenced by diagnostics::text_sink::build_prefix(), diagnostics::text_sink::file_name_as_prefix(), and diagnostics::column_policy::get_location_text().
void diagnostic_set_info | ( | diagnostics::diagnostic_info * | diagnostic, |
const char * | gmsgid, | ||
va_list * | args, | ||
rich_location * | richloc, | ||
enum diagnostics::kind | kind ) |
Initialize DIAGNOSTIC, where the message GMSGID has not yet been translated.
References _, diagnostic_set_info_translated(), and gcc_assert.
void diagnostic_set_info_translated | ( | diagnostics::diagnostic_info * | diagnostic, |
const char * | msg, | ||
va_list * | args, | ||
rich_location * | richloc, | ||
enum diagnostics::kind | kind ) |
Initialize DIAGNOSTIC, where the message MSG has already been translated.
References errno, gcc_assert, diagnostic::m_metadata, and msg.
Referenced by diagnostic_set_info().
void fancy_abort | ( | const char * | file, |
int | line, | ||
const char * | function ) |
Report an internal compiler error in a friendly manner. This is the function that gets called upon use of abort() in the source code generally, thanks to a special macro.
References bt_callback(), bt_err_callback(), count, fnotice(), fputc(), diagnostics::get_text_for_kind(), global_dc, internal_error(), real_abort(), and trim_filename().
int get_terminal_width | ( | void | ) |
Return the value of the getenv("COLUMNS") as an integer. If the value is not set to a positive integer, use ioctl to get the terminal width. If it fails, return INT_MAX.
References INT_MAX.
Referenced by print_specific_help(), and diagnostics::context::set_caret_max_width().
|
static |
Disable warnings about quoting issues in the pp_xxx calls below that (intentionally) don't follow GCC diagnostic conventions.
Really call the system 'abort'. This has to go right at the end of this file, so that there are no functions after it that call abort and get the system abort instead of our macro.
References abort.
Referenced by diagnostics::context::action_after_output(), diagnostics::context::error_recursion(), and fancy_abort().
const char * trim_filename | ( | const char * | name | ) |
Given a partial pathname as input, return another pathname that shares no directory elements with the pathname of __FILE__. This is used by fancy_abort() to print `internal compiler error in expr.cc' instead of `internal compiler error in ../../GCC/gcc/expr.cc'.
References this_file.
Referenced by emit_insn_modes_h(), fancy_abort(), fancy_abort(), new_adjust(), and new_mode().
|
static |
Functions at which to stop the backtrace print. It's not particularly helpful to print the callers of these functions.
Referenced by bt_callback().
const char* progname |
Name of program invoked, sans directories.
Referenced by diagnostic_finish_va(), diagnostic_finish_via_msg_buf(), display_help(), error(), execute(), fatal(), general_init(), diagnostics::column_policy::get_location_text(), internal_error(), main(), main(), main(), main(), main(), driver::maybe_print_and_exit(), print_usage(), print_version(), print_version(), read_state(), read_state_structures(), read_state_typedefs(), read_state_variables(), driver::set_progname(), usage(), warning(), write_insn_preds_c(), state_writer::write_state, state_writer::write_state_structures(), state_writer::write_state_typedefs(), state_writer::write_state_variables(), write_tm_constrs_h(), write_tm_preds_h(), and diagnostics::text_sink::~text_sink().