OSDN Git Service

* lex.c (lang_init_options): New function.
[pf3gnuchains/gcc-fork.git] / gcc / cpplib.h
1 /* Definitions for CPP library.
2    Copyright (C) 1995, 1996, 1997 Free Software Foundation, Inc.
3    Written by Per Bothner, 1994-95.
4
5 This program is free software; you can redistribute it and/or modify it
6 under the terms of the GNU General Public License as published by the
7 Free Software Foundation; either version 2, or (at your option) any
8 later version.
9
10 This program is distributed in the hope that it will be useful,
11 but WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
13 GNU General Public License for more details.
14
15 You should have received a copy of the GNU General Public License
16 along with this program; if not, write to the Free Software
17 Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
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!  */
22
23 #include <sys/types.h>
24 #include <sys/stat.h>
25 #ifdef __STDC__
26 #include <stdarg.h>
27 #else
28 #include <varargs.h>
29 #endif
30
31 #ifdef __cplusplus
32 extern "C" {
33 #endif
34
35 typedef unsigned char U_CHAR;
36
37 typedef struct cpp_reader cpp_reader;
38 typedef struct cpp_buffer cpp_buffer;
39 typedef struct cpp_options cpp_options;
40 typedef struct hashnode cpp_hashnode;
41
42 enum cpp_token {
43   CPP_EOF = -1,
44   CPP_OTHER = 0,
45   CPP_COMMENT = 1,
46   CPP_HSPACE,
47   CPP_VSPACE, /* newlines and #line directives */
48   CPP_NAME,
49   CPP_NUMBER,
50   CPP_CHAR,
51   CPP_STRING,
52   CPP_DIRECTIVE,
53   CPP_LPAREN,   /* "(" */
54   CPP_RPAREN,   /* ")" */
55   CPP_LBRACE,   /* "{" */
56   CPP_RBRACE,   /* "}" */
57   CPP_COMMA,    /* "," */
58   CPP_SEMICOLON,/* ";" */
59   CPP_3DOTS,    /* "..." */
60 #if 0
61   CPP_ANDAND, /* "&&" */
62   CPP_OROR,   /* "||" */
63   CPP_LSH,    /* "<<" */
64   CPP_RSH,    /* ">>" */
65   CPP_EQL,    /* "==" */
66   CPP_NEQ,    /* "!=" */
67   CPP_LEQ,    /* "<=" */
68   CPP_GEQ,    /* ">=" */
69   CPP_PLPL,   /* "++" */
70   CPP_MINMIN, /* "--" */
71 #endif
72   /* POP_TOKEN is returned when we've popped a cpp_buffer. */
73   CPP_POP
74 };
75
76 #ifndef PARAMS
77 #define PARAMS(P) PROTO(P)
78 #endif /* !PARAMS */
79
80 typedef enum cpp_token (*parse_underflow_t) PARAMS((cpp_reader *));
81 typedef int (*parse_cleanup_t) PARAMS((cpp_buffer *, cpp_reader *));
82
83 /* A parse_marker indicates a previous position,
84    which we can backtrack to. */
85
86 struct parse_marker {
87   cpp_buffer *buf;
88   struct parse_marker *next;
89   int position;
90 };
91
92 extern void parse_set_mark PARAMS ((struct parse_marker *, cpp_reader *));
93 extern void parse_clear_mark PARAMS ((struct parse_marker *));
94 extern void parse_goto_mark PARAMS((struct parse_marker *, cpp_reader *));
95 extern void parse_move_mark PARAMS((struct parse_marker *, cpp_reader *));
96
97 extern int cpp_handle_options PARAMS ((cpp_reader *, int, char **));
98 extern enum cpp_token cpp_get_token PARAMS ((cpp_reader *));
99 extern void cpp_skip_hspace PARAMS((cpp_reader *));
100 extern enum cpp_token cpp_get_non_space_token PARAMS ((cpp_reader *));
101
102 /* This frees resources used by PFILE. */
103 extern void cpp_cleanup PARAMS ((cpp_reader *PFILE));
104
105 /* Maintain and search list of included files, for #import.  */
106
107 #define IMPORT_HASH_SIZE 31
108
109 struct import_file {
110   char *name;
111   ino_t inode;
112   dev_t dev;
113   struct import_file *next;
114 };
115
116 /* If we have a huge buffer, may need to cache more recent counts */
117 #define CPP_LINE_BASE(BUF) ((BUF)->buf + (BUF)->line_base)
118
119 struct cpp_buffer {
120   unsigned char *buf;
121   unsigned char *cur;
122   unsigned char *rlimit; /* end of valid data */
123   unsigned char *alimit; /* end of allocated buffer */
124   unsigned char *prev;  /* start of current token */
125
126   char *fname;
127   /* Filename specified with #line command.  */
128   char *nominal_fname;
129
130   /* Record where in the search path this file was found.
131      For #include_next.  */
132   struct file_name_list *dir;
133
134   long line_base;
135   long lineno; /* Line number at CPP_LINE_BASE. */
136   long colno; /* Column number at CPP_LINE_BASE. */
137   parse_underflow_t underflow;
138   parse_cleanup_t cleanup;
139   void *data;
140   struct parse_marker *marks;
141   /* Value of if_stack at start of this file.
142      Used to prohibit unmatched #endif (etc) in an include file.  */
143   struct if_stack *if_stack;
144
145   /* True if this is a header file included using <FILENAME>.  */
146   char system_header_p;
147   char seen_eof;
148
149   /* True if buffer contains escape sequences.
150      Currently there are three kinds:
151      "@-" means following identifier should not be macro-expanded.
152      "@ " means a token-separator.  This turns into " " in final output
153           if not stringizing and needed to separate tokens; otherwise nothing.
154      "@@" means a normal '@'.
155      (An '@' inside a string stands for itself and is never an escape.) */
156   char has_escapes;
157 };
158
159 struct cpp_pending;  /* Forward declaration - for C++. */
160 struct file_name_map_list;
161
162 typedef struct assertion_hashnode ASSERTION_HASHNODE;
163 #define ASSERTION_HASHSIZE 37
164
165 /* Maximum nesting of cpp_buffers.  We use a static limit, partly for
166    efficiency, and partly to limit runaway recursion.  */
167 #define CPP_STACK_MAX 200
168
169 /* A cpp_reader encapsulates the "state" of a pre-processor run.
170    Applying cpp_get_token repeatedly yields a stream of pre-processor
171    tokens.  Usually, there is only one cpp_reader object active. */
172
173 struct cpp_reader {
174   parse_underflow_t get_token;
175   cpp_buffer *buffer;
176   cpp_buffer buffer_stack[CPP_STACK_MAX];
177
178   int errors;                   /* Error counter for exit code */
179   void *data;
180
181   /* A buffer used for both for cpp_get_token's output, and also internally. */
182   unsigned char *token_buffer;
183   /* Allocated size of token_buffer.  CPP_RESERVE allocates space.  */
184   int token_buffer_size;
185   /* End of the written part of token_buffer. */
186   unsigned char *limit;
187
188   /* Line where a newline was first seen in a string constant.  */
189   int multiline_string_line;
190
191   /* Current depth in #include directives that use <...>.  */
192   int system_include_depth;
193
194   /* List of included files that contained #pragma once.  */
195   struct file_name_list *dont_repeat_files;
196
197   /* List of other included files.
198      If ->control_macro if nonzero, the file had a #ifndef
199      around the entire contents, and ->control_macro gives the macro name.  */
200   struct file_name_list *all_include_files;
201
202   /* Current maximum length of directory names in the search path
203      for include files.  (Altered as we get more of them.)  */
204   int max_include_len;
205
206   /* Hash table of files already included with #include or #import.  */
207   struct import_file *import_hash_table[IMPORT_HASH_SIZE];
208
209   struct if_stack *if_stack;
210
211   /* Nonzero means we are inside an IF during a -pcp run.  In this mode
212      macro expansion is done, and preconditions are output for all macro
213      uses requiring them. */
214   char pcp_inside_if;
215
216   /* Nonzero means we have printed (while error reporting) a list of
217      containing files that matches the current status. */
218   char input_stack_listing_current;
219
220   /* If non-zero, macros are not expanded. */
221   char no_macro_expand;
222
223   /* Print column number in error messages. */
224   char show_column;
225
226   /* We're printed a warning recommending against using #import. */
227   char import_warning;
228
229   /* If true, character between '<' and '>' are a single (string) token. */
230   char parsing_include_directive;
231
232   /* True if escape sequences (as described for has_escapes in
233      parse_buffer) should be emitted. */
234   char output_escapes;
235
236   /* 0: Have seen non-white-space on this line.
237      1: Only seen white space so far on this line.
238      2: Only seen white space so far in this file. */
239    char only_seen_white;
240
241   /* Nonzero means this file was included with a -imacros or -include
242      command line and should not be recorded as an include file.  */
243
244   int no_record_file;
245
246   long lineno;
247
248   struct tm *timebuf;
249
250   ASSERTION_HASHNODE *assertion_hashtab[ASSERTION_HASHSIZE];
251
252   /* Buffer of -M output.  */
253   char *deps_buffer;
254
255   /* Number of bytes allocated in above.  */
256   int deps_allocated_size;
257
258   /* Number of bytes used.  */
259   int deps_size;
260
261   /* Number of bytes since the last newline.  */
262   int deps_column;
263
264 #ifdef __cplusplus
265   ~cpp_reader () { cpp_cleanup (this); }
266 #endif
267 };
268
269 #define CPP_FATAL_LIMIT 1000
270 /* True if we have seen a "fatal" error. */
271 #define CPP_FATAL_ERRORS(READER) ((READER)->errors >= CPP_FATAL_LIMIT)
272
273 #define CPP_BUF_PEEK(BUFFER) \
274   ((BUFFER)->cur < (BUFFER)->rlimit ? *(BUFFER)->cur : EOF)
275 #define CPP_BUF_GET(BUFFER) \
276   ((BUFFER)->cur < (BUFFER)->rlimit ? *(BUFFER)->cur++ : EOF)
277 #define CPP_FORWARD(BUFFER, N) ((BUFFER)->cur += (N))
278
279 /* Macros for manipulating the token_buffer. */
280
281 #define CPP_OUT_BUFFER(PFILE) ((PFILE)->token_buffer)
282
283 /* Number of characters currently in PFILE's output buffer. */
284 #define CPP_WRITTEN(PFILE) ((PFILE)->limit - (PFILE)->token_buffer)
285 #define CPP_PWRITTEN(PFILE) ((PFILE)->limit)
286
287 /* Make sure PFILE->token_buffer has space for at least N more characters. */
288 #define CPP_RESERVE(PFILE, N) \
289   (CPP_WRITTEN (PFILE) + N > (PFILE)->token_buffer_size \
290    && (cpp_grow_buffer (PFILE, N), 0))
291
292 /* Append string STR (of length N) to PFILE's output buffer.
293    Assume there is enough space. */
294 #define CPP_PUTS_Q(PFILE, STR, N) \
295   (bcopy (STR, (PFILE)->limit, (N)), (PFILE)->limit += (N))
296 /* Append string STR (of length N) to PFILE's output buffer.  Make space. */
297 #define CPP_PUTS(PFILE, STR, N) CPP_RESERVE(PFILE, N), CPP_PUTS_Q(PFILE, STR,N)
298 /* Append character CH to PFILE's output buffer.  Assume sufficient space. */
299 #define CPP_PUTC_Q(PFILE, CH) (*(PFILE)->limit++ = (CH))
300 /* Append character CH to PFILE's output buffer.  Make space if need be. */
301 #define CPP_PUTC(PFILE, CH) (CPP_RESERVE (PFILE, 1), CPP_PUTC_Q (PFILE, CH))
302 /* Make sure PFILE->limit is followed by '\0'. */
303 #define CPP_NUL_TERMINATE_Q(PFILE) (*(PFILE)->limit = 0)
304 #define CPP_NUL_TERMINATE(PFILE) (CPP_RESERVE(PFILE, 1), *(PFILE)->limit = 0)
305 #define CPP_ADJUST_WRITTEN(PFILE,DELTA) ((PFILE)->limit += (DELTA))
306 #define CPP_SET_WRITTEN(PFILE,N) ((PFILE)->limit = (PFILE)->token_buffer + (N))
307
308 #define CPP_OPTIONS(PFILE) ((cpp_options *) (PFILE)->data)
309
310 #define CPP_BUFFER(PFILE) ((PFILE)->buffer)
311 #define CPP_PREV_BUFFER(BUFFER) ((BUFFER)+1)
312 /* The bottom of the buffer stack. */
313 #define CPP_NULL_BUFFER(PFILE) (&(PFILE)->buffer_stack[CPP_STACK_MAX])
314
315 /* Pointed to by cpp_reader::data. */
316 struct cpp_options {
317   char *in_fname;
318
319   /* Name of output file, for error messages.  */
320   char *out_fname;
321
322   struct file_name_map_list *map_list;
323
324   /* Non-0 means -v, so print the full set of include dirs.  */
325   char verbose;
326
327   /* Nonzero means use extra default include directories for C++.  */
328
329   char cplusplus;
330
331   /* Nonzero means handle cplusplus style comments */
332
333   char cplusplus_comments;
334
335   /* Nonzero means handle #import, for objective C.  */
336
337   char objc;
338
339   /* Nonzero means this is an assembly file, and allow
340      unknown directives, which could be comments.  */
341
342   int lang_asm;
343
344   /* Nonzero means turn NOTREACHED into #pragma NOTREACHED etc */
345
346   char for_lint;
347
348   /* Nonzero means handle CHILL comment syntax
349      and output CHILL string delimiter for __DATE___ etc. */
350
351   char chill;
352
353   /* Nonzero means copy comments into the output file.  */
354
355   char put_out_comments;
356
357   /* Nonzero means don't process the ANSI trigraph sequences.  */
358
359   char no_trigraphs;
360
361   /* Nonzero means print the names of included files rather than
362      the preprocessed output.  1 means just the #include "...",
363      2 means #include <...> as well.  */
364
365   char print_deps;
366
367   /* Nonzero if missing .h files in -M output are assumed to be generated
368      files and not errors.  */
369
370   char print_deps_missing_files;
371
372   /* If true, fopen (deps_file, "a") else fopen (deps_file, "w"). */
373   char print_deps_append;
374
375   /* Nonzero means print names of header files (-H).  */
376
377   char print_include_names;
378
379   /* Nonzero means try to make failure to fit ANSI C an error.  */
380
381   char pedantic_errors;
382
383   /* Nonzero means don't print warning messages.  -w.  */
384
385   char inhibit_warnings;
386
387   /* Nonzero means warn if slash-star appears in a comment.  */
388
389   char warn_comments;
390
391   /* Nonzero means warn if there are any trigraphs.  */
392
393   char warn_trigraphs;
394
395   /* Nonzero means warn if #import is used.  */
396
397   char warn_import;
398
399   /* Nonzero means warn if a macro argument is (or would be)
400      stringified with -traditional.  */
401
402   char warn_stringify;
403
404   /* Nonzero means turn warnings into errors.  */
405
406   char warnings_are_errors;
407
408   /* Nonzero causes output not to be done,
409      but directives such as #define that have side effects
410      are still obeyed.  */
411
412   char no_output;
413
414   /* Nonzero means we should look for header.gcc files that remap file
415      names.  */
416   char remap;
417
418   /* Nonzero means don't output line number information.  */
419
420   char no_line_commands;
421
422 /* Nonzero means output the text in failing conditionals,
423    inside #failed ... #endfailed.  */
424
425   char output_conditionals;
426
427   /* Nonzero means -I- has been seen,
428      so don't look for #include "foo" the source-file directory.  */
429   char ignore_srcdir;
430
431   /* Zero means dollar signs are punctuation.
432      This used to be needed for conformance to the C Standard,
433      before the C Standard was corrected.  */
434   char dollars_in_ident;
435
436   /* Nonzero means try to imitate old fashioned non-ANSI preprocessor.  */
437   char traditional;
438
439   /* Nonzero means warn if undefined identifiers are evaluated in an #if.  */
440   char warn_undef;
441
442   /* Nonzero for the 1989 C Standard, including corrigenda and amendments.  */
443   char c89;
444
445   /* Nonzero means give all the error messages the ANSI standard requires.  */
446   char pedantic;
447
448   char done_initializing;
449
450   struct file_name_list *include;       /* First dir to search */
451   /* First dir to search for <file> */
452   /* This is the first element to use for #include <...>.
453      If it is 0, use the entire chain for such includes.  */
454   struct file_name_list *first_bracket_include;
455   /* This is the first element in the chain that corresponds to
456      a directory of system header files.  */
457   struct file_name_list *first_system_include;
458   struct file_name_list *last_include;  /* Last in chain */
459
460   /* Chain of include directories to put at the end of the other chain.  */
461   struct file_name_list *after_include;
462   struct file_name_list *last_after_include;    /* Last in chain */
463
464   /* Chain to put at the start of the system include files.  */
465   struct file_name_list *before_system;
466   struct file_name_list *last_before_system;    /* Last in chain */
467
468   /* Directory prefix that should replace `/usr' in the standard
469      include file directories.  */
470   char *include_prefix;
471
472   char inhibit_predefs;
473   char no_standard_includes;
474   char no_standard_cplusplus_includes;
475
476 /* dump_only means inhibit output of the preprocessed text
477              and instead output the definitions of all user-defined
478              macros in a form suitable for use as input to cccp.
479    dump_names means pass #define and the macro name through to output.
480    dump_definitions means pass the whole definition (plus #define) through
481 */
482
483   enum {dump_none = 0, dump_only, dump_names, dump_definitions}
484      dump_macros;
485
486 /* Nonzero means pass all #define and #undef directives which we actually
487    process through to the output stream.  This feature is used primarily
488    to allow cc1 to record the #defines and #undefs for the sake of
489    debuggers which understand about preprocessor macros, but it may
490    also be useful with -E to figure out how symbols are defined, and
491    where they are defined.  */
492   int debug_output;
493
494   /* Nonzero means pass #include lines through to the output,
495      even if they are ifdefed out.  */
496   int dump_includes;
497
498   /* Pending -D, -U and -A options, in reverse order. */
499   struct cpp_pending *pending;
500
501   /* File name which deps are being written to.
502      This is 0 if deps are being written to stdout.  */
503   char *deps_file;
504
505   /* Target-name to write with the dependency information.  */
506   char *deps_target;
507 };
508
509 #define CPP_TRADITIONAL(PFILE) (CPP_OPTIONS(PFILE)-> traditional)
510 #define CPP_WARN_UNDEF(PFILE) (CPP_OPTIONS(PFILE)->warn_undef)
511 #define CPP_C89(PFILE) (CPP_OPTIONS(PFILE)->c89)
512 #define CPP_PEDANTIC(PFILE) (CPP_OPTIONS (PFILE)->pedantic)
513 #define CPP_PRINT_DEPS(PFILE) (CPP_OPTIONS (PFILE)->print_deps)
514
515 /* Name under which this program was invoked.  */
516
517 extern char *progname;
518
519 /* The structure of a node in the hash table.  The hash table
520    has entries for all tokens defined by #define commands (type T_MACRO),
521    plus some special tokens like __LINE__ (these each have their own
522    type, and the appropriate code is run when that type of node is seen.
523    It does not contain control words like "#define", which are recognized
524    by a separate piece of code. */
525
526 /* different flavors of hash nodes --- also used in keyword table */
527 enum node_type {
528  T_DEFINE = 1,  /* the `#define' keyword */
529  T_INCLUDE,     /* the `#include' keyword */
530  T_INCLUDE_NEXT, /* the `#include_next' keyword */
531  T_IMPORT,      /* the `#import' keyword */
532  T_IFDEF,       /* the `#ifdef' keyword */
533  T_IFNDEF,      /* the `#ifndef' keyword */
534  T_IF,          /* the `#if' keyword */
535  T_ELSE,        /* `#else' */
536  T_PRAGMA,      /* `#pragma' */
537  T_ELIF,        /* `#elif' */
538  T_UNDEF,       /* `#undef' */
539  T_LINE,        /* `#line' */
540  T_ERROR,       /* `#error' */
541  T_WARNING,     /* `#warning' */
542  T_ENDIF,       /* `#endif' */
543  T_SCCS,        /* `#sccs', used on system V.  */
544  T_IDENT,       /* `#ident', used on system V.  */
545  T_ASSERT,      /* `#assert', taken from system V.  */
546  T_UNASSERT,    /* `#unassert', taken from system V.  */
547  T_SPECLINE,    /* special symbol `__LINE__' */
548  T_DATE,        /* `__DATE__' */
549  T_FILE,        /* `__FILE__' */
550  T_BASE_FILE,   /* `__BASE_FILE__' */
551  T_INCLUDE_LEVEL, /* `__INCLUDE_LEVEL__' */
552  T_VERSION,     /* `__VERSION__' */
553  T_SIZE_TYPE,   /* `__SIZE_TYPE__' */
554  T_PTRDIFF_TYPE,   /* `__PTRDIFF_TYPE__' */
555  T_WCHAR_TYPE,   /* `__WCHAR_TYPE__' */
556  T_USER_LABEL_PREFIX_TYPE, /* `__USER_LABEL_PREFIX__' */
557  T_REGISTER_PREFIX_TYPE,   /* `__REGISTER_PREFIX__' */
558  T_TIME,        /* `__TIME__' */
559  T_CONST,       /* Constant value, used by `__STDC__' */
560  T_MACRO,       /* macro defined by `#define' */
561  T_DISABLED,    /* macro temporarily turned off for rescan */
562  T_SPEC_DEFINED, /* special `defined' macro for use in #if statements */
563  T_PCSTRING,    /* precompiled string (hashval is KEYDEF *) */
564  T_UNUSED       /* Used for something not defined.  */
565  };
566
567 /* Structure returned by create_definition */
568 typedef struct macrodef MACRODEF;
569 struct macrodef
570 {
571   struct definition *defn;
572   unsigned char *symnam;
573   int symlen;
574 };
575
576 /* Structure allocated for every #define.  For a simple replacement
577    such as
578         #define foo bar ,
579    nargs = -1, the `pattern' list is null, and the expansion is just
580    the replacement text.  Nargs = 0 means a functionlike macro with no args,
581    e.g.,
582        #define getchar() getc (stdin) .
583    When there are args, the expansion is the replacement text with the
584    args squashed out, and the reflist is a list describing how to
585    build the output from the input: e.g., "3 chars, then the 1st arg,
586    then 9 chars, then the 3rd arg, then 0 chars, then the 2nd arg".
587    The chars here come from the expansion.  Whatever is left of the
588    expansion after the last arg-occurrence is copied after that arg.
589    Note that the reflist can be arbitrarily long---
590    its length depends on the number of times the arguments appear in
591    the replacement text, not how many args there are.  Example:
592    #define f(x) x+x+x+x+x+x+x would have replacement text "++++++" and
593    pattern list
594      { (0, 1), (1, 1), (1, 1), ..., (1, 1), NULL }
595    where (x, y) means (nchars, argno). */
596
597 typedef struct definition DEFINITION;
598 struct definition {
599   int nargs;
600   int length;                   /* length of expansion string */
601   int predefined;               /* True if the macro was builtin or */
602                                 /* came from the command line */
603   unsigned char *expansion;
604   int line;                     /* Line number of definition */
605   char *file;                   /* File of definition */
606   char rest_args;               /* Nonzero if last arg. absorbs the rest */
607   struct reflist {
608     struct reflist *next;
609     char stringify;             /* nonzero if this arg was preceded by a
610                                    # operator. */
611     char raw_before;            /* Nonzero if a ## operator before arg. */
612     char raw_after;             /* Nonzero if a ## operator after arg. */
613     char rest_args;             /* Nonzero if this arg. absorbs the rest */
614     int nchars;                 /* Number of literal chars to copy before
615                                    this arg occurrence.  */
616     int argno;                  /* Number of arg to substitute (origin-0) */
617   } *pattern;
618   union {
619     /* Names of macro args, concatenated in reverse order
620        with comma-space between them.
621        The only use of this is that we warn on redefinition
622        if this differs between the old and new definitions.  */
623     unsigned char *argnames;
624   } args;
625 };
626
627 extern unsigned char is_idchar[256];
628
629 /* Stack of conditionals currently in progress
630    (including both successful and failing conditionals).  */
631
632 struct if_stack {
633   struct if_stack *next;        /* for chaining to the next stack frame */
634   char *fname;          /* copied from input when frame is made */
635   int lineno;                   /* similarly */
636   int if_succeeded;             /* true if a leg of this if-group
637                                     has been passed through rescan */
638   unsigned char *control_macro; /* For #ifndef at start of file,
639                                    this is the macro name tested.  */
640   enum node_type type;          /* type of last directive seen in this group */
641 };
642 typedef struct if_stack IF_STACK_FRAME;
643
644 extern void cpp_buf_line_and_col PARAMS((cpp_buffer *, long *, long *));
645 extern cpp_buffer* cpp_file_buffer PARAMS((cpp_reader *));
646 extern void cpp_define PARAMS ((cpp_reader*, unsigned char *));
647
648 extern void cpp_error PVPROTO ((cpp_reader *, const char *, ...))
649   ATTRIBUTE_PRINTF_2;
650 extern void cpp_warning PVPROTO ((cpp_reader *, const char *, ...))
651   ATTRIBUTE_PRINTF_2;
652 extern void cpp_pedwarn PVPROTO ((cpp_reader *, const char *, ...))
653   ATTRIBUTE_PRINTF_2;
654 extern void cpp_error_with_line PVPROTO ((cpp_reader *, int, int, const char *, ...))
655   ATTRIBUTE_PRINTF_4;
656 extern void cpp_pedwarn_with_line PVPROTO ((cpp_reader *, int, int, const char *, ...))
657   ATTRIBUTE_PRINTF_4;
658 extern void cpp_pedwarn_with_file_and_line PVPROTO ((cpp_reader *, char *, int, const char *, ...))
659   ATTRIBUTE_PRINTF_4;
660 extern void cpp_error_from_errno PROTO ((cpp_reader *, const char *));
661 extern void cpp_perror_with_name PROTO ((cpp_reader *, const char *));
662 extern void v_cpp_message PROTO ((cpp_reader *, int, const char *, va_list));
663
664 extern void cpp_grow_buffer PARAMS ((cpp_reader *, long));
665 extern int cpp_parse_escape PARAMS ((cpp_reader *, char **));
666 extern cpp_buffer *cpp_push_buffer PARAMS ((cpp_reader *,
667                                             unsigned char *, long));
668 extern cpp_buffer *cpp_pop_buffer PARAMS ((cpp_reader *));
669
670 extern cpp_hashnode *cpp_lookup PARAMS ((cpp_reader *, const unsigned char *,
671                                          int, int));
672 extern void cpp_reader_init PARAMS ((cpp_reader *));
673 extern void cpp_options_init PARAMS ((cpp_options *));
674 extern int cpp_start_read PARAMS ((cpp_reader *, char *));
675 extern int cpp_read_check_assertion PARAMS ((cpp_reader *));
676 extern int scan_decls PARAMS ((cpp_reader *, int, char **));
677 extern void skip_rest_of_line PARAMS ((cpp_reader *));
678 extern void cpp_finish PARAMS ((cpp_reader *));
679
680 /* From cpperror.c */
681 extern void cpp_fatal PVPROTO ((cpp_reader *, const char *, ...))
682   ATTRIBUTE_PRINTF_2;
683 extern void cpp_message PVPROTO ((cpp_reader *, int, const char *, ...))
684   ATTRIBUTE_PRINTF_3;
685 extern void cpp_pfatal_with_name PROTO ((cpp_reader *, const char *));
686 extern void cpp_file_line_for_message PROTO ((cpp_reader *, char *, int, int));
687 extern void cpp_print_containing_files PROTO ((cpp_reader *));
688
689 #ifdef __cplusplus
690 }
691 #endif