#include "config.h"#include "system.h"#include "version.h"#include "cppdefault.h"#include "tradcpp.h"#include "mkdeps.h"#include "intl.h"

Go to the source code of this file.
| #define abort | ( | void | ) | fancy_abort(__LINE__, 0); |
| #define CHECK_DEPTH | ( | code | ) |
Value:
if (indepth >= (INPUT_STACK_MAX - 1)) \ { \ error_with_line (line_for_error (instack[indepth].lineno), \ "macro or #include recursion too deep"); \ code; \ }
Definition at line 141 of file tradcpp.c.
Referenced by expand_to_temp_buffer(), finclude(), and macroexpand().
| #define check_expand | ( | OBUF, | |||
| NEEDED | ) |
Value:
do { \ if ((OBUF)->length - ((OBUF)->bufp - (OBUF)->buf) <= (NEEDED)) \ grow_outbuf ((OBUF), (NEEDED)); \ } while (0)
Definition at line 162 of file tradcpp.c.
Referenced by do_line(), handle_directive(), output_line_command(), rescan(), and special_symbol().
| #define HASHSIZE 1403 |
Definition at line 312 of file tradcpp.c.
Referenced by do_define(), dump_all_macros(), install(), lookup(), parse_assertion(), and rescan().
| #define INPUT_STACK_MAX 200 |
| #define MAKE_POS | ( | v | ) | (v & 0x7fffffff) |
| #define POPMACRO |
| #define RECACHE |
Definition at line 476 of file tradcpp.c.
Referenced by collect_expansion(), do_define(), do_include(), do_include_next(), do_line(), do_undef(), do_xifdef(), and special_symbol().
| #define U (const unsigned char *) |
| typedef struct definition DEFINITION |
| typedef struct if_stack IF_STACK_FRAME |
| typedef struct pending_dir pending_dir |
| enum file_change_code |
| enum msgtype |
| enum node_type |
| enum pending_dir_t |
| static unsigned char* canonicalize_text | ( | unsigned char * | buf, | |
| unsigned char * | limit, | |||
| unsigned char ** | climit | |||
| ) | const [static] |
| static DEFINITION* collect_expansion | ( | U_CHAR * | buf, | |
| U_CHAR * | end, | |||
| int | nargs, | |||
| struct arglist * | arglist | |||
| ) | [static] |
Definition at line 2971 of file tradcpp.c.
References abort, arglist::argno, c, concat(), error(), definition::expansion, is_idchar, is_idstart, is_space, arglist::length, definition::length, lim1, arglist::name, definition::nargs, arglist::next, definition::reflist::next, NULL, p, p1, definition::pattern, SKIP_WHITE_SPACE, strncmp(), xcalloc(), and xmalloc().
Referenced by do_define().
| static int compare_defs | ( | DEFINITION * | d1, | |
| DEFINITION * | d2 | |||
| ) | [static] |
Definition at line 3700 of file tradcpp.c.
References if_stack::fname, if_stack::lineno, if_stack::next, output_line_command(), same_file, skip_if_group(), if_stack::type, and xcalloc().
Referenced by do_if(), and do_xifdef().
Definition at line 4983 of file tradcpp.c.
Referenced by do_unassert(), do_undef(), and eval_if_expression().
| static int discard_comments | ( | U_CHAR * | start, | |
| int | length, | |||
| int | newlines | |||
| ) | [static] |
Definition at line 4609 of file tradcpp.c.
References c, and newline_fix().
Referenced by copy_comment(), do_include_common(), end_directive(), macarg(), parse_include(), and scan_translation_unit_trad().
Definition at line 3449 of file tradcpp.c.
References hashval::answers, find_answer(), free(), hashnode::name, answer::next, node, parse_assertion(), T_ASSERT, hashnode::type, hashnode::value, and warning.
Definition at line 2734 of file tradcpp.c.
References alloca, definition::argnames, arglist::argno, collect_expansion(), compare_defs(), hashval::defn, error(), hashf(), HASHSIZE, i, install(), is_idchar, is_idstart, is_nvspace, arglist::length, lookup(), memcpy, msg, arglist::name, arglist::next, NULL, SKIP_WHITE_SPACE, strncmp(), T_MACRO, tmp, hashnode::type, hashnode::value, warning, and xmalloc().
Definition at line 3592 of file tradcpp.c.
References error(), eval_if_expression(), file_buf::fname, fprintf(), indepth, instack, NULL, output_line_command(), same_file, skip_if_group(), strcmp(), T_ELIF, and T_IF.
Definition at line 3897 of file tradcpp.c.
References error(), file_buf::fname, fprintf(), indepth, instack, output_line_command(), same_file, skip_if_group(), strcmp(), T_ELIF, T_ELSE, and T_IF.
Definition at line 3576 of file tradcpp.c.
References conditional_skip(), eval_if_expression(), indepth, instack, and T_IF.
Definition at line 2309 of file tradcpp.c.
References alloca, file_buf::buf, file_buf::bufp, error(), expand_to_temp_buffer(), f, fail, file_name_list::fname, file_buf::fname, fp, free(), get_filename(), ignore_srcdir, indepth, instack, is_nvspace, max_include_len, memcpy, n, file_name_list::next, NULL, process_include(), SKIP_WHITE_SPACE, strncpy(), strrchr(), and system_header_p.
Definition at line 2408 of file tradcpp.c.
References alloca, file_buf::buf, file_buf::bufp, do_include(), error(), expand_to_temp_buffer(), fail, free(), get_filename(), indepth, instack, is_nvspace, memcpy, file_buf::next_header_dir, process_include(), SKIP_WHITE_SPACE, and system_header_p.
Definition at line 3151 of file tradcpp.c.
References atoi(), file_buf::buf, file_buf::bufp, check_expand, hashval::cpval, enter_file, error(), expand_to_temp_buffer(), file_buf::fname, FNAME_HASHSIZE, hashf(), indepth, instack, ISDIGIT, leave_file, hashnode::length, file_buf::length, file_buf::lineno, memcpy, hashnode::next, NULL, output_line_command(), q, same_file, SKIP_WHITE_SPACE, strncmp(), hashnode::value, and xcalloc().
Definition at line 3480 of file tradcpp.c.
References hashval::answers, delete_macro(), find_answer(), free(), answer::next, node, p, parse_assertion(), T_ASSERT, T_UNASSERT, hashnode::type, and hashnode::value.
Definition at line 3257 of file tradcpp.c.
References delete_macro(), is_idchar, lookup(), hashnode::name, NULL, SKIP_WHITE_SPACE, strncmp(), T_MACRO, hashnode::type, and warning.
Definition at line 3657 of file tradcpp.c.
References conditional_skip(), end, indepth, instack, is_idchar, is_nvspace, lookup(), NULL, skip, SKIP_WHITE_SPACE, T_IF, T_IFDEF, and T_IFNDEF.
Referenced by do_ifdef(), and do_ifndef().
| static void dump_all_macros | ( | ) | [static] |
Definition at line 5021 of file tradcpp.c.
References concat(), hashval::defn, dump_arg_n(), dump_defn_1(), definition::expansion, HASHSIZE, i, definition::length, hashnode::name, definition::nargs, hashnode::next, NULL, offset, definition::pattern, printf(), T_MACRO, hashnode::type, and hashnode::value.
Referenced by main().
| static void dump_arg_n | ( | DEFINITION * | defn, | |
| int | argnum | |||
| ) | [static] |
Definition at line 5084 of file tradcpp.c.
References fwrite, p, p1, putchar(), and skip_quoted_string().
Referenced by dump_all_macros().
| void error_from_errno | ( | char * | name | ) | const |
Definition at line 4763 of file tradcpp.c.
References errno, error(), and strerror().
Referenced by output_deps(), and process_include().
| static int eval_if_expression | ( | U_CHAR * | buf, | |
| int | length | |||
| ) | const [static] |
Definition at line 3632 of file tradcpp.c.
References file_buf::buf, delete_macro(), expand_to_temp_buffer(), free(), install(), T_SPEC_DEFINED, and U.
| static FILE_BUF expand_to_temp_buffer | ( | U_CHAR * | buf, | |
| U_CHAR * | limit, | |||
| int | output_marks | |||
| ) | const [static] |
Definition at line 1838 of file tradcpp.c.
References abort, alloca, file_buf::buf, file_buf::bufp, CHECK_DEPTH, file_buf::fname, file_buf::free_ptr, file_buf::if_stack, indepth, instack, directive::length, file_buf::length, file_buf::lineno, file_buf::macro, obuf, p1, p2, rescan(), and xmalloc().
Referenced by do_include(), do_include_next(), do_line(), eval_if_expression(), and macarg().
| void fancy_abort | ( | int | line, | |
| const char * | func | |||
| ) |
| static int file_size_and_mode | ( | int | fd, | |
| int * | mode_pointer, | |||
| long * | size_pointer | |||
| ) | [static] |
Definition at line 5265 of file tradcpp.c.
References fstat, stat::st_mode, and stat::st_size.
Referenced by finclude(), and main().
| static void finclude | ( | int | f, | |
| const char * | fname, | |||
| struct file_name_list * | nhd, | |||
| FILE_BUF * | op | |||
| ) | [static] |
Definition at line 2634 of file tradcpp.c.
References file_buf::buf, file_buf::bufp, CHECK_DEPTH, close, enter_file, file_size_and_mode(), fixup_newlines(), file_buf::fname, fp, free(), i, file_buf::if_stack, indepth, instack, leave_file, file_buf::length, file_buf::lineno, memset, file_buf::next_header_dir, output_line_command(), perror_with_name(), read, rescan(), S_ISREG, xmalloc(), and xrealloc().
Referenced by main(), and process_include().
| static struct answer** find_answer | ( | HASHNODE * | node, | |
| const struct answer * | candidate | |||
| ) | [static, read] |
Definition at line 3518 of file tradcpp.c.
References answer::answer, answer::len, memcmp, answer::next, and result.
Definition at line 1916 of file tradcpp.c.
References alloca, buf, c, check_expand, ident, is_idchar, is_nvspace, directive::length, n, directive::name, name_newline_fix(), newline_fix(), skip_quoted_string(), skip_to_end_of_comment(), strncmp(), T_DEFINE, T_INCLUDE, and directive::type.
Referenced by rescan().
| static int hashf | ( | U_CHAR * | name, | |
| int | len, | |||
| int | hashsize | |||
| ) | const [static] |
Definition at line 5005 of file tradcpp.c.
References HASHSTEP, MAKE_POS, and r.
Referenced by do_define(), do_line(), install(), lookup(), and parse_assertion().
| static void init_dependency_output | ( | ) | [static] |
Definition at line 1003 of file tradcpp.c.
References deps_add_target(), deps_append, deps_file, deps_missing_files, getenv(), inhibit_output, memcpy, print_deps, s, strchr, and xmalloc().
Referenced by main().
| static void initialize_builtins | ( | ) | [static] |
Definition at line 5131 of file tradcpp.c.
References flag_signed_char, install_spec, install_value, PTRDIFF_TYPE, REGISTER_PREFIX, SIZE_TYPE, T_BASE_FILE, T_DATE, T_FILE, T_INCLUDE_LEVEL, T_SPECLINE, T_TIME, T_VERSION, user_label_prefix, WCHAR_TYPE, and WINT_TYPE.
Referenced by java_init_decl_processing(), and main().
Definition at line 4894 of file tradcpp.c.
References hashnode::bucket_hdr, hashf(), HASHSIZE, is_idchar, hashnode::length, memcpy, hashnode::name, hashnode::next, NULL, p, hashnode::prev, q, hashnode::type, and xmalloc().
Referenced by do_define(), eval_if_expression(), and parse_assertion().
| static int line_for_error | ( | int | line | ) | [static] |
Definition at line 4826 of file tradcpp.c.
References i, indepth, instack, and file_buf::lineno.
Referenced by macroexpand(), rescan(), and skip_quoted_string().
Definition at line 4943 of file tradcpp.c.
References hashf(), HASHSIZE, is_idchar, hashnode::length, hashnode::name, hashnode::next, NULL, and strncmp().
Definition at line 4390 of file tradcpp.c.
References abort, file_buf::buf, buf, file_buf::bufp, c, comments, discard_comments(), expand_to_temp_buffer(), file_buf::fname, free(), file_buf::free_ptr, indepth, instack, ISPRINT, file_buf::length, file_buf::lineno, macarg1(), file_buf::macro, memcpy, argdata::newlines, obuf, T_MACRO, hashnode::type, xmalloc(), and xrealloc().
Referenced by macroexpand().
Definition at line 4127 of file tradcpp.c.
References abort, alloca, args, file_buf::buf, file_buf::bufp, c, CHECK_DEPTH, error(), exp, argdata::expand_length, argdata::expanded, definition::expansion, file_buf::fname, free(), argdata::free1, argdata::free2, file_buf::free_ptr, i, file_buf::if_stack, indepth, instack, is_idchar, is_space, ISPRINT, l1, file_buf::length, definition::length, line_for_error(), file_buf::lineno, macarg(), file_buf::macro, memmove, definition::nargs, NULL, offset, p1, p2, parse_error(), definition::pattern, argdata::raw, argdata::raw_length, special_symbol(), sprintf(), argdata::stringified_length, T_MACRO, and xmalloc().
Referenced by rescan().
| int main | ( | int argc | , | |
| char ** | argv | |||
| ) |
Definition at line 514 of file tradcpp.c.
References pending_dir::arg, file_buf::buf, file_buf::bufp, c, default_include::cplusplus, cpp_GCC_INCLUDE_DIR_len, cpp_include_defaults, deps_add_default_target(), deps_add_dep(), deps_add_target(), deps_file, deps_free(), deps_init(), deps_missing_files, di, dump_all_macros(), dump_macros, errors, exit(), f, fatal(), FATAL_EXIT_CODE, fd, ferror(), file_size_and_mode(), fileno, finclude(), fixup_newlines(), flag_signed_char, file_name_list::fname, default_include::fname, file_buf::fname, fp, fprintf(), free(), freopen, gcc_init_libintl, getrlimit(), hex_init(), i, file_buf::if_stack, ignore_srcdir, in_fname, indepth, inhibit_output, inhibit_warnings, init_dependency_output(), initialize_builtins(), instack, file_buf::length, file_buf::lineno, make_assertion(), make_definition(), make_undef(), max_include_len, file_name_list::next, no_line_commands, no_output, NULL, O_RDONLY, open, out_fname, OUTBUF_SIZE, output_deps(), output_line_command(), p, PD_ASSERTION, PD_DEFINE, PD_FILE, PD_UNDEF, perror_with_name(), pfatal_with_name(), print_deps, print_deps_phony_targets, progname, PTR, put_out_comments, read, rescan(), S_ISREG, same_file, setrlimit(), size, strcmp(), strlen(), strncmp(), SUCCESS_EXIT_CODE, pending_dir::type, user_label_prefix, USER_LABEL_PREFIX, version_string, warn_comments, write, xcalloc(), xmalloc(), and xrealloc().
| static void make_assertion | ( | char * | str | ) | const [static] |
| static void make_definition | ( | char * | str | ) | const [static] |
| static void make_undef | ( | char * | str | ) | const [static] |
Definition at line 1128 of file tradcpp.c.
References count, is_idchar, and p.
Referenced by handle_directive(), and skip_if_group().
Definition at line 1093 of file tradcpp.c.
Referenced by discard_comments(), handle_directive(), macarg1(), rescan(), skip_if_group(), and skip_to_end_of_comment().
| static void output_deps | ( | ) | [static] |
Definition at line 1055 of file tradcpp.c.
References deps_append, deps_file, deps_phony_targets(), deps_write(), error_from_errno(), fatal(), fclose(), ferror(), fopen, and print_deps_phony_targets.
Referenced by main().
| static void output_line_command | ( | FILE_BUF * | ip, | |
| FILE_BUF * | op, | |||
| int | conditional, | |||
| enum file_change_code | file_change | |||
| ) | [static] |
Definition at line 4071 of file tradcpp.c.
References check_expand, enter_file, leave_file, len, memcpy, no_line_commands, no_output, NULL, same_file, sprintf(), strcat(), strlen(), and system_include_depth.
Referenced by conditional_skip(), do_elif(), do_else(), do_endif(), do_line(), finclude(), main(), and rescan().
| static DEFINITION* collect_expansion PARAMS | ( | (U_CHAR *, U_CHAR *, int, struct arglist *) | ) | [static] |
| static int compare_defs PARAMS | ( | (DEFINITION *, DEFINITION *) | ) | [static] |
| static int hashf PARAMS | ( | (const U_CHAR *, int, int) | ) | [static] |
| static struct hashnode* install PARAMS | ( | (const U_CHAR *, int, enum node_type, int) | ) | [static, read] |
| static unsigned char* canonicalize_text PARAMS | ( | (const unsigned char *, const unsigned char *, const unsigned char **) | ) | [static] |
| static HASHNODE* parse_assertion PARAMS | ( | (const unsigned char *, const unsigned char *, struct answer **, int) | ) | [static] |
| void perror_with_name | ( | char * | name | ) | const |
Definition at line 4803 of file tradcpp.c.
References errno, errors, fprintf(), progname, and strerror().
Referenced by delete_if_ordinary(), encap_real_callback(), finclude(), main(), pfatal_with_name(), and process_command().
| void pfatal_with_name | ( | char * | name | ) | const |
Definition at line 4811 of file tradcpp.c.
References exit(), FATAL_EXIT_CODE, and perror_with_name().
Referenced by execute(), lang_specific_driver(), load_specs(), and main().
| static void process_include | ( | struct file_name_list * | stackp, | |
| const U_CHAR * | fbeg, | |||
| int | flen, | |||
| int | system_header_p, | |||
| FILE_BUF * | op | |||
| ) | [static] |
Definition at line 2478 of file tradcpp.c.
References alloca, close, deps_add_dep(), deps_missing_files, error_from_errno(), f, finclude(), file_name_list::fname, IS_ABSOLUTE_PATHNAME, len, max_include_len, memcpy, file_name_list::next, O_RDONLY, open, p, print_deps, ptr, strcat(), strcmp(), strcpy, strlen(), strncat(), strncpy(), system_include_depth, warning, xmalloc(), and xstrdup().
Definition at line 1197 of file tradcpp.c.
References abort, alloca, file_buf::buf, file_buf::bufp, c, check_expand, hashval::defn, file_name_list::fname, handle_directive(), HASHSIZE, HASHSTEP, i, file_buf::if_stack, indepth, instack, is_idchar, is_space, ISIDNUM, hashnode::length, file_buf::length, line_for_error(), file_buf::lineno, file_buf::macro, macroexpand(), MAKE_POS, memcpy, hashnode::name, definition::nargs, newline_fix(), hashnode::next, no_output, NULL, output_line_command(), p, POPMACRO, put_out_comments, q, RECACHE, same_file, skip_if_group(), str, T_ELIF, T_ELSE, T_IF, T_IFDEF, T_IFNDEF, T_MACRO, hashnode::type, hashnode::value, warn_comments, and warning.
Referenced by calculate_global_regs_live(), expand_to_temp_buffer(), finclude(), machine_dependent_reorg(), main(), mt_reorg_hazard(), sh_reorg(), and vect_analyze_loop_form().
Definition at line 5167 of file tradcpp.c.
References file_buf::buf, file_buf::bufp, file_buf::fname, file_buf::free_ptr, file_buf::if_stack, indepth, instack, file_buf::length, file_buf::lineno, file_buf::macro, NULL, and directive::type.
Definition at line 3730 of file tradcpp.c.
References error(), if_stack::fname, free(), indepth, instack, is_idchar, is_nvspace, directive::length, if_stack::lineno, directive::name, name_newline_fix(), newline_fix(), if_stack::next, skip_quoted_string(), skip_to_end_of_comment(), strncmp(), T_ELIF, T_ELSE, T_ENDIF, T_IF, T_IFDEF, T_IFNDEF, if_stack::type, directive::type, and xcalloc().
Referenced by conditional_skip(), do_elif(), do_else(), and rescan().
| static U_CHAR* skip_quoted_string | ( | U_CHAR * | bp, | |
| const U_CHAR * | limit, | |||
| int | start_line, | |||
| int * | count_newlines, | |||
| int * | backslash_newlines_p, | |||
| int * | eofp | |||
| ) | const [static] |
Definition at line 4016 of file tradcpp.c.
References c, and line_for_error().
Referenced by dump_defn_1(), handle_directive(), and skip_if_group().
Definition at line 3953 of file tradcpp.c.
References file_buf::bufp, file_buf::lineno, newline_fix(), NULL, put_out_comments, warn_comments, and warning.
Referenced by handle_directive(), and skip_if_group().
Definition at line 2163 of file tradcpp.c.
References abort, alloca, buf, file_buf::bufp, check_expand, error(), fatal(), file_buf::fname, i, indepth, instack, is_idchar, is_idstart, len, file_buf::lineno, localtime(), lookup(), memcpy, monthnames, NULL, SKIP_WHITE_SPACE, sprintf(), strlen(), T_BASE_FILE, T_CONST, T_DATE, T_FILE, T_INCLUDE_LEVEL, T_SPEC_DEFINED, T_SPECLINE, T_TIME, T_UNUSED, T_VERSION, time, tmp, hashnode::type, and version_string.
Referenced by macroexpand().
| int test_assertion | ( | unsigned char ** | pbuf | ) |
Definition at line 3396 of file tradcpp.c.
References buf, find_answer(), is_idchar, is_space, node, parse_assertion(), result, strlen(), T_ASSERT, T_IF, and hashnode::type.
Definition at line 4702 of file tradcpp.c.
References _, errors, file_buf::fname, fprintf(), fputs(), i, indepth, inhibit_warnings, instack, file_buf::lineno, MT_ERROR, MT_WARNING, NULL, progname, putc(), and vfprintf().
| int deps_append = 0 |
| int deps_missing_files = 0 |
Definition at line 70 of file tradcpp.c.
Referenced by init_dependency_output(), main(), and process_include().
| int dump_macros |
| int flag_signed_char = 0 |
| IF_STACK_FRAME* if_stack = NULL |
| int ignore_srcdir |
| struct file_name_list* include = 0 |
| int indepth = -1 |
Definition at line 140 of file tradcpp.c.
Referenced by do_elif(), do_else(), do_endif(), do_if(), do_include(), do_include_next(), do_line(), do_xifdef(), expand_to_temp_buffer(), finclude(), line_for_error(), macarg(), macroexpand(), main(), rescan(), run_directive(), skip_if_group(), special_symbol(), and v_message().
| int inhibit_output = 0 |
| int inhibit_warnings = 0 |
Referenced by do_elif(), do_else(), do_endif(), do_if(), do_include(), do_include_next(), do_line(), do_xifdef(), expand_to_temp_buffer(), ffecom_close_include_(), ffecom_file_(), ffecom_open_include_(), finclude(), line_for_error(), macarg(), macroexpand(), main(), print_containing_files(), CFG::Process_no_exit(), rescan(), run_directive(), skip_if_group(), special_symbol(), and v_message().
const char* const monthnames[] [static] |
| int no_line_commands |
Definition at line 74 of file tradcpp.c.
Referenced by main(), output_line_command(), and print_line().
| int no_output |
Definition at line 104 of file tradcpp.c.
Referenced by main(), output_line_command(), and rescan().
Definition at line 157 of file tradcpp.c.
Referenced by _bfd_vms_length_hash_symbol(), conversion_loop(), one_cppchar_to_utf8(), one_utf8_to_utf16(), one_utf8_to_utf32(), and output_fpop().
| int print_deps = 0 |
Definition at line 52 of file tradcpp.c.
Referenced by init_dependency_output(), main(), and process_include().
| int print_deps_phony_targets = 0 |
| int put_out_comments = 0 |
Definition at line 43 of file tradcpp.c.
Referenced by main(), rescan(), and skip_to_end_of_comment().
| int system_include_depth = 0 |
Definition at line 150 of file tradcpp.c.
Referenced by output_line_command(), and process_include().
const char* user_label_prefix [static] |
| int warn_comments |
Definition at line 98 of file tradcpp.c.
Referenced by _cpp_lex_direct(), _cpp_skip_block_comment(), copy_comment(), main(), rescan(), skip_block_comment(), and skip_to_end_of_comment().
1.5.6