Branch data Line data Source code
1 : : /* Command line option handling. Interactions with diagnostics code.
2 : : Copyright (C) 2010-2025 Free Software Foundation, Inc.
3 : :
4 : : This file is part of GCC.
5 : :
6 : : GCC is free software; you can redistribute it and/or modify it under
7 : : the terms of the GNU General Public License as published by the Free
8 : : Software Foundation; either version 3, or (at your option) any later
9 : : version.
10 : :
11 : : GCC is distributed in the hope that it will be useful, but WITHOUT ANY
12 : : WARRANTY; without even the implied warranty of MERCHANTABILITY or
13 : : FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
14 : : for more details.
15 : :
16 : : You should have received a copy of the GNU General Public License
17 : : along with GCC; see the file COPYING3. If not see
18 : : <http://www.gnu.org/licenses/>. */
19 : :
20 : : #ifndef GCC_OPTS_DIAGNOSTIC_H
21 : : #define GCC_OPTS_DIAGNOSTIC_H
22 : :
23 : : /* Abstract subclass of diagnostics::option_id_manager for gcc options. */
24 : :
25 : : class gcc_diagnostic_option_id_manager : public diagnostics::option_id_manager
26 : : {
27 : : public:
28 : : char *make_option_url (diagnostics::option_id option_id) const final override;
29 : :
30 : : protected:
31 : 297960 : gcc_diagnostic_option_id_manager (unsigned lang_mask)
32 : 297960 : : m_lang_mask (lang_mask)
33 : : {}
34 : :
35 : : unsigned m_lang_mask;
36 : : };
37 : :
38 : : /* Concrete implementation of diagnostics::option_id_manager for compiler. */
39 : :
40 : : class compiler_diagnostic_option_id_manager
41 : : : public gcc_diagnostic_option_id_manager
42 : : {
43 : : public:
44 : 285689 : compiler_diagnostic_option_id_manager (const diagnostics::context &context,
45 : : unsigned lang_mask,
46 : : void *opts)
47 : 285689 : : gcc_diagnostic_option_id_manager (lang_mask),
48 : 285689 : m_context (context),
49 : 285689 : m_opts (opts)
50 : : {
51 : : }
52 : :
53 : : int option_enabled_p (diagnostics::option_id option_id) const final override;
54 : : char *
55 : : make_option_name (diagnostics::option_id option_id,
56 : : enum diagnostics::kind orig_diag_kind,
57 : : enum diagnostics::kind diag_kind) const final override;
58 : :
59 : : private:
60 : : const diagnostics::context &m_context;
61 : : void *m_opts;
62 : : };
63 : :
64 : : extern void
65 : : handle_OPT_fdiagnostics_add_output_ (const gcc_options &opts,
66 : : diagnostics::context &dc,
67 : : const char *arg,
68 : : location_t loc);
69 : :
70 : : extern void
71 : : handle_OPT_fdiagnostics_set_output_ (const gcc_options &opts,
72 : : diagnostics::context &dc,
73 : : const char *arg,
74 : : location_t loc);
75 : : #endif
|