comparison libcpp/internal.h @ 145:1830386684a0

gcc-9.2.0
author anatofuz
date Thu, 13 Feb 2020 11:34:05 +0900
parents 84e7813d76e9
children
comparison
equal deleted inserted replaced
131:84e7813d76e9 145:1830386684a0
1 /* Part of CPP library. 1 /* Part of CPP library.
2 Copyright (C) 1997-2018 Free Software Foundation, Inc. 2 Copyright (C) 1997-2020 Free Software Foundation, Inc.
3 3
4 This program is free software; you can redistribute it and/or modify it 4 This program is free software; you can redistribute it and/or modify it
5 under the terms of the GNU General Public License as published by the 5 under the terms of the GNU General Public License as published by the
6 Free Software Foundation; either version 3, or (at your option) any 6 Free Software Foundation; either version 3, or (at your option) any
7 later version. 7 later version.
65 #define CPP_BUFFER(PFILE) ((PFILE)->buffer) 65 #define CPP_BUFFER(PFILE) ((PFILE)->buffer)
66 #define CPP_BUF_COLUMN(BUF, CUR) ((CUR) - (BUF)->line_base) 66 #define CPP_BUF_COLUMN(BUF, CUR) ((CUR) - (BUF)->line_base)
67 #define CPP_BUF_COL(BUF) CPP_BUF_COLUMN(BUF, (BUF)->cur) 67 #define CPP_BUF_COL(BUF) CPP_BUF_COLUMN(BUF, (BUF)->cur)
68 68
69 #define CPP_INCREMENT_LINE(PFILE, COLS_HINT) do { \ 69 #define CPP_INCREMENT_LINE(PFILE, COLS_HINT) do { \
70 const struct line_maps *line_table = PFILE->line_table; \ 70 const class line_maps *line_table = PFILE->line_table; \
71 const struct line_map_ordinary *map = \ 71 const struct line_map_ordinary *map = \
72 LINEMAPS_LAST_ORDINARY_MAP (line_table); \ 72 LINEMAPS_LAST_ORDINARY_MAP (line_table); \
73 linenum_type line = SOURCE_LINE (map, line_table->highest_line); \ 73 linenum_type line = SOURCE_LINE (map, line_table->highest_line); \
74 linemap_line_start (PFILE->line_table, line + 1, COLS_HINT); \ 74 linemap_line_start (PFILE->line_table, line + 1, COLS_HINT); \
75 } while (0) 75 } while (0)
76
77 /* Maximum nesting of cpp_buffers. We use a static limit, partly for
78 efficiency, and partly to limit runaway recursion. */
79 #define CPP_STACK_MAX 200
80 76
81 /* Host alignment handling. */ 77 /* Host alignment handling. */
82 struct dummy 78 struct dummy
83 { 79 {
84 char c; 80 char c;
115 #define BUFF_ROOM(BUFF) (size_t) ((BUFF)->limit - (BUFF)->cur) 111 #define BUFF_ROOM(BUFF) (size_t) ((BUFF)->limit - (BUFF)->cur)
116 #define BUFF_FRONT(BUFF) ((BUFF)->cur) 112 #define BUFF_FRONT(BUFF) ((BUFF)->cur)
117 #define BUFF_LIMIT(BUFF) ((BUFF)->limit) 113 #define BUFF_LIMIT(BUFF) ((BUFF)->limit)
118 114
119 /* #include types. */ 115 /* #include types. */
120 enum include_type {IT_INCLUDE, IT_INCLUDE_NEXT, IT_IMPORT, IT_CMDLINE, IT_DEFAULT}; 116 enum include_type
117 {
118 /* Directive-based including mechanisms. */
119 IT_INCLUDE, /* #include */
120 IT_INCLUDE_NEXT, /* #include_next */
121 IT_IMPORT, /* #import */
122
123 /* Non-directive including mechanisms. */
124 IT_CMDLINE, /* -include */
125 IT_DEFAULT, /* forced header */
126 IT_MAIN, /* main */
127
128 IT_DIRECTIVE_HWM = IT_IMPORT + 1, /* Directives below this. */
129 IT_HEADER_HWM = IT_DEFAULT + 1 /* Header files below this. */
130 };
121 131
122 union utoken 132 union utoken
123 { 133 {
124 const cpp_token *token; 134 const cpp_token *token;
125 const cpp_token **ptoken; 135 const cpp_token **ptoken;
148 cpp_hashnode *macro_node; 158 cpp_hashnode *macro_node;
149 /* This buffer contains an array of virtual locations. The virtual 159 /* This buffer contains an array of virtual locations. The virtual
150 location at index 0 is the virtual location of the token at index 160 location at index 0 is the virtual location of the token at index
151 0 in the current instance of cpp_context; similarly for all the 161 0 in the current instance of cpp_context; similarly for all the
152 other virtual locations. */ 162 other virtual locations. */
153 source_location *virt_locs; 163 location_t *virt_locs;
154 /* This is a pointer to the current virtual location. This is used 164 /* This is a pointer to the current virtual location. This is used
155 to iterate over the virtual locations while we iterate over the 165 to iterate over the virtual locations while we iterate over the
156 tokens they belong to. */ 166 tokens they belong to. */
157 source_location *cur_virt_loc; 167 location_t *cur_virt_loc;
158 } macro_context; 168 } macro_context;
159 169
160 /* The kind of tokens carried by a cpp_context. */ 170 /* The kind of tokens carried by a cpp_context. */
161 enum context_tokens_kind { 171 enum context_tokens_kind {
162 /* This is the value of cpp_context::tokens_kind if u.iso.first 172 /* This is the value of cpp_context::tokens_kind if u.iso.first
222 enum context_tokens_kind tokens_kind; 232 enum context_tokens_kind tokens_kind;
223 }; 233 };
224 234
225 struct lexer_state 235 struct lexer_state
226 { 236 {
227 /* Nonzero if first token on line is CPP_HASH. */ 237 /* 1 if we're handling a directive. 2 if it's an include-like
238 directive. */
228 unsigned char in_directive; 239 unsigned char in_directive;
229 240
230 /* Nonzero if in a directive that will handle padding tokens itself. 241 /* Nonzero if in a directive that will handle padding tokens itself.
231 #include needs this to avoid problems with computed include and 242 #include needs this to avoid problems with computed include and
232 spacing between tokens. */ 243 spacing between tokens. */
254 /* Nonzero to prevent macro expansion. */ 265 /* Nonzero to prevent macro expansion. */
255 unsigned char prevent_expansion; 266 unsigned char prevent_expansion;
256 267
257 /* Nonzero when parsing arguments to a function-like macro. */ 268 /* Nonzero when parsing arguments to a function-like macro. */
258 unsigned char parsing_args; 269 unsigned char parsing_args;
259
260 /* Nonzero if in a __has_include__ or __has_include_next__ statement. */
261 unsigned char in__has_include__;
262 270
263 /* Nonzero if prevent_expansion is true only because output is 271 /* Nonzero if prevent_expansion is true only because output is
264 being discarded. */ 272 being discarded. */
265 unsigned char discarding_output; 273 unsigned char discarding_output;
266 274
280 cpp_hashnode *n_defined; /* defined operator */ 288 cpp_hashnode *n_defined; /* defined operator */
281 cpp_hashnode *n_true; /* C++ keyword true */ 289 cpp_hashnode *n_true; /* C++ keyword true */
282 cpp_hashnode *n_false; /* C++ keyword false */ 290 cpp_hashnode *n_false; /* C++ keyword false */
283 cpp_hashnode *n__VA_ARGS__; /* C99 vararg macros */ 291 cpp_hashnode *n__VA_ARGS__; /* C99 vararg macros */
284 cpp_hashnode *n__VA_OPT__; /* C++ vararg macros */ 292 cpp_hashnode *n__VA_OPT__; /* C++ vararg macros */
285 cpp_hashnode *n__has_include__; /* __has_include__ operator */
286 cpp_hashnode *n__has_include_next__; /* __has_include_next__ operator */
287 }; 293 };
288 294
289 typedef struct _cpp_line_note _cpp_line_note; 295 typedef struct _cpp_line_note _cpp_line_note;
290 struct _cpp_line_note 296 struct _cpp_line_note
291 { 297 {
329 /* Value of if_stack at start of this file. 335 /* Value of if_stack at start of this file.
330 Used to prohibit unmatched #endif (etc) in an include file. */ 336 Used to prohibit unmatched #endif (etc) in an include file. */
331 struct if_stack *if_stack; 337 struct if_stack *if_stack;
332 338
333 /* True if we need to get the next clean line. */ 339 /* True if we need to get the next clean line. */
334 bool need_line; 340 bool need_line : 1;
335 341
336 /* True if we have already warned about C++ comments in this file. 342 /* True if we have already warned about C++ comments in this file.
337 The warning happens only for C89 extended mode with -pedantic on, 343 The warning happens only for C89 extended mode with -pedantic on,
338 or for -Wtraditional, and only once per file (otherwise it would 344 or for -Wtraditional, and only once per file (otherwise it would
339 be far too noisy). */ 345 be far too noisy). */
340 unsigned int warned_cplusplus_comments : 1; 346 bool warned_cplusplus_comments : 1;
341 347
342 /* True if we don't process trigraphs and escaped newlines. True 348 /* True if we don't process trigraphs and escaped newlines. True
343 for preprocessed input, command line directives, and _Pragma 349 for preprocessed input, command line directives, and _Pragma
344 buffers. */ 350 buffers. */
345 unsigned int from_stage3 : 1; 351 bool from_stage3 : 1;
346 352
347 /* At EOF, a buffer is automatically popped. If RETURN_AT_EOF is 353 /* At EOF, a buffer is automatically popped. If RETURN_AT_EOF is
348 true, a CPP_EOF token is then returned. Otherwise, the next 354 true, a CPP_EOF token is then returned. Otherwise, the next
349 token from the enclosing buffer is returned. */ 355 token from the enclosing buffer is returned. */
350 unsigned int return_at_eof : 1; 356 bool return_at_eof : 1;
351 357
352 /* One for a system header, two for a C system header file that therefore 358 /* One for a system header, two for a C system header file that therefore
353 needs to be extern "C" protected in C++, and zero otherwise. */ 359 needs to be extern "C" protected in C++, and zero otherwise. */
354 unsigned char sysp; 360 unsigned char sysp;
355 361
370 char *name; 376 char *name;
371 /* The stored macro content. */ 377 /* The stored macro content. */
372 unsigned char *definition; 378 unsigned char *definition;
373 379
374 /* Definition line number. */ 380 /* Definition line number. */
375 source_location line; 381 location_t line;
376 /* If macro defined in system header. */ 382 /* If macro defined in system header. */
377 unsigned int syshdr : 1; 383 unsigned int syshdr : 1;
378 /* Nonzero if it has been expanded or had its existence tested. */ 384 /* Nonzero if it has been expanded or had its existence tested. */
379 unsigned int used : 1; 385 unsigned int used : 1;
380 386
381 /* Mark if we save an undefined macro. */ 387 /* Mark if we save an undefined macro. */
382 unsigned int is_undef : 1; 388 unsigned int is_undef : 1;
389 /* Nonzero if it was a builtin macro. */
390 unsigned int is_builtin : 1;
383 }; 391 };
384 392
385 /* A cpp_reader encapsulates the "state" of a pre-processor run. 393 /* A cpp_reader encapsulates the "state" of a pre-processor run.
386 Applying cpp_get_token repeatedly yields a stream of pre-processor 394 Applying cpp_get_token repeatedly yields a stream of pre-processor
387 tokens. Usually, there is only one cpp_reader object active. */ 395 tokens. Usually, there is only one cpp_reader object active. */
395 403
396 /* Lexer state. */ 404 /* Lexer state. */
397 struct lexer_state state; 405 struct lexer_state state;
398 406
399 /* Source line tracking. */ 407 /* Source line tracking. */
400 struct line_maps *line_table; 408 class line_maps *line_table;
401 409
402 /* The line of the '#' of the current directive. */ 410 /* The line of the '#' of the current directive. */
403 source_location directive_line; 411 location_t directive_line;
404 412
405 /* Memory buffers. */ 413 /* Memory buffers. */
406 _cpp_buff *a_buff; /* Aligned permanent storage. */ 414 _cpp_buff *a_buff; /* Aligned permanent storage. */
407 _cpp_buff *u_buff; /* Unaligned permanent storage. */ 415 _cpp_buff *u_buff; /* Unaligned permanent storage. */
408 _cpp_buff *free_buffs; /* Free buffer chain. */ 416 _cpp_buff *free_buffs; /* Free buffer chain. */
417 /* Token generated while handling a directive, if any. */ 425 /* Token generated while handling a directive, if any. */
418 cpp_token directive_result; 426 cpp_token directive_result;
419 427
420 /* When expanding a macro at top-level, this is the location of the 428 /* When expanding a macro at top-level, this is the location of the
421 macro invocation. */ 429 macro invocation. */
422 source_location invocation_location; 430 location_t invocation_location;
423 431
424 /* This is the node representing the macro being expanded at 432 /* This is the node representing the macro being expanded at
425 top-level. The value of this data member is valid iff 433 top-level. The value of this data member is valid iff
426 in_macro_expansion_p() returns TRUE. */ 434 cpp_in_macro_expansion_p() returns TRUE. */
427 cpp_hashnode *top_most_macro_node; 435 cpp_hashnode *top_most_macro_node;
428 436
429 /* Nonzero if we are about to expand a macro. Note that if we are 437 /* Nonzero if we are about to expand a macro. Note that if we are
430 really expanding a macro, the function macro_of_context returns 438 really expanding a macro, the function macro_of_context returns
431 the macro being expanded and this flag is set to false. Client 439 the macro being expanded and this flag is set to false. Client
432 code should use the function in_macro_expansion_p to know if we 440 code should use the function cpp_in_macro_expansion_p to know if we
433 are either about to expand a macro, or are actually expanding 441 are either about to expand a macro, or are actually expanding
434 one. */ 442 one. */
435 bool about_to_expand_macro_p; 443 bool about_to_expand_macro_p;
436 444
437 /* Search paths for include files. */ 445 /* Search paths for include files. */
510 /* EOF token, and a token forcing paste avoidance. */ 518 /* EOF token, and a token forcing paste avoidance. */
511 cpp_token avoid_paste; 519 cpp_token avoid_paste;
512 cpp_token eof; 520 cpp_token eof;
513 521
514 /* Opaque handle to the dependencies of mkdeps.c. */ 522 /* Opaque handle to the dependencies of mkdeps.c. */
515 struct deps *deps; 523 class mkdeps *deps;
516 524
517 /* Obstack holding all macro hash nodes. This never shrinks. 525 /* Obstack holding all macro hash nodes. This never shrinks.
518 See identifiers.c */ 526 See identifiers.c */
519 struct obstack hash_ob; 527 struct obstack hash_ob;
520 528
549 struct 557 struct
550 { 558 {
551 unsigned char *base; 559 unsigned char *base;
552 unsigned char *limit; 560 unsigned char *limit;
553 unsigned char *cur; 561 unsigned char *cur;
554 source_location first_line; 562 location_t first_line;
555 } out; 563 } out;
556 564
557 /* Used for buffer overlays by traditional.c. */ 565 /* Used for buffer overlays by traditional.c. */
558 const unsigned char *saved_cur, *saved_rlimit, *saved_line_base; 566 const unsigned char *saved_cur, *saved_rlimit, *saved_line_base;
559 567
568 cpp_comment_table comments; 576 cpp_comment_table comments;
569 577
570 /* List of saved macros by push_macro. */ 578 /* List of saved macros by push_macro. */
571 struct def_pragma_macro *pushed_macros; 579 struct def_pragma_macro *pushed_macros;
572 580
573 /* If non-null, the lexer will use this location for the next token 581 /* If non-zero, the lexer will use this location for the next token
574 instead of getting a location from the linemap. */ 582 instead of getting a location from the linemap. */
575 source_location *forced_token_location_p; 583 location_t forced_token_location;
576 }; 584 };
577 585
578 /* Character classes. Based on the more primitive macros in safe-ctype.h. 586 /* Character classes. Based on the more primitive macros in safe-ctype.h.
579 If the definition of `numchar' looks odd to you, please look up the 587 If the definition of `numchar' looks odd to you, please look up the
580 definition of a pp-number in the C standard [section 6.4.8 of C99]. 588 definition of a pp-number in the C standard [section 6.4.8 of C99].
591 #define is_hspace(x) ISBLANK(x) 599 #define is_hspace(x) ISBLANK(x)
592 #define is_vspace(x) IS_VSPACE(x) 600 #define is_vspace(x) IS_VSPACE(x)
593 #define is_nvspace(x) IS_NVSPACE(x) 601 #define is_nvspace(x) IS_NVSPACE(x)
594 #define is_space(x) IS_SPACE_OR_NUL(x) 602 #define is_space(x) IS_SPACE_OR_NUL(x)
595 603
604 #define SEEN_EOL() (pfile->cur_token[-1].type == CPP_EOF)
605
596 /* This table is constant if it can be initialized at compile time, 606 /* This table is constant if it can be initialized at compile time,
597 which is the case if cpp was compiled with GCC >=2.7, or another 607 which is the case if cpp was compiled with GCC >=2.7, or another
598 compiler that supports C99. */ 608 compiler that supports C99. */
599 #if HAVE_DESIGNATED_INITIALIZERS 609 #if HAVE_DESIGNATED_INITIALIZERS
600 extern const unsigned char _cpp_trigraph_map[UCHAR_MAX + 1]; 610 extern const unsigned char _cpp_trigraph_map[UCHAR_MAX + 1];
622 static inline int cpp_in_primary_file (cpp_reader *); 632 static inline int cpp_in_primary_file (cpp_reader *);
623 static inline int 633 static inline int
624 cpp_in_primary_file (cpp_reader *pfile) 634 cpp_in_primary_file (cpp_reader *pfile)
625 { 635 {
626 return pfile->line_table->depth == 1; 636 return pfile->line_table->depth == 1;
637 }
638
639 /* True if NODE is a macro for the purposes of ifdef, defined etc. */
640 inline bool _cpp_defined_macro_p (cpp_hashnode *node)
641 {
642 /* Do not treat conditional macros as being defined. This is due to
643 the powerpc port using conditional macros for 'vector', 'bool',
644 and 'pixel' to act as conditional keywords. This messes up tests
645 like #ifndef bool. */
646 return cpp_macro_p (node) && !(node->flags & NODE_CONDITIONAL);
627 } 647 }
628 648
629 /* In macro.c */ 649 /* In macro.c */
630 extern void _cpp_notify_macro_use (cpp_reader *pfile, cpp_hashnode *node); 650 extern void _cpp_notify_macro_use (cpp_reader *pfile, cpp_hashnode *node);
631 inline void _cpp_maybe_notify_macro_use (cpp_reader *pfile, cpp_hashnode *node) 651 inline void _cpp_maybe_notify_macro_use (cpp_reader *pfile, cpp_hashnode *node)
644 extern void _cpp_unsave_parameters (cpp_reader *, unsigned); 664 extern void _cpp_unsave_parameters (cpp_reader *, unsigned);
645 extern bool _cpp_arguments_ok (cpp_reader *, cpp_macro *, const cpp_hashnode *, 665 extern bool _cpp_arguments_ok (cpp_reader *, cpp_macro *, const cpp_hashnode *,
646 unsigned int); 666 unsigned int);
647 extern const unsigned char *_cpp_builtin_macro_text (cpp_reader *, 667 extern const unsigned char *_cpp_builtin_macro_text (cpp_reader *,
648 cpp_hashnode *, 668 cpp_hashnode *,
649 source_location = 0); 669 location_t = 0);
650 extern int _cpp_warn_if_unused_macro (cpp_reader *, cpp_hashnode *, void *); 670 extern int _cpp_warn_if_unused_macro (cpp_reader *, cpp_hashnode *, void *);
651 extern void _cpp_push_token_context (cpp_reader *, cpp_hashnode *, 671 extern void _cpp_push_token_context (cpp_reader *, cpp_hashnode *,
652 const cpp_token *, unsigned int); 672 const cpp_token *, unsigned int);
653 extern void _cpp_backup_tokens_direct (cpp_reader *, unsigned int); 673 extern void _cpp_backup_tokens_direct (cpp_reader *, unsigned int);
654 674
657 extern void _cpp_destroy_hashtable (cpp_reader *); 677 extern void _cpp_destroy_hashtable (cpp_reader *);
658 678
659 /* In files.c */ 679 /* In files.c */
660 typedef struct _cpp_file _cpp_file; 680 typedef struct _cpp_file _cpp_file;
661 extern _cpp_file *_cpp_find_file (cpp_reader *, const char *, cpp_dir *, 681 extern _cpp_file *_cpp_find_file (cpp_reader *, const char *, cpp_dir *,
662 bool, int, bool, source_location); 682 int angle, bool fake, bool preinclude,
683 bool has_include, location_t);
663 extern bool _cpp_find_failed (_cpp_file *); 684 extern bool _cpp_find_failed (_cpp_file *);
664 extern void _cpp_mark_file_once_only (cpp_reader *, struct _cpp_file *); 685 extern void _cpp_mark_file_once_only (cpp_reader *, struct _cpp_file *);
665 extern void _cpp_fake_include (cpp_reader *, const char *); 686 extern void _cpp_fake_include (cpp_reader *, const char *);
666 extern bool _cpp_stack_file (cpp_reader *, _cpp_file*, bool, 687 extern bool _cpp_stack_file (cpp_reader *, _cpp_file*, include_type, location_t);
667 source_location);
668 extern bool _cpp_stack_include (cpp_reader *, const char *, int, 688 extern bool _cpp_stack_include (cpp_reader *, const char *, int,
669 enum include_type, source_location); 689 enum include_type, location_t);
670 extern int _cpp_compare_file_date (cpp_reader *, const char *, int); 690 extern int _cpp_compare_file_date (cpp_reader *, const char *, int);
671 extern void _cpp_report_missing_guards (cpp_reader *); 691 extern void _cpp_report_missing_guards (cpp_reader *);
672 extern void _cpp_init_files (cpp_reader *); 692 extern void _cpp_init_files (cpp_reader *);
673 extern void _cpp_cleanup_files (cpp_reader *); 693 extern void _cpp_cleanup_files (cpp_reader *);
674 extern void _cpp_pop_file_buffer (cpp_reader *, struct _cpp_file *, 694 extern void _cpp_pop_file_buffer (cpp_reader *, struct _cpp_file *,
708 extern void *_cpp_commit_buff (cpp_reader *pfile, size_t size); 728 extern void *_cpp_commit_buff (cpp_reader *pfile, size_t size);
709 729
710 /* In init.c. */ 730 /* In init.c. */
711 extern void _cpp_maybe_push_include_file (cpp_reader *); 731 extern void _cpp_maybe_push_include_file (cpp_reader *);
712 extern const char *cpp_named_operator2name (enum cpp_ttype type); 732 extern const char *cpp_named_operator2name (enum cpp_ttype type);
733 extern void _cpp_restore_special_builtin (cpp_reader *pfile,
734 struct def_pragma_macro *);
713 735
714 /* In directives.c */ 736 /* In directives.c */
715 extern int _cpp_test_assertion (cpp_reader *, unsigned int *); 737 extern int _cpp_test_assertion (cpp_reader *, unsigned int *);
716 extern int _cpp_handle_directive (cpp_reader *, int); 738 extern int _cpp_handle_directive (cpp_reader *, bool);
717 extern void _cpp_define_builtin (cpp_reader *, const char *); 739 extern void _cpp_define_builtin (cpp_reader *, const char *);
718 extern char ** _cpp_save_pragma_names (cpp_reader *); 740 extern char ** _cpp_save_pragma_names (cpp_reader *);
719 extern void _cpp_restore_pragma_names (cpp_reader *, char **); 741 extern void _cpp_restore_pragma_names (cpp_reader *, char **);
720 extern int _cpp_do__Pragma (cpp_reader *, source_location); 742 extern int _cpp_do__Pragma (cpp_reader *, location_t);
721 extern void _cpp_init_directives (cpp_reader *); 743 extern void _cpp_init_directives (cpp_reader *);
722 extern void _cpp_init_internal_pragmas (cpp_reader *); 744 extern void _cpp_init_internal_pragmas (cpp_reader *);
723 extern void _cpp_do_file_change (cpp_reader *, enum lc_reason, const char *, 745 extern void _cpp_do_file_change (cpp_reader *, enum lc_reason, const char *,
724 linenum_type, unsigned int); 746 linenum_type, unsigned int);
725 extern void _cpp_pop_buffer (cpp_reader *); 747 extern void _cpp_pop_buffer (cpp_reader *);
728 /* In directives.c */ 750 /* In directives.c */
729 struct _cpp_dir_only_callbacks 751 struct _cpp_dir_only_callbacks
730 { 752 {
731 /* Called to print a block of lines. */ 753 /* Called to print a block of lines. */
732 void (*print_lines) (int, const void *, size_t); 754 void (*print_lines) (int, const void *, size_t);
733 bool (*maybe_print_line) (source_location); 755 bool (*maybe_print_line) (location_t);
734 }; 756 };
735 757
736 extern void _cpp_preprocess_dir_only (cpp_reader *, 758 extern void _cpp_preprocess_dir_only (cpp_reader *,
737 const struct _cpp_dir_only_callbacks *); 759 const struct _cpp_dir_only_callbacks *);
738 760
777 const unsigned char *, int, 799 const unsigned char *, int,
778 struct normalize_state *state, 800 struct normalize_state *state,
779 cppchar_t *, 801 cppchar_t *,
780 source_range *char_range, 802 source_range *char_range,
781 cpp_string_location_reader *loc_reader); 803 cpp_string_location_reader *loc_reader);
804
805 extern bool _cpp_valid_utf8 (cpp_reader *pfile,
806 const uchar **pstr,
807 const uchar *limit,
808 int identifier_pos,
809 struct normalize_state *nst,
810 cppchar_t *cp);
811
782 extern void _cpp_destroy_iconv (cpp_reader *); 812 extern void _cpp_destroy_iconv (cpp_reader *);
783 extern unsigned char *_cpp_convert_input (cpp_reader *, const char *, 813 extern unsigned char *_cpp_convert_input (cpp_reader *, const char *,
784 unsigned char *, size_t, size_t, 814 unsigned char *, size_t, size_t,
785 const unsigned char **, off_t *); 815 const unsigned char **, off_t *);
786 extern const char *_cpp_default_encoding (void); 816 extern const char *_cpp_default_encoding (void);
863 of the expansion point of MACRO. For function-like macros 893 of the expansion point of MACRO. For function-like macros
864 invocations, it's best to make it point to the closing parenthesis 894 invocations, it's best to make it point to the closing parenthesis
865 of the macro, rather than the the location of the first character 895 of the macro, rather than the the location of the first character
866 of the macro. NUM_TOKENS is the number of tokens that are part of 896 of the macro. NUM_TOKENS is the number of tokens that are part of
867 the replacement-list of MACRO. */ 897 the replacement-list of MACRO. */
868 const line_map_macro *linemap_enter_macro (struct line_maps *, 898 const line_map_macro *linemap_enter_macro (class line_maps *,
869 struct cpp_hashnode*, 899 struct cpp_hashnode*,
870 source_location, 900 location_t,
871 unsigned int); 901 unsigned int);
872 902
873 /* Create and return a virtual location for a token that is part of a 903 /* Create and return a virtual location for a token that is part of a
874 macro expansion-list at a macro expansion point. See the comment 904 macro expansion-list at a macro expansion point. See the comment
875 inside struct line_map_macro to see what an expansion-list exactly 905 inside struct line_map_macro to see what an expansion-list exactly
890 itself a macro expansion or not). 920 itself a macro expansion or not).
891 921
892 MACRO_DEFINITION_LOC is the location in the macro definition, 922 MACRO_DEFINITION_LOC is the location in the macro definition,
893 either of the token itself or of a macro parameter that it 923 either of the token itself or of a macro parameter that it
894 replaces. */ 924 replaces. */
895 source_location linemap_add_macro_token (const line_map_macro *, 925 location_t linemap_add_macro_token (const line_map_macro *,
896 unsigned int, 926 unsigned int,
897 source_location, 927 location_t,
898 source_location); 928 location_t);
899 929
900 /* Return the source line number corresponding to source location 930 /* Return the source line number corresponding to source location
901 LOCATION. SET is the line map set LOCATION comes from. If 931 LOCATION. SET is the line map set LOCATION comes from. If
902 LOCATION is the location of token that is part of the 932 LOCATION is the location of token that is part of the
903 expansion-list of a macro expansion return the line number of the 933 expansion-list of a macro expansion return the line number of the
904 macro expansion point. */ 934 macro expansion point. */
905 int linemap_get_expansion_line (struct line_maps *, 935 int linemap_get_expansion_line (class line_maps *,
906 source_location); 936 location_t);
907 937
908 /* Return the path of the file corresponding to source code location 938 /* Return the path of the file corresponding to source code location
909 LOCATION. 939 LOCATION.
910 940
911 If LOCATION is the location of a token that is part of the 941 If LOCATION is the location of a token that is part of the
912 replacement-list of a macro expansion return the file path of the 942 replacement-list of a macro expansion return the file path of the
913 macro expansion point. 943 macro expansion point.
914 944
915 SET is the line map set LOCATION comes from. */ 945 SET is the line map set LOCATION comes from. */
916 const char* linemap_get_expansion_filename (struct line_maps *, 946 const char* linemap_get_expansion_filename (class line_maps *,
917 source_location); 947 location_t);
918 948
919 #ifdef __cplusplus 949 #ifdef __cplusplus
920 } 950 }
921 #endif 951 #endif
922 952