1. 27 Nov, 2000 1 commit
    • c-lex.c (cb_enter_file, [...]): Combine into the new function cb_change_file. · 27e2564a
              * 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
      Neil Booth committed
  2. 03 Nov, 2000 1 commit
  3. 30 Oct, 2000 1 commit
    • cppfiles.c (stack_include_file): Check for stacked contexts here. · a5c3cccd
      	* 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
      Neil Booth committed
  4. 28 Oct, 2000 1 commit
    • New macro expander. · 93c80368
      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
      Neil Booth committed
  5. 21 Sep, 2000 1 commit
    • cppfiles.c (lookup_include_file): Rename to open_file. · 2047e26f
      	* cppfiles.c (lookup_include_file): Rename to open_file.
      	Always create a splay tree value, even on syscall failures.
      	Negative entries indicated by fd == -2.
      	Re-open files closed in the meantime.
      	(_cpp_fake_include): Create a negative splay tree entry.
      	(find_include_file, cpp_read_file): Update for function name
      	change.
      	* gcc.gd/cpp/mi4.c: Testcase.
      
      From-SVN: r36564
      Neil Booth committed
  6. 19 Sep, 2000 1 commit
  7. 16 Sep, 2000 2 commits
  8. 12 Sep, 2000 1 commit
    • cppfiles.c: Move all default-#defines to top of file. · a58d32c2
      	* cppfiles.c: Move all default-#defines to top of file.
      	(open_include_file): Replace by lookup_include_file.
      	(read_with_read, read_file): Merged into read_include_file.
      	(stack_include_file, purge_cache): New functions.
      	(close_cached_fd): Delete.
      	(lookup_include_file, read_include_file, _cpp_pop_file_buffer):
      	Cache the in-memory buffer, not the file descriptor.
      
      	* cpphash.h (struct include_file): Add buffer, st, refcnt,
      	mapped fields.
      	(xcnew): New utility macro.
      	(DO_NOT_REREAD, NEVER_REREAD): Move up by struct include_file.
      	* cpplib.h (struct cpp_buffer): Remove mapped field.
      
      	* cpplex.c (parse_string): Accept backslash space newline as a
      	line continuation.
      	(lex_line): Likewise.
      	(_cpp_get_token): Remove hard limit on macro nesting.
      
      testsuite:
      	* gcc.dg/cpp/backslash.c: New test.
      
      From-SVN: r36347
      Zack Weinberg committed
  9. 24 Aug, 2000 2 commits
  10. 02 Aug, 2000 1 commit
    • cpperror.c (v_message): Split into _cpp_begin_message and v_message macro. · 58fea6af
      	* cpperror.c (v_message): Split into _cpp_begin_message and
      	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.
      
      From-SVN: r35415
      Zack Weinberg committed
  11. 16 Jul, 2000 1 commit
  12. 13 Jul, 2000 1 commit
    • cppexp.c, [...]: Eradicate all traces of code dependent on traditional,… · f9a0e96c
      cppexp.c, [...]: Eradicate all traces of code dependent on traditional, lang_chill, or lang_fortran.
      
      	* cppexp.c, cpphash.c, cpphash.h, cppinit.c, cpplex.c,
      	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.
      
      From-SVN: r35003
      Zack Weinberg committed
  13. 05 Jul, 2000 1 commit
    • cpplex.c: Don't include sys/mman.h. · c71f835b
      toplevel:
      	* 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.
      
      From-SVN: r34870
      Zack Weinberg committed
  14. 04 Jul, 2000 1 commit
    • top level: · 041c3194
      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.
      
      From-SVN: r34859
      Zack Weinberg committed
  15. 02 Jul, 2000 1 commit
    • cpplib.h (struct cpp_reader): New field include_depth. · fb753f88
      	* cpplib.h (struct cpp_reader): New field include_depth.
      	(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.
      
      From-SVN: r34831
      Jakub Jelinek committed
  16. 30 Jun, 2000 1 commit
    • cpp.texi: Document #pragma GCC dependency · f3f751ad
      	* cpp.texi: Document #pragma GCC dependency
      	* 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.
      
      From-SVN: r34808
      Nathan Sidwell committed
  17. 28 Jun, 2000 1 commit
    • cppfiles.c (open_include_file): If open(2) returns EMFILE or ENFILE... · d4506961
      	* cppfiles.c (open_include_file): If open(2) returns EMFILE or
      	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.
      
      From-SVN: r34760
      Zack Weinberg committed
  18. 21 Jun, 2000 2 commits
    • cppfiles.c (cpp_make_system_header): New function. · e605b040
      	* cppfiles.c (cpp_make_system_header): New function.
      	* 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.
      
      From-SVN: r34641
      Zack Weinberg committed
    • cppfiles.c: Include splay-tree.h, not hashtab.h. · c31a6508
      	* cppfiles.c: Include splay-tree.h, not hashtab.h.
      	(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.
      
      From-SVN: r34636
      Zack Weinberg committed
  19. 09 Jun, 2000 1 commit
  20. 01 Jun, 2000 1 commit
    • [multiple changes] · d7a2e0f7
      2000-06-01  Zack Weinberg  <zack@wolery.cumb.org>
      
      	* 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().
      
      From-SVN: r34344
      Zack Weinberg committed
  21. 29 May, 2000 1 commit
    • cpplib.h (cpp_reader): Remove if_stack. · ea4a453b
      	* cpplib.h (cpp_reader): Remove if_stack.  Change
      	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.
      
      From-SVN: r34253
      Zack Weinberg committed
  22. 28 May, 2000 1 commit
    • cppfiles.c: Read files in, using mmap if possible, then prescan them separately. · f8f769ea
      	* cppfiles.c: Read files in, using mmap if possible, then
      	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 *.
      
      From-SVN: r34228
      Zack Weinberg committed
  23. 04 May, 2000 1 commit
    • cpphash.h (U): New define, to correct type of string constants. · 12cf91fe
      gcc:
      	* 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.
      
      From-SVN: r33657
      Zack Weinberg committed
  24. 02 May, 2000 1 commit
    • cpplib.h (CPP_POP, [...]): Delete. · c56c2073
      	* cpplib.h (CPP_POP, parse_cleanup_t): Delete.
      	(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.
      
      From-SVN: r33611
      Zack Weinberg committed
  25. 01 May, 2000 1 commit
  26. 30 Apr, 2000 1 commit
    • cppfiles.c (redundant_include_p): Provide length of token to cpp_defined. · 638d694d
      	* cppfiles.c (redundant_include_p): Provide length of token to
      	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.
      
      From-SVN: r33551
      Zack Weinberg committed
  27. 18 Apr, 2000 2 commits
    • cccp.c, [...]: Removed. · 86702e31
      	* cccp.c, cexp.y, cexp.c, cccp.1: Removed.
      
      	* 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.
      
      From-SVN: r33238
      Zack Weinberg committed
    • conflict.c (conflict_graph_add): Pass enum type to htab_find_slot. · e38992e8
      	* gcc/conflict.c (conflict_graph_add): Pass enum type to
      	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.
      
      From-SVN: r33236
      Richard Kenner committed
  28. 17 Apr, 2000 1 commit
    • Makefile.in ($(srcdir)/c-parse.y: c-parse.in): Enclose the whole message in quotes. · 5f6d3823
              * Makefile.in ($(srcdir)/c-parse.y: c-parse.in): Enclose the whole
              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.
      
      From-SVN: r33192
      Dave Pitts committed
  29. 14 Apr, 2000 1 commit
    • cpplex.c (cpp_output_tokens, [...]): New public interfaces. · f2d5f0cc
      	* cpplex.c (cpp_output_tokens, cpp_scan_buffer_nooutput): New public
      	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.
      
      From-SVN: r33159
      Zack Weinberg committed
  30. 06 Apr, 2000 1 commit
    • cpphash.c (CPP_IS_MACRO_BUFFER, [...]): Delete. · ff2b53ef
      	* cpphash.c (CPP_IS_MACRO_BUFFER, FORWARD, PEEKC): Delete.
      	(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.
      
      From-SVN: r32965
      Zack Weinberg committed
  31. 31 Mar, 2000 1 commit
    • cpplib.h: Merge struct cpp_options into struct cpp_reader. · ae79697b
      	* cpplib.h: Merge struct cpp_options into struct cpp_reader.
      	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.
      
      From-SVN: r32850
      Zack Weinberg committed
  32. 29 Mar, 2000 1 commit
  33. 28 Mar, 2000 1 commit
    • cppfiles.c (hash_IHASH): Just return i->hash. · 29a72a4f
      2000-03-28  Zack Weinberg  <zack@wolery.cumb.org>
      
      	* 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.
      
      From-SVN: r32792
      Zack Weinberg committed
  34. 15 Mar, 2000 1 commit
  35. 14 Mar, 2000 2 commits
    • cppfiles.c (find_include_file): Don't assume nshort is a substring of name. · 56488666
      	* cppfiles.c (find_include_file): Don't assume nshort is a
      	substring of name.
      
      From-SVN: r32533
      Zack Weinberg committed
    • cppfiles.c: Include mkdeps.h. · 168d3732
      	* cppfiles.c: Include mkdeps.h.
      	(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.
      
      From-SVN: r32519
      Zack Weinberg committed