Line data Source code
1 : /* Declaration of struct diagnostics::option_id.
2 : Copyright (C) 2024-2026 Free Software Foundation, Inc.
3 : Contributed by David Malcolm <dmalcolm@redhat.com>.
4 :
5 : This file is part of GCC.
6 :
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.
11 :
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.
16 :
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/>. */
20 :
21 : #ifndef GCC_DIAGNOSTICS_OPTION_ID_H
22 : #define GCC_DIAGNOSTICS_OPTION_ID_H
23 :
24 : namespace diagnostics {
25 :
26 : /* A class to use for the ID of an option that controls
27 : a particular diagnostic.
28 : This is just a wrapper around "int", but better documents
29 : the intent of the code. */
30 :
31 : struct option_id
32 : {
33 112517955 : option_id () : m_idx (0) {}
34 :
35 120936535 : option_id (int idx) : m_idx (idx) {}
36 : /* Ideally we'd take an enum opt_code here, but we don't
37 : want to depend on its decl. */
38 :
39 105176033 : bool operator== (option_id other) const
40 : {
41 105176033 : return m_idx == other.m_idx;
42 : }
43 :
44 : int m_idx;
45 : };
46 :
47 : } // namespace diagnostics
48 :
49 : #endif /* ! GCC_DIAGNOSTICS_OPTION_ID_H */
|