aboutsummaryrefslogtreecommitdiff
path: root/gcc/opts-diagnostic.h
blob: 48cc21e31a4865d0711d14bc31493b37c0d32077 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
/* Command line option handling.  Interactions with diagnostics code.
   Copyright (C) 2010-2024 Free Software Foundation, Inc.

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/>.  */

#ifndef GCC_OPTS_DIAGNOSTIC_H
#define GCC_OPTS_DIAGNOSTIC_H

/* Abstract subclass of diagnostic_option_manager for gcc options.  */

class gcc_diagnostic_option_manager : public diagnostic_option_manager
{
public:
  char *make_option_url (diagnostic_option_id option_id) const final override;

protected:
  gcc_diagnostic_option_manager (unsigned lang_mask)
  : m_lang_mask (lang_mask)
  {}

  unsigned m_lang_mask;
};

/* Concrete implementation of diagnostic_option_manager for compiler.  */

class compiler_diagnostic_option_manager : public gcc_diagnostic_option_manager
{
public:
  compiler_diagnostic_option_manager (const diagnostic_context &context,
				      unsigned lang_mask,
				      void *opts)
  : gcc_diagnostic_option_manager (lang_mask),
    m_context (context),
    m_opts (opts)
  {
  }

  int option_enabled_p (diagnostic_option_id option_id) const final override;
  char *make_option_name (diagnostic_option_id option_id,
			  diagnostic_t orig_diag_kind,
			  diagnostic_t diag_kind) const final override;

private:
  const diagnostic_context &m_context;
  void *m_opts;
};

#endif