1. 24 Aug, 2000 2 commits
  2. 02 Aug, 2000 1 commit
    • zack's avatar
      * cpperror.c (v_message): Split into _cpp_begin_message and · 6cae2504
      zack authored
      	v_message macro.  All callers updated.
      	(_cpp_begin_message): Do inhibit_errors/inhibit_warnings
      	checks here.
      
      	* cppfiles.c (cpp_syshdr_flags): New function.
      	(read_include_file): Don't call cpp_output_tokens.  Call
      	enter_file hook.
      	* cppinit.c (dump_macros_helper): Moved to cppmain.c.
      	(cpp_reader_init): Don't initialize token_buffer.  Call
      	_cpp_init_internal_pragmas.
      	(cpp_cleanup): Don't clear token_buffer.
      	(cpp_start_read): Don't worry about output from -D processing.
      	Don't call cpp_output_tokens.
      	(cpp_finish): Don't dump macros here.  Don't call
      	cpp_output_tokens.
      	* cppmacro.c (_cpp_dump_definition): Rename
      	cpp_dump_definition.  Write directly to a FILE *.
      	(dump_funlike_macro): Delete.
      	(dump_macro_args): New.
      
      	* cpplex.c (TOKEN_LEN): Convert to inline function.
      	(_cpp_grow_token_buffer, safe_fwrite, cpp_output_tokens,
      	cpp_scan_line, _cpp_dump_list): Delete.
      	(cpp_printf, cpp_output_list): New.
      	(output_line_command): Don't worry about entering or leaving files.
      	(cpp_scan_buffer): Just output each token as we hit it.
      	(process_directive): Don't call cpp_output_tokens.
      	(_cpp_glue_header_name): Don't use token_buffer.
      	(output_token, dump_param_spelling): Write directly to a FILE *.
      
      	* cpplib.c (pass_thru_directive, dump_macro_name,
      	pragma_dispatch, do_pragma_gcc): Delete.
      	(do_define, do_undef, parse_include, do_line, do_ident, do_pragma,
      	do_pragma_poison, cpp_pop_buffer): Call the appropriate hook
      	functions.
      	(do_error, do_warning, pragma_dependency): Call
      	_cpp_begin_message, then cpp_output_list.
      	(cpp_register_pragma, cpp_register_pragma_space,
      	_cpp_init_internal_pragmas): New.
      	(do_pragma): Walk the pragmas table here.
      	(do_pragma_once, do_pragma_poison, do_pragma_system_header,
      	do_pragma_dependency): Return void.
      	(do_pragma_implementation): Moved to cppmain.c.
      
      	* cpplib.h: Update prototypes.
      	 (struct cpp_reader): Remove printer, token_buffer,
      	token_buffer_size, and limit.  Add struct cb, and pragmas.
      	(struct cpp_printer): Remove last_id and written.
      	(CPP_WRITTEN, CPP_PWRITTEN, CPP_SET_WRITTEN,
      	CPP_ADJUST_WRITTEN): Delete.
      	* cpphash.h: Update prototypes.
      	(ufputs): New wrapper.
      
      	* cppmain.c (cb_define, cb_undef, cb_include, cb_ident,
      	cb_enter_file, cb_leave_file, cb_def_pragma): New functions.
      	(main): Set up callbacks.  Register #pragma implementation.
      	Dump macros from here.
      
      
      git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@35415 138bc75d-0d04-0410-961f-82ee72b054a4
      6cae2504
  3. 16 Jul, 2000 1 commit
  4. 13 Jul, 2000 1 commit
    • zack's avatar
      * cppexp.c, cpphash.c, cpphash.h, cppinit.c, cpplex.c, · 241e762e
      zack authored
      	cpplib.c, cpplib.h: Eradicate all traces of code dependent on
      	traditional, lang_chill, or lang_fortran.
      
      	* cppfiles.c: #undef strcmp to suppress warning about macros
      	used without arguments.
      	(_cpp_execute_include): Use f, not fname, in "No include path"
      	error.
      	(_cpp_pop_file_buffer): New function.
      	* cpplib.c: Don't include <sys/mman.h>.
      	(cpp_push_buffer): Set line_base and lineno in new buffer.
      	(cpp_pop_buffer): Use _cpp_pop_file_buffer.
      
      	* cpplex.c: Move all prototypes and structure declarations to the
      	top of the file.  Properly parenthesise some macro arguments.
      	(cpp_scan_line): New function.
      	(special_symbol [case T_INCLUDE_DEPTH]): Use pfile->include_depth,
      	don't need to walk up the stack counting.
      
      
      git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@35003 138bc75d-0d04-0410-961f-82ee72b054a4
      241e762e
  5. 05 Jul, 2000 1 commit
    • zack's avatar
      toplevel: · f51c2148
      zack authored
      	* cpplex.c: Don't include sys/mman.h.
      	(cpp_push_buffer, cpp_pop_buffer): Moved to cpplib.c.
      
      	* cpplib.c: Include sys/mman.h and obstack.h.
      	(cpp_push_buffer): Moved from cpplex.c; allocate buffers on an
      	obstack.
      	(cpp_pop_buffer): Moved from cpplex.c; free buffers from an obstack.
      	(_cpp_unwind_if_stack): Now static, unwind_if_stack.  Don't
      	bother freeing if stack entries (they will be freed with their buffer).
      	(do_endif): Free if stack entries from the buffer obstack.
      	(push_conditional): Allocate if stack entries from the buffer obstack.
      
      	(find_answer): Rename to _cpp_find_answer.
      	(do_assert, do_unassert): Update.
      
      	* cpphash.h: Update prototypes.
      	(xobnew): New convenience macro.
      	* cpplib.h (struct cpp_reader): Add hash_ob and buffer_ob fields.
      	Update comments.
      	(struct cpp_hashnode): Remove disabled field.
      
      	* cppinit.c: Don't include hashtab.h or splay-tree.h.
      	(report_missing_guard): Moved to cppfiles.c.
      	(cpp_reader_init): Call cpp_init_stacks, cpp_init_macros,
      	cpp_init_includes.
      	(cpp_cleanup): Call cpp_cleanup_stacks, cpp_cleanup_macros,
      	cpp_cleanup_includes.  Don't destroy hashtab or
      	all_include_files here.
      	(cpp_finish): Use _cpp_report_missing_guards.
      
      	* cppfiles.c (report_missing_guard): Moved from cppinit.c.
      	(_cpp_init_include_table): Rename _cpp_init_includes.
      	(_cpp_cleanup_includes, _cpp_report_missing_guards): New.
      
      	* cppexp.c (parse_assertion): Update for new name of
      	find_answer.
      
      	* Makefile.in (cpplib.o, cpphash.o, cppinit.o): Update deps.
      
      	* cpplib.c (do_ident): s/VSPACE/EOF/
      
      testsuite:
      	* gcc.dg/cpp/ident.c: New test.
      
      
      git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@34870 138bc75d-0d04-0410-961f-82ee72b054a4
      f51c2148
  6. 04 Jul, 2000 1 commit
    • zack's avatar
      top level: · f80e83a9
      zack authored
      2000-07-03  Zack Weinberg  <zack@wolery.cumb.org>
      
      	* fix-header.c (struct partial_proto): Remove unnecessary fields.
      	(recognized_extern, recognized_function, read_scan_file):
      	Update for new scheme.
      	(check_protection): It's still a multiple include guard even
      	if it doesn't always trigger.
      	* scan-decls.c (skip_to_closing_brace, scan_decls): Update for
      	new scheme.
      	* scan.h: Declare struct cpp_token.  Update prototypes.
      
      2000-07-03  Neil Booth  <neilb@earthling.net>
      	    Zack Weinberg  <zack@wolery.cumb.org>
      
      	Complete overhaul of the lexer and macro expander.
      
      	* cpphash.c (object_defn, funct_defn, push_macro_expansion,
      	arg, arglist, argdata, reflist, collect_objlike_expansion,
      	collect_funlike_expansion, collect_params,
      	warn_trad_stringify, trad_stringify, duplicate_arg_p, add_pat,
      	unsafe_chars, macarg, compare_defs, special_symbol,
      	scan_arguments, stringify, funlike_macroexpand,
      	_cpp_quote_string, monthnames): Delete.
      	(cpp_lookup, _cpp_free_definition, dump_funlike_macro,
      	_cpp_create_definition, _cpp_dump_definition,
      	dump_hash_helper): Adjust.
      	(find_param, count_params, parse_define, var_args_str,
      	check_macro_redefinition, save_expansion): New.
      
      	* cpplex.c (skip_block_comment, skip_line_comment, parse_name,
              parse_string, output_line_command, trigraph_replace,
              lex_line, cpp_push_buffer, cpp_pop_buffer, cpp_output_tokens,
              cpp_scan_buffer_nooutput, cpp_scan_buffer, cpp_free_toklist,
              cpp_idcmp, _cpp_get_directive_token, _cpp_init_input_buffer,
      	_cpp_skip_rest_of_line): Modify.
      
              (maybe_macroexpand, skip_comment, copy_comment, skip_string,
      	find_position, null_warning, bump_column, expand_name_space,
      	pedantic_whitespace, _cpp_output_list, _cpp_slice_toklist,
      	_cpp_squeeze_toklist, _cpp_scan_until, _cpp_skip_hspace,
      	_cpp_parse_name, _cpp_lex_token, cpp_get_non_space_token,
      	_cpp_prescan): Delete.
      
      	(dump_param_spelling, process_directive, lex_next,
              is_macro_disabled, stringify_arg, expand_context_stack,
              output_token, make_string_token, alloc_number_token,
              special_symbol, duplicate_token, maybe_paste_with_next,
              can_paste, prevent_macro_expansion, restore_macro_expansion,
              get_temp_token, release_temp_tokens, quote_string,
              token_names, token_spellings, _cpp_expand_name_space,
              _cpp_glue_header_name, _cpp_reserve_name_space,
              digraph_spellings, trigraph_ok, skip_whitespace, save_comment,
              placemarker_token, eof_token, cpp_context, macro_args,
              get_raw_token, parse_arg, parse_args, save_token,
              push_arg_context, push_macro_context, pop_context,
              do_pop_context, free_macro_args, _cpp_get_line,
              _cpp_run_directive): New.
      
      	* cpplib.c (validate_else, parse_include, push_conditional,
      	pass_thru_directive, read_line_number, parse_ifdef,
      	detect_if_not_defined, _cpp_check_directive, do_define,
      	do_undef, do_include, do_import, do_include_next, do_error,
      	do_warning, do_ident, do_pragma, pragma_dispatch, gcc_pragmas,
      	top_pragmas, do_pragma_gcc, do_pragma_implementation,
      	do_pragma_poison, do_pragma_system_header,
      	do_pragma_dependency, do_sccs, do_ifdef, do_ifndef, do_else,
      	dl_elif, do_endif, _cpp_unwind_if_stack, do_assert,
      	do_unassert, cpp_define, cpp_undef, cpp_assert, cpp_unassert,
      	cpp_defined): Update for new scheme.
      	(strtoul_for_line, get_define_node, dump_macro_name,
      	_cpp_check_linemarker, _cpp_parse_assertion): New.
      	(_cpp_handle_directive, do_pragma_default): Delete.
      
      	* cpphash.h (struct predicate): Now struct answer.
      	(enum spell_type, struct token_spelling, struct directive,
      	directive_handler): New.
      	Update prototypes.  Remove unused macros.
      	* cpplib.h: Update prototypes.  Remove unused macros,
      	structure definitions, and fields.
      
      	* cpperror.c (print_containing_files, v_message): Adjust.
      	* cppexp.c (parse_assertion, lex, parse_escape,
      	_cpp_parse_expr): Adjust.
      	* cppfiles.c (open_include_file, _cpp_execute_include,
      	_cpp_compare_file_date, cpp_read_file, read_include_file):
      	Adjust.
      	* cppinit.c (dump_special_to_buffer): Delete.
      	(append_include_chain, merge_include_chains, cpp_reader_init,
      	cpp_cleanup, initialize_builtins, builtin_array, cpp_start_read,
      	cpp_finish, handle_option, print_help): Adjust.
      	* cppmain.c (main): Adjust.
      
      testsuite:
      2000-07-03  Zack Weinberg  <zack@wolery.cumb.org>
      
      	* testsuite/gcc.dg/cpp/19951025-1.c: Adjust regexps.
      	* testsuite/gcc.dg/cpp/19990703-1.c: Likewise.
      	* testsuite/gcc.dg/cpp/20000625-1.c: Likewise.
      	* testsuite/gcc.dg/cpp/20000625-2.c: Likewise.
      
      	* testsuite/gcc.dg/cpp/macro1.c,
      	testsuite/gcc.dg/cpp/paste1.c, testsuite/gcc.dg/cpp/paste2.c,
      	testsuite/gcc.dg/cpp/paste3.c, testsuite/gcc.dg/cpp/paste4.c,
      	testsuite/gcc.dg/cpp/strify1.c,
      	testsuite/gcc.dg/cpp/strify2.c: New tests.
      
      
      git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@34859 138bc75d-0d04-0410-961f-82ee72b054a4
      f80e83a9
  7. 02 Jul, 2000 1 commit
    • jakub's avatar
      * cpplib.h (struct cpp_reader): New field include_depth. · 7609e3aa
      jakub authored
      	(struct cpp_printer): Rename last_bsd to last_id.
      	* cppfiles.c (read_include_file): Bump include_depth.
      	* cpplex.c (cpp_pop_buffer): Decrement include_depth.
      	(output_line_command): Output correct #line if a header
      	is including itself and is not protected against multiple inclusion.
      	Use include_depth instead of buffer_stack_depth, last_id instead of
      	last_bsd.
      	* cppinit.c (cpp_start_read): Initialize last_id instead of
      	last_bsd.
      
      
      git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@34831 138bc75d-0d04-0410-961f-82ee72b054a4
      7609e3aa
  8. 30 Jun, 2000 1 commit
    • nathan's avatar
      * cpp.texi: Document #pragma GCC dependency · e485814b
      nathan authored
      	* cppfiles.c (open_include_file): Set date to unknown.
      	(_cpp_compare_file_date): New function.
      	(read_include_file): Set file date.
      	* cpphash.h (struct include_file): Add date member.
      	(_cpp_compare_file_date): Prototype.
      	* cpplib.c (parse_include): Add trail parameter. Adjust.
      	(do_include): Adjust parse_include call.
      	(do_import): Likewise.
      	(do_include_next): Likewise.
      	(gcc_pragmas): Add dependency pragma.
      	(do_pragma_dependancy): New pragma.
      
      
      git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@34808 138bc75d-0d04-0410-961f-82ee72b054a4
      e485814b
  9. 28 Jun, 2000 1 commit
    • zack's avatar
      * cppfiles.c (open_include_file): If open(2) returns EMFILE or · 34627970
      zack authored
      	ENFILE, close all cached file descriptors and try again.
      	(_cpp_execute_include): Keep a count of the number of times
      	each header is included.
      	(close_cached_fd): New function.
      	* cpphash.h (struct include_file): Rename before to
      	include_count; all users updated.  Make include_count and sysp
      	unsigned short.
      	* cppinit.c (cpp_finish): If -H, report headers that could use
      	reinclude guards.
      	(report_missing_guard): New function.
      
      
      git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@34760 138bc75d-0d04-0410-961f-82ee72b054a4
      34627970
  10. 21 Jun, 2000 2 commits
    • zack's avatar
      * cppfiles.c (cpp_make_system_header): New function. · 6af24d0a
      zack authored
      	* cpplib.h: Prototype it.
      	* cpplib.c (do_line, do_pragma_system_header): Use it.
      	* fix-header.c (read_scan_file): Use it.
      
      	* fix-header.c (check_macro_names): Cast second arg of
      	cpp_defined to const unsigned char *.
      	(read_scan_file): Make getchar_call const unsigned char.
      
      
      git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@34641 138bc75d-0d04-0410-961f-82ee72b054a4
      6af24d0a
    • zack's avatar
      * cppfiles.c: Include splay-tree.h, not hashtab.h. · c95d8aaa
      zack authored
      	(redundant_include_p, make_IHASH, hash_IHASH, eq_IHASH): Delete.
      	(destroy_include_file_node): New.
      	(_cpp_init_include_hash): Rename _cpp_init_include_table.
      	Create a splay tree, not a hash table.
      	(open_include_file): Look up the path in the include table,
      	do the multiple include optimization here, etc.
      	(cpp_included): Walk the path.
      	(find_include_file): Just walk the path calling
      	open_include_file, or call it directly for an absolute path.
      	(_cpp_fake_ihash): Rename _cpp_fake_include and update for new
      	scheme.
      	(read_include_file): Update for new scheme.  Don't close the
      	file unless reading fails.
      	(_cpp_execute_include, cpp_read_file): Tweak for new scheme.
      
      	* cpphash.h (struct ihash, NEVER_REINCLUDE): Delete.
      	(struct include_file): New.
      	(NEVER_REREAD, DO_NOT_REREAD, CPP_IN_SYSTEM_HEADER): New
      	macros.
      	(CPP_PEDANTIC, CPP_WTRADITIONAL): Update.
      	Update prototypes.
      
      	* cppinit.c: Include splay-tree.h.
      	(cpp_reader_init, cpp_cleanup): Update.
      
      	* cpplib.h (struct cpp_buffer): Change ihash field to
      	'struct include_file *inc'.  Remove system_header_p.
      	(struct cpp_reader): Change all_include_files to a
      	struct splay_tree_s *.
      
      	* cpplex.c: Update all references to cpp_buffer->ihash and/or
      	cpp_buffer->system_header_p.
      	(cpp_pop_buffer): Close file here, only if DO_NOT_REREAD.
      
      
      git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@34636 138bc75d-0d04-0410-961f-82ee72b054a4
      c95d8aaa
  11. 09 Jun, 2000 1 commit
  12. 01 Jun, 2000 1 commit
    • zack's avatar
      2000-06-01 Zack Weinberg <zack@wolery.cumb.org> · 5b1b3ffb
      zack authored
      	* cpplex.c (maybe_macroexpand): Use CPP_WTRADITIONAL.  Improve
      	error message.
      	* cpplib.c (parse_include): Remove support for VAX-C
      	"#include starlet" misfeature.
      
      	* gcc.dg/cpp-tradwarn2.c: Update egrep pattern.
      
      2000-05-31 Laurynas Biveinis <lauras@softhome.net>
      
      	* cppfiles.c: conditionally define O_BINARY.
      	(open_include_file): pass O_BINARY to open().
      
      
      git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@34344 138bc75d-0d04-0410-961f-82ee72b054a4
      5b1b3ffb
  13. 29 May, 2000 1 commit
    • zack's avatar
      * cpplib.h (cpp_reader): Remove if_stack. Change · c4357c92
      zack authored
      	potential_control_macro to a cpp_hashnode *.  Add skipping flag.
      	* cpphash.h (struct ihash): Change control_macro to a
      	cpp_hashnode * and shorten name to cmacro.
      	Add NEVER_REINCLUDE constant.
      
      	* cppfiles.c (redundant_include_p): Drop cpp_reader argument.
      	Examine the cmacro node directly, no need to call cpp_defined.
      	(_cpp_execute_include, read_include_file): Set cmacro to
      	NEVER_REINCLUDE, not U"".
      	* cpplex.c (cpp_push_buffer): Don't set new->if_stack.
      	(cpp_get_token): If pfile->skipping is true, discard text and
      	keep scanning until we hit a directive; don't expand macros.
      
      	* cpplib.c (struct if_stack): Remove if_succeeded, add
      	was_skipping. Change control_macro to a cpp_hashnode * and
      	shorten name to cmacro.  Remove typedef IF_STACK.
      	(parse_ifdef), detect_if_not_defined): Return a cpp_hashnode *.
      	(conditional_skip, skip_if_group,
      	consider_directive_while_skipping): Delete.
      	(push_conditional): New.
      	(_cpp_handle_directive): Don't process directives other than
      	conditionals if we are skipping.
      
      	(do_ifdef, do_ifndef, do_if, do_else, do_elif, do_endif):
      	Update to new scheme.
      	(validate_else): Skip rest of line here, unconditionally.
      	(_cpp_unwind_if_stack): The stack is per-buffer.  Force
      	pfile->skipping off.
      
      	(all): Remove `scare quotes' from error messages.
      
      	* gcc.dg/cpp-mi.c: Add another case, cpp-mix.h, where the
      	guard macro is already defined when the header is first
      	included.
      	* gcc.dg/cpp-mix.h: New file.
      	* gcc.dg/endif-label.c: Update patterns to match compiler.
      
      	* g++.brendan/complex1.C: Declare abort.
      	* g++.law/refs4.C: Remove XFAIL.
      	* g++.oliva/expr2.C: Declare abort and exit.
      
      
      git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@34253 138bc75d-0d04-0410-961f-82ee72b054a4
      c4357c92
  14. 28 May, 2000 1 commit
    • zack's avatar
      * cppfiles.c: Read files in, using mmap if possible, then · c4abf88d
      zack authored
      	prescan them separately.
      	(read_file, read_with_read): New functions.
      	* cpplex.c: Don't define UCHAR_MAX.
      	(_cpp_read_and_prescan): Rename to _cpp_prescan.  Don't read
      	the file here.
      
      	* cppinit.c (handle_option): Automatically define __cplusplus,
      	__OBJC__, __ASEEMBLER__, _LANGUAGE_FORTRAN here when we see
      	the respective -lang switch.
      
      	* cpphash.h (enum node_type, struct hashnode, _cpp_lookup
      	prototype): Move to...
      	* cpplib.h: ... here.  Rename struct hashnode to struct
      	cpp_hashnode and give it a typedef.  Rename _cpp_lookup to
      	cpp_lookup.  Add 'fe_value' slot, a union tree_node *.
      
      
      git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@34228 138bc75d-0d04-0410-961f-82ee72b054a4
      c4abf88d
  15. 04 May, 2000 1 commit
    • zack's avatar
      gcc: · e057cf7c
      zack authored
      	* cpphash.h (U): New define, to correct type of string constants.
      	(ustrcmp, ustrncmp, ustrlen, uxstrdup, ustrchr): New wrapper
      	routines, to do casts when passing unsigned strings to libc.
      	* cppexp.c, cppfiles.c, cpphash.c, cppinit.c, cpplib.c: Use them.
      
      	* cppfiles.c (_cpp_execute_include): Make filename an U_CHAR *.
      	* cpphash.c (_cpp_quote_string): Make string an U_CHAR *.
      	* cppinit.c (dump_special_to_buffer): Make macro name an U_CHAR *.
      	* cpplex.c (parse_ifdef, parse_include, validate_else): Make
      	second argument an U_CHAR *.
      
      	* cppinit.c (builtin_array): Make name and value U_CHAR *, add
      	length field, clean up initializer.
      	(ISTABLE): Add __extension__ to designated-
      	initializers version.
      	* cpplex.c (CHARTAB): Likewise.
      
      	* mbchar.c: Add dummy external declaration to the !MULTIBYTE_CHARS
      	case so the file won't be empty.
      
      include:
      	* symcat.h: Remove #endif label.
      
      
      git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@33657 138bc75d-0d04-0410-961f-82ee72b054a4
      e057cf7c
  16. 02 May, 2000 1 commit
    • zack's avatar
      * cpplib.h (CPP_POP, parse_cleanup_t): Delete. · d1678bc6
      zack authored
      	(cpp_buffer): Remove cleanup, seen_eof, manual_pop members.
      
      	* cppfiles.c (file_cleanup): Delete.
      	* cpphash.c (macro_cleanup): Delete.
      	(collect_objlike_expansion, collect_funlike_expansion,
      	macarg, scan_arguments): Remove CPP_POP case.
      
      	* cpplex.c (null_cleanup): Delete.
      	(cpp_pop_buffer): Do the work that was done in the cleanups
      	here.  Call _cpp_unwind_if_stack from here.
      	(_cpp_expand_to_buffer, cpp_scan_buffer_nooutput,
      	cpp_scan_buffer): Run until we see CPP_EOF and the top of
      	stack is the buffer _below_ the one we stacked.
      	(cpp_get_token): Always pop an exhausted buffer.  Return
      	CPP_EOF unless it's a macro buffer.  Don't call _cpp_handle_eof.
      	* cpplib.c (skip_if_group): Don't call cpp_get_token to
      	increment the line number.
      	(_cpp_handle_eof): Rename to _cpp_unwind_if_stack.
      
      	* fix-header.c (read_scan_file) [parsing getchar()]: Run until
      	we see CPP_EOF and the top of stack is the buffer _below_ the
      	one we stacked.
      	* scan-decls.c: Likewise.
      
      
      git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@33611 138bc75d-0d04-0410-961f-82ee72b054a4
      d1678bc6
  17. 01 May, 2000 1 commit
  18. 30 Apr, 2000 1 commit
    • zack's avatar
      * cppfiles.c (redundant_include_p): Provide length of token to · 14feeeba
      zack authored
      	cpp_defined.
      	* cpphash.c (_cpp_make_hashnode, _cpp_lookup_slot): Hash
      	values are unsigned int.
      	(_cpp_lookup, _cpp_lookup_slot): Do not calculate the length.
      	(_cpp_lookup_slot): Do not calculate the hash, either.
      	* cpphash.h: Update prototypes.
      	* cpplib.c (do_define, do_undef, do_pragma_poison, do_assert):
      	Hashes are unsigned int.  Calculate hash here, pass by value
      	to _cpp_lookup_slot.
      
      
      git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@33551 138bc75d-0d04-0410-961f-82ee72b054a4
      14feeeba
  19. 18 Apr, 2000 2 commits
    • zack's avatar
      * cccp.c, cexp.y, cexp.c, cccp.1: Removed. · 0b30807c
      zack authored
      	* configure.in: Delete --disable-cpplib option and all
      	references to cpp_main.
      	* configure: Regenerate.
      	* Makefile.in: Remove all references to CCCP, CCCP_OBJS,
      	@cpp_main@, cccp.c, cexp.c, cexp.y, cexp.output, cexp.o,
      	cccp.o, cccp, or cppmain.  Link cppmain.o straight to
      	cpp$(exeext).  Add --no-headers to makeinfo command line when
      	generating INSTALL.  Install and uninstall cpp.1 manpage, not
      	cccp.1.
      	* install.texi: Delete all references to cexp.y/cexp.c.
      	Delete ancient instructions for compiling GCC on 3b1.
      	* INSTALL: Regenerate.
      
      	* cppfiles.c, cpplib.h, jump.c, protoize.c, c-lex.c,
      	ch/decl.c, ch/lex.c, cp/lex.c, f/lex.c, mips/t-ecoff,
      	mips/t-elf, mips/t-r3900: Remove references to cccp.c.
      	* convex.h, fx80.h, m68k.h, pdp11.h, contrib/gcc_update,
      	f/g77install.texi: Remove references to	cexp.c/cexp.y.
      	* xm-linux.h, xm-os2.h, romp.h: Remove definition of BSTRING,
      	which is no longer tested anywhere.
      
      	* po/POTFILES.in: Remove cccp.c and cexp.c.  Comment out
      	alpha/vms-tramp.asm.
      
      
      git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@33238 138bc75d-0d04-0410-961f-82ee72b054a4
      0b30807c
    • kenner's avatar
      * gcc/conflict.c (conflict_graph_add): Pass enum type to · 2b3dbc20
      kenner authored
      	htab_find_slot.
      	* gcc/cpperror.c (hashtab.h): Now include.
      	* gcc/cppexp.c (hashtab.h): Likewise.
      	* gcc/cpplex.c (hashtab.h): Likewise.
      	* gcc/cppfiles.c (hashtab.h): Likewise.
      	(find_include_file, _cpp_calc_hash, cpp_read_file): Pass enum type
      	to htab_find_slot_with_hash.
      	* gcc/cpphash.c (hashtab.h): Now include.
      	(_cpp_lookup_slot): INSERT is now enum insert_option.
      	* gcc/cpphash.h (_cpp_lookup_slot): Likewise.
      	* gcc/cppinit.c (hashtab.h): Include earlier.
      	(initialize_builtins): Pass enum to htab_find_slot.
      	* gcc/cpplib.c (hashtab.h): Now include.
      	(do_define, do_undef): Pass enum type to _cpp_lookup_slot.
      	(do_pragma_poison, do_assert): Likewise.
      	* gcc/emit-rtl.c (gen_rtx_CONST_INT): Pass enum to
      	htab_find_slot_with_hash.
      	* gcc/simplify-rtx.c (cselib_lookup_mem, cselib_lookup): Likewise.
      	* gcc/tree.c (type_hash_add): Likewise.
      	(build1): Minor cleanup.
      	* include/hashtab.h (enum insert_option): New type.
      	(htab_find_slot, htab_find_slot_with_hash): Use it.
      	* libiberty/hashtab.c: Various minor cleanups.
      	(htab_find_slot_with_hash): INSERT is now enum insert_option.
      	(htab_find_slot): Likewise.
      
      
      git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@33236 138bc75d-0d04-0410-961f-82ee72b054a4
      2b3dbc20
  20. 17 Apr, 2000 1 commit
    • rth's avatar
      * Makefile.in ($(srcdir)/c-parse.y: c-parse.in): Enclose the whole · 58f9db87
      rth authored
              message in quotes. Otherwise, IBM's make program treats the '#' as the
              start of a comment and ignores the remainder of the line.
      
              * c-lex.c (yylex): Change for EBCDIC, lower case characters preceed
              upper case.
              * cccp.c (initialize_char_syntax): Allow for holes in EBCDIC.
              * cexp.y (initialize_random_junk): Likewise.
              * cppfiles.c (find_include_file): Cast alloca return value.
              * cppinit.c (initialize_standard_includes): Likewise.
              * cpplib.c (cpp_define, cpp_undef): Likewise.
              * defaults.h (ASM_OUTPUT_ASCII): Use ISPRINT.
              * final.c (output_asm_insn): Allow for holes in EBCDIC.
              * fold-const.c (CHARMASK): New.
              (real_hex_to_f): Use it.
              * real.c (CHARMASK): New.
              (etoasc, asctoeg): Use it.
              (asctoeg): EBCDIC lower case characters preceed upper case.
      
      
      git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@33192 138bc75d-0d04-0410-961f-82ee72b054a4
      58f9db87
  21. 14 Apr, 2000 1 commit
    • zack's avatar
      * cpplex.c (cpp_output_tokens, cpp_scan_buffer_nooutput): New public · e2f9a79f
      zack authored
      	interfaces.
      	(safe_fwrite, output_line_command): New static functions.
      	(cpp_expand_to_buffer): Now private to cpplib.
      	(cpp_scan_buffer): Take a printer.
      
      	* cpphash.h: Update prototypes.
      	* cpplib.h: Update prototypes.
      	(cpp_printer): New.
      	(cpp_buffer): Remove last_nominal_fname.
      	(cpp_reader): Remove lineno.
      
      	* cppmain.c: Use a cpp_printer.
      	* fix-header.c: No need to inhibit line commands.  Call
      	cpp_start_read with no printer.
      
      	* cpperror.c (cpp_notice_from_errno): Provide default name.
      	* cppfiles.c (make_IHASH, _cpp_fake_ihash): New functions.
      	(find_include_file, cpp_read_file): Use make_IHASH.
      	(file_cleanup): Set control_macro and clear
      	input_stack_listing_current here.
      	(_cpp_execute_include): Don't output entering-file marker.
      	* cpphash.c (special_symbol): Look for the line number in the
      	buffer, not the reader.
      	(_cpp_macroexpand): No need to disable line commands.
      	(_cpp_dump_definition): No need to generate line commands.
      	(dump_hash_helper): Remove excess newline from output.
      	* cppinit.c (dump_special_to_buffer): No need to generate line
      	commands.
      	(cpp_printer_init): New.
      	(cpp_start_read): Take a printer, and start it up if it's not
      	NULL.  No need to generate line commands.
      	(cpp_finish): Expect no buffers stacked at all.  Take a
      	printer argument, and flush the output buffer if it's not
      	NULL.
      	* cpplex.c (_cpp_lex_token): Return EOF if there's no buffer.
      	Don't put two hashes at the beginning of an assertion.
      	(cpp_get_token): Don't increment pfile->lineno or emit line
      	commands here.  Return EOF if there's no buffer when we get
      	EOF.
      	* cpplib.c (do_define, skip_if_group):
      	No need to disable line commands.
      	(_cpp_output_line_command): Delete function.
      	(do_line): Don't emit line commands here, but set things up so
      	they will be emitted if necessary.  Use _cpp_fake_ihash to
      	make unique nominal_fnames if necessary.
      	(do_elif, do_else, _cpp_handle_eof): Call cpp_error_with_line
      	with 0 for column, not -1.
      	(_cpp_handle_eof): Don't set the control macro here.  Don't
      	clear input_stack_listing_current here.  Don't emit line
      	commands.
      
      
      git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@33159 138bc75d-0d04-0410-961f-82ee72b054a4
      e2f9a79f
  22. 06 Apr, 2000 1 commit
    • zack's avatar
      * cpphash.c (CPP_IS_MACRO_BUFFER, FORWARD, PEEKC): Delete. · c030ed73
      zack authored
      	(macro_cleanup): No need to cast pbuf->macro.
      	(collect_expansion): Use _cpp_get_define_token.  Goto done if
      	it returns VSPACE.  Remove check for trailing space after
      	CPP_COMMENT.
      	(_cpp_create_definition): Don't diddle flags here.  Return
      	directly on error.
      	(unsafe_chars): Handle c1 being EOF.
      	(push_macro_expansion): Use unsafe_chars for both accidental-paste
      	checks.  Don't push the buffer till after we're done with
      	them.
      	* cpplex.c (PEEKBUF, GETBUF, FORWARDBUF): New.
      	(PEEKN, FORWARD, GETC, PEEKC): Use them.
      	(cpp_push_buffer): Don't set new->alimit.  Set new->mark
      	appropriately.
      	(_cpp_parse_assertion): Don't NUL terminate.
      	(_cpp_lex_token): Fix -traditional macro handling.  Don't skip
      	hspace before calling _cpp_parse_assertion.  Remove all sets
      	of only_seen_white. Treat '\f' as hspace.  Don't do anything
      	special with '\n' here.
      	(maybe_macroexpand): Handle T_EMPTY hash entries without
      	pushing a buffer at all.
      	(cpp_get_token): Handle clearing only_seen_white here.  Handle
      	incrementing the line number here.  Clear
      	potential_control_macro as well as only_seen_white, if
      	appropriate.
      	(cpp_get_non_space_token): Don't eat CPP_POP tokens.
      	(_cpp_get_define_token): New function, basically like
      	_cpp_get_directive_token was but doesn't eat horizontal space.
      	Don't do anything with only_seen_white here.
      	(_cpp_get_directive_token): Just call _cpp_get_define_token
      	repeatedly till it returns non-hspace.
      
      	* cpplib.c (PEEKN, FORWARD, GETC, PEEKC): Delete.
      	(conditional_skip, skip_if_group): Return int.
      	(DIRECTIVE_TABLE): Change origin of all conditional directives
      	to "COND".
      	(TRAD_DIRECT_P): New macro.
      	(_cpp_handle_directive): Use _cpp_get_directive_token.  Issue
      	an error for a bogus directive, unless -lang-asm.  Use
      	TRAD_DIRECT_P. Loop calling handler functions till one returns
      	zero.
      	(get_macro_name): Don't diddle flags here.
      	(do_define): Diddle flags here.  Use _cpp_get_directive_token.
      	Create T_EMPTY nodes for #define macro /* nothing */.
      	(do_undef): Don't copy the name.  Use _cpp_get_directive_token.
      	Use hp->name when calling pass_thru_directive.
      	(do_if, do_else, do_elif, do_ifdef, do_ifndef, conditional_skip):
      	Return the result of conditional_skip and/or skip_if_group.
      	Don't call _cpp_output_line_command.
      	(consider_directive_while_skipping): Use _cpp_get_directive_token.
      	Issue -Wtraditional warnings as appropriate.  Don't complain
      	about unrecognized directives.  If we are to stop skipping,
      	return the number of the directive that ended the skip.
      	(skip_if_group): Use _cpp_get_directive_token.  Turn off macro
      	expansion and line commands while skipping.  Return the result
      	of consider_directive_while_skipping, if nonzero.
      	(do_endif): Just set potential_control_macro here.
      	(validate_else): Use _cpp_get_directive_token.
      	(do_assert, do_unassert): Don't save pointers into the
      	token_buffer across calls to the lexer.  Use
      	_cpp_get_directive_token.
      
      	* cpplib.h (cpp_buffer): Remove alimit and colno.  Make mark a
      	pointer, not an offset.  Replace 'data', which was a generic
      	pointer, with 'macro', which points to a struct hashnode.
      	(cpp_reader): Add 'potential_control_macro' pointer.
      	* cpphash.h (T_UNUSED): Replace with T_EMPTY.
      	(CPP_BUF_GET, CPP_FORWARD): Delete.
      	(CPP_IN_COLUMN_1, ADJACENT_TO_MARK): New macros.
      	(CPP_IS_MACRO_BUFFER, CPP_SET_BUF_MARK, CPP_GOTO_BUF_MARK,
      	ACTIVE_MARK_P): Update.
      	(_cpp_get_define_token): New internal function.
      	* cppfiles.c (read_include_file): Don't set fp->alimit or fp->colno.
      
      
      git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@32965 138bc75d-0d04-0410-961f-82ee72b054a4
      c030ed73
  23. 31 Mar, 2000 1 commit
    • zack's avatar
      * cpplib.h: Merge struct cpp_options into struct cpp_reader. · 2ff3ad1d
      zack authored
      	Reorder struct cpp_options and struct cpp_reader for better
      	packing.  Replace CPP_OPTIONS macro with CPP_OPTION which
      	takes two args.  Change all 'char' flags to 'unsigned char'.
      	Move show_column flag into struct cpp_options.  Don't
      	prototype cpp_options_init.
      	* cpphash.h, cpperror.c, cppexp.c, cppfiles.c, cpphash.c,
      	cppinit.c, cpplex.c, cpplib.c:
      	Replace CPP_OPTIONS (pfile)->whatever with
      	CPP_OPTION (pfile, whatever), and likewise for
      	opts = CPP_OPTIONS (pfile); ... opts->whatever;
      
      	* cppinit.c (merge_include_chains): Take a cpp_reader *.
      	Extract CPP_OPTION (pfile, pending) and work with that
      	directly.
      	(cpp_options_init): Delete.
      	(cpp_reader_init): Turn on on-by-default options here.
      	Allocate the pending structure here.
      	(cl_options, enum opt_code): Define these from the same table,
      	kept in a large macro.  Add -fshow-column and -fno-show-column
      	options.
      
      	* cpperror.c (v_message): If show_column is off, don't print
      	the column number.
      
      	* cppmain.c: Update for new interface.
      	* fix-header.c: Likewise.
      
      
      git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@32850 138bc75d-0d04-0410-961f-82ee72b054a4
      2ff3ad1d
  24. 29 Mar, 2000 1 commit
  25. 28 Mar, 2000 1 commit
    • zack's avatar
      2000-03-28 Zack Weinberg <zack@wolery.cumb.org> · 45aa4a51
      zack authored
      	* cppfiles.c (hash_IHASH): Just return i->hash.
      	(cpp_included): Set dummy.hash using _cpp_calc_hash.  Use
      	htab_find_with_hash.
      	(cpp_read_file): Likewise.
      	(find_include_file): Likewise.  Properly initialize
      	ih->nshort.  Share ih->name and ih->nshort if possible.
      	* cpphash.c (_cpp_calc_hash): New function.
      	(hash_HASHNODE): Just return h->hash.
      	(_cpp_lookup): Set dummy.hash using _cpp_calc_hash.  Use
      	htab_find_with_hash.
      	* cpphash.h: Prototype _cpp_calc_hash.
      	* cppinit.c (initialize_builtins): Provide a valid hash
      	to _cpp_make_hashnode, using _cpp_calc_hash.
      
      	* cpphash.c (collect_expansion): # is not a special character
      	in object-like macros.  In -traditional mode, /**/ is not
      	token paste at the beginning or end of the line.
      	* cpplib.c (do_include, do_import, do_include_next): If
      	parse_include fails, return immediately.
      
      
      git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@32792 138bc75d-0d04-0410-961f-82ee72b054a4
      45aa4a51
  26. 15 Mar, 2000 1 commit
  27. 14 Mar, 2000 2 commits
    • zack's avatar
      * cppfiles.c (find_include_file): Don't assume nshort is a · 770b6a87
      zack authored
      	substring of name.
      
      
      git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@32533 138bc75d-0d04-0410-961f-82ee72b054a4
      770b6a87
    • zack's avatar
      * cppfiles.c: Include mkdeps.h. · 4bf559f2
      zack authored
      	(find_include_file, read_include_file): Remove _cpp_ prefix
      	from name, make static.
      	(_cpp_execute_include): New function, broken out of
      	do_include.
      
      	* cpplib.c: Don't include mkdeps.h.
      	(struct directive): Remove type field. Reorder entries.  The
      	function takes only one argument.
      	(struct if_stack): Make type field an int.
      	(directive_table): Rename to dtable.  Generate it, the
      	prototypes of the directive handlers, and the enum for the
      	directive numbers, from a template macro.
      	(do_ifndef, do_include_next, do_import): New functions.
      	(do_define, do_include, do_endif, do_ifdef, do_if, do_else,
      	do_undef, do_line, do_elif, do_error, do_pragma, do_warning,
      	do_ident, do_assert, do_unassert, do_sccs): Take only one
      	argument.
      	(do_sccs): Define always, but alter behavior based on
      	SCCS_DIRECTIVE.
      	(_cpp_handle_directive, consider_directive_while_skipping):
      	Restructure for new directive table layout.
      
      	(pass_thru_directive): Take a directive number, not a pointer
      	to a struct directive.
      	(parse_include): New function, broken out of do_include.
      	(do_include, do_import, do_include_next): Use parse_include
      	and _cpp_execute_include.
      	(do_elif, do_else): Test for T_ELSE specifically when checking
      	for #elif/#else after #else.
      	(parse_ifdef): New function, broken out of do_ifdef.
      	(validate_else): Expect a name arg without a leading #.
      	(if_directive_name): Delete.
      	(cpp_define, cpp_assert, cpp_undef, cpp_unassert): Call
      	directive handlers with only one argument.
      
      	* cpphash.h: Update prototypes.
      	(enum node_type): Remove entries for directives.
      	* Makefile.in: Update dependencies.
      
      
      git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@32519 138bc75d-0d04-0410-961f-82ee72b054a4
      4bf559f2
  28. 13 Mar, 2000 1 commit
    • zack's avatar
      * Makefile.in (LIBCPP_OBJS): Add cpplex.o. · 0578f103
      zack authored
      	(cpplex.o): New target.
      	* po/POTFILES.in: Add cpplex.c.
      
      	* cpplex.c (_cpp_grow_token_buffer, null_cleanup,
      	cpp_push_buffer, cpp_pop_buffer, cpp_scan_buffer,
      	cpp_expand_to_buffer, cpp_buf_line_and_col, cpp_file_buffer,
      	skip_block_comment, skip_line_comment, skip_comment,
      	copy_comment, _cpp_skip_hspace, _cpp_skip_rest_of_line,
      	_cpp_parse_name, skip_string, parse_string,
      	_cpp_parse_assertion, cpp_get_token, cpp_get_non_space_token,
      	_cpp_get_directive_token, find_position,
      	_cpp_read_and_prescan, _cpp_init_input_buffer): Move here.
      	(maybe_macroexpand, _cpp_lex_token): New functions.
      
      	* cpplib.c (SKIP_WHITE_SPACE, eval_if_expr, parse_set_mark,
      	parse_goto_mark): Delete.
      	(_cpp_handle_eof): New function.
      	(_cpp_handle_directive): Rename from handle_directive.
      	(_cpp_output_line_command): Rename from output_line_command.
      	(do_if, do_elif): Call _cpp_parse_expr directly.
      	* cppfiles.c (_cpp_read_include_file): Don't call
      	init_input_buffer here.
      	* cpphash.c (quote_string): Move here, rename _cpp_quote_string.
      	* cppexp.c (_cpp_parse_expr): Diddle parsing_if_directive
      	here; pop the token_buffer and skip the rest of the line here.
      	* cppinit.c (cpp_start_read): Call _cpp_init_input_buffer
      	here.
      
      	* cpphash.h (CPP_RESERVE, CPP_IS_MACRO_BUFFER, ACTIVE_MARK_P):
      	Define here.
      	(CPP_SET_BUF_MARK, CPP_GOTO_BUF_MARK, CPP_SET_MARK,
      	CPP_GOTO_MARK): New macros.
      	(_cpp_quote_string, _cpp_parse_name, _cpp_skip_rest_of_line,
      	_cpp_skip_hspace, _cpp_parse_assertion, _cpp_lex_token,
      	_cpp_read_and_prescan, _cpp_init_input_buffer,
      	_cpp_grow_token_buffer, _cpp_get_directive_token,
      	_cpp_handle_directive, _cpp_handle_eof,
      	_cpp_output_line_command): Prototype them here.
      	* cpplib.h (enum cpp_token): Add CPP_MACRO.
      	(CPP_RESERVE, get_directive_token, cpp_grow_buffer,
      	quote_string, output_line_command): Remove.
      
      
      git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@32513 138bc75d-0d04-0410-961f-82ee72b054a4
      0578f103
  29. 12 Mar, 2000 1 commit
    • zack's avatar
      Convert cpplib to use libiberty/hashtab.c. · 5ecec5da
      zack authored
      	* cpplib.h (struct cpp_reader): Make hashtab and
      	all_include_files of type 'struct htab *'.  Delete HASHSIZE
      	and ALL_INCLUDE_HASHSIZE macros.
      
      	* cpphash.h: Update prototypes.
      	(struct hashnode): Remove next, prev, and bucket_hdr members.
      	Make length a size_t.  Add hash member.
      	(struct ihash): Remove next member.  Add hash member.  Make
      	name a flexible array member.
      
      	* cppfiles.c: Include hashtab.h.
      	(include_hash): Delete.
      	(IHASHSIZE): New macro.
      	(hash_IHASH, eq_IHASH, _cpp_init_include_hash): New functions.
      	(cpp_included): Do the hash lookup here.
      	(_cpp_find_include_file): Rewrite.
      	(cpp_read_file): Put the "fake" hash entry into the hash
      	table.  Honor the control_macro, if it turns out we've seen
      	the file before.  Don't push the buffer here.
      	(_cpp_read_include_file): Push the buffer here.
      	(OMODES): New macro.  Use it whenever we call open(2).
      
      	* cpphash.c: Include hashtab.h.
      	(hash_HASHNODE, eq_HASHNODE, del_HASHNODE, dump_hash_helper,
      	_cpp_init_macro_hash, _cpp_dump_macro_hash, _cpp_make_hashnode,
      	_cpp_lookup_slot): New functions.
      	(HASHSIZE): new macro.
      	(hashf, _cpp_install, _cpp_delete_macro): Delete.
      	(_cpp_lookup): Use hashtab.h routines.
      
      	* cppinit.c: Include hashtab.h.
      	(cpp_reader_init): Call _cpp_init_macro_hash and
      	_cpp_init_include_hash.  Don't allocate hashtab directly.
      	(cpp_cleanup): Just call htab_delete on pfile->hashtab and
      	pfile->all_include_files.
      	(initialize_builtins): Use _cpp_make_hashnode and
      	htab_find_slot to add hash entries.
      	(cpp_finish): Just call _cpp_dump_macro_hash.
      	* cpplib.c: Include hashtab.h.
      	(do_define): Use _cpp_lookup_slot and _cpp_make_hashnode to
      	create hash entries.
      	(do_pragma_poison, do_assert): Likewise.
      	(do_include): Don't push the buffer here.  Don't increment
      	system_include_depth unless _cpp_read_include_file succeeds.
      	(do_undef, do_unassert): Use _cpp_lookup_slot and htab_clear_slot
      	or htab_remove_elt.
      	(do_pragma_implementation): Use alloca to create copy.
      
      	* Makefile.in: Update dependencies.
      
      
      git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@32497 138bc75d-0d04-0410-961f-82ee72b054a4
      5ecec5da
  30. 11 Mar, 2000 1 commit
    • neil's avatar
      * cppfiles.c (file_cleanup, _cpp_find_include_file, · 8d7a2585
      neil authored
      	remap_filename, _cpp_read_include_file, actual_directory,
      	hack_vms_include_specification): Replace bcopy(), index() etc
      	calls.  Add casts to some allocations.  Make some variables
       	pointers to const [unsigned] char.
      	* cpphash.c (_cpp_install, macro_cleanup, collect_expansion,
      	collect_formal_parameters): Similarly.
      	* cppinit.c (struct pending_option, append_include_chain,
      	cpp_options_init, cpp_reader_init, initialize_standard_includes,
      	cpp_start_read, new_pending_define, handle_option): Similarly.
      	* cpplib.c (cpp_define, copy_comment, do_define, do_include,
      	do_undef, do_error, do_warning, do_pragma, do_pragma_once,
      	do_pragma_implementation, detect_if_not_defined,
      	do_ifdef, skip_if_group, cpp_get_token, parse_string,
      	do_assert, do_unassert): Similarly.
      	* cpplib.h (cpp_buffer, cpp_options): Update types.  Update
      	function prototypes.
      	* mkdeps.c (deps_add_target, deps_add_dep): cast allocations.
      
      
      git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@32477 138bc75d-0d04-0410-961f-82ee72b054a4
      8d7a2585
  31. 08 Mar, 2000 2 commits
    • zack's avatar
      * Makefile.in (LIBCPP_DEPS): New macro. · 1e8b9746
      zack authored
      	(cpplib.o, cpphash.o, cpperror.o, cppexp.o, cppfiles.o): Use
      	it to declare deps.
      	* cpperror.c: Include cpphash.h.
      	* cppexp.c: Include cpphash.h.  Remove MULTIBYTE_CHARS
      	dingleberry.
      	(lex): Don't use CPP_WARN_UNDEF.
      	(_cpp_parse_expr): Return an int, the truth value.
      	* cppfiles.c: Include cpphash.h.
      	(_cpp_merge_include_chains): Move to cppinit.c and make static.
      	* cppinit.c (include_defaults_array): Disentangle.
      	(cpp_cleanup): Don't free the if stack here.
      	(cpp_finish): Pop off all buffers, not just one.
      	* cpplib.c (eval_if_expr): Return int.
      	(do_xifdef): Rename do_ifdef.
      	(handle_directive): Don't use CPP_PREPROCESSED.
      	(cpp_get_token): Don't use CPP_C89.
      	* fix-header.c: Don't use CPP_OPTIONS.
      
      	* cpplib.h: Move U_CHAR, enum node_type, struct
      	file_name_list, struct ihash, is_idchar, is_idstart,
      	is_numchar, is_numstart, is_hspace, is_space, CPP_BUF_PEEK,
      	CPP_BUF_GET, CPP_FORWARD, CPP_PUTS, CPP_PUTS_Q, CPP_PUTC,
      	CPP_PUTC_Q, CPP_NUL_TERMINATE, CPP_NUL_TERMINATE_Q,
      	CPP_BUMP_BUFFER_LINE, CPP_BUMP_LINE, CPP_PREV_BUFFER,
      	CPP_PRINT_DEPS, CPP_TRADITIONAL, CPP_PEDANTIC, and prototypes
      	of _cpp_simplify_pathname, _cpp_find_include_file,
      	_cpp_read_include_file, and _cpp_parse_expr to cpphash.h.
      	Move struct if_stack to cpplib.c.  Move struct cpp_pending to
      	cppinit.c.
      	Change all uses of U_CHAR to be unsigned char instead.
      	Delete CPP_WARN_UNDEF, CPP_C89, and CPP_PREPROCESSED.
      
      
      git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@32435 138bc75d-0d04-0410-961f-82ee72b054a4
      1e8b9746
    • zack's avatar
      * cpplib.h (parse_underflow_t, CPP_NULL_BUFFER): Delete. · 5b201908
      zack authored
      	(struct cpp_buffer): Remove fname and underflow fields.
      	(struct cpp_reader): Remove get_token field.
      	(struct include_hash): Rename to struct ihash.  Add typedef to
      	IHASH.
      	(struct if_stack): Remove fname field.
      	(IF_STACK_FRAME): Rename to IF_STACK.
      
      	* cpperror.c (print_containing_files): Trust that there are no
      	macro buffers below the top file buffer.
      	* cppfiles.c: Replace all references to 'struct include_hash'
      	with 'IHASH'.  Rename initialize_input_buffer to
      	init_input_buffer.  Don't set or reference cpp_buffer->fname,
      	use buffer->ihash->name instead.
      	* cpphash.c (special_symbol): Use cpp_file_buffer.  Use NULL
      	not CPP_NULL_BUFFER.
      	* cppinit.c: Use NULL not CPP_NULL_BUFFER, IF_STACK not
      	IF_STACK_FRAME, IHASH not struct include_hash.
      	* cpplib.c: Rename eval_if_expression to eval_if_expr.  Remove
      	null_underflow.  Use IF_STACK not IF_STACK_FRAME, IHASH not
      	struct include_hash, NULL not CPP_NULL_BUFFER.  Remove all
      	references to cpp_buffer->fname (delete entirely, or use
      	->ihash->name instead) and IF_STACK->fname.
      	(cpp_push_buffer): Don't set new->underflow.
      	(do_include): Use cpp_file_buffer.
      
      	* cpphash.c (collect_formal_parameters): Remove duplicate
      	increment of argslen.  Pedwarn in C99 mode if __VA_ARGS__ is
      	used as a macro argument name.  Don't append "..." to namebuf
      	for varargs macros.  After we're done scanning, go through
      	namebuf and make it NUL separated, not comma separated.
      	(_cpp_compare_defs): Remove register tag from variables.
      	Expect defn->argnames to be NUL separated.
      	(_cpp_dump_definition): Expect defn->argnames to be NUL
      	separated and in forward order.
      	* cpphash.h: Update documentation of argnames field.
      
      
      git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@32430 138bc75d-0d04-0410-961f-82ee72b054a4
      5b201908
  32. 07 Mar, 2000 1 commit
    • zack's avatar
      * cppfiles.c (_cpp_find_include_file): Make sure ih->name is · 94221a92
      zack authored
      	initialized.
      	* cppinit.c (cpp_cleanup): Free imp->nshort also.
      
      	* cpperror.c (cpp_print_containing_files,
      	cpp_print_file_and_line, v_cpp_message): Rename to
      	print_containing_files, print_file_and_line, and v_message.
      	* cppexp.c (cpp_parse_expr, cpp_parse_escape, cpp_lex): Rename
      	to _cpp_parse_expr, parse_escape, and lex.
      	(parse_charconst): Remove broken multibyte support.
      	* cppfiles.c (include_hash): Make static.
      	(cpp_included): New function.
      	(merge_include_chains, find_include_file, finclude,
      	simplify_pathname): Rename to _cpp_merge_include_chains,
      	_cpp_find_include_file, _cpp_read_include_file, and
      	_cpp_simplify_pathname.
      	* cpphash.c (cpp_lookup, free_definition, delete_macro,
      	cpp_install, create_definition, macroexpand, compare_defs,
      	dump_definition): Rename to _cpp_lookup, _cpp_free_definition,
      	_cpp_delete_macro, _cpp_install, _cpp_create_definition,
      	_cpp_macroexpand, _cpp_compare_defs, and _cpp_dump_definition.
      	* cppinit.c (cpp_handle_option): Rename to handle_option, make
      	static.
      	* cpplib.c: Remove extern prototype of cpp_parse_expr.
      
      	* cpphash.h: Update prototypes.
      	* cpplib.h: Likewise.  Prototype _cpp_parse_expr here.
      
      
      git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@32390 138bc75d-0d04-0410-961f-82ee72b054a4
      94221a92
  33. 04 Mar, 2000 1 commit
    • zack's avatar
      * mkdeps.c, mkdeps.h: New files. · 62adb1fe
      zack authored
      	* po/POTFILES.in: Add them.
      	* Makefile.in (LIBCPP_OBJS): Add mkdeps.o.
      	(cpplib.o, cppinit.o): Depend on mkdeps.h.
      	(mkdeps.o): New target.
      
      	* cppfiles.c: Delete deps_output.
      	* cppinit.c: Include mkdeps.h.  Delete known_suffixes,
      	OBJECT_SUFFIX, and base_name.
      	(cpp_cleanup): Use deps_free.  Free ihash->name when clearing
      	the include hash.
      	(initialize_dependency_output): Use deps_init,
      	deps_add_target, deps_calc_target, and deps_add_dep.  Remove
      	all the unnecessary string bashing.
      	(cpp_finish): Use deps_write.  Remove an unnecessary nesting
      	level.
      	* cpplib.c (do_include): Use deps_add_dep.
      	* cpplib.h (struct cpp_reader): Replace deps_buffer,
      	deps_allocated_size, deps_size, deps_column members with
      	single pointer to a struct deps.  Delete prototype of
      	deps_output.
      
      
      git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@32329 138bc75d-0d04-0410-961f-82ee72b054a4
      62adb1fe
  34. 02 Mar, 2000 1 commit
    • zack's avatar
      * cppfiles.c (cpp_read_file): New function. · d2e850c1
      zack authored
      	* cpphash.c (collect_expansion): Make sure to reset last_token
      	to NORM when we hit a string.  Handle trailing whitespace
      	properly when the expansion is empty.
      	(create_definition): Disable line commands while parsing the
      	directive line.
      	(dump_definition): If pfile->lineno == 0, output a line
      	command ahead of the dump, and add a trailing newline.
      
      	* cppinit.c (append_include_chain): Add fifth argument, which
      	indicates whether or not system headers are C++ aware.
      	(initialize_standard_includes): New function,
      	broken out of read_and_prescan.  Pass 'cxx_aware' value from
      	the include_defaults_array on to append_include_chain.
      	(dump_special_to_buffer): Const-ify char array.
      	(builtin_array): Don't dump __BASE_FILE__.
      	(cpp_start_read): Use cpp_read_file.  Reorder code for
      	clarity.  Don't output line commands here for -D/-A/-U
      	switches.  Don't call deps_output for files included with
      	-include or -imacros.
      
      	* cpplib.c (do_define): Don't pay any attention to the second
      	argument.
      	(cpp_expand_to_buffer): Disable line commands while scanning.
      	(output_line_command): Work in the file buffer.
      	* cpplib.h: Remove no_record_file flag from struct cpp_reader.
      	Fix formatting of comments.  Prototype cpp_read_file.
      
      
      git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@32293 138bc75d-0d04-0410-961f-82ee72b054a4
      d2e850c1
  35. 26 Feb, 2000 1 commit