OSDN Git Service

Merge from pch-branch.
[pf3gnuchains/gcc-fork.git] / gcc / cp / lex.h
1 /* Define constants and variables for communication with the parser.
2    Copyright (C) 1987, 1992, 1993, 1994, 1995, 1996, 1997, 1998,
3    2000, 2001, 2002, 2003 Free Software Foundation, Inc.
4    Hacked by Michael Tiemann (tiemann@cygnus.com)
5    and by Brendan Kehoe (brendan@cygnus.com).
6
7    This file is part of GCC.
8
9    GCC is free software; you can redistribute it and/or modify it
10    under the terms of the GNU General Public License as published by
11    the Free Software Foundation; either version 2, or (at your option)
12    any later version.
13
14    GCC is distributed in the hope that it will be useful, but
15    WITHOUT ANY WARRANTY; without even the implied warranty of
16    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
17    General Public License for more details.
18
19    You should have received a copy of the GNU General Public License
20    along with GCC; see the file COPYING.  If not, write to the Free
21    Software Foundation, 59 Temple Place - Suite 330, Boston, MA
22    02111-1307, USA.  */
23
24
25 #ifndef GCC_CP_LEX_H
26 #define GCC_CP_LEX_H
27
28 #if 0
29 /* Formerly, the RID_* values used as mask bits did not fit into a
30    single 32-bit word.  Now they do, but let's preserve the old logic
31    in case they ever stop fitting again.  -zw, 8 Aug 2000 */
32
33 /* The type that can represent all values of RIDBIT.  */
34 /* We assume that we can stick in at least 32 bits into this.  */
35 typedef struct { unsigned long idata[2]; }
36      RID_BIT_TYPE;
37
38 /* Be careful, all these modify N twice.  */
39 #define RIDBIT_SETP(N, V) (((unsigned long)1 << (int) ((N)%32))               \
40                             & (V).idata[(N)/32])
41 #define RIDBIT_NOTSETP(NN, VV) (! RIDBIT_SETP (NN, VV))
42 #define RIDBIT_SET(N, V) do {                                                 \
43                                 (V).idata[(N)/32]                             \
44                                   |= ((unsigned long)1 << (int) ((N)%32));    \
45                               } while (0)
46 #define RIDBIT_RESET(N, V) do {                                               \
47                                   (V).idata[(N)/32]                           \
48                                     &= ~((unsigned long)1 << (int) ((N)%32)); \
49                                 } while (0)
50 #define RIDBIT_RESET_ALL(V) do {                                              \
51                                    (V).idata[0] = 0;                          \
52                                    (V).idata[1] = 0;                          \
53                                  } while (0)
54 #define RIDBIT_ANY_SET(V) ((V).idata[0] || (V).idata[1])
55 #else
56 typedef unsigned long RID_BIT_TYPE;     /* assumed at least 32 bits */
57 #define RIDBIT_OF(R) ((unsigned long)1 << (int) (R))
58
59 #define RIDBIT_SETP(N, V) ((V) & RIDBIT_OF (N))
60 #define RIDBIT_NOTSETP(N, V) (! ((V) & RIDBIT_OF (N)))
61 #define RIDBIT_ANY_SET(V) (V)
62
63 #define RIDBIT_SET(N, V) do { (V) |= RIDBIT_OF (N); } while (0)
64 #define RIDBIT_RESET(N, V) do { (V) &= ~RIDBIT_OF (N); } while (0)
65 #define RIDBIT_RESET_ALL(V) do { (V) = 0; } while (0)
66 #endif
67
68 #endif /* ! GCC_CP_LEX_H */