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