OSDN Git Service

* cppexp.c: Update all code for new lexer interface.
[pf3gnuchains/gcc-fork.git] / gcc / cpplib.h
1 /* Definitions for CPP library.
2    Copyright (C) 1995, 96-99, 2000 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 #ifndef __GCC_CPPLIB__
23 #define __GCC_CPPLIB__
24
25 #include <sys/types.h>
26
27 #ifdef __cplusplus
28 extern "C" {
29 #endif
30
31 typedef struct cpp_reader cpp_reader;
32 typedef struct cpp_buffer cpp_buffer;
33 typedef struct cpp_options cpp_options;
34 typedef struct cpp_printer cpp_printer;
35 typedef struct cpp_token cpp_token;
36 typedef struct cpp_toklist cpp_toklist;
37 typedef struct cpp_name cpp_name;
38 typedef struct cpp_hashnode cpp_hashnode;
39
40 /* The first two groups, apart from '=', can appear in preprocessor
41    expressions.  This allows a lookup table to be implemented in
42    _cpp_parse_expr.
43
44    The first group, to CPP_LAST_EQ, can be immediately followed by an
45    '='.  The lexer needs operators ending in '=', like ">>=", to be in
46    the same order as their counterparts without the '=', like ">>".  */
47
48 /* Positions in the table.  */
49 #define CPP_LAST_EQ CPP_LSHIFT
50 #define CPP_FIRST_DIGRAPH CPP_HASH
51
52 #define TTYPE_TABLE                             \
53   T(CPP_EQ = 0,         "=")                    \
54   T(CPP_NOT,            "!")                    \
55   T(CPP_GREATER,        ">")    /* compare */   \
56   T(CPP_LESS,           "<")                    \
57   T(CPP_PLUS,           "+")    /* math */      \
58   T(CPP_MINUS,          "-")                    \
59   T(CPP_MULT,           "*")                    \
60   T(CPP_DIV,            "/")                    \
61   T(CPP_MOD,            "%")                    \
62   T(CPP_AND,            "&")    /* bit ops */   \
63   T(CPP_OR,             "|")                    \
64   T(CPP_XOR,            "^")                    \
65   T(CPP_RSHIFT,         ">>")                   \
66   T(CPP_LSHIFT,         "<<")                   \
67 \
68   T(CPP_COMPL,          "~")                    \
69   T(CPP_AND_AND,        "&&")   /* logical */   \
70   T(CPP_OR_OR,          "||")                   \
71   T(CPP_QUERY,          "?")                    \
72   T(CPP_COLON,          ":")                    \
73   T(CPP_COMMA,          ",")    /* grouping */  \
74   T(CPP_OPEN_PAREN,     "(")                    \
75   T(CPP_CLOSE_PAREN,    ")")                    \
76   T(CPP_EQ_EQ,          "==")   /* compare */   \
77   T(CPP_NOT_EQ,         "!=")                   \
78   T(CPP_GREATER_EQ,     ">=")                   \
79   T(CPP_LESS_EQ,        "<=")                   \
80 \
81   T(CPP_PLUS_EQ,        "+=")   /* math */      \
82   T(CPP_MINUS_EQ,       "-=")                   \
83   T(CPP_MULT_EQ,        "*=")                   \
84   T(CPP_DIV_EQ,         "/=")                   \
85   T(CPP_MOD_EQ,         "%=")                   \
86   T(CPP_AND_EQ,         "&=")   /* bit ops */   \
87   T(CPP_OR_EQ,          "|=")                   \
88   T(CPP_XOR_EQ,         "^=")                   \
89   T(CPP_RSHIFT_EQ,      ">>=")                  \
90   T(CPP_LSHIFT_EQ,      "<<=")                  \
91   /* Digraphs together, beginning with CPP_FIRST_DIGRAPH.  */   \
92   T(CPP_HASH,           "#")    /* digraphs */  \
93   T(CPP_PASTE,          "##")                   \
94   T(CPP_OPEN_SQUARE,    "[")                    \
95   T(CPP_CLOSE_SQUARE,   "]")                    \
96   T(CPP_OPEN_BRACE,     "{")                    \
97   T(CPP_CLOSE_BRACE,    "}")                    \
98   /* The remainder of the punctuation.  Order is not significant. */    \
99   T(CPP_SEMICOLON,      ";")    /* structure */ \
100   T(CPP_ELLIPSIS,       "...")                  \
101   T(CPP_BACKSLASH,      "\\")                   \
102   T(CPP_PLUS_PLUS,      "++")   /* increment */ \
103   T(CPP_MINUS_MINUS,    "--")                   \
104   T(CPP_DEREF,          "->")   /* accessors */ \
105   T(CPP_DOT,            ".")                    \
106   T(CPP_SCOPE,          "::")                   \
107   T(CPP_DEREF_STAR,     "->*")                  \
108   T(CPP_DOT_STAR,       ".*")                   \
109   T(CPP_MIN,            "<?")   /* extension */ \
110   T(CPP_MAX,            ">?")                   \
111   T(CPP_PLACEMARKER,    "")     /* Placemarker token.  */  \
112   C(CPP_OTHER,          0)      /* stray punctuation */    \
113 \
114   I(CPP_NAME,           0)      /* word */      \
115   I(CPP_INT,            0)      /* 23 */        \
116   I(CPP_FLOAT,          0)      /* 3.14159 */   \
117   I(CPP_NUMBER,         0)      /* 34_be+ta  */ \
118   S(CPP_CHAR,           0)      /* 'char' */    \
119   S(CPP_WCHAR,          0)      /* L'char' */   \
120   S(CPP_STRING,         0)      /* "string" */  \
121   S(CPP_WSTRING,        0)      /* L"string" */ \
122 \
123   I(CPP_COMMENT,        0)      /* Only if output comments.  */ \
124   N(CPP_MACRO_ARG,      0)      /* Macro argument.  */          \
125   N(CPP_EOF,            0)      /* End of file.  */             \
126   I(CPP_HEADER_NAME,    0)      /* <stdio.h> in #include */
127
128 #define T(e, s) e,
129 #define I(e, s) e,
130 #define S(e, s) e,
131 #define C(e, s) e,
132 #define N(e, s) e,
133 enum cpp_ttype
134 {
135   TTYPE_TABLE
136   N_TTYPES
137 };
138 #undef T
139 #undef I
140 #undef S
141 #undef C
142 #undef N
143
144 /* Payload of a NAME, NUMBER, FLOAT, STRING, or COMMENT token.  */
145 struct cpp_name
146 {
147   unsigned int len;
148   const unsigned char *text;
149 };
150
151 /* Flags for the cpp_token structure.  */
152 #define PREV_WHITE      (1 << 0) /* If whitespace before this token.  */
153 #define BOL             (1 << 1) /* Beginning of logical line.  */
154 #define DIGRAPH         (1 << 2) /* If it was a digraph.  */
155 #define STRINGIFY_ARG   (1 << 3) /* If macro argument to be stringified.  */
156 #define PASTE_LEFT      (1 << 4) /* If on LHS of a ## operator.  */
157 #define PASTED          (1 << 5) /* The result of a ## operator.  */
158
159 /* A preprocessing token.  This has been carefully packed and should
160    occupy 16 bytes on 32-bit hosts and 24 bytes on 64-bit hosts.  */
161 struct cpp_token
162 {
163   unsigned int line;            /* starting line number of this token */
164   unsigned short col;           /* starting column of this token */
165   ENUM_BITFIELD(cpp_ttype) type : CHAR_BIT;  /* token type */
166   unsigned char flags;          /* flags - see above */
167
168   union
169   {
170     HOST_WIDEST_INT integer;    /* an integer */
171     struct cpp_name name;       /* a string */
172     unsigned int aux;           /* argument no. for a CPP_MACRO_ARG, or
173                                    character represented by CPP_OTHER.  */
174   } val;
175 };
176
177 /* cpp_toklist flags.  */
178 #define LIST_OFFSET     (1 << 0)
179 #define VAR_ARGS        (1 << 1)
180 #define GNU_REST_ARGS   (1 << 2) /* Set in addition to VAR_ARGS.  */
181 #define BEG_OF_FILE     (1 << 3)
182
183 struct directive;               /* These are deliberately incomplete.  */
184 struct answer;
185 struct macro_args;
186 struct cpp_context;
187
188 struct cpp_toklist
189 {
190   cpp_token *tokens;            /* actual tokens as an array */
191   unsigned int tokens_used;     /* tokens used */
192   unsigned int tokens_cap;      /* tokens allocated */
193
194   unsigned char *namebuf;       /* names buffer */
195   unsigned int name_used;       /* _bytes_ used */
196   unsigned int name_cap;        /* _bytes_ allocated */
197
198   /* If the list represents a directive, this points to it.  */
199   const struct directive *directive;
200
201   const char *file;             /* in file name */
202   unsigned int line;            /* starting line number */
203
204   unsigned short params_len;    /* length of macro parameter names.  */
205
206   short int paramc;             /* no. of macro params (-1 = obj-like).  */
207
208   /* Per-list flags, see above */
209   unsigned short flags;
210 };
211
212 struct cpp_buffer
213 {
214   const unsigned char *cur;      /* current position */
215   const unsigned char *rlimit; /* end of valid data */
216   const unsigned char *buf;      /* entire buffer */
217   const unsigned char *line_base; /* start of current line */
218
219   struct cpp_buffer *prev;
220
221   /* Filename specified with #line command.  */
222   const char *nominal_fname;
223
224   /* Actual directory of this file, used only for "" includes */
225   struct file_name_list *actual_dir;
226
227   /* Pointer into the include table.  Used for include_next and
228      to record control macros. */
229   struct include_file *inc;
230
231   /* Value of if_stack at start of this file.
232      Used to prohibit unmatched #endif (etc) in an include file.  */
233   struct if_stack *if_stack;
234
235   /* Line number at line_base (above). */
236   unsigned int lineno;
237
238   /* True if we have already warned about C++ comments in this file.
239      The warning happens only for C89 extended mode with -pedantic on,
240      or for -Wtraditional, and only once per file (otherwise it would
241      be far too noisy).  */
242   char warned_cplusplus_comments;
243
244   /* True if this buffer's data is mmapped.  */
245   char mapped;
246 };
247
248 struct file_name_map_list;
249 struct htab;
250
251 /* Maximum nesting of cpp_buffers.  We use a static limit, partly for
252    efficiency, and partly to limit runaway recursion.  */
253 #define CPP_STACK_MAX 200
254
255 /* Values for opts.dump_macros.
256   dump_only means inhibit output of the preprocessed text
257              and instead output the definitions of all user-defined
258              macros in a form suitable for use as input to cpp.
259    dump_names means pass #define and the macro name through to output.
260    dump_definitions means pass the whole definition (plus #define) through
261 */
262 enum { dump_none = 0, dump_only, dump_names, dump_definitions };
263
264 /* This structure is nested inside struct cpp_reader, and
265    carries all the options visible to the command line.  */
266 struct cpp_options
267 {
268   /* Name of input and output files.  */
269   const char *in_fname;
270   const char *out_fname;
271
272   /* Characters between tab stops.  */
273   unsigned int tabstop;
274
275   /* Pending options - -D, -U, -A, -I, -ixxx. */
276   struct cpp_pending *pending;
277
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;
281
282   /* Target-name to write with the dependency information.  */
283   char *deps_target;
284
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> */
288
289   /* Map between header names and file names, used only on DOS where
290      file names are limited in length.  */
291   struct file_name_map_list *map_list;
292
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
298   /* Non-0 means -v, so print the full set of include dirs.  */
299   unsigned char verbose;
300
301   /* Nonzero means use extra default include directories for C++.  */
302   unsigned char cplusplus;
303
304   /* Nonzero means handle cplusplus style comments */
305   unsigned char cplusplus_comments;
306
307   /* Nonzero means handle #import, for objective C.  */
308   unsigned char objc;
309
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).  */
314   unsigned char lang_asm;
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.  */
319   unsigned char lang_fortran;
320
321   /* Nonzero means handle CHILL comment syntax and output CHILL string
322      delimiters for __DATE__ etc. */
323   unsigned char chill;
324
325   /* Nonzero means don't copy comments into the output file.  */
326   unsigned char discard_comments;
327
328   /* Nonzero means process the ISO trigraph sequences.  */
329   unsigned char trigraphs;
330
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;
335
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;
339
340   /* If true, fopen (deps_file, "a") else fopen (deps_file, "w"). */
341   unsigned char print_deps_append;
342
343   /* Nonzero means print names of header files (-H).  */
344   unsigned char print_include_names;
345
346   /* Nonzero means cpp_pedwarn causes a hard error.  */
347   unsigned char pedantic_errors;
348
349   /* Nonzero means don't print warning messages.  */
350   unsigned char inhibit_warnings;
351
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;
355
356   /* Nonzero means warn if slash-star appears in a comment.  */
357   unsigned char warn_comments;
358
359   /* Nonzero means warn if there are any trigraphs.  */
360   unsigned char warn_trigraphs;
361
362   /* Nonzero means warn if #import is used.  */
363   unsigned char warn_import;
364
365   /* Nonzero means warn if a macro argument is (or would be)
366      stringified with -traditional, and warn about directives
367      with the # indented from the beginning of the line.  */
368   unsigned char warn_traditional;
369
370   /* Nonzero means warn if ## is applied to two tokens that cannot be
371      pasted together.  */
372   unsigned char warn_paste;
373
374   /* Nonzero means turn warnings into errors.  */
375   unsigned char warnings_are_errors;
376
377   /* Nonzero causes output not to be done, but directives such as
378      #define that have side effects are still obeyed.  */
379   unsigned char no_output;
380
381   /* Nonzero means we should look for header.gcc files that remap file
382      names.  */
383   unsigned char remap;
384
385   /* Nonzero means don't output line number information.  */
386   unsigned char no_line_commands;
387
388   /* Nonzero means -I- has been seen, so don't look for #include "foo"
389      the source-file directory.  */
390   unsigned char ignore_srcdir;
391
392   /* Zero means dollar signs are punctuation. */
393   unsigned char dollars_in_ident;
394
395   /* Nonzero means try to imitate old fashioned non-ISO preprocessor.  */
396   unsigned char traditional;
397
398   /* Nonzero means warn if undefined identifiers are evaluated in an #if.  */
399   unsigned char warn_undef;
400
401   /* Nonzero for the 1989 C Standard, including corrigenda and amendments.  */
402   unsigned char c89;
403
404   /* Nonzero for the 1999 C Standard, including corrigenda and amendments.  */
405   unsigned char c99;
406
407   /* Nonzero means give all the error messages the ANSI standard requires.  */
408   unsigned char pedantic;
409
410   /* Nonzero means we're looking at already preprocessed code, so don't
411      bother trying to do macro expansion and whatnot.  */
412   unsigned char preprocessed;
413
414   /* Nonzero disables all the standard directories for headers.  */
415   unsigned char no_standard_includes;
416
417   /* Nonzero disables the C++-specific standard directories for headers.  */
418   unsigned char no_standard_cplusplus_includes;
419
420   /* Nonzero means dump macros in some fashion - see above.  */
421   unsigned char dump_macros;
422
423   /* Nonzero means pass all #define and #undef directives which we
424      actually process through to the output stream.  This feature is
425      used primarily to allow cc1 to record the #defines and #undefs
426      for the sake of debuggers which understand about preprocessor
427      macros, but it may also be useful with -E to figure out how
428      symbols are defined, and where they are defined.  */
429   unsigned char debug_output;
430
431   /* Nonzero means pass #include lines through to the output.  */
432   unsigned char dump_includes;
433
434   /* Print column number in error messages.  */
435   unsigned char show_column;
436 };
437
438 /* A cpp_reader encapsulates the "state" of a pre-processor run.
439    Applying cpp_get_token repeatedly yields a stream of pre-processor
440    tokens.  Usually, there is only one cpp_reader object active. */
441
442 struct cpp_reader
443 {
444   /* HACK FIXME.  Maybe make into cpp_printer printer later.  */
445   cpp_printer *printer;
446
447   /* Top of buffer stack.  */
448   cpp_buffer *buffer;
449
450   /* A buffer used for both for cpp_get_token's output, and also internally. */
451   unsigned char *token_buffer;
452   /* Allocated size of token_buffer.  CPP_RESERVE allocates space.  */
453   unsigned int token_buffer_size;
454   /* End of the written part of token_buffer. */
455   unsigned char *limit;
456
457   /* Error counter for exit code */
458   unsigned int errors;
459
460   /* Line and column where a newline was first seen in a string constant.  */
461   unsigned int multiline_string_line;
462   unsigned int multiline_string_column;
463
464   /* Current depth in #include directives that use <...>.  */
465   unsigned int system_include_depth;
466
467   /* Current depth of buffer stack. */
468   unsigned int buffer_stack_depth;
469
470   /* Current depth in #include directives.  */
471   unsigned int include_depth;
472
473   /* Hash table of macros and assertions.  See cpphash.c */
474   struct htab *hashtab;
475
476   /* Tree of other included files.  See cppfiles.c */
477   struct splay_tree_s *all_include_files;
478
479   /* Chain of `actual directory' file_name_list entries,
480      for "" inclusion. */
481   struct file_name_list *actual_dirs;
482
483   /* Current maximum length of directory names in the search path
484      for include files.  (Altered as we get more of them.)  */
485   unsigned int max_include_len;
486
487   /* Potential controlling macro for the current buffer.  This is only
488      live between the #endif and the end of file, and there can only
489      be one at a time, so it is per-reader not per-buffer.  */
490   const cpp_hashnode *potential_control_macro;
491
492   /* Token column position adjustment owing to tabs in whitespace.  */
493   unsigned int col_adjust;
494
495   /* Token list used to store logical lines with new lexer.  */
496   cpp_toklist token_list;
497
498   /* Temporary token store.  */
499   cpp_token **temp_tokens;
500   unsigned int temp_cap;
501   unsigned int temp_alloced;
502   unsigned int temp_used;
503
504   /* Date and time tokens.  Calculated together if either is requested.  */
505   cpp_token *date;
506   cpp_token *time;
507
508   /* The # of a the current directive. It may not be first in line if
509      we append, and finding it is tedious.  */
510   const cpp_token *first_directive_token;
511
512   /* Context stack.  Used for macro expansion and for determining
513      which macros are disabled.  */
514   unsigned int context_cap;
515   unsigned int cur_context;
516   unsigned int no_expand_level;
517   unsigned int paste_level;
518   struct cpp_context *contexts;
519
520   /* Current arguments when scanning arguments. Used for pointer
521      fix-up.  */
522   struct macro_args *args;
523
524   /* Buffer of -M output.  */
525   struct deps *deps;
526
527   /* Obstack holding all macro hash nodes.  This never shrinks.
528      See cpphash.c */
529   struct obstack *hash_ob;
530
531   /* Obstack holding buffer and conditional structures.  This is a
532      real stack.  See cpplib.c */
533   struct obstack *buffer_ob;
534
535   /* User visible options.  */
536   struct cpp_options opts;
537
538   /* Nonzero means we have printed (while error reporting) a list of
539      containing files that matches the current status.  */
540   unsigned char input_stack_listing_current;
541
542   /* We're printed a warning recommending against using #import.  */
543   unsigned char import_warning;
544
545   /* True after cpp_start_read completes.  Used to inhibit some
546      warnings while parsing the command line.  */
547   unsigned char done_initializing;
548
549   /* True if we are skipping a failed conditional group.  */
550   unsigned char skipping;
551
552   /* True if we need to save parameter spellings - only if -pedantic,
553      or we might need to write out definitions.  */
554   unsigned char save_parameter_spellings;
555
556   /* If we're in lex_line.  */
557   unsigned char in_lex_line;
558
559   /* True if output_line_command needs to output a newline.  */
560   unsigned char need_newline;
561 };
562
563 /* struct cpp_printer encapsulates state used to convert the stream of
564    tokens coming from cpp_get_token back into a text file.  Not
565    everyone wants to do that, hence we separate the function.  */
566
567 struct cpp_printer
568 {
569   FILE *outf;                   /* stream to write to */
570   const char *last_fname;       /* previous file name */
571   unsigned int last_id;         /* did we just push? */
572   unsigned int lineno;          /* line currently being written */
573   unsigned int written;         /* low water mark in token buffer */
574 };
575
576 #define CPP_FATAL_LIMIT 1000
577 /* True if we have seen a "fatal" error. */
578 #define CPP_FATAL_ERRORS(READER) ((READER)->errors >= CPP_FATAL_LIMIT)
579
580 /* Macros for manipulating the token_buffer. */
581
582 /* Number of characters currently in PFILE's output buffer. */
583 #define CPP_WRITTEN(PFILE) ((size_t)((PFILE)->limit - (PFILE)->token_buffer))
584 #define CPP_PWRITTEN(PFILE) ((PFILE)->limit)
585 #define CPP_ADJUST_WRITTEN(PFILE,DELTA) ((PFILE)->limit += (DELTA))
586 #define CPP_SET_WRITTEN(PFILE,N) ((PFILE)->limit = (PFILE)->token_buffer + (N))
587
588 #define CPP_OPTION(PFILE, OPTION) ((PFILE)->opts.OPTION)
589 #define CPP_BUFFER(PFILE) ((PFILE)->buffer)
590 #define CPP_BUF_LINE(BUF) ((BUF)->lineno)
591 #define CPP_BUF_COLUMN(BUF, CUR) ((CUR) - (BUF)->line_base + pfile->col_adjust)
592 #define CPP_BUF_COL(BUF) CPP_BUF_COLUMN(BUF, (BUF)->cur)
593
594 /* Name under which this program was invoked.  */
595 extern const char *progname;
596
597 /* The structure of a node in the hash table.  The hash table
598    has entries for all tokens defined by #define commands (type T_MACRO),
599    plus some special tokens like __LINE__ (these each have their own
600    type, and the appropriate code is run when that type of node is seen.
601    It does not contain control words like "#define", which are recognized
602    by a separate piece of code. */
603
604 /* different flavors of hash nodes */
605 enum node_type
606 {
607   T_VOID = 0,      /* no definition yet */
608   T_SPECLINE,      /* `__LINE__' */
609   T_DATE,          /* `__DATE__' */
610   T_FILE,          /* `__FILE__' */
611   T_BASE_FILE,     /* `__BASE_FILE__' */
612   T_INCLUDE_LEVEL, /* `__INCLUDE_LEVEL__' */
613   T_TIME,          /* `__TIME__' */
614   T_STDC,          /* `__STDC__' */
615   T_POISON,        /* poisoned identifier */
616   T_MACRO,         /* a macro, either object-like or function-like */
617   T_ASSERTION      /* predicate for #assert */
618 };
619
620 /* There is a slot in the hashnode for use by front ends when integrated
621    with cpplib.  It holds a tree (see tree.h) but we mustn't drag that
622    header into every user of cpplib.h.  cpplib does not do anything with
623    this slot except clear it when a new node is created.  */
624 union tree_node;
625
626 struct cpp_hashnode
627 {
628   unsigned int hash;                    /* cached hash value */
629   unsigned short length;                /* length of name */
630   ENUM_BITFIELD(node_type) type : 8;    /* node type */
631
632   union
633   {
634     const cpp_toklist *expansion;       /* a macro's replacement list.  */
635     struct answer *answers;             /* answers to an assertion.  */
636   } value;
637
638   union tree_node *fe_value;            /* front end value */
639
640   const unsigned char name[1];          /* name[length] */
641 };
642
643 extern int cpp_handle_options PARAMS ((cpp_reader *, int, char **));
644 extern void cpp_reader_init PARAMS ((cpp_reader *));
645 extern cpp_printer *cpp_printer_init PARAMS ((cpp_reader *, cpp_printer *));
646 extern int cpp_start_read PARAMS ((cpp_reader *, cpp_printer *, const char *));
647 extern void cpp_output_tokens PARAMS ((cpp_reader *, cpp_printer *,
648                                        unsigned int));
649 extern void cpp_finish PARAMS ((cpp_reader *, cpp_printer *));
650 extern void cpp_cleanup PARAMS ((cpp_reader *));
651
652 extern const cpp_token *cpp_get_token PARAMS ((cpp_reader *));
653
654 extern void cpp_define PARAMS ((cpp_reader *, const char *));
655 extern void cpp_assert PARAMS ((cpp_reader *, const char *));
656 extern void cpp_undef  PARAMS ((cpp_reader *, const char *));
657 extern void cpp_unassert PARAMS ((cpp_reader *, const char *));
658
659 extern void cpp_free_token_list PARAMS ((cpp_toklist *));
660
661 /* N.B. The error-message-printer prototypes have not been nicely
662    formatted because exgettext needs to see 'msgid' on the same line
663    as the name of the function in order to work properly.  Only the
664    string argument gets a name in an effort to keep the lines from
665    getting ridiculously oversized.  */
666
667 extern void cpp_ice PARAMS ((cpp_reader *, const char *msgid, ...))
668   ATTRIBUTE_PRINTF_2;
669 extern void cpp_fatal PARAMS ((cpp_reader *, const char *msgid, ...))
670   ATTRIBUTE_PRINTF_2;
671 extern void cpp_error PARAMS ((cpp_reader *, const char *msgid, ...))
672   ATTRIBUTE_PRINTF_2;
673 extern void cpp_warning PARAMS ((cpp_reader *, const char *msgid, ...))
674   ATTRIBUTE_PRINTF_2;
675 extern void cpp_pedwarn PARAMS ((cpp_reader *, const char *msgid, ...))
676   ATTRIBUTE_PRINTF_2;
677 extern void cpp_notice PARAMS ((cpp_reader *, const char *msgid, ...))
678   ATTRIBUTE_PRINTF_2;
679 extern void cpp_error_with_line PARAMS ((cpp_reader *, int, int, const char *msgid, ...))
680   ATTRIBUTE_PRINTF_4;
681 extern void cpp_warning_with_line PARAMS ((cpp_reader *, int, int, const char *msgid, ...))
682   ATTRIBUTE_PRINTF_4;
683 extern void cpp_pedwarn_with_line PARAMS ((cpp_reader *, int, int, const char *msgid, ...))
684   ATTRIBUTE_PRINTF_4;
685 extern void cpp_pedwarn_with_file_and_line PARAMS ((cpp_reader *, const char *, int, int, const char *msgid, ...))
686   ATTRIBUTE_PRINTF_5;
687 extern void cpp_error_from_errno        PARAMS ((cpp_reader *, const char *));
688 extern void cpp_notice_from_errno       PARAMS ((cpp_reader *, const char *));
689
690 /* In cpplex.c */
691 extern cpp_buffer *cpp_push_buffer      PARAMS ((cpp_reader *,
692                                                  const unsigned char *, long));
693 extern cpp_buffer *cpp_pop_buffer       PARAMS ((cpp_reader *));
694 extern void cpp_scan_buffer             PARAMS ((cpp_reader *, cpp_printer *));
695 extern void cpp_scan_buffer_nooutput    PARAMS ((cpp_reader *));
696 extern int cpp_idcmp                    PARAMS ((const unsigned char *,
697                                                  size_t, const char *));
698
699 /* In cpphash.c */
700 extern int cpp_defined                  PARAMS ((cpp_reader *,
701                                                  const unsigned char *, int));
702 extern cpp_hashnode *cpp_lookup         PARAMS ((cpp_reader *,
703                                                  const unsigned char *, int));
704
705 /* In cppfiles.c */
706 extern int cpp_included                 PARAMS ((cpp_reader *, const char *));
707 extern int cpp_read_file                PARAMS ((cpp_reader *, const char *));
708 extern void cpp_make_system_header      PARAMS ((cpp_reader *,
709                                                  cpp_buffer *, int));
710
711 #ifdef __cplusplus
712 }
713 #endif
714 #endif /* __GCC_CPPLIB__ */