aboutsummaryrefslogtreecommitdiff
path: root/gcc/cppfiles.c
AgeCommit message (Collapse)AuthorFilesLines
2001-10-11alias.c: Remove uses of "register" specifier in declarations of arguments ↵Stan Shebs1-1/+1
and local... 2001-10-10 Stan Shebs <shebs@apple.com> * alias.c: Remove uses of "register" specifier in declarations of arguments and local variables. * c-common.c: Ditto. * c-convert.c: Ditto. * c-decl.c: Ditto. * c-format.c: Ditto. * c-semantics.c: Ditto. * c-typeck.c: Ditto. * caller-save.c: Ditto. * calls.c: Ditto. * cfg.c: Ditto. * cfgbuild.c: Ditto. * cfgrtl.c: Ditto. * collect2.c: Ditto. * combine.c: Ditto. * convert.c: Ditto. * cppexp.c: Ditto. * cppfiles.c: Ditto. * cse.c: Ditto. * dbxout.c: Ditto. * defaults.h: Ditto. * df.c: Ditto. * dwarf2out.c: Ditto. * dwarfout.c: Ditto. * emit-rtl.c: Ditto. * explow.c: Ditto. * expmed.c: Ditto. * expr.c: Ditto. * final.c: Ditto. * fix-header.c: Ditto. * floatlib.c: Ditto. * flow.c: Ditto. * fold-const.c: Ditto. * function.c: Ditto. * gcc.c: Ditto. * gcse.c: Ditto. * gen-protos.c: Ditto. * genattrtab.c: Ditto. * gencheck.c: Ditto. * genconfig.c: Ditto. * genemit.c: Ditto. * genextract.c: Ditto. * genflags.c: Ditto. * gengenrtl.c: Ditto. * genoutput.c: Ditto. * genpeep.c: Ditto. * genrecog.c: Ditto. * gensupport.c: Ditto. * global.c: Ditto. * gmon.c: Ditto. * graph.c: Ditto. * haifa-sched.c: Ditto. * hard-reg-set.h: Ditto. * hash.c: Ditto. * integrate.c: Ditto. * jump.c: Ditto. * lists.c: Ditto. * local-alloc.c: Ditto. * loop.c: Ditto. * mips-tdump.c: Ditto. * mips-tfile.c: Ditto. * optabs.c: Ditto. * prefix.c: Ditto. * print-rtl.c: Ditto. * read-rtl.c: Ditto. * real.c: Ditto. * recog.c: Ditto. * reg-stack.c: Ditto. * regclass.c: Ditto. * regmove.c: Ditto. * reload.c: Ditto. * reload1.c: Ditto. * reorg.c: Ditto. * resource.c: Ditto. * rtl.c: Ditto. * rtlanal.c: Ditto. * scan.c: Ditto. * sched-deps.c: Ditto. * sched-rgn.c: Ditto. * sdbout.c: Ditto. * simplify-rtx.c: Ditto. * stmt.c: Ditto. * stor-layout.c: Ditto. * toplev.c: Ditto. * tradcif.y: Ditto. * tradcpp.c: Ditto. * tree.c: Ditto. * unroll.c: Ditto. * varasm.c: Ditto. * xcoffout.c: Ditto. From-SVN: r46173
2001-10-10calls.c: Fix formatting.Kazu Hirata1-1/+1
* calls.c: Fix formatting. * c-decl.c: Likewise. * cfgcleanup.c: Likewise. * combine.c: Likewise. * cppfiles.c: Likewise. * cpplib.c: Likewise. * cppmacro.c: Likewise. * crtstuff.c: Likewise. * cse.c: Likewise. * dwarf2out.c: Likewise. * expmed.c: Likewise. * expr.c: Likewise. * fold-const.c: Likewise. * function.c: Likewise. * gcse.c: Likewise. * genattrtab.c: Likewise. * ggc-page.c: Likewise. * integrate.c: Likewise. * libgcc2.c: Likewise. * loop.c: Likewise. * optabs.c: Likewise. * profile.c: Likewise. * protoize.c: Likewise. * real.c: Likewise. * recog.c: Likewise. * reload1.c: Likewise. * reload.c: Likewise. * reorg.c: Likewise. * resource.c: Likewise. * sched-rgn.c: Likewise. * sdbout.c: Likewise. * stmt.c: Likewise. * toplev.c: Likewise. * varasm.c: Likewise. From-SVN: r46145
2001-10-08cppfiles.c (open_file): Don't mark zero-length files never-reread here.Neil Booth1-25/+15
* cppfiles.c (open_file): Don't mark zero-length files never-reread here. Don't output diagnostics here either. (stack_include_file): Mark them never-reread here. (_cpp_read_file): Update. From-SVN: r46084
2001-08-22cpperror.c (print_location): Don't show _Pragma.Neil Booth1-8/+16
* cpperror.c (print_location): Don't show _Pragma. * cppfiles.c (_cpp_pop_file_buffer): Handle -include file pushing and file change callback generation here. (stack_include_file): Update use of cpp_push_buffer. * cpphash.h (_cpp_pop_file_buffer): Update prototype. (struct cpp_buffer): Remove type, pfile members. * cppinit.c (cpp_handle_option): Use free_chain. * cpplex.c (_cpp_lex_token): Don't do -include file pushing here. (skip_escaped_newlines, get_effective_char, lex_percent): Take a cpp_reader rather than a cpp_buffer. (skip_escaped_newlines, get_effective_char, skip_block_comment, skip_line_comment, parse_string, lex_percent, lex_dot, _cpp_lex_token): Update accordingly. * cpplib.c (_cpp_pop_buffer): Don't do file change callback generation here. (cpp_push_buffer): Update prototype. (run_directive): Update use of cpp_push_buffer. (_cpp_do__Pragma, cpp_define, cpp_define_builtin, cpp_undef, handle_assertion): Update use of run_directive. * cpplib.h (enum cpp_buffer_type): Remove. (cpp_push_buffer): Update prototype. * fix-header.c (read_scan_file): Update. From-SVN: r45112
2001-08-21cppfiles.c (stack_include_file): line-map.c now handles include depth.Neil Booth1-12/+1
* cppfiles.c (stack_include_file): line-map.c now handles include depth. (handle_missing_handler): Similarly. (_cpp_execute_include): Similarly. (_cpp_pop_file_buffer): Similarly. * cpphash.h (struct cpp_reader): Remove system_include_depth, buffer_stack_depth and include_depth. * cpplib.c (do_include_common): line-map.c now handles include depth. (cpp_push_buffer): Similarly. (_cpp_pop_buffer): Similarly. * cppmacro.c (builtin_macro): Update. * line-map.c (init_line_maps): Set depth. (add_line_map): Increment "used" earlier. Update and use the include depth. (trace_include): Use the include depth. * line-map.h (struct line_maps): New member depth. From-SVN: r45085
2001-08-21cppfiles.c (stack_include_file): Don't handle -H here.Neil Booth1-12/+2
* cppfiles.c (stack_include_file): Don't handle -H here. * cppinit.c (cpp_start_read): Set include tracing after cpp_post_options and after stacking the main file. * line-map.c (trace_include): New. (init_line_maps, add_line_map): Update. * line-map.h (struct line_maps): New member trace_includes. From-SVN: r45084
2001-08-21cppfiles.c (stack_include_file): Harmonize system headerness tests.Neil Booth1-41/+43
* cppfiles.c (stack_include_file): Harmonize system headerness tests. * cppfiles.c (stack_include_file): Only stack a file if there is something to do. Return a boolean indicating whether a buffer was stacked or not. (_cpp_execute_include): Similarly. (_cpp_read_file): Similarly. * cpphash.h (_cpp_read_file, _cpp_execute_include): Update prototypes. From-SVN: r45083
2001-08-17cpperror.c (print_location): Don't take a file name; use the line map instead.Neil Booth1-2/+6
* cpperror.c (print_location): Don't take a file name; use the line map instead. (_cpp_begin_message): Similarly. (cpp_ice, cpp_fatal, cpp_error, cpp_error_with_line, cpp_warning, cpp_warning_with_line, cpp_pedwarn, cpp_pedwarn_with_line): Update. (cpp_pedwarn_with_file_and_line): Remove. * cppfiles.c (stack_include_file): Update; set filename to stdin here when appropriate. * cpphash.h (struct cpp_buffer): Remove nominal_fname. (_cpp_begin_message): Don't take a file name. * cppinit.c: Add comment. * cpplex.c: Fix end-of-directive indicator. * cpplib.c: Don't include intl.h. (run_directive, do_diagnostic): Update. (do_line): Update to not use nominal_fname. (cpp_push_buffer): Don't take a filename. * cpplib.h (struct ht): Remove. (cpp_push_buffer): Don't take a filename. (cpp_pedwarn_with_file_and_line): Remove. * cppmacro.c (struct cpp_macro): Remove file. (builtin_macro): Update. (_cpp_create_definition): Update. * cppmain.c: Correct comment. * fix-header.c (read_scan_file): Update. From-SVN: r44986
2001-08-11c-lex.c (map): Make const.Neil Booth1-8/+5
* c-lex.c (map): Make const. (cb_file_change): Update for callback passing a line map. Don't assume we have a previous map. Remove sanity check about popping too many files. * cpperror.c (print_location): Make map const. * cppfiles.c (stack_include_file): Update; line maps now hold sysp. (cpp_make_system_header): Similarly. (search_from): Similarly. (_cpp_execute_include): Don't remember where we came from. * cpphash.h (struct cpp_buffer): Remove return_to_line, sysp. (struct cpp_reader): Make map const. (CPP_IN_SYSTEM_HEADER, _cpp_do_file_change): Update. * cpplib.c (do_line): Update; line maps now hold sysp. (cpp_push_buffer): Similarly. (_cpp_do_file_change): Similarly; callback with map instead. (cpp_get_line_maps): Constify return value. (_cpp_pop_buffer): Update. * cpplib.h (struct cpp_file_change): Remove. (struct cpp_callbacks): Update. (cpp_get_line_maps): Constify return value. * cppmacro.c (_cpp_create_definition): Update. * cppmain.c (struct printer): Constify map. (maybe_print_line): Similarly. (print_line): Similarly. Deduce flags 1 and 2 here. (cb_file_change): Update. * line-map.c (free_line_maps): Warn regardless. (add_line_map): Return pointer to const. When passed NULL to_file with LC_LEAVE, use the obvious values for the return point so the caller doesn't have to figure them out. (lookup_line): Return pointer to const. (print_containing_files): Take pointer to const. * line-map.h (struct line_map): New members reason, sysp. (add_line_map): Return pointer to const. (lookup_line): Similarly. (print_containing_files): Take pointer to const. From-SVN: r44789
2001-08-05re PR preprocessor/3081 (Preprocessor merges 2 first lines when -imacros is ↵Neil Booth1-5/+4
being used) PR preprocessor/3081 * c-lex.c (map): New. (cb_file_change): Update map and use it. (cb_def_pragma, cb_define, cb_undef): Use map and line. (c_lex): Update to use map. * cpperror.c (print_location): Move to using logical line numbers. * cppfiles.c (stack_include_file): Update for new _cpp_do_file_change. (cpp_make_system_header): Similarly. (_cpp_execute_include): Stop line numbering hacks. Store the line we will return to. * cpphash.h (CPP_BUF_LINE): Remove. (struct cpp_buffer): Remove lineno and pseudo_newlines. Add map and return_to_line. (_cpp_do_file_change): Update. * cppinit.c (cpp_start_read): Update line kludge. * cpplex.c (handle_newline): Don't update lineno and pseudo_newlines. (trigraph_ok): Use logical line numbers for diagnostics. (skip_block_comment): Likewise. (skip_whitespace): Likewise. (skip_line_comment): Use pfile->line instead. (_cpp_lex_token): Update to use logical line numbering exclusively. Handle BOL locally. Accept new lines in directives, but keep pfile->line decremented. Diagnostics use logical lines. Update directive handling. * cpplib.c (SEEN_EOL): New. (skip_rest_of_line, check_eol): Use it. (end_directive): Increase line number when accepting the newline at the end of a directive. (run_directive): Simplify. (do_line): Bad LC_LEAVEs become LC_RENAMEs. Update. (_cpp_do_file_change): Update to take buffer line number as an argument, and store the current map in the cpp_reader. Remove line number kludges. (_cpp_do__Pragma): Restore output position after a _Pragma. (cpp_push_buffer): Don't set output line or lineno. (_cpp_pop_buffer): Transfer more info from a faked buffer. Remove line kludge. Set output_line. * cppmacro.c (builtin_macro): Update handling of __LINE__. (parse_arg): Use logical lines. (save_lookahead_token): Save EOFs too now. * cppmain.c (struct printer): Fix comments. (printer_init): Simplify, let caller do errors. (scan_translation_unit, check_multiline_token, dump_macro): Update. (maybe_print_line): Simplify. (print_line): Don't print a linemarker if -P. (cb_define, cb_undef, cb_def_pragma, cb_ident, cb_include): Update. (cb_file_change): Simplify. * line-map.h (LAST_SOURCE_LINE): Fix. (CURRENT_LINE_MAP): New. * gcc.dg/cpp/19951025-1.c: Revert. * gcc.dg/cpp/directiv.c: We no longer process directives that interrupt macro arguments. From-SVN: r44650
2001-08-04Makefile.in (CPPLIB_H): New, so that dependencies on cpplib.h are also on ↵Neil Booth1-1/+1
line-map.h. * Makefile.in (CPPLIB_H): New, so that dependencies on cpplib.h are also on line-map.h. * cppfiles.c (stack_include_file): Update. * cpphash.h (struct cpp_buffer): New member return_at_eof. (_cpp_pop_buffer): New. * cppinit.c (cpp_destroy, cpp_finish): Update. (do_includes): Mark each buffer to return at EOF. * cpplex.c (_cpp_lex_token): Pop buffers at EOF. Continue or return as requested. * cpplib.c (run_directive, do_line, cpp_push_buffer): Update. (cpp_pop_buffer): Rename _cpp_pop_buffer. Stop skipping. * cpplib.h (cpp_pop_buffer): Remove. (cpp_scan_buffer_nooutput): Rename cpp_scan_nooutput. * cppmacro.c (cpp_scan_buffer_nooutput): Similarly. No need to pop buffers. * cppmain.c (scan_buffer): Rename scan_translation_unit. No need to pop buffers. (do_preprocessing): Update. * fix-header.c (read_scan_file): Update. No need to pop buffers. * c-parse.in (_yylex): Similarly. * scan-decls.c (scan_decls): Similarly. * line-map.h: Update comments. * cp/spew.c (read_token): No need to pop buffers. * objc/Make-lang.in (objc-act.o): Update dependencies. From-SVN: r44634
2001-08-02line-map.c: New.Neil Booth1-3/+3
* line-map.c: New. * line-map.h: New. * Makefile.in (line-map.o): New. (LIBCPP_OBJS, LIBCPP_DEPS): Update. * c-lex.c (cb_file_change): Update for new cpp_file_change structure. * cpperror.c (print_containing_files): Similarly. (print_location): Update. Don't output a space before _Pragma. * cppfiles.c (stack_include_file): Set to line 1 immediately. (stack_include_filee, cpp_make_system_header): Update. (_cpp_execute_include): Get logical line number right for calling as-yet-unterminated #include. * cpphash.h (struct cpp_reader): Add line_maps. (_cpp_do_file_change): Update. * cppinit.c (cpp_create_reader): Initialize line maps. (cpp_destroy): Destroy line maps. (cpp_start_read): Get logical line number right. * cpplex.c (parse_string): Only warn once for multi-line strings. Use boolean variable for null warning. * cpplib.c (_cpp_handle_directive): End the directive if it isn't already. (do_include_common): End the directive early. (do_line): Don't warn about out-of-range lines in preprocessed source. Update. Remove unused variables. (_cpp_do_file_change): Update for new line mapping. (pragma_cb): New typedef. (cpp_register_pragma): Stop looking ahead before calling the handler. Clean up. (do_pragma_system_header): End directive early. (cpp_get_line_maps): New. (cpp_pop_buffer): Fudge logical line. Update. * cpplib.h: Include line-map.h (enum cpp_fc_reason): Remove. (struct cpp_file_change): Update. (cpp_get_line_maps): New. * cppmain.c (struct_printer): New member map. (cb_file_change): Update for new mappings. * fix-header.c (cb_file_change): Similarly. testsuite: * gcc.dg/cpp/19951025-1.c: Update. From-SVN: r44584
2001-08-01alias.c: Fix comment formatting.Kazu Hirata1-4/+4
* alias.c: Fix comment formatting. * bitmap.c: Likewise. * builtins.c: Likewise. * calls.c: Likewise. * c-common.c: Likewise. * c-decl.c: Likewise. * c-dump.c: Likewise. * c-lex.c: Likewise. * collect2.c: Likewise. * combine.c: Likewise. * conflict.c: Likewise. * cppfiles.c: Likewise. * cppinit.c: Likewise. * cpplex.c: Likewise. * cpplib.c: Likewise. * cppmacro.c: Likewise. * cppspec.c: Likewise. * c-pragma.c: Likewise. * crtstuff.c: Likewise. * cse.c: Likewise. * cselib.c: Likewise. * c-semantics.c: Likewise. * c-typeck.c: Likewise. From-SVN: r44547
2001-07-29cppexp.c (parse_defined): Always record the macro name.Neil Booth1-4/+4
* cppexp.c (parse_defined): Always record the macro name. (lex): Don't worry about identifiers, or special-case CPP_NOT here. (_cpp_parse_expr): Figure out at the end of the routine whether we saw a valid !defined() expression. * cppfiles.c (stack_include_file): Update for mi_valid. (_cpp_pop_file_buffer): Similarly. * cpplex.c (_cpp_lex_token): Similarly. * cpphash.h (enum mi_state, enum mi_ind, mi_state, mi_if_not_defined, mi_lexed): Remove. (mi_valid): New. * cpplib.c (do_if): Simplify. (do_endif, push_conditional, _cpp_handle_directive): Update for renaming of mi_state to mi_valid. * cpp.texi: Add index entries for digraphs, and add comment that C++ refers to them as alternative tokens. From-SVN: r44459
2001-05-22cppfiles.c (remove_component_p): Don't assume lstat/stat will keep errno ↵Alexandre Oliva1-0/+6
unchanged on success. * cppfiles.c (remove_component_p): Don't assume lstat/stat will keep errno unchanged on success. From-SVN: r42445
2001-05-05cppfiles.c (struct include_file): New member err_no.Neil Booth1-9/+9
* cppfiles.c (struct include_file): New member err_no. (find_or_create_entry): Set it. (open_file): Don't set fds to -2. Instead, use err_no to remember previous errors, if any. From-SVN: r41865
2001-04-06configure.in: Add check for lstat.Neil Booth1-96/+118
* configure.in: Add check for lstat. * configure, config.in: Regenerate. * cppinit.c (append_include_chain): Make empty path ".". * cpplib.c (do_line): Don't simplify #line paths. * cppfiles.c (remove_component_p): New function. (find_or_create_entry): Acknowledge stat () errors during path simplification. (handle_missing_header): Don't simplify paths. (_cpp_simplify_pathname): Don't simplify VMS paths. Return the empty path untouched. Don't leave a trailing '/'. From-SVN: r41148
2001-04-06cppfiles.c (open_file): Fail directories silently, but with an errno of ↵Neil Booth1-30/+34
NOENT set. * cppfiles.c (open_file): Fail directories silently, but with an errno of NOENT set. (read_include_file): Move the common exit code to the sole caller. Return an int indicating success or failure. Let open_file handle directories. (stack_include_file): If read_include_file fails, push a "null" buffer. From-SVN: r41138
2001-03-16* cppfiles.c (stack_include_file): Use MAX of sysp.Alexandre Oliva1-2/+2
From-SVN: r40536
2001-03-15cpp.texi: Update documentation for -include and -imacros.Neil Booth1-73/+72
* cpp.texi: Update documentation for -include and -imacros. * cppfiles.c (struct include_file): Remove "defined" memeber. (find_or_create_entry): Make a copy of the file name, and simplify it. (open_file): Update to ensure we use the simplified filename. (stack_include_file): Don't set search_from. (cpp_included): Don't simplify the path name here. (find_include_file): New prototype. Call search_from to get the start of the "" include chain. Don't simplify the filenames here. (_cpp_execute_include): New prototype. Move diagnostics to do_include_common. Update. (_cpp_pop_file_buffer): Don't set defined. (search_from): New prototype. Use the preprocessor's cwd for files included from the command line. (read_name_map): Don't simplify the pathname here. * cpphash.h (enum include_type): New. (struct buffer): Delete search from. New search_cached. (_cpp_execute_include): Update prototype. * cppinit.c (do_includes): Use _cpp_execute_include. * cpplib.c (do_include_common): New function. (do_include, do_include_next, do_import): Use it. From-SVN: r40486
2001-03-14cppfiles.c (stack_include_file): Only increase the include count if we ↵Neil Booth1-57/+56
actually process the file properly... * cppfiles.c (stack_include_file): Only increase the include count if we actually process the file properly, as opposed to treating it as length zero. Only call read_include_file if not DO_NOT_REREAD. Handle the -H include file output here. (read_include_file): Remove now redundant DO_NOT_REREAD check. (cpp_included, find_include_file): Simplify pathnames after remapping them. If remapping, don't use the remapped file name's buffer as our scratch buffer. (cpp_pop_file_buffer): Replace the multiple include macro only if it isn't yet set. (read_name_map): Simplify remapped names when reading in. (remap_filename): Move code to code path that uses it. (_cpp_simplify_pathname): Return the input pointer. * cpphash.h (_cpp_simplify_pathname): Update prototype. From-SVN: r40467
2001-03-13cppfiles.c (NO_INCLUDE_PATH): New macro.Neil Booth1-70/+47
* cppfiles.c (NO_INCLUDE_PATH): New macro. (find_include_file): Decide here which part of the include chain to start the search. Complain about an empty include chain in all cases apart from an abolsute file name. (_cpp_execute_include): Don't choose the search chain here. Don't call handle_missing_include in the case of an empty include chain. (_cpp_compare_file_date): Don't choose the search chain here. * cpplib.c (do_include_next): Move the in-main-file diagnostic here from _cpp_execute_include. Behave like #include if we're in the main file. From-SVN: r40445
2001-03-12cppfiles.c: Update comments.Neil Booth1-105/+116
* cppfiles.c: Update comments. (destroy_include_file_node): Rename destroy_node. (find_or_create_entry): New function. (open_file, _cpp_fake_include): Use it. (handle_missing_header): New function, broken out of _cpp_execute include. Don't segfault if there is no system or quoted path. (_cpp_execute_include): Use handle_missing_header. From-SVN: r40423
2001-03-11cppfiles.c (INCLUDE_LEN_FUDGE, ENOMEM): Delete.Neil Booth1-12/+3
* cppfiles.c (INCLUDE_LEN_FUDGE, ENOMEM): Delete. (cpp_included, find_include_file): Update. (_cpp_compare_file_date): Make else unconditional. From-SVN: r40388
2001-03-10cppfiles.c (search_from): Use lbasename.Neil Booth1-5/+1
* cppfiles.c (search_from): Use lbasename. * mkdeps.c (deps_add_default_target): Use lbasename. From-SVN: r40364
2001-03-04* cppfiles.c (search_from): Special case the empty string.Neil Booth1-1/+5
From-SVN: r40236
2001-03-04cppfiles.c (_cpp_execute_include): Don't make a null-terminated copy of the ↵Neil Booth1-15/+6
filename. * cppfiles.c (_cpp_execute_include): Don't make a null-terminated copy of the filename. Don't use CPP_PREV_BUFFER. Don't call strlen or strcpy; we already know the length. (_cpp_compare_file_date): Similarly. * cpphash.h (struct cpp_reader): Delete done_initialising. (CPP_PREV_BUFFER): Delete. * cppinit.c (cpp_start_read): Don't set done_initialising. * cpplex.c (parse_string): Guarantee null-termination. (_cpp_equiv_toklists): Remove. * cpplib.c (glue_header_name): Null-terminate. (do_line): Don't leak memory. * cpplib.h (BT_WEAK): Delete. * cppmain.c (cb_ident): Strings are now null-terminated. From-SVN: r40233
2001-03-02cppfiles.c (struct include_file): Update.Neil Booth1-93/+75
* cppfiles.c (struct include_file): Update. (stack_include_file): Use search_from. (cpp_included, find_include_file): Update. (cpp_execute_include): Update. ptr->name may not be null terminated. Use the new search_from member variable of cpp_buffer. (_cpp_compare_file_date): Similarly. (search_from): New function, similiar to actual_directory. (actual_directory): Delete. (remap_filename): Update. loc->name may not be null terminated. (struct file_name_list): Rename search_path. Update. * cpphash.h (struct cpp_buffer): Delete actual_dir. New members search_from and dir. (struct cpp_reader): Remove actual_dirs. * cppinit.c (struct cpp_pending): Update for renamed objects. (append_include_chain, remove_dup_dir, remove_dup_dirs, merge_include_chains, cpp_destroy, cpp_start_read): Similarly. * cpplib.h (struct cpp_options): Similarly. From-SVN: r40178
2001-02-21cppfiles.c: Update comments.Neil Booth1-8/+4
* cppfiles.c: Update comments. (_cpp_read_file): Don't check for NULL filenames any more. * cppinit.c (cpp_start_read): Don't do canonicalization of in_fname and out_fname. Use the passed file name exclusively. (_cpp_handle_options): Don't treat "-" as a command line option, but as a normal filename. (_cpp_post_options): Canonicalize in_fname and out_fname. * cppmain.c (printer_init): Don't check out_fname for NULL. * c-lex.c (orig_filename): Rename cpp_filename for clarity. (init_c_lex): Update, and use "" to represent stdin to CPP. (yyparse): Update. From-SVN: r39938
2001-02-19cppfiles.c (stack_include_file): Generate dependencies here, and manage ↵Neil Booth1-19/+23
include_count here too. * cppfiles.c (stack_include_file): Generate dependencies here, and manage include_count here too. (PRINT_THIS_DEP): Delete. (_cpp_execute_include): Do not generate dependencies here, apart from the case of a missing header. Do not manage include_count. (_cpp_read_file): Leave dependency generation to stack_include_file. From-SVN: r39899
2001-02-16cppfiles.c (_cpp_make_system_header): Generate a file change callback.Neil Booth1-0/+2
* cppfiles.c (_cpp_make_system_header): Generate a file change callback. From-SVN: r39749
2001-01-24cppfiles.c (_cpp_read_file): Add to dependencies if requested.Jakub Jelinek1-0/+3
* cppfiles.c (_cpp_read_file): Add to dependencies if requested. * cppinit.c (cpp_start_read): Remove deps_add_dep call. * tradcpp.c (main): Add -imacros or -include'd dependencies for -M*. * cpp.texi (-M, -MM): Document -M -include behaviour. From-SVN: r39240
2001-01-13cppfiles.c (_cpp_fake_include): New function.Neil Booth1-1/+22
* cppfiles.c (_cpp_fake_include): New function. * cpphash.h (_cpp_fake_include): New. * cpplib.c (do_line): Call _cpp_fake_include when entering header files in preprocessed input. * cppmain.c (cb_pragma_implementation): Remove handling. (setup_callbacks): Don't register pragmas. From-SVN: r38987
2001-01-11[multiple changes]Neil Booth1-4/+4
2001-01-11 Neil Booth <neil@daikokuya.demon.co.uk> * cppinit.c (cpp_start_read): If -fpreprocessed, ignore -D, -U and -A, and don't initialize the builtins. * cppmain.c (cb_define, cb_undef): Unconditionally process the callback. * tradcpp.c (main): Fix typo. 2000-01-11 Mark Elbrecht <snowball3@bigfoot.com> * cppfiles.c (cpp_included, find_include_file, _cpp_execute_include) (read_name_map): Use IS_ABSOLUTE_PATH. * tradcpp.c (get_filename): Likewise. From-SVN: r38925
2001-01-09cppfiles.c (_cpp_execute_include): Move `len` initialisation after `ptr` is ↵Graham Stott1-1/+2
initialised. * cppfiles.c (_cpp_execute_include): Move `len` initialisation after `ptr` is initialised. From-SVN: r38826
2001-01-04tradcpp.c (deps_file, [...]): New variables.Jakub Jelinek1-7/+8
* tradcpp.c (deps_file, print_deps_missing_files): New variables. (main): Handle -MG, -MD, -MMD. Bail out if -MG is given without -M or -MM. (do_include): Handle missing headers like cpp0. * cppfiles.c (_cpp_execute_include): Don't prefix absolute header paths with first include pathname. Don't strcat to uninitialized string. From-SVN: r38683
2000-12-18c-lex.c: s/change_file/file_change.Neil Booth1-8/+11
* c-lex.c: s/change_file/file_change. * cpplib.h: Similarly. * cppmain.c: Similarly. * fix-header.c: Similarly. * cppfiles.c (stack_include_file): Pass the buffer location and size to cpp_push_buffer. Generate the file_change callback, so that sysp is already set. * cpphash.h: Add _cpp_do_file_change. * cpplib.c (do_line): Set buffer->sysp directly. Generate the file_change callback after setting sysp. (_cpp_do_file_change): Handle FC_ENTER and the FC_RENAME exception here. (cpp_push_buffer): Don't generate a callback. Clear sysp. (cpp_pop_buffer): Clean up logic. From-SVN: r38357
2000-12-17c-lex.c: Move main_input_filename handling to FC_ENTER.Neil Booth1-13/+0
* c-lex.c: Move main_input_filename handling to FC_ENTER. Clean up. * cpperror.c (print_containing_files): Get right line number. (print_location): Output column of 1 if 0. * cppfiles.c (stack_include_file): cpp_push_buffer handles the callback. * cpphash.h (_cpp_do_file_change): No longer external. * cpplib.c (do_file_change): Now local to cpplib.c. (do_line): Fake a buffer stack for preprocessed files. (cpp_push_buffer): Create a file_change callback. Handle faked buffers. (cpp_pop_buffer): Similarly. * cpplib.h: BUF_FAKE: New buffer type. * cppmain.c: Update to handle correct file renaming where a #line is the first line of the main file, and produce only the renamed file, not the original file, as output. From-SVN: r38319
2000-12-15cppfiles.c (hack_vms_include_specification): Delete function (not used since ↵Zack Weinberg1-280/+0
1998). * cppfiles.c (hack_vms_include_specification): Delete function (not used since 1998). From-SVN: r38268
2000-12-13cppfiles.c (read_name_map): Return null if open () fails.Neil Booth1-28/+22
* cppfiles.c (read_name_map): Return null if open () fails. (remap_filename): Simplify logic. Add ICE if it doesn't work as expected. Perform secondary lookup attempt on base filename only. From-SVN: r38227
2000-12-11cpperror.c (print_location): New function.Neil Booth1-4/+1
* cpperror.c (print_location): New function. (print_containing_files): Simplify. (_cpp_begin_message): Simplify and use print_location. * cppfiles.c (stack_include_file): Update. (_cpp_pop_file_buffer): Update. * cpphash.h (struct cpp_buffer): New members include_stack_listed and type. * cpplib.c (_cpp_handle_directive): Buffer->inc is not null. (run_directive): Take buffer type. cpp_push_buffer cannot fail. (_cpp_do__Pragma, cpp_define, _cpp_define_builtin, cpp_undef, handle_assertion): Update. (cpp_push_buffer): Take a buffer type and file name. (cpp_pop_buffer): Update. Clear include_stack_listed. * cpplib.h (input_stack_listing_current): Remove. (enum cpp_buffer_type): New. (cpp_push_buffer): New prototype. * cppmacro.c (builtin_macro): Simplify; buffer cannot be null. * fix-header.c (read_scan_file): Update. From-SVN: r38186
2000-12-09cppfiles.c (NEVER_REREAD, [...]): Move from cpphash.h.Neil Booth1-0/+10
* cppfiles.c (NEVER_REREAD, DO_NOT_REREAD): Move from cpphash.h. * cpphash.h (NEVER_REREAD, DO_NOT_REREAD, ABSOLUTE_PATH): Delete. * cpplex.c (parse_identifier): Improve diagnostic. (_cpp_lex_token): Return unconditionally at the end of a directive. * cpplib.c (read_flag): Verify legality of each flag. (end_directive): Resotre pfile->skipping before skip_rest_of_line. (do_line): Use the new read_flag. * cppmacro.c (struct cpp_macro, parse_arg, replace_args, check_macro_redefinition, parse_params): Rename var_args to variadic. From-SVN: r38150
2000-12-07cppfiles.c (struct include_file): Move from cpphash.h.Neil Booth1-10/+59
* cppfiles.c (struct include_file): Move from cpphash.h. (_cpp_never_reread): New function. (open_file, read_include_file): Use it. (stack_include_file): Set the buffer's sysp according to the path in which the file was found. (find_include_file): Don't set sysp. (cpp_make_system_header, actual_directory): Update. (_cpp_execute_include): Do #include_next lookup handling here, not in cpplib.c. Use _cpp_never_reread. * cpphash.h (struct_include_file): Remove. (struct cpp_buffer): New member sysp. (CPP_IN_SYSTEM_HEADER, _cpp_execute_include): Update. (_cpp_never_reread): New. * cpplib.c (read_line_number): Rename read_flag. Rework slightly. (end_directive): Clear line_extension flag. (_cpp_handle_directive): Set line_extension flag for #number. (do_include_next): Handle path lookup in _cpp_execute_include. (do_line): Cleanup to use read_flag. Don't allow flags in #line. (_cpp_do_file_change): Update. (do_pragma_once): Use cpp_never_reread. Clean up. * cpplib.h (struct lexer_state): New member line_extension. From-SVN: r38120
2000-12-07c-common.c (parse_in): Make a cpp_reader *.Neil Booth1-44/+0
* c-common.c (parse_in): Make a cpp_reader *. * cppfiles.c (_cpp_fake_include): Remove. * cpphash.h: Similarly. * cpplib.c (do_line): Don't call _cpp_fake_include. A valid #line always creates a callback; FC_RENAME if there are no #line flags. * fix-header.c (read_scan_file): cpp_push_buffer cannot fail. The first EOF must be our get_char buffer. From-SVN: r38101
2000-12-05cppfiles.c (stack_include_file): Push zero-length buffers in case of failure.Neil Booth1-37/+47
* cppfiles.c (stack_include_file): Push zero-length buffers in case of failure. Return void, as we don't fail any more. (read_include_file): Check for files we shouldn't re-read. Don't return an error code; errors are implied by marking the file NEVER_REREAD. (_cpp_execute_include): Move the recursion and in-macro checks here. Update for stack_include_file not failing. * cpplib.c (cpp_push_buffer): Always succeed, since _cpp_execute_include performs the recursion check. Tidy up. * cpplib.h (cpp_push_buffer): Update prototype. From-SVN: r38057
2000-12-04cppfiles.c (cpp_make_system_header): Take 2 booleans, and operate on current ↵Neil Booth1-10/+9
buffer. * cppfiles.c (cpp_make_system_header): Take 2 booleans, and operate on current buffer. (cpp_read_file): Rename _cpp_read_file. * cpplib.c (do_line, do_pragma_system_header): Update calls to cpp_make_system_header. * fix-header.c: Similarly. * cpphash.h (_cpp_read_file): Move from... * cpplib.h: ... here. * cppinit.c (do_includes, cpp_start_read): Update appropriately. From-SVN: r37989
2000-11-27c-lex.c (cb_enter_file, [...]): Combine into the new function cb_change_file.Neil Booth1-17/+11
* c-lex.c (cb_enter_file, cb_leave_file, cb_rename_file): Combine into the new function cb_change_file. (init_c_lex): Update. * cppfiles.c (stack_include_file): Use _cpp_do_file_change. (cpp_syshdr_flags): Delete. * cpphash.h (_cpp_do_file_change): New prototype. Move struct cpp_buffer here from... * cpplib.h (struct cpp_buffer): ... here. (enum cpp_fc_reason, struct cpp_file_loc, struct_cpp_file_change, change_file): New. (enter_file, leave_file, rename_file, cpp_syshdr_flags): Delete. * cpplib.c (do_line): Update for new cb_change_file callback. (_cpp_do_file_change): New function. (_cpp_pop_buffer): Update to use it. * cppmain.c (move_printer): Delete. (main): Set up single callback cb_change_file. (cb_enter_file, cb_leave_file, cb_rename_file): Delete. (cb_change_file): New. * fix-header.c (cur_file, cb_change_file): New. (recognized_function, read_scan_file): Update. * scan-decls.c (scan_decls): Update. * scan.h (recognized_function): Update prototype. From-SVN: r37784
2000-11-03cppfiles.c (open_file): If already read, then don't reopen.Nathan Sidwell1-4/+12
* cppfiles.c (open_file): If already read, then don't reopen. Immediately close an empty file. From-SVN: r37227
2000-10-30cppfiles.c (stack_include_file): Check for stacked contexts here.Neil Booth1-0/+3
* cppfiles.c (stack_include_file): Check for stacked contexts here. * cpphash.h (_cpp_do__Pragma): New prototype. * cppinit.c (cpp_reader_init): Add _Pragma keyword to hash table. * cpplex.c (skip_escaped_newlines): Only process trigraphs and escaped newlines if !(buffer->from_stage3). (_cpp_lex_token): Warn about missing newlines iff !buffer->from_stage3. * cpplib.c (get__Pragma_string, destringize, _cpp_do__Pragma): New functions. (run_directive): Set output_line for _Pragma to avoid line markers in output. Set from_stage3 and prevent macro expansion for _Pragma and command-line options. Check buffer exhaustion. (cpp_push_buffer): Don't check for stacked macro contexts, as this is perfectly legitimate for _Pragma. Move the check to stack_include_file instead. Set from_stage3 iff buffer is preprocessed input. * cpplib.h (struct cpp_buffer): Make warned_cplusplus_comments unsigned. New boolean from_stage3. (struct spec_nodes): Add n__Pragma. * cppmacro.c (enter_macro_context): Flip sense of return value. (_cpp_get_token): Handle _Pragma operator. From-SVN: r37147
2000-10-28New macro expander.Neil Booth1-27/+39
2000-10-28 Neil Booth <neilb@earthling.net> New macro expander. * cpplib.c (struct answer): New. (struct if_stack): Use cpp_lexer_pos rather than line and col. Rename cmacro mi_cmacro. (struct directive, KANDR, STDC89, EXTENSION, COND, IF_COND, INCL, IN_I): New directive and flags. (skip_rest_of_line, check_eol, run_directive, glue_header_name, parse_answer, parse_assertion, find_answer): New functions. (parse_ifdef, detect_if_not_defined, validate_else): Remove. (lex_macro_node): New function to replace parse_ifdef and get_define_node. (_cpp_handle_directive): New function, combines _cpp_check_directive and _cpp_check_linemarker. (do_define, do_undef, parse_include, do_include, do_import, do_include_next, read_line_number, do_line, do_ident, do_pragma, do_pragma_once, do_pragma_poison, do_pragma_dependency): Update for new token getting interface. (do_ifdef, do_ifndef, do_if, do_else, do_endif, push_conditional) : Update for new multiple-include optimisation technique. (do_elif): Don't forget to invalidate controlling macros. (unwind_if_stack, cpp_defined, cpp_push_buffer, cpp_pop_buffer): Update. (parse_assertion, parse_answer, find_answer, _cpp_test_assertion): Functions to handle assertions with the new token interface. (do_assert, do_unassert): Use them. (cpp_define, _cpp_define_builtin, cpp_undef, cpp_assert, cpp_unassert): Use run_directive. (_cpp_init_stacks): Register directive names. Don't register special nodes. * cpperror.c (print_containing_files, _cpp_begin_message): Update to new position recording regime. (cpp_ice, cpp_fatal, cpp_error, cpp_error_with_line, cpp_warning, cpp_warning_with_line, cpp_pedwarn, cpp_pedwarn_with_line, cpp_pedwarn_with_file_and_line): Update for _cpp_begin_message changes. (cpp_type2name): Move to cpplex.c. * cppexp.c (parse_charconst): spec_nodes is no longer a pointer. (parse_defined): Update to handle new multiple include optimisation method. Remove poisoned identifier warning. (parse_assertion, TYPE_NAME): Delete. (lex): Update for multiple include optimisation, removal of CPP_DEFINED, to use _cpp_test_assertion for assertions and cpp_token_as_text. (_cpp_parse_expr): Update for MI optimisation, and to use op_as_text. (op_as_text): New function, to wrap cpp_token_as_text. * cppfiles.c (stack_include_file, _cpp_pop_file_buffer): Update for MI optimisation. (_cpp_execute_include): Take a token rather than 3 arguments. Fix segfault on diagnostic. (_cpp_compare_file_date): Take a token rather than 3 args. (cpp_read_file): Work correctly for zero-length files. * cpphash.c (_cpp_init_macros, _cpp_cleanup_macros): Rename _cpp_init_hashtable and _cpp_cleanup_hashtable. (cpp_lookup): Place identifiers at front of identifier pool for _cpp_lookup_with_hash. (_cpp_lookup_with_hash): Require identifiers to be at the front of the identifier pool. Commit the memory if not already in the hash table. * cppinit.c (cpp_reader_init): Move cpp_init_completed test to top. Initialise various members of cpp_reader, memory pools, and the special nodes. (cpp_printer_init): Delete. (cpp_cleanup): Update. (struct builtin, builtin_array, initialize_builtins): Update for new hashnode definition and builtin handling. (cpp_start_read, cpp_finish): Don't take or initialise a printer. Update. * cpplib.h (cpp_printer, cpp_toklist, CPP_DEFINED, BOL, PASTED, VAR_ARGS, BEG_OF_FILE, IN_DIRECTIVE, KNOWN_DIRECTIVE, T_VOID, T_SPECLINE, T_DATE, T_FILE, T_BASE_FILE, T_INCLUDE_LEVEL, T_TIME, T_STDC, T_OPERATOR, T_POISON, T_MACRO, T_ASSERTION): Delete. (struct cpp_pool, struct cpp_macro, struct cpp_lexer_pos, struct cpp_lookahead, CPP_DHASH, enum mi_state, enum mi_ind, NO_EXPAND, VARARGS_FIRST, struct cpp_token_with_pos, struct toklist, struct cpp_context, struct specnodes, TOKEN_LOOKAHEAD, TOKEN_BUFFSIZE, NODE_OPERATOR, NODE_POISONED, NODE_BUILTIN, NODE_DIAGNOSTIC, NT_VOID, NT_MACRO, NT_ASSERTION, enum builtin_type, cpp_can_paste): New. (struct cpp_token): Delete line and col members. (struct cpp_buffer): New member output_lineno. (struct lexer_state): Delete indented, in_lex_line, seen_dot. Add va_args_ok, poisoned_ok, prevent_expansion, parsing_args. (struct cpp_reader): New members lexer_pos, macro_pos, directive_pos, ident_pool, temp_string_pool, macro_pool, argument_pool, string_pool, base_context, context, directive, mi_state, mi_if_not_defined, mi_lexed, mi_cmacro, mi_ind_cmacro, la_read, la_write, la_unused, mlstring_pos, macro_buffer, macro_buffer_len. Delete members mls_line, mls_column, token_list, potential_control_macro, temp_tokens, temp_cap, temp_alloced, temp_used, first_directive_token, context_cap, cur_context, no_expand_level, paste_level, contexts, args, save_parameter_spellings, need_newline, . Change type of date, time and spec_nodes members. Change prototypes for include and ident callbacks. (struct cpp_hashnode): Change type of name. Remove union members expansion and code. Add members macro, operator and builtin. (cpp_token_len, cpp_token_as_text, cpp_spell_token, cpp_start_read, cpp_finish, cpp_avoid_paste, cpp_get_token, cpp_get_line, cpp_get_output_line, cpp_macro_definition, cpp_start_lookahead, cpp_stop_lookahead): New prototypes. (cpp_printer_init, cpp_dump_definition): Delete prototypes. (U_CHAR, U, ustrcmp, ustrncmp, ustrlen, uxstrdup, ustrchr, ufputs): Move from cpphash.h. * cpphash.h (U_CHAR, U, ustrcmp, ustrncmp, ustrlen, uxstrdup, ustrchr, ufputs): Move to cpplib.h. (enum spell_type, struct token_spelling, _cpp_token_spellings, TOKEN_SPELL, TOKEN_NAME, struct answer, FREE_ANSWER, KANDR, STDC89, EXTENSION, COND, EXPAND, INCL, COMMENTS, IN_I, struct directive, directive_handler, struct spec_nodes, _cpp_digraph_spellings, _cpp_free_temp_tokens, _cpp_init_input_buffer, _cpp_grow_token_buffer, _cpp_init_toklist, _cpp_clear_toklist, _cpp_expand_token_space, _cpp_expand_name_space, _cpp_equiv_tokens, _cpp_equiv_toklists, _cpp_process_directive, _cpp_run_directive, _cpp_get_line, _cpp_get_raw_token, _cpp_glue_header_name, _cpp_can_paste, _cpp_check_directive, _cpp_check_linemarker, _cpp_parse_assertion, _cpp_find_answer): Delete. (VALID_SIGN, ALIGN, POOL_FRONT, POOL_LIMIT, POOL_BASE, POOL_SIZE, POOL_USED, POOL_COMMIT, struct cpp_chunk, _cpp_lex_token, _cpp_init_pool, _cpp_free_pool, _cpp_pool_reserve, _cpp_pool_alloc, _cpp_next_chunk, _cpp_lock_pool, _cpp_unlock_pool, _cpp_test_assertion, _cpp_handle_directive, DSC): New. (struct include_file): New member defined. (DO_NOT_REREAD, _cpp_begin_message, _cpp_execute_include, _cpp_compare_file_date): Update. (_cpp_pop_context, _cpp_get_token, _cpp_free_lookaheads, _cpp_push_token): New. (_cpp_init_macros, _cpp_cleanup_macros): Rename to _cpp_init_hashtable, _cpp_cleanup_hashtable. * Makefile.in: Remove cppoutput.c. * cppoutput.c: Delete * fixheader.c (read_scan_file): Update for new cpp_get_token prototype. (recognized_function): New argument LINE. * scan-decls.c (skip_to_closing_brace, scan_decls): Update for new cpp_get_token prototype. * scan.h (recognized_function): Update prototype. * po/POTFILES.in: Remove cppoutput.c. From-SVN: r37098