]>
Commit | Line | Data |
---|---|---|
c39ed964 | 1 | /* Structures that hang off cpp_identifier, for PCH. |
f1717362 | 2 | Copyright (C) 1986-2016 Free Software Foundation, Inc. |
c39ed964 | 3 | |
4 | This program is free software; you can redistribute it and/or modify it | |
5 | under the terms of the GNU General Public License as published by the | |
6bc9506f | 6 | Free Software Foundation; either version 3, or (at your option) any |
c39ed964 | 7 | later version. |
8 | ||
9 | This program is distributed in the hope that it will be useful, | |
10 | but WITHOUT ANY WARRANTY; without even the implied warranty of | |
11 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
12 | GNU General Public License for more details. | |
13 | ||
14 | You should have received a copy of the GNU General Public License | |
6bc9506f | 15 | along with this program; see the file COPYING3. If not see |
16 | <http://www.gnu.org/licenses/>. */ | |
c39ed964 | 17 | |
18 | #include "cpplib.h" | |
19 | ||
fe4dcd90 | 20 | #if !defined (HAVE_UCHAR) && !defined (IN_GCC) |
c39ed964 | 21 | typedef unsigned char uchar; |
22 | #endif | |
fe4dcd90 | 23 | |
924bbf02 | 24 | #define UC (const unsigned char *) /* Intended use: UC"string" */ |
c39ed964 | 25 | |
26 | /* Chained list of answers to an assertion. */ | |
fb1e4f4a | 27 | struct GTY(()) answer { |
c39ed964 | 28 | struct answer *next; |
29 | unsigned int count; | |
30 | cpp_token GTY ((length ("%h.count"))) first[1]; | |
31 | }; | |
32 | ||
33 | /* Each macro definition is recorded in a cpp_macro structure. | |
34 | Variadic macros cannot occur with traditional cpp. */ | |
fb1e4f4a | 35 | struct GTY(()) cpp_macro { |
109ca87a | 36 | /* Parameters, if any. If parameter names use extended identifiers, |
37 | the original spelling of those identifiers, not the canonical | |
38 | UTF-8 spelling, goes here. */ | |
c39ed964 | 39 | cpp_hashnode ** GTY ((nested_ptr (union tree_node, |
40 | "%h ? CPP_HASHNODE (GCC_IDENT_TO_HT_IDENT (%h)) : NULL", | |
41 | "%h ? HT_IDENT_TO_GCC_IDENT (HT_NODE (%h)) : NULL"), | |
42 | length ("%h.paramc"))) | |
43 | params; | |
44 | ||
45 | /* Replacement tokens (ISO) or replacement text (traditional). See | |
46 | comment at top of cpptrad.c for how traditional function-like | |
47 | macros are encoded. */ | |
48 | union cpp_macro_u | |
49 | { | |
50 | cpp_token * GTY ((tag ("0"), length ("%0.count"))) tokens; | |
fe4dcd90 | 51 | const unsigned char * GTY ((tag ("1"))) text; |
c39ed964 | 52 | } GTY ((desc ("%1.traditional"))) exp; |
53 | ||
54 | /* Definition line number. */ | |
55 | source_location line; | |
56 | ||
57 | /* Number of tokens in expansion, or bytes for traditional macros. */ | |
58 | unsigned int count; | |
59 | ||
60 | /* Number of parameters. */ | |
61 | unsigned short paramc; | |
62 | ||
63 | /* If a function-like macro. */ | |
64 | unsigned int fun_like : 1; | |
65 | ||
66 | /* If a variadic macro. */ | |
67 | unsigned int variadic : 1; | |
68 | ||
69 | /* If macro defined in system header. */ | |
70 | unsigned int syshdr : 1; | |
71 | ||
72 | /* Nonzero if it has been expanded or had its existence tested. */ | |
73 | unsigned int used : 1; | |
74 | ||
75 | /* Indicate which field of 'exp' is in use. */ | |
76 | unsigned int traditional : 1; | |
941f2388 | 77 | |
78 | /* Indicate whether the tokens include extra CPP_PASTE tokens at the | |
79 | end to track invalid redefinitions with consecutive CPP_PASTE | |
80 | tokens. */ | |
81 | unsigned int extra_tokens : 1; | |
c39ed964 | 82 | }; |