1 /* Definitions for c-indentation.c.
2    Copyright (C) 2015-2018 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_C_INDENTATION_H
21 #define GCC_C_INDENTATION_H
22 
23 /* Token information used by the -Wmisleading-indentation implementation.  */
24 
25 struct 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 
35 template <typename T>
36 inline token_indent_info
37 get_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 
47 extern void
48 warn_for_misleading_indentation (const token_indent_info &guard_tinfo,
49 				 const token_indent_info &body_tinfo,
50 				 const token_indent_info &next_tinfo);
51 extern const char *
52 guard_tinfo_to_string (enum rid keyword);
53 
54 #endif  /* ! GCC_C_INDENTATION_H  */
55