blob: afe4edad99e1c434ad775fdcd49a3124a9d4caa6 [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,
Jakub Jelinek748086b2009-04-09 17:00:19 +02003 1999, 2000, 2001, 2002, 2003, 2004, 2009 Free Software Foundation, Inc.
Geoffrey Keatingd8044162004-06-09 20:10:13 +00004
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
Jakub Jelinek748086b2009-04-09 17:00:19 +02007Free Software Foundation; either version 3, or (at your option) any
Geoffrey Keatingd8044162004-06-09 20:10:13 +00008later 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
Jakub Jelinek748086b2009-04-09 17:00:19 +020016along with this program; see the file COPYING3. If not see
17<http://www.gnu.org/licenses/>. */
Geoffrey Keatingd8044162004-06-09 20:10:13 +000018
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
Kris Van Heesb6baa672008-04-18 13:58:08 +000025#define UC (const unsigned char *) /* Intended use: UC"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};