[PATCH][v5] RISC-V: add option -m(no-)autovec-segment
[official-gcc.git] / gcc / diagnostic-format-text.h
blobd3b10dd518aeb688e4dd6b630e9b52a20cf6d494
1 /* Classic text-based output of diagnostics.
2 Copyright (C) 2023-2024 Free Software Foundation, Inc.
3 Contributed by David Malcolm <dmalcolm@redhat.com>.
5 This file is part of GCC.
7 GCC is free software; you can redistribute it and/or modify it under
8 the terms of the GNU General Public License as published by the Free
9 Software Foundation; either version 3, or (at your option) any later
10 version.
12 GCC is distributed in the hope that it will be useful, but WITHOUT ANY
13 WARRANTY; without even the implied warranty of MERCHANTABILITY or
14 FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
15 for more details.
17 You should have received a copy of the GNU General Public License
18 along with GCC; see the file COPYING3. If not see
19 <http://www.gnu.org/licenses/>. */
21 #ifndef GCC_DIAGNOSTIC_FORMAT_TEXT_H
22 #define GCC_DIAGNOSTIC_FORMAT_TEXT_H
24 #include "diagnostic-format.h"
26 /* Subclass of diagnostic_output_format for classic text-based output
27 to stderr.
29 Uses diagnostic_context.m_text_callbacks to provide client-specific
30 textual output (e.g. include paths, macro expansions, etc). */
32 class diagnostic_text_output_format : public diagnostic_output_format
34 public:
35 diagnostic_text_output_format (diagnostic_context &context)
36 : diagnostic_output_format (context),
37 m_column_policy (context),
38 m_last_module (nullptr),
39 m_includes_seen (nullptr)
41 ~diagnostic_text_output_format ();
43 void dump (FILE *out, int indent) const override;
45 void on_begin_group () override {}
46 void on_end_group () override {}
47 void on_report_diagnostic (const diagnostic_info &,
48 diagnostic_t orig_diag_kind) override;
49 void on_diagram (const diagnostic_diagram &diagram) override;
50 void after_diagnostic (const diagnostic_info &) final override;
51 bool machine_readable_stderr_p () const final override
53 return false;
56 /* Helpers for writing lang-specific starters/finalizers for text output. */
57 char *build_prefix (const diagnostic_info &) const;
58 void report_current_module (location_t where);
59 void append_note (location_t location,
60 const char * gmsgid, ...) ATTRIBUTE_GCC_DIAG(3,4);
63 char *file_name_as_prefix (const char *) const;
65 void print_path (const diagnostic_path &path);
67 bool show_column_p () const { return get_context ().m_show_column; }
69 const diagnostic_column_policy &get_column_policy () const
71 return m_column_policy;
73 diagnostic_location_print_policy get_location_print_policy () const;
75 private:
76 void print_any_cwe (const diagnostic_info &diagnostic);
77 void print_any_rules (const diagnostic_info &diagnostic);
78 void print_option_information (const diagnostic_info &diagnostic,
79 diagnostic_t orig_diag_kind);
81 label_text get_location_text (const expanded_location &s) const;
82 bool includes_seen_p (const line_map_ordinary *map);
84 diagnostic_column_policy m_column_policy;
86 /* Used to detect when the input file stack has changed since last
87 described. */
88 const line_map_ordinary *m_last_module;
90 /* Include files that report_current_module has already listed the
91 include path for. */
92 hash_set<location_t, false, location_hash> *m_includes_seen;
95 #endif /* ! GCC_DIAGNOSTIC_FORMAT_TEXT_H */