annotate libcpp/internal.h @ 158:494b0b89df80 default tip

...
author Shinji KONO <kono@ie.u-ryukyu.ac.jp>
date Mon, 25 May 2020 18:13:55 +0900
parents 1830386684a0
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
0
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
1 /* Part of CPP library.
145
1830386684a0 gcc-9.2.0
anatofuz
parents: 131
diff changeset
2 Copyright (C) 1997-2020 Free Software Foundation, Inc.
0
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
3
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
4 This program is free software; you can redistribute it and/or modify it
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
5 under the terms of the GNU General Public License as published by the
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
6 Free Software Foundation; either version 3, or (at your option) any
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
7 later version.
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
8
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
9 This program is distributed in the hope that it will be useful,
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
10 but WITHOUT ANY WARRANTY; without even the implied warranty of
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
11 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
12 GNU General Public License for more details.
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
13
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
14 You should have received a copy of the GNU General Public License
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
15 along with this program; see the file COPYING3. If not see
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
16 <http://www.gnu.org/licenses/>. */
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
17
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
18 /* This header defines all the internal data structures and functions
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
19 that need to be visible across files. It should not be used outside
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
20 cpplib. */
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
21
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
22 #ifndef LIBCPP_INTERNAL_H
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
23 #define LIBCPP_INTERNAL_H
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
24
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
25 #include "symtab.h"
131
84e7813d76e9 gcc-8.2
mir3636
parents: 111
diff changeset
26 #include "cpplib.h"
0
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
27
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
28 #if HAVE_ICONV
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
29 #include <iconv.h>
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
30 #else
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
31 #define HAVE_ICONV 0
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
32 typedef int iconv_t; /* dummy */
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
33 #endif
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
34
55
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents: 47
diff changeset
35 #ifdef __cplusplus
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents: 47
diff changeset
36 extern "C" {
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents: 47
diff changeset
37 #endif
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents: 47
diff changeset
38
0
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
39 struct directive; /* Deliberately incomplete. */
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
40 struct pending_option;
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
41 struct op;
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
42 struct _cpp_strbuf;
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
43
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
44 typedef bool (*convert_f) (iconv_t, const unsigned char *, size_t,
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
45 struct _cpp_strbuf *);
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
46 struct cset_converter
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
47 {
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
48 convert_f func;
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
49 iconv_t cd;
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
50 int width;
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
51 };
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
52
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
53 #define BITS_PER_CPPCHAR_T (CHAR_BIT * sizeof (cppchar_t))
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
54
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
55 /* Test if a sign is valid within a preprocessing number. */
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
56 #define VALID_SIGN(c, prevc) \
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
57 (((c) == '+' || (c) == '-') && \
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
58 ((prevc) == 'e' || (prevc) == 'E' \
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
59 || (((prevc) == 'p' || (prevc) == 'P') \
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
60 && CPP_OPTION (pfile, extended_numbers))))
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
61
111
kono
parents: 67
diff changeset
62 #define DIGIT_SEP(c) ((c) == '\'' && CPP_OPTION (pfile, digit_separators))
kono
parents: 67
diff changeset
63
0
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
64 #define CPP_OPTION(PFILE, OPTION) ((PFILE)->opts.OPTION)
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
65 #define CPP_BUFFER(PFILE) ((PFILE)->buffer)
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
66 #define CPP_BUF_COLUMN(BUF, CUR) ((CUR) - (BUF)->line_base)
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
67 #define CPP_BUF_COL(BUF) CPP_BUF_COLUMN(BUF, (BUF)->cur)
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
68
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
69 #define CPP_INCREMENT_LINE(PFILE, COLS_HINT) do { \
145
1830386684a0 gcc-9.2.0
anatofuz
parents: 131
diff changeset
70 const class line_maps *line_table = PFILE->line_table; \
111
kono
parents: 67
diff changeset
71 const struct line_map_ordinary *map = \
kono
parents: 67
diff changeset
72 LINEMAPS_LAST_ORDINARY_MAP (line_table); \
0
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
73 linenum_type line = SOURCE_LINE (map, line_table->highest_line); \
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
74 linemap_line_start (PFILE->line_table, line + 1, COLS_HINT); \
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
75 } while (0)
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
76
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
77 /* Host alignment handling. */
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
78 struct dummy
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
79 {
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
80 char c;
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
81 union
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
82 {
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
83 double d;
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
84 int *p;
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
85 } u;
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
86 };
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
87
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
88 #define DEFAULT_ALIGNMENT offsetof (struct dummy, u)
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
89 #define CPP_ALIGN2(size, align) (((size) + ((align) - 1)) & ~((align) - 1))
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
90 #define CPP_ALIGN(size) CPP_ALIGN2 (size, DEFAULT_ALIGNMENT)
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
91
131
84e7813d76e9 gcc-8.2
mir3636
parents: 111
diff changeset
92 #define _cpp_mark_macro_used(NODE) \
84e7813d76e9 gcc-8.2
mir3636
parents: 111
diff changeset
93 (cpp_user_macro_p (NODE) ? (NODE)->value.macro->used = 1 : 0)
0
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
94
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
95 /* A generic memory buffer, and operations on it. */
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
96 typedef struct _cpp_buff _cpp_buff;
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
97 struct _cpp_buff
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
98 {
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
99 struct _cpp_buff *next;
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
100 unsigned char *base, *cur, *limit;
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
101 };
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
102
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
103 extern _cpp_buff *_cpp_get_buff (cpp_reader *, size_t);
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
104 extern void _cpp_release_buff (cpp_reader *, _cpp_buff *);
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
105 extern void _cpp_extend_buff (cpp_reader *, _cpp_buff **, size_t);
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
106 extern _cpp_buff *_cpp_append_extend_buff (cpp_reader *, _cpp_buff *, size_t);
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
107 extern void _cpp_free_buff (_cpp_buff *);
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
108 extern unsigned char *_cpp_aligned_alloc (cpp_reader *, size_t);
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
109 extern unsigned char *_cpp_unaligned_alloc (cpp_reader *, size_t);
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
110
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
111 #define BUFF_ROOM(BUFF) (size_t) ((BUFF)->limit - (BUFF)->cur)
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
112 #define BUFF_FRONT(BUFF) ((BUFF)->cur)
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
113 #define BUFF_LIMIT(BUFF) ((BUFF)->limit)
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
114
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
115 /* #include types. */
145
1830386684a0 gcc-9.2.0
anatofuz
parents: 131
diff changeset
116 enum include_type
1830386684a0 gcc-9.2.0
anatofuz
parents: 131
diff changeset
117 {
1830386684a0 gcc-9.2.0
anatofuz
parents: 131
diff changeset
118 /* Directive-based including mechanisms. */
1830386684a0 gcc-9.2.0
anatofuz
parents: 131
diff changeset
119 IT_INCLUDE, /* #include */
1830386684a0 gcc-9.2.0
anatofuz
parents: 131
diff changeset
120 IT_INCLUDE_NEXT, /* #include_next */
1830386684a0 gcc-9.2.0
anatofuz
parents: 131
diff changeset
121 IT_IMPORT, /* #import */
1830386684a0 gcc-9.2.0
anatofuz
parents: 131
diff changeset
122
1830386684a0 gcc-9.2.0
anatofuz
parents: 131
diff changeset
123 /* Non-directive including mechanisms. */
1830386684a0 gcc-9.2.0
anatofuz
parents: 131
diff changeset
124 IT_CMDLINE, /* -include */
1830386684a0 gcc-9.2.0
anatofuz
parents: 131
diff changeset
125 IT_DEFAULT, /* forced header */
1830386684a0 gcc-9.2.0
anatofuz
parents: 131
diff changeset
126 IT_MAIN, /* main */
1830386684a0 gcc-9.2.0
anatofuz
parents: 131
diff changeset
127
1830386684a0 gcc-9.2.0
anatofuz
parents: 131
diff changeset
128 IT_DIRECTIVE_HWM = IT_IMPORT + 1, /* Directives below this. */
1830386684a0 gcc-9.2.0
anatofuz
parents: 131
diff changeset
129 IT_HEADER_HWM = IT_DEFAULT + 1 /* Header files below this. */
1830386684a0 gcc-9.2.0
anatofuz
parents: 131
diff changeset
130 };
0
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
131
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
132 union utoken
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
133 {
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
134 const cpp_token *token;
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
135 const cpp_token **ptoken;
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
136 };
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
137
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
138 /* A "run" of tokens; part of a chain of runs. */
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
139 typedef struct tokenrun tokenrun;
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
140 struct tokenrun
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
141 {
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
142 tokenrun *next, *prev;
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
143 cpp_token *base, *limit;
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
144 };
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
145
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
146 /* Accessor macros for struct cpp_context. */
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
147 #define FIRST(c) ((c)->u.iso.first)
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
148 #define LAST(c) ((c)->u.iso.last)
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
149 #define CUR(c) ((c)->u.trad.cur)
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
150 #define RLIMIT(c) ((c)->u.trad.rlimit)
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
151
111
kono
parents: 67
diff changeset
152 /* This describes some additional data that is added to the macro
kono
parents: 67
diff changeset
153 token context of type cpp_context, when -ftrack-macro-expansion is
kono
parents: 67
diff changeset
154 on. */
kono
parents: 67
diff changeset
155 typedef struct
kono
parents: 67
diff changeset
156 {
kono
parents: 67
diff changeset
157 /* The node of the macro we are referring to. */
kono
parents: 67
diff changeset
158 cpp_hashnode *macro_node;
kono
parents: 67
diff changeset
159 /* This buffer contains an array of virtual locations. The virtual
kono
parents: 67
diff changeset
160 location at index 0 is the virtual location of the token at index
kono
parents: 67
diff changeset
161 0 in the current instance of cpp_context; similarly for all the
kono
parents: 67
diff changeset
162 other virtual locations. */
145
1830386684a0 gcc-9.2.0
anatofuz
parents: 131
diff changeset
163 location_t *virt_locs;
111
kono
parents: 67
diff changeset
164 /* This is a pointer to the current virtual location. This is used
kono
parents: 67
diff changeset
165 to iterate over the virtual locations while we iterate over the
kono
parents: 67
diff changeset
166 tokens they belong to. */
145
1830386684a0 gcc-9.2.0
anatofuz
parents: 131
diff changeset
167 location_t *cur_virt_loc;
111
kono
parents: 67
diff changeset
168 } macro_context;
kono
parents: 67
diff changeset
169
kono
parents: 67
diff changeset
170 /* The kind of tokens carried by a cpp_context. */
kono
parents: 67
diff changeset
171 enum context_tokens_kind {
kono
parents: 67
diff changeset
172 /* This is the value of cpp_context::tokens_kind if u.iso.first
kono
parents: 67
diff changeset
173 contains an instance of cpp_token **. */
kono
parents: 67
diff changeset
174 TOKENS_KIND_INDIRECT,
kono
parents: 67
diff changeset
175 /* This is the value of cpp_context::tokens_kind if u.iso.first
kono
parents: 67
diff changeset
176 contains an instance of cpp_token *. */
kono
parents: 67
diff changeset
177 TOKENS_KIND_DIRECT,
kono
parents: 67
diff changeset
178 /* This is the value of cpp_context::tokens_kind when the token
kono
parents: 67
diff changeset
179 context contains tokens resulting from macro expansion. In that
kono
parents: 67
diff changeset
180 case struct cpp_context::macro points to an instance of struct
kono
parents: 67
diff changeset
181 macro_context. This is used only when the
kono
parents: 67
diff changeset
182 -ftrack-macro-expansion flag is on. */
kono
parents: 67
diff changeset
183 TOKENS_KIND_EXTENDED
kono
parents: 67
diff changeset
184 };
kono
parents: 67
diff changeset
185
0
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
186 typedef struct cpp_context cpp_context;
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
187 struct cpp_context
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
188 {
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
189 /* Doubly-linked list. */
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
190 cpp_context *next, *prev;
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
191
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
192 union
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
193 {
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
194 /* For ISO macro expansion. Contexts other than the base context
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
195 are contiguous tokens. e.g. macro expansions, expanded
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
196 argument tokens. */
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
197 struct
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
198 {
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
199 union utoken first;
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
200 union utoken last;
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
201 } iso;
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
202
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
203 /* For traditional macro expansion. */
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
204 struct
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
205 {
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
206 const unsigned char *cur;
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
207 const unsigned char *rlimit;
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
208 } trad;
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
209 } u;
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
210
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
211 /* If non-NULL, a buffer used for storage related to this context.
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
212 When the context is popped, the buffer is released. */
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
213 _cpp_buff *buff;
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
214
111
kono
parents: 67
diff changeset
215 /* If tokens_kind is TOKEN_KIND_EXTENDED, then (as we thus are in a
kono
parents: 67
diff changeset
216 macro context) this is a pointer to an instance of macro_context.
kono
parents: 67
diff changeset
217 Otherwise if tokens_kind is *not* TOKEN_KIND_EXTENDED, then, if
kono
parents: 67
diff changeset
218 we are in a macro context, this is a pointer to an instance of
kono
parents: 67
diff changeset
219 cpp_hashnode, representing the name of the macro this context is
kono
parents: 67
diff changeset
220 for. If we are not in a macro context, then this is just NULL.
kono
parents: 67
diff changeset
221 Note that when tokens_kind is TOKEN_KIND_EXTENDED, the memory
kono
parents: 67
diff changeset
222 used by the instance of macro_context pointed to by this member
kono
parents: 67
diff changeset
223 is de-allocated upon de-allocation of the instance of struct
kono
parents: 67
diff changeset
224 cpp_context. */
kono
parents: 67
diff changeset
225 union
kono
parents: 67
diff changeset
226 {
kono
parents: 67
diff changeset
227 macro_context *mc;
kono
parents: 67
diff changeset
228 cpp_hashnode *macro;
kono
parents: 67
diff changeset
229 } c;
0
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
230
111
kono
parents: 67
diff changeset
231 /* This determines the type of tokens held by this context. */
kono
parents: 67
diff changeset
232 enum context_tokens_kind tokens_kind;
0
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
233 };
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
234
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
235 struct lexer_state
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
236 {
145
1830386684a0 gcc-9.2.0
anatofuz
parents: 131
diff changeset
237 /* 1 if we're handling a directive. 2 if it's an include-like
1830386684a0 gcc-9.2.0
anatofuz
parents: 131
diff changeset
238 directive. */
0
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
239 unsigned char in_directive;
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
240
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
241 /* Nonzero if in a directive that will handle padding tokens itself.
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
242 #include needs this to avoid problems with computed include and
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
243 spacing between tokens. */
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
244 unsigned char directive_wants_padding;
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
245
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
246 /* True if we are skipping a failed conditional group. */
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
247 unsigned char skipping;
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
248
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
249 /* Nonzero if in a directive that takes angle-bracketed headers. */
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
250 unsigned char angled_headers;
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
251
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
252 /* Nonzero if in a #if or #elif directive. */
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
253 unsigned char in_expression;
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
254
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
255 /* Nonzero to save comments. Turned off if discard_comments, and in
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
256 all directives apart from #define. */
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
257 unsigned char save_comments;
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
258
131
84e7813d76e9 gcc-8.2
mir3636
parents: 111
diff changeset
259 /* Nonzero if lexing __VA_ARGS__ and __VA_OPT__ are valid. */
0
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
260 unsigned char va_args_ok;
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
261
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
262 /* Nonzero if lexing poisoned identifiers is valid. */
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
263 unsigned char poisoned_ok;
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
264
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
265 /* Nonzero to prevent macro expansion. */
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
266 unsigned char prevent_expansion;
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
267
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
268 /* Nonzero when parsing arguments to a function-like macro. */
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
269 unsigned char parsing_args;
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
270
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
271 /* Nonzero if prevent_expansion is true only because output is
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
272 being discarded. */
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
273 unsigned char discarding_output;
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
274
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
275 /* Nonzero to skip evaluating part of an expression. */
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
276 unsigned int skip_eval;
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
277
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
278 /* Nonzero when handling a deferred pragma. */
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
279 unsigned char in_deferred_pragma;
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
280
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
281 /* Nonzero if the deferred pragma being handled allows macro expansion. */
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
282 unsigned char pragma_allow_expansion;
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
283 };
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
284
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
285 /* Special nodes - identifiers with predefined significance. */
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
286 struct spec_nodes
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
287 {
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
288 cpp_hashnode *n_defined; /* defined operator */
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
289 cpp_hashnode *n_true; /* C++ keyword true */
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
290 cpp_hashnode *n_false; /* C++ keyword false */
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
291 cpp_hashnode *n__VA_ARGS__; /* C99 vararg macros */
131
84e7813d76e9 gcc-8.2
mir3636
parents: 111
diff changeset
292 cpp_hashnode *n__VA_OPT__; /* C++ vararg macros */
0
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
293 };
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
294
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
295 typedef struct _cpp_line_note _cpp_line_note;
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
296 struct _cpp_line_note
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
297 {
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
298 /* Location in the clean line the note refers to. */
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
299 const unsigned char *pos;
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
300
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
301 /* Type of note. The 9 'from' trigraph characters represent those
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
302 trigraphs, '\\' an escaped newline, ' ' an escaped newline with
63
b7f97abdc517 update gcc from gcc-4.5.0 to gcc-4.6
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents: 55
diff changeset
303 intervening space, 0 represents a note that has already been handled,
b7f97abdc517 update gcc from gcc-4.5.0 to gcc-4.6
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents: 55
diff changeset
304 and anything else is invalid. */
0
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
305 unsigned int type;
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
306 };
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
307
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
308 /* Represents the contents of a file cpplib has read in. */
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
309 struct cpp_buffer
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
310 {
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
311 const unsigned char *cur; /* Current location. */
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
312 const unsigned char *line_base; /* Start of current physical line. */
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
313 const unsigned char *next_line; /* Start of to-be-cleaned logical line. */
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
314
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
315 const unsigned char *buf; /* Entire character buffer. */
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
316 const unsigned char *rlimit; /* Writable byte at end of file. */
111
kono
parents: 67
diff changeset
317 const unsigned char *to_free; /* Pointer that should be freed when
kono
parents: 67
diff changeset
318 popping the buffer. */
0
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
319
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
320 _cpp_line_note *notes; /* Array of notes. */
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
321 unsigned int cur_note; /* Next note to process. */
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
322 unsigned int notes_used; /* Number of notes. */
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
323 unsigned int notes_cap; /* Size of allocated array. */
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
324
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
325 struct cpp_buffer *prev;
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
326
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
327 /* Pointer into the file table; non-NULL if this is a file buffer.
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
328 Used for include_next and to record control macros. */
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
329 struct _cpp_file *file;
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
330
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
331 /* Saved value of __TIMESTAMP__ macro - date and time of last modification
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
332 of the assotiated file. */
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
333 const unsigned char *timestamp;
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
334
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
335 /* Value of if_stack at start of this file.
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
336 Used to prohibit unmatched #endif (etc) in an include file. */
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
337 struct if_stack *if_stack;
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
338
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
339 /* True if we need to get the next clean line. */
145
1830386684a0 gcc-9.2.0
anatofuz
parents: 131
diff changeset
340 bool need_line : 1;
0
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
341
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
342 /* True if we have already warned about C++ comments in this file.
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
343 The warning happens only for C89 extended mode with -pedantic on,
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
344 or for -Wtraditional, and only once per file (otherwise it would
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
345 be far too noisy). */
145
1830386684a0 gcc-9.2.0
anatofuz
parents: 131
diff changeset
346 bool warned_cplusplus_comments : 1;
0
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
347
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
348 /* True if we don't process trigraphs and escaped newlines. True
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
349 for preprocessed input, command line directives, and _Pragma
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
350 buffers. */
145
1830386684a0 gcc-9.2.0
anatofuz
parents: 131
diff changeset
351 bool from_stage3 : 1;
0
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
352
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
353 /* At EOF, a buffer is automatically popped. If RETURN_AT_EOF is
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
354 true, a CPP_EOF token is then returned. Otherwise, the next
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
355 token from the enclosing buffer is returned. */
145
1830386684a0 gcc-9.2.0
anatofuz
parents: 131
diff changeset
356 bool return_at_eof : 1;
0
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
357
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
358 /* One for a system header, two for a C system header file that therefore
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
359 needs to be extern "C" protected in C++, and zero otherwise. */
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
360 unsigned char sysp;
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
361
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
362 /* The directory of the this buffer's file. Its NAME member is not
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
363 allocated, so we don't need to worry about freeing it. */
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
364 struct cpp_dir dir;
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
365
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
366 /* Descriptor for converting from the input character set to the
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
367 source character set. */
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
368 struct cset_converter input_cset_desc;
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
369 };
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
370
47
3bfb6c00c1e0 update it from 4.4.2 to 4.4.3.
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents: 0
diff changeset
371 /* The list of saved macros by push_macro pragma. */
3bfb6c00c1e0 update it from 4.4.2 to 4.4.3.
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents: 0
diff changeset
372 struct def_pragma_macro {
3bfb6c00c1e0 update it from 4.4.2 to 4.4.3.
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents: 0
diff changeset
373 /* Chain element to previous saved macro. */
3bfb6c00c1e0 update it from 4.4.2 to 4.4.3.
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents: 0
diff changeset
374 struct def_pragma_macro *next;
3bfb6c00c1e0 update it from 4.4.2 to 4.4.3.
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents: 0
diff changeset
375 /* Name of the macro. */
3bfb6c00c1e0 update it from 4.4.2 to 4.4.3.
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents: 0
diff changeset
376 char *name;
3bfb6c00c1e0 update it from 4.4.2 to 4.4.3.
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents: 0
diff changeset
377 /* The stored macro content. */
67
f6334be47118 update gcc from gcc-4.6-20100522 to gcc-4.6-20110318
nobuyasu <dimolto@cr.ie.u-ryukyu.ac.jp>
parents: 63
diff changeset
378 unsigned char *definition;
f6334be47118 update gcc from gcc-4.6-20100522 to gcc-4.6-20110318
nobuyasu <dimolto@cr.ie.u-ryukyu.ac.jp>
parents: 63
diff changeset
379
f6334be47118 update gcc from gcc-4.6-20100522 to gcc-4.6-20110318
nobuyasu <dimolto@cr.ie.u-ryukyu.ac.jp>
parents: 63
diff changeset
380 /* Definition line number. */
145
1830386684a0 gcc-9.2.0
anatofuz
parents: 131
diff changeset
381 location_t line;
67
f6334be47118 update gcc from gcc-4.6-20100522 to gcc-4.6-20110318
nobuyasu <dimolto@cr.ie.u-ryukyu.ac.jp>
parents: 63
diff changeset
382 /* If macro defined in system header. */
f6334be47118 update gcc from gcc-4.6-20100522 to gcc-4.6-20110318
nobuyasu <dimolto@cr.ie.u-ryukyu.ac.jp>
parents: 63
diff changeset
383 unsigned int syshdr : 1;
f6334be47118 update gcc from gcc-4.6-20100522 to gcc-4.6-20110318
nobuyasu <dimolto@cr.ie.u-ryukyu.ac.jp>
parents: 63
diff changeset
384 /* Nonzero if it has been expanded or had its existence tested. */
f6334be47118 update gcc from gcc-4.6-20100522 to gcc-4.6-20110318
nobuyasu <dimolto@cr.ie.u-ryukyu.ac.jp>
parents: 63
diff changeset
385 unsigned int used : 1;
f6334be47118 update gcc from gcc-4.6-20100522 to gcc-4.6-20110318
nobuyasu <dimolto@cr.ie.u-ryukyu.ac.jp>
parents: 63
diff changeset
386
f6334be47118 update gcc from gcc-4.6-20100522 to gcc-4.6-20110318
nobuyasu <dimolto@cr.ie.u-ryukyu.ac.jp>
parents: 63
diff changeset
387 /* Mark if we save an undefined macro. */
f6334be47118 update gcc from gcc-4.6-20100522 to gcc-4.6-20110318
nobuyasu <dimolto@cr.ie.u-ryukyu.ac.jp>
parents: 63
diff changeset
388 unsigned int is_undef : 1;
145
1830386684a0 gcc-9.2.0
anatofuz
parents: 131
diff changeset
389 /* Nonzero if it was a builtin macro. */
1830386684a0 gcc-9.2.0
anatofuz
parents: 131
diff changeset
390 unsigned int is_builtin : 1;
47
3bfb6c00c1e0 update it from 4.4.2 to 4.4.3.
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents: 0
diff changeset
391 };
3bfb6c00c1e0 update it from 4.4.2 to 4.4.3.
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents: 0
diff changeset
392
0
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
393 /* A cpp_reader encapsulates the "state" of a pre-processor run.
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
394 Applying cpp_get_token repeatedly yields a stream of pre-processor
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
395 tokens. Usually, there is only one cpp_reader object active. */
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
396 struct cpp_reader
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
397 {
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
398 /* Top of buffer stack. */
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
399 cpp_buffer *buffer;
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
400
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
401 /* Overlaid buffer (can be different after processing #include). */
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
402 cpp_buffer *overlaid_buffer;
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
403
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
404 /* Lexer state. */
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
405 struct lexer_state state;
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
406
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
407 /* Source line tracking. */
145
1830386684a0 gcc-9.2.0
anatofuz
parents: 131
diff changeset
408 class line_maps *line_table;
0
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
409
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
410 /* The line of the '#' of the current directive. */
145
1830386684a0 gcc-9.2.0
anatofuz
parents: 131
diff changeset
411 location_t directive_line;
0
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
412
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
413 /* Memory buffers. */
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
414 _cpp_buff *a_buff; /* Aligned permanent storage. */
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
415 _cpp_buff *u_buff; /* Unaligned permanent storage. */
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
416 _cpp_buff *free_buffs; /* Free buffer chain. */
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
417
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
418 /* Context stack. */
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
419 struct cpp_context base_context;
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
420 struct cpp_context *context;
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
421
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
422 /* If in_directive, the directive if known. */
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
423 const struct directive *directive;
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
424
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
425 /* Token generated while handling a directive, if any. */
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
426 cpp_token directive_result;
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
427
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
428 /* When expanding a macro at top-level, this is the location of the
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
429 macro invocation. */
145
1830386684a0 gcc-9.2.0
anatofuz
parents: 131
diff changeset
430 location_t invocation_location;
0
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
431
111
kono
parents: 67
diff changeset
432 /* This is the node representing the macro being expanded at
kono
parents: 67
diff changeset
433 top-level. The value of this data member is valid iff
145
1830386684a0 gcc-9.2.0
anatofuz
parents: 131
diff changeset
434 cpp_in_macro_expansion_p() returns TRUE. */
111
kono
parents: 67
diff changeset
435 cpp_hashnode *top_most_macro_node;
kono
parents: 67
diff changeset
436
kono
parents: 67
diff changeset
437 /* Nonzero if we are about to expand a macro. Note that if we are
kono
parents: 67
diff changeset
438 really expanding a macro, the function macro_of_context returns
kono
parents: 67
diff changeset
439 the macro being expanded and this flag is set to false. Client
145
1830386684a0 gcc-9.2.0
anatofuz
parents: 131
diff changeset
440 code should use the function cpp_in_macro_expansion_p to know if we
111
kono
parents: 67
diff changeset
441 are either about to expand a macro, or are actually expanding
kono
parents: 67
diff changeset
442 one. */
kono
parents: 67
diff changeset
443 bool about_to_expand_macro_p;
0
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
444
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
445 /* Search paths for include files. */
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
446 struct cpp_dir *quote_include; /* "" */
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
447 struct cpp_dir *bracket_include; /* <> */
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
448 struct cpp_dir no_search_path; /* No path. */
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
449
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
450 /* Chain of all hashed _cpp_file instances. */
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
451 struct _cpp_file *all_files;
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
452
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
453 struct _cpp_file *main_file;
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
454
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
455 /* File and directory hash table. */
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
456 struct htab *file_hash;
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
457 struct htab *dir_hash;
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
458 struct file_hash_entry_pool *file_hash_entries;
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
459
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
460 /* Negative path lookup hash table. */
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
461 struct htab *nonexistent_file_hash;
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
462 struct obstack nonexistent_file_ob;
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
463
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
464 /* Nonzero means don't look for #include "foo" the source-file
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
465 directory. */
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
466 bool quote_ignores_source_dir;
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
467
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
468 /* Nonzero if any file has contained #pragma once or #import has
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
469 been used. */
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
470 bool seen_once_only;
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
471
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
472 /* Multiple include optimization. */
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
473 const cpp_hashnode *mi_cmacro;
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
474 const cpp_hashnode *mi_ind_cmacro;
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
475 bool mi_valid;
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
476
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
477 /* Lexing. */
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
478 cpp_token *cur_token;
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
479 tokenrun base_run, *cur_run;
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
480 unsigned int lookaheads;
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
481
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
482 /* Nonzero prevents the lexer from re-using the token runs. */
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
483 unsigned int keep_tokens;
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
484
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
485 /* Buffer to hold macro definition string. */
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
486 unsigned char *macro_buffer;
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
487 unsigned int macro_buffer_len;
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
488
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
489 /* Descriptor for converting from the source character set to the
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
490 execution character set. */
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
491 struct cset_converter narrow_cset_desc;
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
492
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
493 /* Descriptor for converting from the source character set to the
55
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents: 47
diff changeset
494 UTF-8 execution character set. */
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents: 47
diff changeset
495 struct cset_converter utf8_cset_desc;
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents: 47
diff changeset
496
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents: 47
diff changeset
497 /* Descriptor for converting from the source character set to the
0
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
498 UTF-16 execution character set. */
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
499 struct cset_converter char16_cset_desc;
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
500
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
501 /* Descriptor for converting from the source character set to the
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
502 UTF-32 execution character set. */
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
503 struct cset_converter char32_cset_desc;
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
504
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
505 /* Descriptor for converting from the source character set to the
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
506 wide execution character set. */
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
507 struct cset_converter wide_cset_desc;
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
508
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
509 /* Date and time text. Calculated together if either is requested. */
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
510 const unsigned char *date;
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
511 const unsigned char *time;
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
512
111
kono
parents: 67
diff changeset
513 /* Externally set timestamp to replace current date and time useful for
kono
parents: 67
diff changeset
514 reproducibility. It should be initialized to -2 (not yet set) and
kono
parents: 67
diff changeset
515 set to -1 to disable it or to a non-negative value to enable it. */
kono
parents: 67
diff changeset
516 time_t source_date_epoch;
kono
parents: 67
diff changeset
517
0
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
518 /* EOF token, and a token forcing paste avoidance. */
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
519 cpp_token avoid_paste;
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
520 cpp_token eof;
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
521
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
522 /* Opaque handle to the dependencies of mkdeps.c. */
145
1830386684a0 gcc-9.2.0
anatofuz
parents: 131
diff changeset
523 class mkdeps *deps;
0
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
524
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
525 /* Obstack holding all macro hash nodes. This never shrinks.
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
526 See identifiers.c */
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
527 struct obstack hash_ob;
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
528
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
529 /* Obstack holding buffer and conditional structures. This is a
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
530 real stack. See directives.c. */
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
531 struct obstack buffer_ob;
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
532
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
533 /* Pragma table - dynamic, because a library user can add to the
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
534 list of recognized pragmas. */
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
535 struct pragma_entry *pragmas;
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
536
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
537 /* Call backs to cpplib client. */
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
538 struct cpp_callbacks cb;
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
539
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
540 /* Identifier hash table. */
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
541 struct ht *hash_table;
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
542
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
543 /* Expression parser stack. */
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
544 struct op *op_stack, *op_limit;
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
545
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
546 /* User visible options. */
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
547 struct cpp_options opts;
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
548
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
549 /* Special nodes - identifiers with predefined significance to the
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
550 preprocessor. */
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
551 struct spec_nodes spec_nodes;
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
552
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
553 /* Whether cpplib owns the hashtable. */
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
554 bool our_hashtable;
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
555
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
556 /* Traditional preprocessing output buffer (a logical line). */
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
557 struct
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
558 {
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
559 unsigned char *base;
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
560 unsigned char *limit;
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
561 unsigned char *cur;
145
1830386684a0 gcc-9.2.0
anatofuz
parents: 131
diff changeset
562 location_t first_line;
0
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
563 } out;
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
564
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
565 /* Used for buffer overlays by traditional.c. */
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
566 const unsigned char *saved_cur, *saved_rlimit, *saved_line_base;
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
567
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
568 /* A saved list of the defined macros, for dependency checking
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
569 of precompiled headers. */
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
570 struct cpp_savedstate *savedstate;
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
571
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
572 /* Next value of __COUNTER__ macro. */
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
573 unsigned int counter;
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
574
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
575 /* Table of comments, when state.save_comments is true. */
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
576 cpp_comment_table comments;
47
3bfb6c00c1e0 update it from 4.4.2 to 4.4.3.
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents: 0
diff changeset
577
3bfb6c00c1e0 update it from 4.4.2 to 4.4.3.
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents: 0
diff changeset
578 /* List of saved macros by push_macro. */
3bfb6c00c1e0 update it from 4.4.2 to 4.4.3.
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents: 0
diff changeset
579 struct def_pragma_macro *pushed_macros;
111
kono
parents: 67
diff changeset
580
145
1830386684a0 gcc-9.2.0
anatofuz
parents: 131
diff changeset
581 /* If non-zero, the lexer will use this location for the next token
111
kono
parents: 67
diff changeset
582 instead of getting a location from the linemap. */
145
1830386684a0 gcc-9.2.0
anatofuz
parents: 131
diff changeset
583 location_t forced_token_location;
0
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
584 };
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
585
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
586 /* Character classes. Based on the more primitive macros in safe-ctype.h.
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
587 If the definition of `numchar' looks odd to you, please look up the
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
588 definition of a pp-number in the C standard [section 6.4.8 of C99].
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
589
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
590 In the unlikely event that characters other than \r and \n enter
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
591 the set is_vspace, the macro handle_newline() in lex.c must be
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
592 updated. */
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
593 #define _dollar_ok(x) ((x) == '$' && CPP_OPTION (pfile, dollars_in_ident))
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
594
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
595 #define is_idchar(x) (ISIDNUM(x) || _dollar_ok(x))
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
596 #define is_numchar(x) ISIDNUM(x)
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
597 #define is_idstart(x) (ISIDST(x) || _dollar_ok(x))
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
598 #define is_numstart(x) ISDIGIT(x)
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
599 #define is_hspace(x) ISBLANK(x)
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
600 #define is_vspace(x) IS_VSPACE(x)
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
601 #define is_nvspace(x) IS_NVSPACE(x)
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
602 #define is_space(x) IS_SPACE_OR_NUL(x)
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
603
145
1830386684a0 gcc-9.2.0
anatofuz
parents: 131
diff changeset
604 #define SEEN_EOL() (pfile->cur_token[-1].type == CPP_EOF)
1830386684a0 gcc-9.2.0
anatofuz
parents: 131
diff changeset
605
0
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
606 /* This table is constant if it can be initialized at compile time,
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
607 which is the case if cpp was compiled with GCC >=2.7, or another
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
608 compiler that supports C99. */
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
609 #if HAVE_DESIGNATED_INITIALIZERS
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
610 extern const unsigned char _cpp_trigraph_map[UCHAR_MAX + 1];
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
611 #else
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
612 extern unsigned char _cpp_trigraph_map[UCHAR_MAX + 1];
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
613 #endif
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
614
131
84e7813d76e9 gcc-8.2
mir3636
parents: 111
diff changeset
615 #if !defined (HAVE_UCHAR) && !defined (IN_GCC)
84e7813d76e9 gcc-8.2
mir3636
parents: 111
diff changeset
616 typedef unsigned char uchar;
84e7813d76e9 gcc-8.2
mir3636
parents: 111
diff changeset
617 #endif
84e7813d76e9 gcc-8.2
mir3636
parents: 111
diff changeset
618
84e7813d76e9 gcc-8.2
mir3636
parents: 111
diff changeset
619 #define UC (const uchar *) /* Intended use: UC"string" */
84e7813d76e9 gcc-8.2
mir3636
parents: 111
diff changeset
620
0
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
621 /* Macros. */
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
622
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
623 static inline int cpp_in_system_header (cpp_reader *);
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
624 static inline int
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
625 cpp_in_system_header (cpp_reader *pfile)
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
626 {
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
627 return pfile->buffer ? pfile->buffer->sysp : 0;
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
628 }
67
f6334be47118 update gcc from gcc-4.6-20100522 to gcc-4.6-20110318
nobuyasu <dimolto@cr.ie.u-ryukyu.ac.jp>
parents: 63
diff changeset
629 #define CPP_PEDANTIC(PF) CPP_OPTION (PF, cpp_pedantic)
f6334be47118 update gcc from gcc-4.6-20100522 to gcc-4.6-20110318
nobuyasu <dimolto@cr.ie.u-ryukyu.ac.jp>
parents: 63
diff changeset
630 #define CPP_WTRADITIONAL(PF) CPP_OPTION (PF, cpp_warn_traditional)
0
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
631
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
632 static inline int cpp_in_primary_file (cpp_reader *);
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
633 static inline int
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
634 cpp_in_primary_file (cpp_reader *pfile)
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
635 {
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
636 return pfile->line_table->depth == 1;
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
637 }
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
638
145
1830386684a0 gcc-9.2.0
anatofuz
parents: 131
diff changeset
639 /* True if NODE is a macro for the purposes of ifdef, defined etc. */
1830386684a0 gcc-9.2.0
anatofuz
parents: 131
diff changeset
640 inline bool _cpp_defined_macro_p (cpp_hashnode *node)
1830386684a0 gcc-9.2.0
anatofuz
parents: 131
diff changeset
641 {
1830386684a0 gcc-9.2.0
anatofuz
parents: 131
diff changeset
642 /* Do not treat conditional macros as being defined. This is due to
1830386684a0 gcc-9.2.0
anatofuz
parents: 131
diff changeset
643 the powerpc port using conditional macros for 'vector', 'bool',
1830386684a0 gcc-9.2.0
anatofuz
parents: 131
diff changeset
644 and 'pixel' to act as conditional keywords. This messes up tests
1830386684a0 gcc-9.2.0
anatofuz
parents: 131
diff changeset
645 like #ifndef bool. */
1830386684a0 gcc-9.2.0
anatofuz
parents: 131
diff changeset
646 return cpp_macro_p (node) && !(node->flags & NODE_CONDITIONAL);
1830386684a0 gcc-9.2.0
anatofuz
parents: 131
diff changeset
647 }
1830386684a0 gcc-9.2.0
anatofuz
parents: 131
diff changeset
648
0
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
649 /* In macro.c */
131
84e7813d76e9 gcc-8.2
mir3636
parents: 111
diff changeset
650 extern void _cpp_notify_macro_use (cpp_reader *pfile, cpp_hashnode *node);
84e7813d76e9 gcc-8.2
mir3636
parents: 111
diff changeset
651 inline void _cpp_maybe_notify_macro_use (cpp_reader *pfile, cpp_hashnode *node)
84e7813d76e9 gcc-8.2
mir3636
parents: 111
diff changeset
652 {
84e7813d76e9 gcc-8.2
mir3636
parents: 111
diff changeset
653 if (!(node->flags & NODE_USED))
84e7813d76e9 gcc-8.2
mir3636
parents: 111
diff changeset
654 _cpp_notify_macro_use (pfile, node);
84e7813d76e9 gcc-8.2
mir3636
parents: 111
diff changeset
655 }
84e7813d76e9 gcc-8.2
mir3636
parents: 111
diff changeset
656 extern cpp_macro *_cpp_new_macro (cpp_reader *, cpp_macro_kind, void *);
0
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
657 extern void _cpp_free_definition (cpp_hashnode *);
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
658 extern bool _cpp_create_definition (cpp_reader *, cpp_hashnode *);
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
659 extern void _cpp_pop_context (cpp_reader *);
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
660 extern void _cpp_push_text_context (cpp_reader *, cpp_hashnode *,
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
661 const unsigned char *, size_t);
131
84e7813d76e9 gcc-8.2
mir3636
parents: 111
diff changeset
662 extern bool _cpp_save_parameter (cpp_reader *, unsigned, cpp_hashnode *,
111
kono
parents: 67
diff changeset
663 cpp_hashnode *);
131
84e7813d76e9 gcc-8.2
mir3636
parents: 111
diff changeset
664 extern void _cpp_unsave_parameters (cpp_reader *, unsigned);
0
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
665 extern bool _cpp_arguments_ok (cpp_reader *, cpp_macro *, const cpp_hashnode *,
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
666 unsigned int);
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
667 extern const unsigned char *_cpp_builtin_macro_text (cpp_reader *,
111
kono
parents: 67
diff changeset
668 cpp_hashnode *,
145
1830386684a0 gcc-9.2.0
anatofuz
parents: 131
diff changeset
669 location_t = 0);
0
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
670 extern int _cpp_warn_if_unused_macro (cpp_reader *, cpp_hashnode *, void *);
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
671 extern void _cpp_push_token_context (cpp_reader *, cpp_hashnode *,
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
672 const cpp_token *, unsigned int);
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
673 extern void _cpp_backup_tokens_direct (cpp_reader *, unsigned int);
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
674
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
675 /* In identifiers.c */
111
kono
parents: 67
diff changeset
676 extern void _cpp_init_hashtable (cpp_reader *, cpp_hash_table *);
0
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
677 extern void _cpp_destroy_hashtable (cpp_reader *);
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
678
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
679 /* In files.c */
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
680 typedef struct _cpp_file _cpp_file;
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
681 extern _cpp_file *_cpp_find_file (cpp_reader *, const char *, cpp_dir *,
145
1830386684a0 gcc-9.2.0
anatofuz
parents: 131
diff changeset
682 int angle, bool fake, bool preinclude,
1830386684a0 gcc-9.2.0
anatofuz
parents: 131
diff changeset
683 bool has_include, location_t);
0
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
684 extern bool _cpp_find_failed (_cpp_file *);
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
685 extern void _cpp_mark_file_once_only (cpp_reader *, struct _cpp_file *);
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
686 extern void _cpp_fake_include (cpp_reader *, const char *);
145
1830386684a0 gcc-9.2.0
anatofuz
parents: 131
diff changeset
687 extern bool _cpp_stack_file (cpp_reader *, _cpp_file*, include_type, location_t);
0
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
688 extern bool _cpp_stack_include (cpp_reader *, const char *, int,
145
1830386684a0 gcc-9.2.0
anatofuz
parents: 131
diff changeset
689 enum include_type, location_t);
0
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
690 extern int _cpp_compare_file_date (cpp_reader *, const char *, int);
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
691 extern void _cpp_report_missing_guards (cpp_reader *);
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
692 extern void _cpp_init_files (cpp_reader *);
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
693 extern void _cpp_cleanup_files (cpp_reader *);
111
kono
parents: 67
diff changeset
694 extern void _cpp_pop_file_buffer (cpp_reader *, struct _cpp_file *,
kono
parents: 67
diff changeset
695 const unsigned char *);
0
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
696 extern bool _cpp_save_file_entries (cpp_reader *pfile, FILE *f);
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
697 extern bool _cpp_read_file_entries (cpp_reader *, FILE *);
111
kono
parents: 67
diff changeset
698 extern const char *_cpp_get_file_name (_cpp_file *);
0
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
699 extern struct stat *_cpp_get_file_stat (_cpp_file *);
111
kono
parents: 67
diff changeset
700 extern bool _cpp_has_header (cpp_reader *, const char *, int,
kono
parents: 67
diff changeset
701 enum include_type);
0
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
702
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
703 /* In expr.c */
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
704 extern bool _cpp_parse_expr (cpp_reader *, bool);
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
705 extern struct op *_cpp_expand_op_stack (cpp_reader *);
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
706
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
707 /* In lex.c */
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
708 extern void _cpp_process_line_notes (cpp_reader *, int);
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
709 extern void _cpp_clean_line (cpp_reader *);
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
710 extern bool _cpp_get_fresh_line (cpp_reader *);
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
711 extern bool _cpp_skip_block_comment (cpp_reader *);
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
712 extern cpp_token *_cpp_temp_token (cpp_reader *);
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
713 extern const cpp_token *_cpp_lex_token (cpp_reader *);
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
714 extern cpp_token *_cpp_lex_direct (cpp_reader *);
111
kono
parents: 67
diff changeset
715 extern unsigned char *_cpp_spell_ident_ucns (unsigned char *, cpp_hashnode *);
0
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
716 extern int _cpp_equiv_tokens (const cpp_token *, const cpp_token *);
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
717 extern void _cpp_init_tokenrun (tokenrun *, unsigned int);
47
3bfb6c00c1e0 update it from 4.4.2 to 4.4.3.
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents: 0
diff changeset
718 extern cpp_hashnode *_cpp_lex_identifier (cpp_reader *, const char *);
111
kono
parents: 67
diff changeset
719 extern int _cpp_remaining_tokens_num_in_context (cpp_context *);
kono
parents: 67
diff changeset
720 extern void _cpp_init_lexer (void);
131
84e7813d76e9 gcc-8.2
mir3636
parents: 111
diff changeset
721 static inline void *_cpp_reserve_room (cpp_reader *pfile, size_t have,
84e7813d76e9 gcc-8.2
mir3636
parents: 111
diff changeset
722 size_t extra)
84e7813d76e9 gcc-8.2
mir3636
parents: 111
diff changeset
723 {
84e7813d76e9 gcc-8.2
mir3636
parents: 111
diff changeset
724 if (BUFF_ROOM (pfile->a_buff) < (have + extra))
84e7813d76e9 gcc-8.2
mir3636
parents: 111
diff changeset
725 _cpp_extend_buff (pfile, &pfile->a_buff, extra);
84e7813d76e9 gcc-8.2
mir3636
parents: 111
diff changeset
726 return BUFF_FRONT (pfile->a_buff);
84e7813d76e9 gcc-8.2
mir3636
parents: 111
diff changeset
727 }
84e7813d76e9 gcc-8.2
mir3636
parents: 111
diff changeset
728 extern void *_cpp_commit_buff (cpp_reader *pfile, size_t size);
0
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
729
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
730 /* In init.c. */
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
731 extern void _cpp_maybe_push_include_file (cpp_reader *);
55
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents: 47
diff changeset
732 extern const char *cpp_named_operator2name (enum cpp_ttype type);
145
1830386684a0 gcc-9.2.0
anatofuz
parents: 131
diff changeset
733 extern void _cpp_restore_special_builtin (cpp_reader *pfile,
1830386684a0 gcc-9.2.0
anatofuz
parents: 131
diff changeset
734 struct def_pragma_macro *);
0
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
735
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
736 /* In directives.c */
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
737 extern int _cpp_test_assertion (cpp_reader *, unsigned int *);
145
1830386684a0 gcc-9.2.0
anatofuz
parents: 131
diff changeset
738 extern int _cpp_handle_directive (cpp_reader *, bool);
0
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
739 extern void _cpp_define_builtin (cpp_reader *, const char *);
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
740 extern char ** _cpp_save_pragma_names (cpp_reader *);
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
741 extern void _cpp_restore_pragma_names (cpp_reader *, char **);
145
1830386684a0 gcc-9.2.0
anatofuz
parents: 131
diff changeset
742 extern int _cpp_do__Pragma (cpp_reader *, location_t);
0
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
743 extern void _cpp_init_directives (cpp_reader *);
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
744 extern void _cpp_init_internal_pragmas (cpp_reader *);
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
745 extern void _cpp_do_file_change (cpp_reader *, enum lc_reason, const char *,
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
746 linenum_type, unsigned int);
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
747 extern void _cpp_pop_buffer (cpp_reader *);
111
kono
parents: 67
diff changeset
748 extern char *_cpp_bracket_include (cpp_reader *);
0
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
749
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
750 /* In directives.c */
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
751 struct _cpp_dir_only_callbacks
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
752 {
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
753 /* Called to print a block of lines. */
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
754 void (*print_lines) (int, const void *, size_t);
145
1830386684a0 gcc-9.2.0
anatofuz
parents: 131
diff changeset
755 bool (*maybe_print_line) (location_t);
0
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
756 };
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
757
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
758 extern void _cpp_preprocess_dir_only (cpp_reader *,
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
759 const struct _cpp_dir_only_callbacks *);
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
760
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
761 /* In traditional.c. */
111
kono
parents: 67
diff changeset
762 extern bool _cpp_scan_out_logical_line (cpp_reader *, cpp_macro *, bool);
0
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
763 extern bool _cpp_read_logical_line_trad (cpp_reader *);
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
764 extern void _cpp_overlay_buffer (cpp_reader *pfile, const unsigned char *,
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
765 size_t);
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
766 extern void _cpp_remove_overlay (cpp_reader *);
131
84e7813d76e9 gcc-8.2
mir3636
parents: 111
diff changeset
767 extern cpp_macro *_cpp_create_trad_definition (cpp_reader *);
0
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
768 extern bool _cpp_expansions_different_trad (const cpp_macro *,
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
769 const cpp_macro *);
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
770 extern unsigned char *_cpp_copy_replacement_text (const cpp_macro *,
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
771 unsigned char *);
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
772 extern size_t _cpp_replacement_text_len (const cpp_macro *);
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
773
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
774 /* In charset.c. */
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
775
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
776 /* The normalization state at this point in the sequence.
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
777 It starts initialized to all zeros, and at the end
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
778 'level' is the normalization level of the sequence. */
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
779
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
780 struct normalize_state
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
781 {
111
kono
parents: 67
diff changeset
782 /* The previous starter character. */
0
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
783 cppchar_t previous;
111
kono
parents: 67
diff changeset
784 /* The combining class of the previous character (whether or not a
kono
parents: 67
diff changeset
785 starter). */
0
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
786 unsigned char prev_class;
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
787 /* The lowest normalization level so far. */
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
788 enum cpp_normalize_level level;
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
789 };
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
790 #define INITIAL_NORMALIZE_STATE { 0, 0, normalized_KC }
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
791 #define NORMALIZE_STATE_RESULT(st) ((st)->level)
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
792
111
kono
parents: 67
diff changeset
793 /* We saw a character C that matches ISIDNUM(), update a
0
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
794 normalize_state appropriately. */
111
kono
parents: 67
diff changeset
795 #define NORMALIZE_STATE_UPDATE_IDNUM(st, c) \
kono
parents: 67
diff changeset
796 ((st)->previous = (c), (st)->prev_class = 0)
0
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
797
111
kono
parents: 67
diff changeset
798 extern bool _cpp_valid_ucn (cpp_reader *, const unsigned char **,
kono
parents: 67
diff changeset
799 const unsigned char *, int,
kono
parents: 67
diff changeset
800 struct normalize_state *state,
kono
parents: 67
diff changeset
801 cppchar_t *,
kono
parents: 67
diff changeset
802 source_range *char_range,
kono
parents: 67
diff changeset
803 cpp_string_location_reader *loc_reader);
145
1830386684a0 gcc-9.2.0
anatofuz
parents: 131
diff changeset
804
1830386684a0 gcc-9.2.0
anatofuz
parents: 131
diff changeset
805 extern bool _cpp_valid_utf8 (cpp_reader *pfile,
1830386684a0 gcc-9.2.0
anatofuz
parents: 131
diff changeset
806 const uchar **pstr,
1830386684a0 gcc-9.2.0
anatofuz
parents: 131
diff changeset
807 const uchar *limit,
1830386684a0 gcc-9.2.0
anatofuz
parents: 131
diff changeset
808 int identifier_pos,
1830386684a0 gcc-9.2.0
anatofuz
parents: 131
diff changeset
809 struct normalize_state *nst,
1830386684a0 gcc-9.2.0
anatofuz
parents: 131
diff changeset
810 cppchar_t *cp);
1830386684a0 gcc-9.2.0
anatofuz
parents: 131
diff changeset
811
0
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
812 extern void _cpp_destroy_iconv (cpp_reader *);
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
813 extern unsigned char *_cpp_convert_input (cpp_reader *, const char *,
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
814 unsigned char *, size_t, size_t,
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
815 const unsigned char **, off_t *);
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
816 extern const char *_cpp_default_encoding (void);
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
817 extern cpp_hashnode * _cpp_interpret_identifier (cpp_reader *pfile,
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
818 const unsigned char *id,
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
819 size_t len);
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
820
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
821 /* Utility routines and macros. */
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
822 #define DSC(str) (const unsigned char *)str, sizeof str - 1
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
823
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
824 /* These are inline functions instead of macros so we can get type
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
825 checking. */
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
826 static inline int ustrcmp (const unsigned char *, const unsigned char *);
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
827 static inline int ustrncmp (const unsigned char *, const unsigned char *,
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
828 size_t);
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
829 static inline size_t ustrlen (const unsigned char *);
111
kono
parents: 67
diff changeset
830 static inline const unsigned char *uxstrdup (const unsigned char *);
kono
parents: 67
diff changeset
831 static inline const unsigned char *ustrchr (const unsigned char *, int);
0
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
832 static inline int ufputs (const unsigned char *, FILE *);
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
833
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
834 /* Use a const char for the second parameter since it is usually a literal. */
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
835 static inline int ustrcspn (const unsigned char *, const char *);
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
836
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
837 static inline int
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
838 ustrcmp (const unsigned char *s1, const unsigned char *s2)
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
839 {
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
840 return strcmp ((const char *)s1, (const char *)s2);
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
841 }
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
842
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
843 static inline int
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
844 ustrncmp (const unsigned char *s1, const unsigned char *s2, size_t n)
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
845 {
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
846 return strncmp ((const char *)s1, (const char *)s2, n);
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
847 }
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
848
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
849 static inline int
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
850 ustrcspn (const unsigned char *s1, const char *s2)
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
851 {
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
852 return strcspn ((const char *)s1, s2);
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
853 }
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
854
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
855 static inline size_t
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
856 ustrlen (const unsigned char *s1)
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
857 {
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
858 return strlen ((const char *)s1);
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
859 }
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
860
111
kono
parents: 67
diff changeset
861 static inline const unsigned char *
0
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
862 uxstrdup (const unsigned char *s1)
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
863 {
111
kono
parents: 67
diff changeset
864 return (const unsigned char *) xstrdup ((const char *)s1);
0
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
865 }
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
866
111
kono
parents: 67
diff changeset
867 static inline const unsigned char *
0
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
868 ustrchr (const unsigned char *s1, int c)
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
869 {
111
kono
parents: 67
diff changeset
870 return (const unsigned char *) strchr ((const char *)s1, c);
0
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
871 }
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
872
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
873 static inline int
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
874 ufputs (const unsigned char *s, FILE *f)
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
875 {
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
876 return fputs ((const char *)s, f);
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
877 }
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
878
111
kono
parents: 67
diff changeset
879 /* In line-map.c. */
kono
parents: 67
diff changeset
880
kono
parents: 67
diff changeset
881 /* Create a macro map. A macro map encodes source locations of tokens
kono
parents: 67
diff changeset
882 that are part of a macro replacement-list, at a macro expansion
kono
parents: 67
diff changeset
883 point. See the extensive comments of struct line_map and struct
kono
parents: 67
diff changeset
884 line_map_macro, in line-map.h.
kono
parents: 67
diff changeset
885
kono
parents: 67
diff changeset
886 This map shall be created when the macro is expanded. The map
kono
parents: 67
diff changeset
887 encodes the source location of the expansion point of the macro as
kono
parents: 67
diff changeset
888 well as the "original" source location of each token that is part
kono
parents: 67
diff changeset
889 of the macro replacement-list. If a macro is defined but never
kono
parents: 67
diff changeset
890 expanded, it has no macro map. SET is the set of maps the macro
kono
parents: 67
diff changeset
891 map should be part of. MACRO_NODE is the macro which the new macro
kono
parents: 67
diff changeset
892 map should encode source locations for. EXPANSION is the location
kono
parents: 67
diff changeset
893 of the expansion point of MACRO. For function-like macros
kono
parents: 67
diff changeset
894 invocations, it's best to make it point to the closing parenthesis
kono
parents: 67
diff changeset
895 of the macro, rather than the the location of the first character
kono
parents: 67
diff changeset
896 of the macro. NUM_TOKENS is the number of tokens that are part of
kono
parents: 67
diff changeset
897 the replacement-list of MACRO. */
145
1830386684a0 gcc-9.2.0
anatofuz
parents: 131
diff changeset
898 const line_map_macro *linemap_enter_macro (class line_maps *,
111
kono
parents: 67
diff changeset
899 struct cpp_hashnode*,
145
1830386684a0 gcc-9.2.0
anatofuz
parents: 131
diff changeset
900 location_t,
111
kono
parents: 67
diff changeset
901 unsigned int);
kono
parents: 67
diff changeset
902
kono
parents: 67
diff changeset
903 /* Create and return a virtual location for a token that is part of a
kono
parents: 67
diff changeset
904 macro expansion-list at a macro expansion point. See the comment
kono
parents: 67
diff changeset
905 inside struct line_map_macro to see what an expansion-list exactly
kono
parents: 67
diff changeset
906 is.
kono
parents: 67
diff changeset
907
kono
parents: 67
diff changeset
908 A call to this function must come after a call to
kono
parents: 67
diff changeset
909 linemap_enter_macro.
kono
parents: 67
diff changeset
910
kono
parents: 67
diff changeset
911 MAP is the map into which the source location is created. TOKEN_NO
kono
parents: 67
diff changeset
912 is the index of the token in the macro replacement-list, starting
kono
parents: 67
diff changeset
913 at number 0.
kono
parents: 67
diff changeset
914
kono
parents: 67
diff changeset
915 ORIG_LOC is the location of the token outside of this macro
kono
parents: 67
diff changeset
916 expansion. If the token comes originally from the macro
kono
parents: 67
diff changeset
917 definition, it is the locus in the macro definition; otherwise it
kono
parents: 67
diff changeset
918 is a location in the context of the caller of this macro expansion
kono
parents: 67
diff changeset
919 (which is a virtual location or a source location if the caller is
kono
parents: 67
diff changeset
920 itself a macro expansion or not).
kono
parents: 67
diff changeset
921
kono
parents: 67
diff changeset
922 MACRO_DEFINITION_LOC is the location in the macro definition,
kono
parents: 67
diff changeset
923 either of the token itself or of a macro parameter that it
kono
parents: 67
diff changeset
924 replaces. */
145
1830386684a0 gcc-9.2.0
anatofuz
parents: 131
diff changeset
925 location_t linemap_add_macro_token (const line_map_macro *,
1830386684a0 gcc-9.2.0
anatofuz
parents: 131
diff changeset
926 unsigned int,
1830386684a0 gcc-9.2.0
anatofuz
parents: 131
diff changeset
927 location_t,
1830386684a0 gcc-9.2.0
anatofuz
parents: 131
diff changeset
928 location_t);
111
kono
parents: 67
diff changeset
929
kono
parents: 67
diff changeset
930 /* Return the source line number corresponding to source location
kono
parents: 67
diff changeset
931 LOCATION. SET is the line map set LOCATION comes from. If
kono
parents: 67
diff changeset
932 LOCATION is the location of token that is part of the
kono
parents: 67
diff changeset
933 expansion-list of a macro expansion return the line number of the
kono
parents: 67
diff changeset
934 macro expansion point. */
145
1830386684a0 gcc-9.2.0
anatofuz
parents: 131
diff changeset
935 int linemap_get_expansion_line (class line_maps *,
1830386684a0 gcc-9.2.0
anatofuz
parents: 131
diff changeset
936 location_t);
111
kono
parents: 67
diff changeset
937
kono
parents: 67
diff changeset
938 /* Return the path of the file corresponding to source code location
kono
parents: 67
diff changeset
939 LOCATION.
kono
parents: 67
diff changeset
940
kono
parents: 67
diff changeset
941 If LOCATION is the location of a token that is part of the
kono
parents: 67
diff changeset
942 replacement-list of a macro expansion return the file path of the
kono
parents: 67
diff changeset
943 macro expansion point.
kono
parents: 67
diff changeset
944
kono
parents: 67
diff changeset
945 SET is the line map set LOCATION comes from. */
145
1830386684a0 gcc-9.2.0
anatofuz
parents: 131
diff changeset
946 const char* linemap_get_expansion_filename (class line_maps *,
1830386684a0 gcc-9.2.0
anatofuz
parents: 131
diff changeset
947 location_t);
111
kono
parents: 67
diff changeset
948
55
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents: 47
diff changeset
949 #ifdef __cplusplus
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents: 47
diff changeset
950 }
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents: 47
diff changeset
951 #endif
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents: 47
diff changeset
952
0
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
953 #endif /* ! LIBCPP_INTERNAL_H */