blob: 23fef1afbba143ef97d9f2183104a9edb830d80d [file] [log] [blame]
Geoffrey Keatingd8044162004-06-09 20:10:13 +00001/* 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
5This program is free software; you can redistribute it and/or modify it
6under the terms of the GNU General Public License as published by the
7Free Software Foundation; either version 2, or (at your option) any
8later version.
9
10This program is distributed in the hope that it will be useful,
11but WITHOUT ANY WARRANTY; without even the implied warranty of
12MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13GNU General Public License for more details.
14
15You should have received a copy of the GNU General Public License
16along with this program; if not, write to the Free Software
17Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
18
19#include "cpplib.h"
20
Roger Saylec8127852004-11-27 21:59:38 +000021#if !defined (HAVE_UCHAR) && !defined (IN_GCC)
Geoffrey Keatingd8044162004-06-09 20:10:13 +000022typedef unsigned char uchar;
23#endif
Roger Saylec8127852004-11-27 21:59:38 +000024
25#define U (const unsigned char *) /* Intended use: U"string" */
Geoffrey Keatingd8044162004-06-09 20:10:13 +000026
27/* Chained list of answers to an assertion. */
28struct 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. */
37struct 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 Saylec8127852004-11-27 21:59:38 +000052 const unsigned char * GTY ((tag ("1"))) text;
Geoffrey Keatingd8044162004-06-09 20:10:13 +000053 } 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};