1/* Definitions for c-indentation.cc.
2 Copyright (C) 2015-2023 Free Software Foundation, Inc.
3
4This file is part of GCC.
5
6GCC is free software; you can redistribute it and/or modify it under
7the terms of the GNU General Public License as published by the Free
8Software Foundation; either version 3, or (at your option) any later
9version.
10
11GCC is distributed in the hope that it will be useful, but WITHOUT ANY
12WARRANTY; without even the implied warranty of MERCHANTABILITY or
13FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
14for more details.
15
16You should have received a copy of the GNU General Public License
17along with GCC; see the file COPYING3. If not see
18<http://www.gnu.org/licenses/>. */
19
20#ifndef GCC_C_INDENTATION_H
21#define GCC_C_INDENTATION_H
22
23/* Token information used by the -Wmisleading-indentation implementation. */
24
25struct token_indent_info
26{
27 location_t location;
28 ENUM_BITFIELD (cpp_ttype) type : 8;
29 ENUM_BITFIELD (rid) keyword : 8;
30};
31
32/* Extract token information from TOKEN, which ought to either be a
33 cp_token * or a c_token *. */
34
35template <typename T>
36inline token_indent_info
37get_token_indent_info (const T *token)
38{
39 token_indent_info info;
40 info.location = token->location;
41 info.type = token->type;
42 info.keyword = token->keyword;
43
44 return info;
45}
46
47extern void
48warn_for_misleading_indentation (const token_indent_info &guard_tinfo,
49 const token_indent_info &body_tinfo,
50 const token_indent_info &next_tinfo);
51extern const char *
52guard_tinfo_to_string (enum rid keyword);
53
54#endif /* ! GCC_C_INDENTATION_H */
55

source code of gcc/c-family/c-indentation.h