cpp-id-data.h 2.67 KB
Newer Older
Geoffrey Keating committed
1
/* Structures that hang off cpp_identifier, for PCH.
2
   Copyright (C) 1986-2016 Free Software Foundation, Inc.
Geoffrey Keating committed
3 4 5

This program is free software; you can redistribute it and/or modify it
under the terms of the GNU General Public License as published by the
6
Free Software Foundation; either version 3, or (at your option) any
Geoffrey Keating committed
7 8 9 10 11 12 13 14
later version.

This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
GNU General Public License for more details.

You should have received a copy of the GNU General Public License
15 16
along with this program; see the file COPYING3.  If not see
<http://www.gnu.org/licenses/>.  */
Geoffrey Keating committed
17 18 19

#include "cpplib.h"

20
#if !defined (HAVE_UCHAR) && !defined (IN_GCC)
Geoffrey Keating committed
21 22
typedef unsigned char uchar;
#endif
23

24
#define UC (const unsigned char *)  /* Intended use: UC"string" */
Geoffrey Keating committed
25 26

/* Chained list of answers to an assertion.  */
27
struct GTY(()) answer {
Geoffrey Keating committed
28 29 30 31 32 33 34
  struct answer *next;
  unsigned int count;
  cpp_token GTY ((length ("%h.count"))) first[1];
};

/* Each macro definition is recorded in a cpp_macro structure.
   Variadic macros cannot occur with traditional cpp.  */
35
struct GTY(()) cpp_macro {
36 37 38
  /* Parameters, if any.  If parameter names use extended identifiers,
     the original spelling of those identifiers, not the canonical
     UTF-8 spelling, goes here.  */
Geoffrey Keating committed
39 40 41 42 43 44 45 46 47 48 49 50
  cpp_hashnode ** GTY ((nested_ptr (union tree_node,
		"%h ? CPP_HASHNODE (GCC_IDENT_TO_HT_IDENT (%h)) : NULL",
			"%h ? HT_IDENT_TO_GCC_IDENT (HT_NODE (%h)) : NULL"),
			length ("%h.paramc")))
    params;

  /* Replacement tokens (ISO) or replacement text (traditional).  See
     comment at top of cpptrad.c for how traditional function-like
     macros are encoded.  */
  union cpp_macro_u
  {
    cpp_token * GTY ((tag ("0"), length ("%0.count"))) tokens;
51
    const unsigned char * GTY ((tag ("1"))) text;
Geoffrey Keating committed
52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76
  } GTY ((desc ("%1.traditional"))) exp;

  /* Definition line number.  */
  source_location line;

  /* Number of tokens in expansion, or bytes for traditional macros.  */
  unsigned int count;

  /* Number of parameters.  */
  unsigned short paramc;

  /* If a function-like macro.  */
  unsigned int fun_like : 1;

  /* If a variadic macro.  */
  unsigned int variadic : 1;

  /* If macro defined in system header.  */
  unsigned int syshdr   : 1;

  /* Nonzero if it has been expanded or had its existence tested.  */
  unsigned int used     : 1;

  /* Indicate which field of 'exp' is in use.  */
  unsigned int traditional : 1;
77 78 79 80 81

  /* Indicate whether the tokens include extra CPP_PASTE tokens at the
     end to track invalid redefinitions with consecutive CPP_PASTE
     tokens.  */
  unsigned int extra_tokens : 1;
Geoffrey Keating committed
82
};