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