comparison libcpp/include/cpplib.h @ 55:77e2b8dfacca gcc-4.4.5

update it from 4.4.3 to 4.5.0
author ryoma <e075725@ie.u-ryukyu.ac.jp>
date Fri, 12 Feb 2010 23:39:51 +0900
parents a06113de4d67
children b7f97abdc517
comparison
equal deleted inserted replaced
52:c156f1bd5cd9 55:77e2b8dfacca
25 #define LIBCPP_CPPLIB_H 25 #define LIBCPP_CPPLIB_H
26 26
27 #include <sys/types.h> 27 #include <sys/types.h>
28 #include "symtab.h" 28 #include "symtab.h"
29 #include "line-map.h" 29 #include "line-map.h"
30
31 #ifdef __cplusplus
32 extern "C" {
33 #endif
34 30
35 typedef struct cpp_reader cpp_reader; 31 typedef struct cpp_reader cpp_reader;
36 typedef struct cpp_buffer cpp_buffer; 32 typedef struct cpp_buffer cpp_buffer;
37 typedef struct cpp_options cpp_options; 33 typedef struct cpp_options cpp_options;
38 typedef struct cpp_token cpp_token; 34 typedef struct cpp_token cpp_token;
129 \ 125 \
130 TK(STRING, LITERAL) /* "string" */ \ 126 TK(STRING, LITERAL) /* "string" */ \
131 TK(WSTRING, LITERAL) /* L"string" */ \ 127 TK(WSTRING, LITERAL) /* L"string" */ \
132 TK(STRING16, LITERAL) /* u"string" */ \ 128 TK(STRING16, LITERAL) /* u"string" */ \
133 TK(STRING32, LITERAL) /* U"string" */ \ 129 TK(STRING32, LITERAL) /* U"string" */ \
130 TK(UTF8STRING, LITERAL) /* u8"string" */ \
134 TK(OBJC_STRING, LITERAL) /* @"string" - Objective-C */ \ 131 TK(OBJC_STRING, LITERAL) /* @"string" - Objective-C */ \
135 TK(HEADER_NAME, LITERAL) /* <stdio.h> in #include */ \ 132 TK(HEADER_NAME, LITERAL) /* <stdio.h> in #include */ \
136 \ 133 \
137 TK(COMMENT, LITERAL) /* Only if output comments. */ \ 134 TK(COMMENT, LITERAL) /* Only if output comments. */ \
138 /* SPELL_LITERAL happens to DTRT. */ \ 135 /* SPELL_LITERAL happens to DTRT. */ \
160 /* C language kind, used when calling cpp_create_reader. */ 157 /* C language kind, used when calling cpp_create_reader. */
161 enum c_lang {CLK_GNUC89 = 0, CLK_GNUC99, CLK_STDC89, CLK_STDC94, CLK_STDC99, 158 enum c_lang {CLK_GNUC89 = 0, CLK_GNUC99, CLK_STDC89, CLK_STDC94, CLK_STDC99,
162 CLK_GNUCXX, CLK_CXX98, CLK_GNUCXX0X, CLK_CXX0X, CLK_ASM}; 159 CLK_GNUCXX, CLK_CXX98, CLK_GNUCXX0X, CLK_CXX0X, CLK_ASM};
163 160
164 /* Payload of a NUMBER, STRING, CHAR or COMMENT token. */ 161 /* Payload of a NUMBER, STRING, CHAR or COMMENT token. */
165 struct cpp_string GTY(()) 162 struct GTY(()) cpp_string {
166 {
167 unsigned int len; 163 unsigned int len;
168 const unsigned char *text; 164 const unsigned char *text;
169 }; 165 };
170 166
171 /* Flags for the cpp_token structure. */ 167 /* Flags for the cpp_token structure. */
176 #define NAMED_OP (1 << 4) /* C++ named operators. */ 172 #define NAMED_OP (1 << 4) /* C++ named operators. */
177 #define NO_EXPAND (1 << 5) /* Do not macro-expand this token. */ 173 #define NO_EXPAND (1 << 5) /* Do not macro-expand this token. */
178 #define BOL (1 << 6) /* Token at beginning of line. */ 174 #define BOL (1 << 6) /* Token at beginning of line. */
179 #define PURE_ZERO (1 << 7) /* Single 0 digit, used by the C++ frontend, 175 #define PURE_ZERO (1 << 7) /* Single 0 digit, used by the C++ frontend,
180 set in c-lex.c. */ 176 set in c-lex.c. */
177 #define SP_DIGRAPH (1 << 8) /* # or ## token was a digraph. */
178 #define SP_PREV_WHITE (1 << 9) /* If whitespace before a ##
179 operator, or before this token
180 after a # operator. */
181 181
182 /* Specify which field, if any, of the cpp_token union is used. */ 182 /* Specify which field, if any, of the cpp_token union is used. */
183 183
184 enum cpp_token_fld_kind { 184 enum cpp_token_fld_kind {
185 CPP_TOKEN_FLD_NODE, 185 CPP_TOKEN_FLD_NODE,
186 CPP_TOKEN_FLD_SOURCE, 186 CPP_TOKEN_FLD_SOURCE,
187 CPP_TOKEN_FLD_STR, 187 CPP_TOKEN_FLD_STR,
188 CPP_TOKEN_FLD_ARG_NO, 188 CPP_TOKEN_FLD_ARG_NO,
189 CPP_TOKEN_FLD_TOKEN_NO,
189 CPP_TOKEN_FLD_PRAGMA, 190 CPP_TOKEN_FLD_PRAGMA,
190 CPP_TOKEN_FLD_NONE 191 CPP_TOKEN_FLD_NONE
191 }; 192 };
192 193
194 /* A macro argument in the cpp_token union. */
195 struct GTY(()) cpp_macro_arg {
196 /* Argument number. */
197 unsigned int arg_no;
198 };
199
200 /* An identifier in the cpp_token union. */
201 struct GTY(()) cpp_identifier {
202 /* The canonical (UTF-8) spelling of the identifier. */
203 cpp_hashnode *
204 GTY ((nested_ptr (union tree_node,
205 "%h ? CPP_HASHNODE (GCC_IDENT_TO_HT_IDENT (%h)) : NULL",
206 "%h ? HT_IDENT_TO_GCC_IDENT (HT_NODE (%h)) : NULL")))
207 node;
208 };
209
193 /* A preprocessing token. This has been carefully packed and should 210 /* A preprocessing token. This has been carefully packed and should
194 occupy 16 bytes on 32-bit hosts and 24 bytes on 64-bit hosts. */ 211 occupy 16 bytes on 32-bit hosts and 24 bytes on 64-bit hosts. */
195 struct cpp_token GTY(()) 212 struct GTY(()) cpp_token {
196 {
197 source_location src_loc; /* Location of first char of token. */ 213 source_location src_loc; /* Location of first char of token. */
198 ENUM_BITFIELD(cpp_ttype) type : CHAR_BIT; /* token type */ 214 ENUM_BITFIELD(cpp_ttype) type : CHAR_BIT; /* token type */
199 unsigned char flags; /* flags - see above */ 215 unsigned short flags; /* flags - see above */
200 216
201 union cpp_token_u 217 union cpp_token_u
202 { 218 {
203 /* An identifier. */ 219 /* An identifier. */
204 cpp_hashnode * 220 struct cpp_identifier GTY ((tag ("CPP_TOKEN_FLD_NODE"))) node;
205 GTY ((nested_ptr (union tree_node,
206 "%h ? CPP_HASHNODE (GCC_IDENT_TO_HT_IDENT (%h)) : NULL",
207 "%h ? HT_IDENT_TO_GCC_IDENT (HT_NODE (%h)) : NULL"),
208 tag ("CPP_TOKEN_FLD_NODE")))
209 node;
210 221
211 /* Inherit padding from this token. */ 222 /* Inherit padding from this token. */
212 cpp_token * GTY ((tag ("CPP_TOKEN_FLD_SOURCE"))) source; 223 cpp_token * GTY ((tag ("CPP_TOKEN_FLD_SOURCE"))) source;
213 224
214 /* A string, or number. */ 225 /* A string, or number. */
215 struct cpp_string GTY ((tag ("CPP_TOKEN_FLD_STR"))) str; 226 struct cpp_string GTY ((tag ("CPP_TOKEN_FLD_STR"))) str;
216 227
217 /* Argument no. for a CPP_MACRO_ARG. */ 228 /* Argument no. for a CPP_MACRO_ARG. */
218 unsigned int GTY ((tag ("CPP_TOKEN_FLD_ARG_NO"))) arg_no; 229 struct cpp_macro_arg GTY ((tag ("CPP_TOKEN_FLD_ARG_NO"))) macro_arg;
230
231 /* Original token no. for a CPP_PASTE (from a sequence of
232 consecutive paste tokens in a macro expansion). */
233 unsigned int GTY ((tag ("CPP_TOKEN_FLD_TOKEN_NO"))) token_no;
219 234
220 /* Caller-supplied identifier for a CPP_PRAGMA. */ 235 /* Caller-supplied identifier for a CPP_PRAGMA. */
221 unsigned int GTY ((tag ("CPP_TOKEN_FLD_PRAGMA"))) pragma; 236 unsigned int GTY ((tag ("CPP_TOKEN_FLD_PRAGMA"))) pragma;
222 } GTY ((desc ("cpp_token_val_index (&%1)"))) val; 237 } GTY ((desc ("cpp_token_val_index (&%1)"))) val;
223 }; 238 };
300 unsigned char uliterals; 315 unsigned char uliterals;
301 316
302 /* Nonzero means print names of header files (-H). */ 317 /* Nonzero means print names of header files (-H). */
303 unsigned char print_include_names; 318 unsigned char print_include_names;
304 319
305 /* Nonzero means cpp_pedwarn causes a hard error. */
306 unsigned char pedantic_errors;
307
308 /* Nonzero means don't print warning messages. */
309 unsigned char inhibit_warnings;
310
311 /* Nonzero means complain about deprecated features. */ 320 /* Nonzero means complain about deprecated features. */
312 unsigned char warn_deprecated; 321 unsigned char warn_deprecated;
313
314 /* Nonzero means don't suppress warnings from system headers. */
315 unsigned char warn_system_headers;
316
317 /* Nonzero means don't print error messages. Has no option to
318 select it, but can be set by a user of cpplib (e.g. fix-header). */
319 unsigned char inhibit_errors;
320 322
321 /* Nonzero means warn if slash-star appears in a comment. */ 323 /* Nonzero means warn if slash-star appears in a comment. */
322 unsigned char warn_comments; 324 unsigned char warn_comments;
323 325
324 /* Nonzero means warn if a user-supplied include directory does not 326 /* Nonzero means warn if a user-supplied include directory does not
351 353
352 /* Nonzero means warn about builtin macros that are redefined or 354 /* Nonzero means warn about builtin macros that are redefined or
353 explicitly undefined. */ 355 explicitly undefined. */
354 unsigned char warn_builtin_macro_redefined; 356 unsigned char warn_builtin_macro_redefined;
355 357
356 /* Nonzero means turn warnings into errors. */
357 unsigned char warnings_are_errors;
358
359 /* Nonzero means we should look for header.gcc files that remap file 358 /* Nonzero means we should look for header.gcc files that remap file
360 names. */ 359 names. */
361 unsigned char remap; 360 unsigned char remap;
362 361
363 /* Zero means dollar signs are punctuation. */ 362 /* Zero means dollar signs are punctuation. */
392 /* Print column number in error messages. */ 391 /* Print column number in error messages. */
393 unsigned char show_column; 392 unsigned char show_column;
394 393
395 /* Nonzero means handle C++ alternate operator names. */ 394 /* Nonzero means handle C++ alternate operator names. */
396 unsigned char operator_names; 395 unsigned char operator_names;
396
397 /* Nonzero means warn about use of C++ alternate operator names. */
398 unsigned char warn_cxx_operator_names;
397 399
398 /* True for traditional preprocessing. */ 400 /* True for traditional preprocessing. */
399 unsigned char traditional; 401 unsigned char traditional;
400 402
401 /* Holds the name of the target (execution) character set. */ 403 /* Holds the name of the target (execution) character set. */
430 one. */ 432 one. */
431 bool phony_targets; 433 bool phony_targets;
432 434
433 /* If true, no dependency is generated on the main file. */ 435 /* If true, no dependency is generated on the main file. */
434 bool ignore_main_file; 436 bool ignore_main_file;
437
438 /* If true, intend to use the preprocessor output (e.g., for compilation)
439 in addition to the dependency info. */
440 bool need_preprocessor_output;
435 } deps; 441 } deps;
436 442
437 /* Target-specific features set by the front end or client. */ 443 /* Target-specific features set by the front end or client. */
438 444
439 /* Precision for target CPP arithmetic, target characters, target 445 /* Precision for target CPP arithmetic, target characters, target
447 address in memory. */ 453 address in memory. */
448 bool bytes_big_endian; 454 bool bytes_big_endian;
449 455
450 /* Nonzero means __STDC__ should have the value 0 in system headers. */ 456 /* Nonzero means __STDC__ should have the value 0 in system headers. */
451 unsigned char stdc_0_in_system_headers; 457 unsigned char stdc_0_in_system_headers;
452
453 /* True means error callback should be used for diagnostics. */
454 bool client_diagnostic;
455 458
456 /* True disables tokenization outside of preprocessing directives. */ 459 /* True disables tokenization outside of preprocessing directives. */
457 bool directives_only; 460 bool directives_only;
458 }; 461 };
459 462
490 493
491 /* Context-sensitive macro support. Returns macro (if any) that should 494 /* Context-sensitive macro support. Returns macro (if any) that should
492 be expanded. */ 495 be expanded. */
493 cpp_hashnode * (*macro_to_expand) (cpp_reader *, const cpp_token *); 496 cpp_hashnode * (*macro_to_expand) (cpp_reader *, const cpp_token *);
494 497
495 /* Called to emit a diagnostic if client_diagnostic option is true. 498 /* Called to emit a diagnostic. This callback receives the
496 This callback receives the translated message. */ 499 translated message. */
497 void (*error) (cpp_reader *, int, const char *, va_list *) 500 bool (*error) (cpp_reader *, int, source_location, unsigned int,
498 ATTRIBUTE_FPTR_PRINTF(3,0); 501 const char *, va_list *)
502 ATTRIBUTE_FPTR_PRINTF(5,0);
499 503
500 /* Callbacks for when a macro is expanded, or tested (whether 504 /* Callbacks for when a macro is expanded, or tested (whether
501 defined or not at the time) in #ifdef, #ifndef or "defined". */ 505 defined or not at the time) in #ifdef, #ifndef or "defined". */
502 void (*used_define) (cpp_reader *, unsigned int, cpp_hashnode *); 506 void (*used_define) (cpp_reader *, unsigned int, cpp_hashnode *);
503 void (*used_undef) (cpp_reader *, unsigned int, cpp_hashnode *); 507 void (*used_undef) (cpp_reader *, unsigned int, cpp_hashnode *);
504 /* Called before #define and #undef or other macro definition 508 /* Called before #define and #undef or other macro definition
505 changes are processed. */ 509 changes are processed. */
506 void (*before_define) (cpp_reader *); 510 void (*before_define) (cpp_reader *);
507 }; 511 /* Called whenever a macro is expanded or tested.
512 Second argument is the location of the start of the current expansion. */
513 void (*used) (cpp_reader *, source_location, cpp_hashnode *);
514 };
515
516 #ifdef VMS
517 #define INO_T_CPP ino_t ino[3]
518 #else
519 #define INO_T_CPP ino_t ino
520 #endif
508 521
509 /* Chain of directories to look for include files in. */ 522 /* Chain of directories to look for include files in. */
510 struct cpp_dir 523 struct cpp_dir
511 { 524 {
512 /* NULL-terminated singly-linked list. */ 525 /* NULL-terminated singly-linked list. */
537 constructed by append_file_to_dir. */ 550 constructed by append_file_to_dir. */
538 char *(*construct) (const char *header, cpp_dir *dir); 551 char *(*construct) (const char *header, cpp_dir *dir);
539 552
540 /* The C front end uses these to recognize duplicated 553 /* The C front end uses these to recognize duplicated
541 directories in the search path. */ 554 directories in the search path. */
542 ino_t ino; 555 INO_T_CPP;
543 dev_t dev; 556 dev_t dev;
544 }; 557 };
545
546 /* Name under which this program was invoked. */
547 extern const char *progname;
548 558
549 /* The structure of a node in the hash table. The hash table has 559 /* The structure of a node in the hash table. The hash table has
550 entries for all identifiers: either macros defined by #define 560 entries for all identifiers: either macros defined by #define
551 commands (type NT_MACRO), assertions created with #assert 561 commands (type NT_MACRO), assertions created with #assert
552 (NT_ASSERTION), or neither of the above (NT_VOID). Builtin macros 562 (NT_ASSERTION), or neither of the above (NT_VOID). Builtin macros
553 like __LINE__ are flagged NODE_BUILTIN. Poisoned identifiers are 563 like __LINE__ are flagged NODE_BUILTIN. Poisoned identifiers are
554 flagged NODE_POISONED. NODE_OPERATOR (C++ only) indicates an 564 flagged NODE_POISONED. NODE_OPERATOR (C++ only) indicates an
555 identifier that behaves like an operator such as "xor". 565 identifier that behaves like an operator such as "xor".
556 NODE_DIAGNOSTIC is for speed in lex_token: it indicates a 566 NODE_DIAGNOSTIC is for speed in lex_token: it indicates a
557 diagnostic may be required for this node. Currently this only 567 diagnostic may be required for this node. Currently this only
558 applies to __VA_ARGS__ and poisoned identifiers. */ 568 applies to __VA_ARGS__, poisoned identifiers, and -Wc++-compat
569 warnings about NODE_OPERATOR. */
559 570
560 /* Hash node flags. */ 571 /* Hash node flags. */
561 #define NODE_OPERATOR (1 << 0) /* C++ named operator. */ 572 #define NODE_OPERATOR (1 << 0) /* C++ named operator. */
562 #define NODE_POISONED (1 << 1) /* Poisoned identifier. */ 573 #define NODE_POISONED (1 << 1) /* Poisoned identifier. */
563 #define NODE_BUILTIN (1 << 2) /* Builtin macro. */ 574 #define NODE_BUILTIN (1 << 2) /* Builtin macro. */
565 #define NODE_WARN (1 << 4) /* Warn if redefined or undefined. */ 576 #define NODE_WARN (1 << 4) /* Warn if redefined or undefined. */
566 #define NODE_DISABLED (1 << 5) /* A disabled macro. */ 577 #define NODE_DISABLED (1 << 5) /* A disabled macro. */
567 #define NODE_MACRO_ARG (1 << 6) /* Used during #define processing. */ 578 #define NODE_MACRO_ARG (1 << 6) /* Used during #define processing. */
568 #define NODE_USED (1 << 7) /* Dumped with -dU. */ 579 #define NODE_USED (1 << 7) /* Dumped with -dU. */
569 #define NODE_CONDITIONAL (1 << 8) /* Conditional macro */ 580 #define NODE_CONDITIONAL (1 << 8) /* Conditional macro */
581 #define NODE_WARN_OPERATOR (1 << 9) /* Warn about C++ named operator. */
570 582
571 /* Different flavors of hash node. */ 583 /* Different flavors of hash node. */
572 enum node_type 584 enum node_type
573 { 585 {
574 NT_VOID = 0, /* No definition yet. */ 586 NT_VOID = 0, /* No definition yet. */
576 NT_ASSERTION /* Predicate for #assert. */ 588 NT_ASSERTION /* Predicate for #assert. */
577 }; 589 };
578 590
579 /* Different flavors of builtin macro. _Pragma is an operator, but we 591 /* Different flavors of builtin macro. _Pragma is an operator, but we
580 handle it with the builtin code for efficiency reasons. */ 592 handle it with the builtin code for efficiency reasons. */
581 enum builtin_type 593 enum cpp_builtin_type
582 { 594 {
583 BT_SPECLINE = 0, /* `__LINE__' */ 595 BT_SPECLINE = 0, /* `__LINE__' */
584 BT_DATE, /* `__DATE__' */ 596 BT_DATE, /* `__DATE__' */
585 BT_FILE, /* `__FILE__' */ 597 BT_FILE, /* `__FILE__' */
586 BT_BASE_FILE, /* `__BASE_FILE__' */ 598 BT_BASE_FILE, /* `__BASE_FILE__' */
616 628
617 /* The common part of an identifier node shared amongst all 3 C front 629 /* The common part of an identifier node shared amongst all 3 C front
618 ends. Also used to store CPP identifiers, which are a superset of 630 ends. Also used to store CPP identifiers, which are a superset of
619 identifiers in the grammatical sense. */ 631 identifiers in the grammatical sense. */
620 632
621 union _cpp_hashnode_value GTY(()) 633 union GTY(()) _cpp_hashnode_value {
622 {
623 /* If a macro. */ 634 /* If a macro. */
624 cpp_macro * GTY((tag ("NTV_MACRO"))) macro; 635 cpp_macro * GTY((tag ("NTV_MACRO"))) macro;
625 /* Answers to an assertion. */ 636 /* Answers to an assertion. */
626 struct answer * GTY ((tag ("NTV_ANSWER"))) answers; 637 struct answer * GTY ((tag ("NTV_ANSWER"))) answers;
627 /* Code for a builtin macro. */ 638 /* Code for a builtin macro. */
628 enum builtin_type GTY ((tag ("NTV_BUILTIN"))) builtin; 639 enum cpp_builtin_type GTY ((tag ("NTV_BUILTIN"))) builtin;
629 /* Macro argument index. */ 640 /* Macro argument index. */
630 unsigned short GTY ((tag ("NTV_ARGUMENT"))) arg_index; 641 unsigned short GTY ((tag ("NTV_ARGUMENT"))) arg_index;
631 }; 642 };
632 643
633 struct cpp_hashnode GTY(()) 644 struct GTY(()) cpp_hashnode {
634 {
635 struct ht_identifier ident; 645 struct ht_identifier ident;
636 unsigned int is_directive : 1; 646 unsigned int is_directive : 1;
637 unsigned int directive_index : 7; /* If is_directive, 647 unsigned int directive_index : 7; /* If is_directive,
638 then index into directive table. 648 then index into directive table.
639 Otherwise, a NODE_OPERATOR. */ 649 Otherwise, a NODE_OPERATOR. */
640 unsigned char rid_code; /* Rid code - for front ends. */ 650 unsigned char rid_code; /* Rid code - for front ends. */
641 ENUM_BITFIELD(node_type) type : 7; /* CPP node type. */ 651 ENUM_BITFIELD(node_type) type : 6; /* CPP node type. */
642 unsigned int flags : 9; /* CPP flags. */ 652 unsigned int flags : 10; /* CPP flags. */
643 653
644 union _cpp_hashnode_value GTY ((desc ("CPP_HASHNODE_VALUE_IDX (%1)"))) value; 654 union _cpp_hashnode_value GTY ((desc ("CPP_HASHNODE_VALUE_IDX (%1)"))) value;
645 }; 655 };
646 656
647 /* Call this first to get a handle to pass to other functions. 657 /* Call this first to get a handle to pass to other functions.
695 /* Set up translation to the target character set. */ 705 /* Set up translation to the target character set. */
696 extern void cpp_init_iconv (cpp_reader *); 706 extern void cpp_init_iconv (cpp_reader *);
697 707
698 /* Call this to finish preprocessing. If you requested dependency 708 /* Call this to finish preprocessing. If you requested dependency
699 generation, pass an open stream to write the information to, 709 generation, pass an open stream to write the information to,
700 otherwise NULL. It is your responsibility to close the stream. 710 otherwise NULL. It is your responsibility to close the stream. */
701 711 extern void cpp_finish (cpp_reader *, FILE *deps_stream);
702 Returns cpp_errors (pfile). */
703 extern int cpp_finish (cpp_reader *, FILE *deps_stream);
704 712
705 /* Call this to release the handle at the end of preprocessing. Any 713 /* Call this to release the handle at the end of preprocessing. Any
706 use of the handle after this function returns is invalid. Returns 714 use of the handle after this function returns is invalid. */
707 cpp_errors (pfile). */
708 extern void cpp_destroy (cpp_reader *); 715 extern void cpp_destroy (cpp_reader *);
709
710 /* Error count. */
711 extern unsigned int cpp_errors (cpp_reader *);
712 716
713 extern unsigned int cpp_token_len (const cpp_token *); 717 extern unsigned int cpp_token_len (const cpp_token *);
714 extern unsigned char *cpp_token_as_text (cpp_reader *, const cpp_token *); 718 extern unsigned char *cpp_token_as_text (cpp_reader *, const cpp_token *);
715 extern unsigned char *cpp_spell_token (cpp_reader *, const cpp_token *, 719 extern unsigned char *cpp_spell_token (cpp_reader *, const cpp_token *,
716 unsigned char *, bool); 720 unsigned char *, bool);
726 extern const unsigned char *cpp_macro_definition (cpp_reader *, 730 extern const unsigned char *cpp_macro_definition (cpp_reader *,
727 const cpp_hashnode *); 731 const cpp_hashnode *);
728 extern void _cpp_backup_tokens (cpp_reader *, unsigned int); 732 extern void _cpp_backup_tokens (cpp_reader *, unsigned int);
729 extern const cpp_token *cpp_peek_token (cpp_reader *, int); 733 extern const cpp_token *cpp_peek_token (cpp_reader *, int);
730 734
731 /* Evaluate a CPP_CHAR or CPP_WCHAR token. */ 735 /* Evaluate a CPP_*CHAR* token. */
732 extern cppchar_t cpp_interpret_charconst (cpp_reader *, const cpp_token *, 736 extern cppchar_t cpp_interpret_charconst (cpp_reader *, const cpp_token *,
733 unsigned int *, int *); 737 unsigned int *, int *);
734 /* Evaluate a vector of CPP_STRING or CPP_WSTRING tokens. */ 738 /* Evaluate a vector of CPP_*STRING* tokens. */
735 extern bool cpp_interpret_string (cpp_reader *, 739 extern bool cpp_interpret_string (cpp_reader *,
736 const cpp_string *, size_t, 740 const cpp_string *, size_t,
737 cpp_string *, enum cpp_ttype); 741 cpp_string *, enum cpp_ttype);
738 extern bool cpp_interpret_string_notranslate (cpp_reader *, 742 extern bool cpp_interpret_string_notranslate (cpp_reader *,
739 const cpp_string *, size_t, 743 const cpp_string *, size_t,
802 #define CPP_N_BINARY 0x0800 806 #define CPP_N_BINARY 0x0800
803 807
804 #define CPP_N_UNSIGNED 0x1000 /* Properties. */ 808 #define CPP_N_UNSIGNED 0x1000 /* Properties. */
805 #define CPP_N_IMAGINARY 0x2000 809 #define CPP_N_IMAGINARY 0x2000
806 #define CPP_N_DFLOAT 0x4000 810 #define CPP_N_DFLOAT 0x4000
811 #define CPP_N_DEFAULT 0x8000
807 812
808 #define CPP_N_FRACT 0x100000 /* Fract types. */ 813 #define CPP_N_FRACT 0x100000 /* Fract types. */
809 #define CPP_N_ACCUM 0x200000 /* Accum types. */ 814 #define CPP_N_ACCUM 0x200000 /* Accum types. */
810 815
811 /* Classify a CPP_NUMBER token. The return value is a combination of 816 /* Classify a CPP_NUMBER token. The return value is a combination of
833 /* An error. */ 838 /* An error. */
834 #define CPP_DL_ERROR 0x03 839 #define CPP_DL_ERROR 0x03
835 /* An internal consistency check failed. Prints "internal error: ", 840 /* An internal consistency check failed. Prints "internal error: ",
836 otherwise the same as CPP_DL_ERROR. */ 841 otherwise the same as CPP_DL_ERROR. */
837 #define CPP_DL_ICE 0x04 842 #define CPP_DL_ICE 0x04
838 /* Extracts a diagnostic level from an int. */ 843 /* An informative note following a warning. */
839 #define CPP_DL_EXTRACT(l) (l & 0xf) 844 #define CPP_DL_NOTE 0x05
840 /* Nonzero if a diagnostic level is one of the warnings. */ 845 /* A fatal error. */
841 #define CPP_DL_WARNING_P(l) (CPP_DL_EXTRACT (l) >= CPP_DL_WARNING \ 846 #define CPP_DL_FATAL 0x06
842 && CPP_DL_EXTRACT (l) <= CPP_DL_PEDWARN)
843 847
844 /* Output a diagnostic of some kind. */ 848 /* Output a diagnostic of some kind. */
845 extern void cpp_error (cpp_reader *, int, const char *msgid, ...) 849 extern bool cpp_error (cpp_reader *, int, const char *msgid, ...)
846 ATTRIBUTE_PRINTF_3; 850 ATTRIBUTE_PRINTF_3;
847 851
848 /* Output a diagnostic with "MSGID: " preceding the 852 /* Output a diagnostic with "MSGID: " preceding the
849 error string of errno. No location is printed. */ 853 error string of errno. No location is printed. */
850 extern void cpp_errno (cpp_reader *, int, const char *msgid); 854 extern bool cpp_errno (cpp_reader *, int, const char *msgid);
851 855
852 /* Same as cpp_error, except additionally specifies a position as a 856 /* Same as cpp_error, except additionally specifies a position as a
853 (translation unit) physical line and physical column. If the line is 857 (translation unit) physical line and physical column. If the line is
854 zero, then no location is printed. */ 858 zero, then no location is printed. */
855 extern void cpp_error_with_line (cpp_reader *, int, source_location, unsigned, 859 extern bool cpp_error_with_line (cpp_reader *, int, source_location, unsigned,
856 const char *msgid, ...) ATTRIBUTE_PRINTF_5; 860 const char *msgid, ...) ATTRIBUTE_PRINTF_5;
857 861
858 /* In lex.c */ 862 /* In lex.c */
859 extern int cpp_ideq (const cpp_token *, const char *); 863 extern int cpp_ideq (const cpp_token *, const char *);
860 extern void cpp_output_line (cpp_reader *, FILE *); 864 extern void cpp_output_line (cpp_reader *, FILE *);
861 extern unsigned char *cpp_output_line_to_string (cpp_reader *, 865 extern unsigned char *cpp_output_line_to_string (cpp_reader *,
862 const unsigned char *); 866 const unsigned char *);
863 extern void cpp_output_token (const cpp_token *, FILE *); 867 extern void cpp_output_token (const cpp_token *, FILE *);
864 extern const char *cpp_type2name (enum cpp_ttype); 868 extern const char *cpp_type2name (enum cpp_ttype, unsigned char flags);
865 /* Returns the value of an escape sequence, truncated to the correct 869 /* Returns the value of an escape sequence, truncated to the correct
866 target precision. PSTR points to the input pointer, which is just 870 target precision. PSTR points to the input pointer, which is just
867 after the backslash. LIMIT is how much text we have. WIDE is true 871 after the backslash. LIMIT is how much text we have. WIDE is true
868 if the escape sequence is part of a wide character constant or 872 if the escape sequence is part of a wide character constant or
869 string literal. Handles all relevant diagnostics. */ 873 string literal. Handles all relevant diagnostics. */
937 extern int cpp_valid_state (cpp_reader *, const char *, int); 941 extern int cpp_valid_state (cpp_reader *, const char *, int);
938 extern void cpp_prepare_state (cpp_reader *, struct save_macro_data **); 942 extern void cpp_prepare_state (cpp_reader *, struct save_macro_data **);
939 extern int cpp_read_state (cpp_reader *, const char *, FILE *, 943 extern int cpp_read_state (cpp_reader *, const char *, FILE *,
940 struct save_macro_data *); 944 struct save_macro_data *);
941 945
942 #ifdef __cplusplus
943 }
944 #endif
945
946 #endif /* ! LIBCPP_CPPLIB_H */ 946 #endif /* ! LIBCPP_CPPLIB_H */