]> gcc.gnu.org Git - gcc.git/blame - gcc/cpplib.h
* execute/va-arg-20.c: New test.
[gcc.git] / gcc / cpplib.h
CommitLineData
7f2935c7 1/* Definitions for CPP library.
e7746130 2 Copyright (C) 1995, 96-99, 2000 Free Software Foundation, Inc.
7f2935c7
PB
3 Written by Per Bothner, 1994-95.
4
5This program is free software; you can redistribute it and/or modify it
6under the terms of the GNU General Public License as published by the
7Free Software Foundation; either version 2, or (at your option) any
8later version.
9
10This program is distributed in the hope that it will be useful,
11but WITHOUT ANY WARRANTY; without even the implied warranty of
12MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13GNU General Public License for more details.
14
15You should have received a copy of the GNU General Public License
16along with this program; if not, write to the Free Software
940d9d63 17Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
7f2935c7
PB
18
19 In other words, you are welcome to use, share and improve this program.
20 You are forbidden to forbid anyone else to use, share and improve
21 what you give them. Help stamp out software-hoarding! */
990c642c
JL
22#ifndef __GCC_CPPLIB__
23#define __GCC_CPPLIB__
7f2935c7
PB
24
25#include <sys/types.h>
7f2935c7
PB
26
27#ifdef __cplusplus
28extern "C" {
29#endif
30
7f2935c7
PB
31typedef struct cpp_reader cpp_reader;
32typedef struct cpp_buffer cpp_buffer;
33typedef struct cpp_options cpp_options;
f2d5f0cc 34typedef struct cpp_printer cpp_printer;
1368ee70
ZW
35typedef struct cpp_token cpp_token;
36typedef struct cpp_toklist cpp_toklist;
37
05183359
NB
38 /* Put operators that can appear in a preprocessor expression first.
39 This allows a lookup table to be implemented in _cpp_parse_expr.
40 Ordering within this group is currently not significant, apart
41 from those ending in '=' being at the end. */
1368ee70 42#define TTYPE_TABLE \
05183359 43 T(CPP_PLUS = 0, "+") /* math */ \
1368ee70
ZW
44 T(CPP_MINUS, "-") \
45 T(CPP_MULT, "*") \
46 T(CPP_DIV, "/") \
47 T(CPP_MOD, "%") \
48 T(CPP_AND, "&") /* bit ops */ \
49 T(CPP_OR, "|") \
50 T(CPP_XOR, "^") \
51 T(CPP_COMPL, "~") \
52 T(CPP_RSHIFT, ">>") \
53 T(CPP_LSHIFT, "<<") \
05183359
NB
54 T(CPP_NOT, "!") /* logicals */ \
55 T(CPP_AND_AND, "&&") \
1368ee70
ZW
56 T(CPP_OR_OR, "||") \
57 T(CPP_QUERY, "?") \
58 T(CPP_COLON, ":") \
59 T(CPP_COMMA, ",") /* grouping */ \
60 T(CPP_OPEN_PAREN, "(") \
61 T(CPP_CLOSE_PAREN, ")") \
05183359
NB
62 T(CPP_GREATER, ">") /* compare */ \
63 T(CPP_LESS, "<") \
64 T(CPP_EQ_EQ, "==") \
1368ee70
ZW
65 T(CPP_NOT_EQ, "!=") \
66 T(CPP_GREATER_EQ, ">=") \
67 T(CPP_LESS_EQ, "<=") \
68\
05183359 69 /* The remainder of the punctuation. Order is not significant. */ \
1368ee70
ZW
70 T(CPP_PLUS_EQ, "+=") /* math */ \
71 T(CPP_MINUS_EQ, "-=") \
72 T(CPP_MULT_EQ, "*=") \
73 T(CPP_DIV_EQ, "/=") \
74 T(CPP_MOD_EQ, "%=") \
75 T(CPP_AND_EQ, "&=") /* bit ops */ \
76 T(CPP_OR_EQ, "|=") \
77 T(CPP_XOR_EQ, "^=") \
78 T(CPP_COMPL_EQ, "~=") \
79 T(CPP_RSHIFT_EQ, ">>=") \
80 T(CPP_LSHIFT_EQ, "<<=") \
05183359 81 T(CPP_EQ, "=") /* assign */ \
1368ee70
ZW
82 T(CPP_PLUS_PLUS, "++") /* increment */ \
83 T(CPP_MINUS_MINUS, "--") \
84 T(CPP_DEREF, "->") /* accessors */ \
85 T(CPP_DOT, ".") \
05183359
NB
86 T(CPP_OPEN_SQUARE, "[") \
87 T(CPP_CLOSE_SQUARE, "]") \
1368ee70
ZW
88 T(CPP_SCOPE, "::") \
89 T(CPP_DEREF_STAR, "->*") \
90 T(CPP_DOT_STAR, ".*") \
05183359
NB
91 T(CPP_OPEN_BRACE, "{") /* structure */ \
92 T(CPP_CLOSE_BRACE, "}") \
93 T(CPP_SEMICOLON, ";") \
94 T(CPP_ELLIPSIS, "...") \
95 T(CPP_HASH, "#") \
96 T(CPP_PASTE, "##") \
97 T(CPP_BACKSLASH, "\\") \
1368ee70
ZW
98 T(CPP_MIN, "<?") /* extension */ \
99 T(CPP_MAX, ">?") \
05183359 100 T(CPP_OTHER, spell_other) /* stray punctuation */ \
1368ee70 101\
05183359
NB
102 T(CPP_NAME, spell_name) /* word */ \
103 T(CPP_INT, 0) /* 23 */ \
104 T(CPP_FLOAT, 0) /* 3.14159 */ \
105 T(CPP_NUMBER, spell_name) /* 34_be+ta */ \
106 T(CPP_CHAR, spell_char) /* 'char' */ \
107 T(CPP_WCHAR, spell_char) /* L'char' */ \
108 T(CPP_STRING, spell_string) /* "string" */ \
109 T(CPP_WSTRING, spell_string) /* L"string" */ \
1368ee70 110\
05183359
NB
111 T(CPP_COMMENT, spell_comment) /* Only if output comments. */ \
112 T(CPP_VSPACE, "\n") /* End of line. */ \
113 T(CPP_EOF, 0) /* End of file. */ \
114 T(CPP_HEADER_NAME, 0) /* <stdio.h> in #include */ \
115 T(CPP_ASSERTION, 0) /* (...) in #assert */ \
1368ee70
ZW
116\
117 /* Obsolete - will be removed when no code uses them still. */ \
05183359
NB
118 T(CPP_HSPACE, 0) /* Horizontal white space. */ \
119 T(CPP_POP, 0) /* End of buffer. */ \
120 T(CPP_DIRECTIVE, 0) /* #define and the like */ \
121 T(CPP_MACRO, 0) /* Like a NAME, but expanded. */
1368ee70
ZW
122
123#define T(e, s) e,
3a2b2c7a 124enum cpp_ttype
c45da1ca 125{
1368ee70
ZW
126 TTYPE_TABLE
127 N_TTYPES
128};
129#undef T
130
131/* Payload of a NAME, NUMBER, FLOAT, STRING, or COMMENT token. */
132struct cpp_name
133{
134 unsigned int len;
135 unsigned int offset; /* from list->namebuf */
136};
137
05183359
NB
138/* Per token flags. */
139#define HSPACE_BEFORE (1 << 0) /* token preceded by hspace */
9e62c811 140
1368ee70
ZW
141/* A preprocessing token.
142 This has been carefully packed and should occupy 16 bytes on
143 both 32- and 64-bit hosts. */
144struct cpp_token
145{
146 unsigned short col; /* starting column of this token */
147#ifdef ENUM_BITFIELDS_ARE_UNSIGNED
148 enum cpp_ttype type : CHAR_BIT; /* node type */
149#else
150 unsigned char type;
151#endif
9e62c811 152 unsigned char flags; /* flags - see above */
05183359
NB
153 unsigned int aux; /* hash of a NAME, or something -
154 see uses in the code */
1368ee70
ZW
155 union
156 {
157 struct cpp_name name; /* a string */
158 HOST_WIDEST_INT integer; /* an integer */
159 } val;
7f2935c7
PB
160};
161
1368ee70
ZW
162/* Directive flags. */
163#define SYNTAX_INCLUDE (1 << 8)
164#define SYNTAX_ASSERT (1 << 9)
165
166typedef int (*directive_handler) PARAMS ((cpp_reader *));
167typedef int (*parse_cleanup_t) PARAMS ((cpp_buffer *, cpp_reader *));
168
169struct cpp_toklist
170{
05183359 171 struct cpp_token *tokens; /* actual tokens as an array */
1368ee70
ZW
172 unsigned int tokens_used; /* tokens used */
173 unsigned int tokens_cap; /* tokens allocated */
174
175 unsigned char *namebuf; /* names buffer */
176 unsigned int name_used; /* _bytes_ used */
177 unsigned int name_cap; /* _bytes_ allocated */
178
179 unsigned int line; /* starting line number */
180
181 /* Only used if tokens[0].type == CPP_DIRECTIVE. This is the
182 handler to call after lexing the rest of this line. The flags
183 indicate whether the rest of the line gets special treatment
184 during lexing (#include, #if, #assert, #unassert). */
185 directive_handler dir_handler;
186 unsigned short dir_flags;
187};
7f2935c7 188
4d9a1b48
ZW
189struct cpp_buffer
190{
7ceb3598
NB
191 const unsigned char *cur; /* current position */
192 const unsigned char *rlimit; /* end of valid data */
193 const unsigned char *buf; /* entire buffer */
7ceb3598 194 const unsigned char *line_base; /* start of current line */
ff2b53ef 195 const unsigned char *mark; /* Saved position for lengthy backtrack. */
7f2935c7 196
4d9a1b48
ZW
197 struct cpp_buffer *prev;
198
7f2935c7 199 /* Filename specified with #line command. */
a9ae4483 200 const char *nominal_fname;
0b3d776a 201 /* Actual directory of this file, used only for "" includes */
f1a86df6 202 struct file_name_list *actual_dir;
7f2935c7 203
0b3d776a 204 /* Pointer into the include hash table. Used for include_next and
4d9a1b48 205 to record control macros. */
38b24ee2 206 struct ihash *ihash;
7f2935c7 207
7f2935c7 208 parse_cleanup_t cleanup;
ff2b53ef
ZW
209
210 /* If the buffer is the expansion of a macro, this points to the
211 macro's hash table entry. */
212 struct hashnode *macro;
31948547 213
7f2935c7
PB
214 /* Value of if_stack at start of this file.
215 Used to prohibit unmatched #endif (etc) in an include file. */
216 struct if_stack *if_stack;
217
3a2b2c7a
ZW
218 /* Line number at line_base (above). */
219 unsigned int lineno;
220
7f2935c7
PB
221 /* True if this is a header file included using <FILENAME>. */
222 char system_header_p;
f2d5f0cc
ZW
223
224 /* True if end-of-file has already been hit once in this buffer. */
7f2935c7
PB
225 char seen_eof;
226
227 /* True if buffer contains escape sequences.
ed45de98
ZW
228 Currently there are two kinds:
229 "\r-" means following identifier should not be macro-expanded.
230 "\r " means a token-separator. This turns into " " in final output
7e2eb697 231 if not stringizing and needed to separate tokens; otherwise nothing.
ed45de98
ZW
232 Any other two-character sequence beginning with \r is an error.
233
234 If this is NOT set, then \r is a one-character escape meaning backslash
235 newline. This is guaranteed not to occur in the middle of a token.
236 The two interpretations of \r do not conflict, because the two-character
237 escapes are used only in macro buffers, and backslash-newline is removed
238 from macro expansion text in collect_expansion and/or macarg. */
7f2935c7 239 char has_escapes;
3773a46b
JM
240
241 /* Used by the C++ frontend to implement redirected input (such as for
242 default argument and/or template parsing). */
243 char manual_pop;
75ec21db
ZW
244
245 /* True if we have already warned about C++ comments in this file.
246 The warning happens only for C89 extended mode with -pedantic on,
247 and only once per file (otherwise it would be far too noisy). */
248 char warned_cplusplus_comments;
7f2935c7
PB
249};
250
7e2eb697 251struct file_name_map_list;
d35364d1 252struct htab;
7f2935c7 253
7f2935c7
PB
254/* Maximum nesting of cpp_buffers. We use a static limit, partly for
255 efficiency, and partly to limit runaway recursion. */
256#define CPP_STACK_MAX 200
af453bb0 257
ae79697b
ZW
258/* Values for opts.dump_macros.
259 dump_only means inhibit output of the preprocessed text
260 and instead output the definitions of all user-defined
86702e31 261 macros in a form suitable for use as input to cpp.
ae79697b
ZW
262 dump_names means pass #define and the macro name through to output.
263 dump_definitions means pass the whole definition (plus #define) through
264*/
265enum { dump_none = 0, dump_only, dump_names, dump_definitions };
7f2935c7 266
ae79697b
ZW
267/* This structure is nested inside struct cpp_reader, and
268 carries all the options visible to the command line. */
269struct cpp_options
c50bca08 270{
ae79697b
ZW
271 /* Name of input and output files. */
272 const char *in_fname;
273 const char *out_fname;
194d7493 274
ae79697b
ZW
275 /* Pending options - -D, -U, -A, -I, -ixxx. */
276 struct cpp_pending *pending;
7f2935c7 277
ae79697b
ZW
278 /* File name which deps are being written to. This is 0 if deps are
279 being written to stdout. */
280 const char *deps_file;
0b22d65c 281
ae79697b
ZW
282 /* Target-name to write with the dependency information. */
283 char *deps_target;
7f2935c7 284
ae79697b
ZW
285 /* Search paths for include files. */
286 struct file_name_list *quote_include; /* First dir to search for "file" */
287 struct file_name_list *bracket_include;/* First dir to search for <file> */
7f2935c7 288
ae79697b
ZW
289 /* Map between header names and file names, used only on DOS where
290 file names are limited in length. */
7e2eb697
PB
291 struct file_name_map_list *map_list;
292
ae79697b
ZW
293 /* Directory prefix that should replace `/usr/lib/gcc-lib/TARGET/VERSION'
294 in the standard include file directories. */
295 const char *include_prefix;
296 unsigned int include_prefix_len;
297
7f2935c7 298 /* Non-0 means -v, so print the full set of include dirs. */
ae79697b 299 unsigned char verbose;
7f2935c7
PB
300
301 /* Nonzero means use extra default include directories for C++. */
ae79697b 302 unsigned char cplusplus;
7f2935c7
PB
303
304 /* Nonzero means handle cplusplus style comments */
ae79697b 305 unsigned char cplusplus_comments;
7f2935c7
PB
306
307 /* Nonzero means handle #import, for objective C. */
ae79697b 308 unsigned char objc;
7f2935c7 309
40c79d58
ZW
310 /* Nonzero means this is an assembly file, so ignore unrecognized
311 directives and the "# 33" form of #line, both of which are
312 probably comments. Also, permit unbalanced ' strings (again,
313 likely to be in comments). */
ae79697b 314 unsigned char lang_asm;
40c79d58
ZW
315
316 /* Nonzero means this is Fortran, and we don't know where the
317 comments are, so permit unbalanced ' strings. Unlike lang_asm,
318 this does not ignore unrecognized directives. */
ae79697b 319 unsigned char lang_fortran;
40c79d58 320
ae79697b
ZW
321 /* Nonzero means handle CHILL comment syntax and output CHILL string
322 delimiters for __DATE__ etc. */
323 unsigned char chill;
7f2935c7 324
564ad5f4 325 /* Nonzero means don't copy comments into the output file. */
ae79697b 326 unsigned char discard_comments;
7f2935c7 327
554fbeef 328 /* Nonzero means process the ANSI trigraph sequences. */
ae79697b 329 unsigned char trigraphs;
7f2935c7 330
ae79697b
ZW
331 /* Nonzero means print the names of included files rather than the
332 preprocessed output. 1 means just the #include "...", 2 means
333 #include <...> as well. */
334 unsigned char print_deps;
7f2935c7 335
ae79697b
ZW
336 /* Nonzero if missing .h files in -M output are assumed to be
337 generated files and not errors. */
338 unsigned char print_deps_missing_files;
7f2935c7
PB
339
340 /* If true, fopen (deps_file, "a") else fopen (deps_file, "w"). */
ae79697b 341 unsigned char print_deps_append;
7f2935c7
PB
342
343 /* Nonzero means print names of header files (-H). */
ae79697b 344 unsigned char print_include_names;
7f2935c7 345
ae79697b
ZW
346 /* Nonzero means cpp_pedwarn causes a hard error. */
347 unsigned char pedantic_errors;
7f2935c7 348
c1212d2f 349 /* Nonzero means don't print warning messages. */
ae79697b 350 unsigned char inhibit_warnings;
7f2935c7 351
ae79697b
ZW
352 /* Nonzero means don't print error messages. Has no option to
353 select it, but can be set by a user of cpplib (e.g. fix-header). */
354 unsigned char inhibit_errors;
c1212d2f 355
7f2935c7 356 /* Nonzero means warn if slash-star appears in a comment. */
ae79697b 357 unsigned char warn_comments;
7f2935c7
PB
358
359 /* Nonzero means warn if there are any trigraphs. */
ae79697b 360 unsigned char warn_trigraphs;
7f2935c7
PB
361
362 /* Nonzero means warn if #import is used. */
ae79697b 363 unsigned char warn_import;
7f2935c7
PB
364
365 /* Nonzero means warn if a macro argument is (or would be)
07aa0b04
ZW
366 stringified with -traditional, and warn about directives
367 with the # indented from the beginning of the line. */
368 unsigned char warn_traditional;
7f2935c7
PB
369
370 /* Nonzero means turn warnings into errors. */
ae79697b 371 unsigned char warnings_are_errors;
7f2935c7 372
ae79697b
ZW
373 /* Nonzero causes output not to be done, but directives such as
374 #define that have side effects are still obeyed. */
375 unsigned char no_output;
7f2935c7 376
31031edd
JL
377 /* Nonzero means we should look for header.gcc files that remap file
378 names. */
ae79697b 379 unsigned char remap;
31031edd 380
7f2935c7 381 /* Nonzero means don't output line number information. */
ae79697b 382 unsigned char no_line_commands;
7f2935c7 383
ae79697b
ZW
384 /* Nonzero means -I- has been seen, so don't look for #include "foo"
385 the source-file directory. */
386 unsigned char ignore_srcdir;
7f2935c7 387
ae79697b
ZW
388 /* Zero means dollar signs are punctuation. */
389 unsigned char dollars_in_ident;
7f2935c7
PB
390
391 /* Nonzero means try to imitate old fashioned non-ANSI preprocessor. */
ae79697b 392 unsigned char traditional;
7f2935c7 393
6ac34fdc 394 /* Nonzero means warn if undefined identifiers are evaluated in an #if. */
ae79697b 395 unsigned char warn_undef;
6ac34fdc 396
76e80421 397 /* Nonzero for the 1989 C Standard, including corrigenda and amendments. */
ae79697b 398 unsigned char c89;
76e80421 399
31948547 400 /* Nonzero for the 1999 C Standard, including corrigenda and amendments. */
ae79697b 401 unsigned char c99;
31948547 402
7f2935c7 403 /* Nonzero means give all the error messages the ANSI standard requires. */
ae79697b 404 unsigned char pedantic;
7f2935c7 405
3773a46b
JM
406 /* Nonzero means we're looking at already preprocessed code, so don't
407 bother trying to do macro expansion and whatnot. */
ae79697b 408 unsigned char preprocessed;
3773a46b 409
ae79697b
ZW
410 /* Nonzero disables all the standard directories for headers. */
411 unsigned char no_standard_includes;
7f2935c7 412
ae79697b
ZW
413 /* Nonzero disables the C++-specific standard directories for headers. */
414 unsigned char no_standard_cplusplus_includes;
7f2935c7 415
ae79697b
ZW
416 /* Nonzero means dump macros in some fashion - see above. */
417 unsigned char dump_macros;
7f2935c7 418
ae79697b
ZW
419 /* Nonzero means pass all #define and #undef directives which we
420 actually process through to the output stream. This feature is
421 used primarily to allow cc1 to record the #defines and #undefs
422 for the sake of debuggers which understand about preprocessor
423 macros, but it may also be useful with -E to figure out how
424 symbols are defined, and where they are defined. */
425 unsigned char debug_output;
7f2935c7 426
ae79697b
ZW
427 /* Nonzero means pass #include lines through to the output. */
428 unsigned char dump_includes;
7f2935c7 429
ae79697b
ZW
430 /* Print column number in error messages. */
431 unsigned char show_column;
432};
7f2935c7 433
7f2935c7 434
ae79697b
ZW
435/* A cpp_reader encapsulates the "state" of a pre-processor run.
436 Applying cpp_get_token repeatedly yields a stream of pre-processor
437 tokens. Usually, there is only one cpp_reader object active. */
31031edd 438
ae79697b
ZW
439struct cpp_reader
440{
9e62c811 441 /* Top of buffer stack. */
ae79697b 442 cpp_buffer *buffer;
7f2935c7 443
9e62c811
ZW
444 /* Token list used by get_directive_token. */
445 cpp_toklist directbuf;
446
ae79697b
ZW
447 /* A buffer used for both for cpp_get_token's output, and also internally. */
448 unsigned char *token_buffer;
449 /* Allocated size of token_buffer. CPP_RESERVE allocates space. */
450 unsigned int token_buffer_size;
451 /* End of the written part of token_buffer. */
452 unsigned char *limit;
7f2935c7 453
ae79697b 454 /* Error counter for exit code */
3a2b2c7a 455 unsigned int errors;
ae79697b
ZW
456
457 /* Line where a newline was first seen in a string constant. */
3a2b2c7a 458 unsigned int multiline_string_line;
ae79697b
ZW
459
460 /* Current depth in #include directives that use <...>. */
3a2b2c7a 461 unsigned int system_include_depth;
ae79697b
ZW
462
463 /* Current depth of buffer stack. */
3a2b2c7a 464 unsigned int buffer_stack_depth;
ae79697b
ZW
465
466 /* Hash table of macros and assertions. See cpphash.c */
467 struct htab *hashtab;
468
469 /* Hash table of other included files. See cppfiles.c */
470 struct htab *all_include_files;
471
472 /* Chain of `actual directory' file_name_list entries,
473 for "" inclusion. */
474 struct file_name_list *actual_dirs;
475
476 /* Current maximum length of directory names in the search path
477 for include files. (Altered as we get more of them.) */
478 unsigned int max_include_len;
479
480 struct if_stack *if_stack;
ff2b53ef 481 const unsigned char *potential_control_macro;
ae79697b 482
ae79697b
ZW
483 /* Buffer of -M output. */
484 struct deps *deps;
485
46d07497
ZW
486 /* A buffer used only by read_and_prescan (in cppfiles.c), which is
487 allocated once per cpp_reader object to keep it off the stack. */
ae79697b 488 unsigned char *input_buffer;
ae79697b
ZW
489 size_t input_buffer_len;
490
491 /* User visible options. */
492 struct cpp_options opts;
493
494 /* Nonzero means we have printed (while error reporting) a list of
495 containing files that matches the current status. */
496 unsigned char input_stack_listing_current;
497
498 /* If non-zero, macros are not expanded. */
499 unsigned char no_macro_expand;
500
501 /* If non-zero, directives cause a hard error. Used when parsing
502 macro arguments. */
503 unsigned char no_directives;
504
505 /* We're printed a warning recommending against using #import. */
506 unsigned char import_warning;
507
508 /* If true, characters between '<' and '>' are a single (string) token. */
509 unsigned char parsing_include_directive;
510
511 /* If true, # introduces an assertion (see do_assert) */
512 unsigned char parsing_if_directive;
513
514 /* If true, # and ## are the STRINGIZE and TOKPASTE operators */
515 unsigned char parsing_define_directive;
516
517 /* True if escape sequences (as described for has_escapes in
518 parse_buffer) should be emitted. */
519 unsigned char output_escapes;
520
521 /* 0: Have seen non-white-space on this line.
522 1: Only seen white space so far on this line.
523 2: Only seen white space so far in this file. */
524 unsigned char only_seen_white;
525
526 /* True after cpp_start_read completes. Used to inhibit some
527 warnings while parsing the command line. */
528 unsigned char done_initializing;
7f2935c7
PB
529};
530
f2d5f0cc
ZW
531/* struct cpp_printer encapsulates state used to convert the stream of
532 tokens coming from cpp_get_token back into a text file. Not
533 everyone wants to do that, hence we separate the function. */
534
535struct cpp_printer
536{
537 FILE *outf; /* stream to write to */
538 const char *last_fname; /* previous file name */
539 unsigned int last_bsd; /* did we just push? */
540 unsigned int lineno; /* line currently being written */
541 unsigned int written; /* low water mark in token buffer */
542};
543
ae79697b
ZW
544#define CPP_FATAL_LIMIT 1000
545/* True if we have seen a "fatal" error. */
546#define CPP_FATAL_ERRORS(READER) ((READER)->errors >= CPP_FATAL_LIMIT)
547
548/* Macros for manipulating the token_buffer. */
549
550/* Number of characters currently in PFILE's output buffer. */
551#define CPP_WRITTEN(PFILE) ((size_t)((PFILE)->limit - (PFILE)->token_buffer))
552#define CPP_PWRITTEN(PFILE) ((PFILE)->limit)
553#define CPP_ADJUST_WRITTEN(PFILE,DELTA) ((PFILE)->limit += (DELTA))
554#define CPP_SET_WRITTEN(PFILE,N) ((PFILE)->limit = (PFILE)->token_buffer + (N))
555
556#define CPP_OPTION(PFILE, OPTION) ((PFILE)->opts.OPTION)
557#define CPP_BUFFER(PFILE) ((PFILE)->buffer)
3a2b2c7a
ZW
558#define CPP_BUF_LINE(BUF) ((BUF)->lineno)
559#define CPP_BUF_COL(BUF) ((BUF)->cur - (BUF)->line_base)
ae79697b 560
7f2935c7 561/* Name under which this program was invoked. */
bcc5cac9 562extern const char *progname;
7f2935c7 563
88ae23e7 564extern int cpp_handle_options PARAMS ((cpp_reader *, int, char **));
3a2b2c7a
ZW
565extern enum cpp_ttype cpp_get_token PARAMS ((cpp_reader *));
566extern enum cpp_ttype cpp_get_non_space_token PARAMS ((cpp_reader *));
7f2935c7 567
88ae23e7 568extern void cpp_reader_init PARAMS ((cpp_reader *));
f2d5f0cc
ZW
569extern cpp_printer *cpp_printer_init PARAMS ((cpp_reader *, cpp_printer *));
570extern int cpp_start_read PARAMS ((cpp_reader *, cpp_printer *, const char *));
571extern void cpp_output_tokens PARAMS ((cpp_reader *, cpp_printer *));
1368ee70
ZW
572extern void cpp_output_list PARAMS ((cpp_reader *, cpp_printer *,
573 const cpp_toklist *));
f2d5f0cc
ZW
574extern void cpp_finish PARAMS ((cpp_reader *, cpp_printer *));
575extern void cpp_cleanup PARAMS ((cpp_reader *));
7f2935c7 576
e23c0ba3 577extern cpp_buffer *cpp_file_buffer PARAMS((cpp_reader *));
7ceb3598
NB
578extern void cpp_define PARAMS ((cpp_reader *, const char *));
579extern void cpp_assert PARAMS ((cpp_reader *, const char *));
580extern void cpp_undef PARAMS ((cpp_reader *, const char *));
581extern void cpp_unassert PARAMS ((cpp_reader *, const char *));
7f2935c7 582
c1212d2f
ZW
583/* N.B. The error-message-printer prototypes have not been nicely
584 formatted because exgettext needs to see 'msgid' on the same line
585 as the name of the function in order to work properly. Only the
586 string argument gets a name in an effort to keep the lines from
587 getting ridiculously oversized. */
588
589extern void cpp_ice PARAMS ((cpp_reader *, const char *msgid, ...))
487a6e06 590 ATTRIBUTE_PRINTF_2;
c1212d2f 591extern void cpp_fatal PARAMS ((cpp_reader *, const char *msgid, ...))
487a6e06 592 ATTRIBUTE_PRINTF_2;
c1212d2f 593extern void cpp_error PARAMS ((cpp_reader *, const char *msgid, ...))
487a6e06 594 ATTRIBUTE_PRINTF_2;
c1212d2f
ZW
595extern void cpp_warning PARAMS ((cpp_reader *, const char *msgid, ...))
596 ATTRIBUTE_PRINTF_2;
597extern void cpp_pedwarn PARAMS ((cpp_reader *, const char *msgid, ...))
598 ATTRIBUTE_PRINTF_2;
599extern void cpp_notice PARAMS ((cpp_reader *, const char *msgid, ...))
600 ATTRIBUTE_PRINTF_2;
601extern void cpp_error_with_line PARAMS ((cpp_reader *, int, int, const char *msgid, ...))
554fbeef 602 ATTRIBUTE_PRINTF_4;
c1212d2f 603extern void cpp_warning_with_line PARAMS ((cpp_reader *, int, int, const char *msgid, ...))
487a6e06 604 ATTRIBUTE_PRINTF_4;
c1212d2f 605extern void cpp_pedwarn_with_line PARAMS ((cpp_reader *, int, int, const char *msgid, ...))
487a6e06 606 ATTRIBUTE_PRINTF_4;
c1212d2f
ZW
607extern void cpp_pedwarn_with_file_and_line PARAMS ((cpp_reader *, const char *, int, int, const char *msgid, ...))
608 ATTRIBUTE_PRINTF_5;
f2d5f0cc
ZW
609extern void cpp_error_from_errno PARAMS ((cpp_reader *, const char *));
610extern void cpp_notice_from_errno PARAMS ((cpp_reader *, const char *));
611
612/* In cpplex.c */
613extern cpp_buffer *cpp_push_buffer PARAMS ((cpp_reader *,
614 const unsigned char *, long));
615extern cpp_buffer *cpp_pop_buffer PARAMS ((cpp_reader *));
616extern void cpp_scan_buffer PARAMS ((cpp_reader *, cpp_printer *));
617extern void cpp_scan_buffer_nooutput PARAMS ((cpp_reader *));
618
1368ee70
ZW
619
620
f2d5f0cc
ZW
621/* In cpphash.c */
622extern int cpp_defined PARAMS ((cpp_reader *,
88ae23e7 623 const unsigned char *, int));
6de1e2a9 624
add7091b 625/* In cppfiles.c */
b0699dad
ZW
626extern int cpp_included PARAMS ((cpp_reader *, const char *));
627extern int cpp_read_file PARAMS ((cpp_reader *, const char *));
628
7f2935c7
PB
629#ifdef __cplusplus
630}
631#endif
990c642c 632#endif /* __GCC_CPPLIB__ */
This page took 0.606268 seconds and 5 git commands to generate.