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, 2009 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 3, 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; see the file COPYING3. If not see 17 <http://www.gnu.org/licenses/>. */ 18 19 #include "cpplib.h" 20 21 #if !defined (HAVE_UCHAR) && !defined (IN_GCC) 22 typedef unsigned char uchar; 23 #endif 24 25 #define UC (const unsigned char *) /* Intended use: UC"string" */ 26 27 /* Chained list of answers to an assertion. */ 28 struct GTY(()) answer { 29 struct answer *next; 30 unsigned int count; 31 cpp_token GTY ((length ("%h.count"))) first[1]; 32 }; 33 34 /* Each macro definition is recorded in a cpp_macro structure. 35 Variadic macros cannot occur with traditional cpp. */ 36 struct GTY(()) cpp_macro { 37 /* Parameters, if any. */ 38 cpp_hashnode ** GTY ((nested_ptr (union tree_node, 39 "%h ? CPP_HASHNODE (GCC_IDENT_TO_HT_IDENT (%h)) : NULL", 40 "%h ? HT_IDENT_TO_GCC_IDENT (HT_NODE (%h)) : NULL"), 41 length ("%h.paramc"))) 42 params; 43 44 /* Replacement tokens (ISO) or replacement text (traditional). See 45 comment at top of cpptrad.c for how traditional function-like 46 macros are encoded. */ 47 union cpp_macro_u 48 { 49 cpp_token * GTY ((tag ("0"), length ("%0.count"))) tokens; 50 const unsigned char * GTY ((tag ("1"))) text; 51 } GTY ((desc ("%1.traditional"))) exp; 52 53 /* Definition line number. */ 54 source_location line; 55 56 /* Number of tokens in expansion, or bytes for traditional macros. */ 57 unsigned int count; 58 59 /* Number of parameters. */ 60 unsigned short paramc; 61 62 /* If a function-like macro. */ 63 unsigned int fun_like : 1; 64 65 /* If a variadic macro. */ 66 unsigned int variadic : 1; 67 68 /* If macro defined in system header. */ 69 unsigned int syshdr : 1; 70 71 /* Nonzero if it has been expanded or had its existence tested. */ 72 unsigned int used : 1; 73 74 /* Indicate which field of 'exp' is in use. */ 75 unsigned int traditional : 1; 76 77 /* Indicate whether the tokens include extra CPP_PASTE tokens at the 78 end to track invalid redefinitions with consecutive CPP_PASTE 79 tokens. */ 80 unsigned int extra_tokens : 1; 81 }; 82