Geoffrey Keating | d804416 | 2004-06-09 20:10:13 +0000 | [diff] [blame] | 1 | /* Structures that hang off cpp_identifier, for PCH. |
| 2 | Copyright (C) 1986, 1987, 1989, 1992, 1993, 1994, 1995, 1996, 1997, 1998, |
| 3 | 1999, 2000, 2001, 2002, 2003, 2004 Free Software Foundation, Inc. |
| 4 | |
| 5 | This program is free software; you can redistribute it and/or modify it |
| 6 | under the terms of the GNU General Public License as published by the |
| 7 | Free Software Foundation; either version 2, or (at your option) any |
| 8 | later version. |
| 9 | |
| 10 | This program is distributed in the hope that it will be useful, |
| 11 | but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 13 | GNU General Public License for more details. |
| 14 | |
| 15 | You should have received a copy of the GNU General Public License |
| 16 | along with this program; if not, write to the Free Software |
| 17 | Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ |
| 18 | |
| 19 | #include "cpplib.h" |
| 20 | |
Roger Sayle | c812785 | 2004-11-27 21:59:38 +0000 | [diff] [blame] | 21 | #if !defined (HAVE_UCHAR) && !defined (IN_GCC) |
Geoffrey Keating | d804416 | 2004-06-09 20:10:13 +0000 | [diff] [blame] | 22 | typedef unsigned char uchar; |
| 23 | #endif |
Roger Sayle | c812785 | 2004-11-27 21:59:38 +0000 | [diff] [blame] | 24 | |
| 25 | #define U (const unsigned char *) /* Intended use: U"string" */ |
Geoffrey Keating | d804416 | 2004-06-09 20:10:13 +0000 | [diff] [blame] | 26 | |
| 27 | /* Chained list of answers to an assertion. */ |
| 28 | struct answer GTY(()) |
| 29 | { |
| 30 | struct answer *next; |
| 31 | unsigned int count; |
| 32 | cpp_token GTY ((length ("%h.count"))) first[1]; |
| 33 | }; |
| 34 | |
| 35 | /* Each macro definition is recorded in a cpp_macro structure. |
| 36 | Variadic macros cannot occur with traditional cpp. */ |
| 37 | struct cpp_macro GTY(()) |
| 38 | { |
| 39 | /* Parameters, if any. */ |
| 40 | cpp_hashnode ** GTY ((nested_ptr (union tree_node, |
| 41 | "%h ? CPP_HASHNODE (GCC_IDENT_TO_HT_IDENT (%h)) : NULL", |
| 42 | "%h ? HT_IDENT_TO_GCC_IDENT (HT_NODE (%h)) : NULL"), |
| 43 | length ("%h.paramc"))) |
| 44 | params; |
| 45 | |
| 46 | /* Replacement tokens (ISO) or replacement text (traditional). See |
| 47 | comment at top of cpptrad.c for how traditional function-like |
| 48 | macros are encoded. */ |
| 49 | union cpp_macro_u |
| 50 | { |
| 51 | cpp_token * GTY ((tag ("0"), length ("%0.count"))) tokens; |
Roger Sayle | c812785 | 2004-11-27 21:59:38 +0000 | [diff] [blame] | 52 | const unsigned char * GTY ((tag ("1"))) text; |
Geoffrey Keating | d804416 | 2004-06-09 20:10:13 +0000 | [diff] [blame] | 53 | } GTY ((desc ("%1.traditional"))) exp; |
| 54 | |
| 55 | /* Definition line number. */ |
| 56 | source_location line; |
| 57 | |
| 58 | /* Number of tokens in expansion, or bytes for traditional macros. */ |
| 59 | unsigned int count; |
| 60 | |
| 61 | /* Number of parameters. */ |
| 62 | unsigned short paramc; |
| 63 | |
| 64 | /* If a function-like macro. */ |
| 65 | unsigned int fun_like : 1; |
| 66 | |
| 67 | /* If a variadic macro. */ |
| 68 | unsigned int variadic : 1; |
| 69 | |
| 70 | /* If macro defined in system header. */ |
| 71 | unsigned int syshdr : 1; |
| 72 | |
| 73 | /* Nonzero if it has been expanded or had its existence tested. */ |
| 74 | unsigned int used : 1; |
| 75 | |
| 76 | /* Indicate which field of 'exp' is in use. */ |
| 77 | unsigned int traditional : 1; |
| 78 | }; |