#include "config.h"#include "system.h"#include "cpplib.h"#include "cpphash.h"

Go to the source code of this file.
Data Types | |
| type | token_spelling |
Defines | |
| #define | OP(e, s) { SPELL_OPERATOR, U s }, |
| #define | TK(e, s) { s, U STRINGX (e) }, |
| #define | TOKEN_SPELL(token) (token_spellings[(token)->type].category) |
| #define | TOKEN_NAME(token) (token_spellings[(token)->type].name) |
| #define | BACKUP() do {buffer->cur = buffer->backup_to;} while (0) |
| #define | IF_NEXT_IS(CHAR, THEN_TYPE, ELSE_TYPE) |
| #define | MIN_BUFF_SIZE 8000 |
| #define | BUFF_SIZE_UPPER_BOUND(MIN_SIZE) (MIN_BUFF_SIZE + (MIN_SIZE) * 3 / 2) |
| #define | EXTENDED_BUFF_SIZE(BUFF, MIN_EXTRA) (MIN_EXTRA + ((BUFF)->limit - (BUFF)->cur) * 2) |
Enumerations | |
| enum | spell_type { SPELL_OPERATOR = 0, SPELL_CHAR, SPELL_IDENT, SPELL_NUMBER, SPELL_STRING, SPELL_NONE, SPELL_OPERATOR = 0, SPELL_CHAR, SPELL_IDENT, SPELL_NUMBER, SPELL_STRING, SPELL_NONE, SPELL_OPERATOR = 0, SPELL_IDENT, SPELL_LITERAL, SPELL_NONE, SPELL_OPERATOR = 0, SPELL_IDENT, SPELL_LITERAL, SPELL_NONE } |
Functions/Subroutines | |
| static void handle_newline | PARAMS ((cpp_reader *)) |
| static int skip_whitespace | PARAMS ((cpp_reader *, cppchar_t)) |
| static uchar *parse_slow | PARAMS ((cpp_reader *, const uchar *, int, unsigned int *)) |
| static void parse_number | PARAMS ((cpp_reader *, cpp_string *, int)) |
| static int unescaped_terminator_p | PARAMS ((cpp_reader *, const uchar *)) |
| static void parse_string | PARAMS ((cpp_reader *, cpp_token *, cppchar_t)) |
| static void save_comment | PARAMS ((cpp_reader *, cpp_token *, const uchar *, cppchar_t)) |
| static int name_p | PARAMS ((cpp_reader *, const cpp_string *)) |
| static int maybe_read_ucs | PARAMS ((cpp_reader *, const unsigned char **, const unsigned char *, cppchar_t *)) |
| static tokenrun *next_tokenrun | PARAMS ((tokenrun *)) |
| static unsigned int hex_digit_value | PARAMS ((unsigned int)) |
| static _cpp_buff *new_buff | PARAMS ((size_t)) |
| int | cpp_ideq (cpp_token *token, const char *string) const |
| static void | handle_newline (cpp_reader *pfile) |
| static bool | trigraph_p (cpp_reader *pfile) |
| static cppchar_t | skip_escaped_newlines (cpp_reader *pfile) |
| static cppchar_t | get_effective_char (cpp_reader *pfile) |
| static int | skip_block_comment (cpp_reader *pfile) |
| static int | skip_line_comment (cpp_reader *pfile) |
| static void | adjust_column (cpp_reader *pfile) |
| static int | skip_whitespace (cpp_reader *pfile, cppchar_t c) |
| static int | name_p (cpp_reader *pfile, const cpp_string *string) |
| static cpp_hashnode * | parse_identifier (cpp_reader *pfile) |
| static uchar * | parse_slow (cpp_reader *pfile, const uchar *cur, int number_p, unsigned int *plen) |
| static void | parse_number (cpp_reader *pfile, cpp_string *number, int leading_period) |
| static int | unescaped_terminator_p (cpp_reader *pfile, const unsigned char *dest) |
| static void | parse_string (cpp_reader *pfile, cpp_token *token, cppchar_t terminator) |
| static void | save_comment (cpp_reader *pfile, cpp_token *token, const unsigned char *from, cppchar_t type) |
| void | _cpp_init_tokenrun (tokenrun *run, unsigned int count) |
| static tokenrun * | next_tokenrun (tokenrun *run) |
| cpp_token * | _cpp_temp_token (cpp_reader *pfile) |
| const cpp_token * | _cpp_lex_token (cpp_reader *pfile) |
| static bool | continue_after_nul (cpp_reader *pfile) |
| cpp_token * | _cpp_lex_direct (cpp_reader *pfile) |
| unsigned int | cpp_token_len (cpp_token *token) const |
| unsigned char * | cpp_spell_token (cpp_reader *pfile, const cpp_token *token, unsigned char *buffer) |
| unsigned char * | cpp_token_as_text (cpp_reader *pfile, const cpp_token *token) |
| const char * | cpp_type2name (enum cpp_ttype type) |
| void | cpp_output_token (cpp_token *token, FILE *fp) const |
| int | _cpp_equiv_tokens (cpp_token *a, cpp_token *b) const |
| int | cpp_avoid_paste (cpp_reader *pfile, const cpp_token *token1, const cpp_token *token2) |
| void | cpp_output_line (cpp_reader *pfile, FILE *fp) |
| static unsigned int | hex_digit_value (unsigned int c) |
| static int | maybe_read_ucs (cpp_reader *pfile, const unsigned char **pstr, const unsigned char *limit, cppchar_t *pc) |
| cppchar_t | cpp_parse_escape (cpp_reader *pfile, const unsigned char **pstr, const unsigned char *limit, int wide) |
| cppchar_t | cpp_interpret_charconst (cpp_reader *pfile, const cpp_token *token, unsigned int *pchars_seen, int *unsignedp) |
| static _cpp_buff * | new_buff (size_t len) |
| void | _cpp_release_buff (cpp_reader *pfile, _cpp_buff *buff) |
| _cpp_buff * | _cpp_get_buff (cpp_reader *pfile, size_t min_size) |
| _cpp_buff * | _cpp_append_extend_buff (cpp_reader *pfile, _cpp_buff *buff, size_t min_extra) |
| void | _cpp_extend_buff (cpp_reader *pfile, _cpp_buff **pbuff, size_t min_extra) |
| void | _cpp_free_buff (_cpp_buff *buff) |
| unsigned char * | _cpp_unaligned_alloc (cpp_reader *pfile, size_t len) |
| unsigned char * | _cpp_aligned_alloc (cpp_reader *pfile, size_t len) |
Variables | |
| static const unsigned char *const | digraph_spellings [] |
| static struct token_spelling | token_spellings [N_TTYPES] = { TTYPE_TABLE } |
| #define BUFF_SIZE_UPPER_BOUND | ( | MIN_SIZE | ) | (MIN_BUFF_SIZE + (MIN_SIZE) * 3 / 2) |
| #define EXTENDED_BUFF_SIZE | ( | BUFF, | |||
| MIN_EXTRA | ) | (MIN_EXTRA + ((BUFF)->limit - (BUFF)->cur) * 2) |
Definition at line 2177 of file cpplex.c.
Referenced by _cpp_append_extend_buff(), and _cpp_extend_buff().
| #define IF_NEXT_IS | ( | CHAR, | |||
| THEN_TYPE, | |||||
| ELSE_TYPE | ) |
Value:
do { \ if (get_effective_char (pfile) == CHAR) \ result->type = THEN_TYPE; \ else \ { \ BACKUP (); \ result->type = ELSE_TYPE; \ } \ } while (0)
Definition at line 1075 of file cpplex.c.
Referenced by _cpp_lex_direct().
| #define MIN_BUFF_SIZE 8000 |
| #define TOKEN_NAME | ( | token | ) | (token_spellings[(token)->type].name) |
| #define TOKEN_SPELL | ( | token | ) | (token_spellings[(token)->type].category) |
Definition at line 69 of file cpplex.c.
Referenced by _cpp_equiv_tokens(), cpp_output_token(), cpp_spell_token(), cpp_token_len(), and cpp_token_val_index().
| enum spell_type |
| unsigned char* _cpp_aligned_alloc | ( | cpp_reader * | pfile, | |
| size_t | len | |||
| ) |
Definition at line 2332 of file cpplex.c.
Referenced by _cpp_create_definition(), insert_pragma_entry(), and new_pragma_entry().
| _cpp_buff* _cpp_append_extend_buff | ( | cpp_reader * | pfile, | |
| _cpp_buff * | buff, | |||
| size_t | min_extra | |||
| ) |
Definition at line 1703 of file cpplex.c.
References memcmp, SPELL_CHAR, SPELL_IDENT, SPELL_NONE, SPELL_NUMBER, SPELL_OPERATOR, SPELL_STRING, and TOKEN_SPELL.
Referenced by find_answer(), and warn_of_redefinition().
| void _cpp_extend_buff | ( | cpp_reader * | pfile, | |
| _cpp_buff ** | pbuff, | |||
| size_t | min_extra | |||
| ) |
Definition at line 2272 of file cpplex.c.
Referenced by _cpp_save_parameter(), alloc_expansion_token(), parse_answer(), parse_string(), save_replacement_text(), and stringify_arg().
| _cpp_buff* _cpp_get_buff | ( | cpp_reader * | pfile, | |
| size_t | min_size | |||
| ) |
Definition at line 2222 of file cpplex.c.
Referenced by _cpp_aligned_alloc(), _cpp_append_extend_buff(), _cpp_extend_buff(), _cpp_unaligned_alloc(), collect_args(), maybe_start_funlike(), replace_args(), replace_args_and_push(), and stringify_arg().
| cpp_token* _cpp_lex_direct | ( | cpp_reader * | pfile | ) |
Definition at line 1098 of file cpplex.c.
Referenced by _cpp_lex_token(), builtin_macro(), lex_expansion_token(), and paste_tokens().
| const cpp_token* _cpp_lex_token | ( | cpp_reader * | pfile | ) |
Definition at line 931 of file cpplex.c.
Referenced by _cpp_handle_directive(), check_eol(), check_eol_return_comments(), cpp_get_token(), create_iso_definition(), do_pragma_poison(), lex_macro_node(), parse_params(), read_flag(), and skip_rest_of_line().
| void _cpp_release_buff | ( | cpp_reader * | pfile, | |
| _cpp_buff * | buff | |||
| ) |
Definition at line 2208 of file cpplex.c.
Referenced by _cpp_pop_context(), _cpp_scan_out_logical_line(), collect_args(), enter_macro_context(), maybe_start_funlike(), scan_out_logical_line(), and stringify_arg().
| cpp_token* _cpp_temp_token | ( | cpp_reader * | pfile | ) |
Definition at line 820 of file cpplex.c.
Referenced by builtin_macro(), cpp_get_token(), glue_header_name(), new_string_token(), padding_token(), paste_tokens(), and replace_args().
| unsigned char* _cpp_unaligned_alloc | ( | cpp_reader * | pfile, | |
| size_t | len | |||
| ) |
Definition at line 2302 of file cpplex.c.
Referenced by _cpp_builtin_macro_text(), cpp_token_as_text(), create_literal(), dequote_string(), do_pragma(), glue_header_name(), lex_number(), parse_number(), push_replacement_text(), save_comment(), and save_replacement_text().
| static void adjust_column | ( | cpp_reader * | pfile | ) | [static] |
Definition at line 371 of file cpplex.c.
References col, cpp_buffer::col_adjust, CPP_BUF_COL, and CPP_OPTION.
Referenced by skip_block_comment(), and skip_whitespace().
| static bool continue_after_nul | ( | cpp_reader * | pfile | ) | [static] |
Definition at line 1029 of file cpplex.c.
References _cpp_overlay_buffer(), _cpp_pop_buffer(), _cpp_read_logical_line_trad(), _cpp_remove_overlay(), BOL, cpp_error(), CPP_OPTION, cpp_buffer::cur, DL_PEDWARN, cpp_buffer::from_stage3, handle_newline(), cpp_buffer::line_base, cpp_buffer::prev, cpp_buffer::return_at_eof, and cpp_buffer::saved_flags.
Referenced by _cpp_lex_direct().
| int cpp_avoid_paste | ( | cpp_reader * | pfile, | |
| const cpp_token * | token1, | |||
| const cpp_token * | token2 | |||
| ) |
| int cpp_ideq | ( | cpp_token * | token, | |
| const char * | string | |||
| ) | const |
Definition at line 104 of file cpplex.c.
References NODE_NAME, uchar, and ustrcmp().
Referenced by read_scan_file(), recognized_extern(), and scan_decls().
| cppchar_t cpp_interpret_charconst | ( | cpp_reader * | pfile, | |
| const cpp_token * | token, | |||
| unsigned int * | pchars_seen, | |||
| int * | unsignedp | |||
| ) |
| void cpp_output_line | ( | cpp_reader * | pfile, | |
| FILE * | fp | |||
| ) |
Definition at line 1635 of file cpplex.c.
References CPP_FIRST_DIGRAPH, DIGRAPH, digraph_spellings, fprintf(), fwrite, int, NAMED_OP, NODE_LEN, NODE_NAME, putc(), SPELL_CHAR, SPELL_IDENT, SPELL_NONE, SPELL_NUMBER, SPELL_OPERATOR, SPELL_STRING, tag, TOKEN_NAME, and TOKEN_SPELL.
Referenced by cb_include(), cpp_output_line(), and scan_translation_unit().
| cppchar_t cpp_parse_escape | ( | cpp_reader * | pfile, | |
| const unsigned char ** | pstr, | |||
| const unsigned char * | limit, | |||
| int | wide | |||
| ) |
Definition at line 1912 of file cpplex.c.
Referenced by cpp_interpret_charconst(), dequote_string(), and lex_string().
| unsigned char* cpp_spell_token | ( | cpp_reader * | pfile, | |
| const cpp_token * | token, | |||
| unsigned char * | buffer | |||
| ) |
Definition at line 1535 of file cpplex.c.
Referenced by c_lex_with_flags(), cpp_macro_definition(), cpp_token_as_text(), glue_header_name(), paste_tokens(), stringify_arg(), and warn_about_normalization().
| unsigned char* cpp_token_as_text | ( | cpp_reader * | pfile, | |
| const cpp_token * | token | |||
| ) |
Definition at line 1609 of file cpplex.c.
Referenced by _cpp_handle_directive(), _cpp_parse_expr(), cb_def_pragma(), cb_include(), check_promotion(), do_line(), do_linemarker(), do_pragma_dependency(), parse_defined(), parse_params(), paste_all_tokens(), paste_tokens(), and read_flag().
| unsigned int cpp_token_len | ( | cpp_token * | token | ) | const |
Definition at line 1514 of file cpplex.c.
References NODE_LEN, SPELL_IDENT, SPELL_NUMBER, SPELL_STRING, and TOKEN_SPELL.
Referenced by cpp_macro_definition(), cpp_token_as_text(), glue_header_name(), paste_tokens(), stringify_arg(), and warn_about_normalization().
| const char* cpp_type2name | ( | enum cpp_ttype | type | ) |
| static cppchar_t get_effective_char | ( | cpp_reader * | pfile | ) | [static] |
Definition at line 252 of file cpplex.c.
References __builtin_expect, cpp_buffer::backup_to, cpp_buffer::cur, next, and skip_escaped_newlines().
Referenced by _cpp_lex_direct().
| static void handle_newline | ( | cpp_reader * | pfile | ) | [static] |
Definition at line 122 of file cpplex.c.
References cpp_buffer::col_adjust, cpp_buffer::cur, and cpp_buffer::line_base.
Referenced by _cpp_lex_direct(), continue_after_nul(), copy_comment(), scan_out_logical_line(), skip_block_comment(), and skip_escaped_newlines().
| static unsigned int hex_digit_value | ( | unsigned int | c | ) | [static] |
Definition at line 1808 of file cpplex.c.
References abort, hex_p, and hex_value.
Referenced by cpp_parse_escape(), and maybe_read_ucs().
| static int maybe_read_ucs | ( | cpp_reader * | pfile, | |
| const unsigned char ** | pstr, | |||
| const unsigned char * | limit, | |||
| cppchar_t * | pc | |||
| ) | [static] |
Definition at line 1840 of file cpplex.c.
References cpp_error(), CPP_OPTION, CPP_WTRADITIONAL, DL_ERROR, DL_WARNING, hex_digit_value(), ISXDIGIT, length, and p.
Referenced by cpp_parse_escape().
| static int name_p | ( | cpp_reader * | pfile, | |
| const cpp_string * | string | |||
| ) | [static] |
Definition at line 2187 of file cpplex.c.
References _cpp_buff::base, base, CPP_ALIGN, _cpp_buff::cur, _cpp_buff::limit, MIN_BUFF_SIZE, _cpp_buff::next, NULL, and xmalloc().
Referenced by _cpp_append_extend_buff(), _cpp_extend_buff(), and _cpp_get_buff().
Definition at line 802 of file cpplex.c.
References _cpp_init_tokenrun(), tokenrun::next, NULL, and xnew.
Referenced by _cpp_lex_token(), and _cpp_temp_token().
| static unsigned int hex_digit_value PARAMS | ( | (unsigned int) | ) | [static] |
| static int maybe_read_ucs PARAMS | ( | (cpp_reader *, const unsigned char **, const unsigned char *, cppchar_t *) | ) | [static] |
| static int name_p PARAMS | ( | (cpp_reader *, const cpp_string *) | ) | [static] |
| static void save_comment PARAMS | ( | (cpp_reader *, cpp_token *, const uchar *, cppchar_t) | ) | [static] |
| static void parse_string PARAMS | ( | (cpp_reader *, cpp_token *, cppchar_t) | ) | [static] |
| static int unescaped_terminator_p PARAMS | ( | (cpp_reader *, const uchar *) | ) | [static] |
| static void parse_number PARAMS | ( | (cpp_reader *, cpp_string *, int) | ) | [static] |
| static uchar* parse_slow PARAMS | ( | (cpp_reader *, const uchar *, int, unsigned int *) | ) | [static] |
| static int skip_whitespace PARAMS | ( | (cpp_reader *, cppchar_t) | ) | [static] |
| static void handle_newline PARAMS | ( | (cpp_reader *) | ) | [static] |
| static cpp_hashnode* parse_identifier | ( | cpp_reader * | pfile | ) | [static] |
Definition at line 452 of file cpplex.c.
References __builtin_expect, base, cpp_error(), cur, DL_ERROR, DL_PEDWARN, cpp_hashnode::flags, HT_ALLOC, HT_ALLOCED, ht_lookup(), ISIDNUM, len, NODE_DIAGNOSTIC, NODE_NAME, NODE_POISONED, parse_slow(), result, and uchar.
Referenced by _cpp_lex_direct().
| static void parse_number | ( | cpp_reader * | pfile, | |
| cpp_string * | number, | |||
| int | leading_period | |||
| ) | [static] |
Definition at line 580 of file cpplex.c.
References _cpp_unaligned_alloc(), base, cur, dest, ISIDNUM, cpp_string::len, memcpy, parse_slow(), cpp_string::text, uchar, and VALID_SIGN.
Referenced by _cpp_lex_direct().
| static uchar* parse_slow | ( | cpp_reader * | pfile, | |
| const uchar * | cur, | |||
| int | number_p, | |||
| unsigned int * | plen | |||
| ) | [static] |
Definition at line 509 of file cpplex.c.
References BACKUP, cpp_buffer::backup_to, base, c, cpp_error(), CPP_PEDANTIC, cpp_buffer::cur, DL_PEDWARN, is_idchar, obstack_1grow, obstack_finish, obstack_grow, obstack_object_size, skip_escaped_newlines(), stack, uchar, and VALID_SIGN.
Referenced by parse_identifier(), and parse_number().
| static void parse_string | ( | cpp_reader * | pfile, | |
| cpp_token * | token, | |||
| cppchar_t | terminator | |||
| ) | [static] |
Definition at line 643 of file cpplex.c.
References _cpp_extend_buff(), BUFF_FRONT, BUFF_LIMIT, c, CLK_ASM, cpp_error(), CPP_OPTION, cpp_buffer::cur, dest, DL_ERROR, DL_WARNING, is_vspace, cpp_string::len, NULL, cpp_buffer::rlimit, skip_escaped_newlines(), cpp_token::str, cpp_string::text, unescaped_terminator_p(), cpp_token::val, and void.
Referenced by _cpp_lex_direct().
| static void save_comment | ( | cpp_reader * | pfile, | |
| cpp_token * | token, | |||
| const unsigned char * | from, | |||
| cppchar_t | type | |||
| ) | [static] |
Definition at line 747 of file cpplex.c.
References _cpp_unaligned_alloc(), is_vspace, len, cpp_string::len, memcpy, cpp_token::str, cpp_string::text, and cpp_token::val.
Referenced by _cpp_lex_direct().
| static int skip_block_comment | ( | cpp_reader * | pfile | ) | [static] |
Definition at line 270 of file cpplex.c.
References adjust_column(), c, CPP_BUF_COL, cpp_error_with_line(), CPP_OPTION, cpp_buffer::cur, DL_WARNING, EOF, handle_newline(), is_vspace, cpp_buffer::rlimit, skip_escaped_newlines(), and warn_comments.
Referenced by _cpp_lex_direct().
| static cppchar_t skip_escaped_newlines | ( | cpp_reader * | pfile | ) | [static] |
Definition at line 182 of file cpplex.c.
References _cpp_trigraph_map, cpp_buffer::backup_to, cpp_error(), cpp_buffer::cur, DL_PEDWARN, DL_WARNING, EOF, cpp_buffer::from_stage3, handle_newline(), is_nvspace, is_vspace, next, cpp_buffer::rlimit, and trigraph_p().
Referenced by _cpp_lex_direct(), get_effective_char(), lex_identifier(), parse_slow(), parse_string(), scan_out_logical_line(), skip_block_comment(), skip_line_comment(), and skip_whitespace().
| static int skip_line_comment | ( | cpp_reader * | pfile | ) | [static] |
Definition at line 316 of file cpplex.c.
References at_eof, c, cpp_error(), cpp_buffer::cur, DL_WARNING, is_vspace, NULL, cpp_buffer::rlimit, skip_escaped_newlines(), and void.
Referenced by _cpp_lex_direct().
| static int skip_whitespace | ( | cpp_reader * | pfile, | |
| cppchar_t | c | |||
| ) | [static] |
Definition at line 387 of file cpplex.c.
References adjust_column(), CPP_BUF_COL, cpp_error(), cpp_error_with_line(), CPP_PEDANTIC, cpp_buffer::cur, DL_PEDWARN, DL_WARNING, is_nvspace, and cpp_buffer::rlimit.
Referenced by _cpp_create_trad_definition(), _cpp_lex_direct(), _cpp_scan_out_logical_line(), read_specs(), scan_out_logical_line(), and scan_parameters().
| static bool trigraph_p | ( | cpp_reader * | pfile | ) | [static] |
Definition at line 144 of file cpplex.c.
References _cpp_trigraph_map, CPP_BUF_COL, cpp_error_with_line(), CPP_OPTION, cpp_buffer::cur, DL_WARNING, and cpp_buffer::last_Wtrigraphs.
Referenced by skip_escaped_newlines().
| static int unescaped_terminator_p | ( | cpp_reader * | pfile, | |
| const unsigned char * | dest | |||
| ) | [static] |
Definition at line 615 of file cpplex.c.
References BUFF_FRONT, start, and obstack::temp.
Referenced by parse_string().
const unsigned char* const digraph_spellings[] [static] |
Initial value:
Definition at line 60 of file cpplex.c.
Referenced by cpp_avoid_paste(), cpp_output_token(), and cpp_spell_token().
struct token_spelling token_spellings[N_TTYPES] = { TTYPE_TABLE } [static] |
1.5.6