Skip to content
Snippets Groups Projects
  1. Jan 03, 2002
    • Neil Booth's avatar
      cpperror.c: Update comments and copyright. · 5d8ebbd8
      Neil Booth authored
      	* cpperror.c: Update comments and copyright.
      	* cppexp.c, cppfiles.c, cpphash.c, cpphash.h, cppinit.c,
      	cpplex.c, cpplib.c, cpplib.h, cppmacro.c, cppmain.c: Similarly.
      
      From-SVN: r48522
      5d8ebbd8
  2. Nov 27, 2001
    • Neil Booth's avatar
      cpphash.c (_cpp_init_hashtable): Update. · 0abc6a6a
      Neil Booth authored
      	* cpphash.c (_cpp_init_hashtable): Update.
      	* cpphash.h (struct spec_nodes): Remove n_L.
      	* cpplex.c (_cpp_lex_direct): Check for prefix L separately.
      
      	* Makefile.in: Update, and add c-objc-common.o dependencies.
      	* c-lang.c: Remove unnecessary includes.
      	(c_init): Move bulk of code to c_objc_common_init, and call it.
      	(c_tree_printer, c_missing_noreturn_ok_p, c_disregard_inline_limits,
      	inline_forbidden_p, c_cannot_inline_tree_fn): Move to
      	c-objc-common.c.
      	* c-objc-common.c: New.  Mostly pulled from c-lang.c.
      	* c-tree.h (c_disregard_inline_limits, c_cannot_inline_fn,
      	c_objc_common_init, c_missing_noreturn_ok_p): New.
      	* toplev.c: Update comment.
      	* doc/passes.texi: Update.
      	* objc/ojbc-act.c (LANG_HOOKS_TREE_INLINING_CANNOT_INLINE_TREE_FN,
      	LANG_HOOKS_TREE_INLINING_DISREGARD_INLINE_LIMITS,
      	LANG_HOOKS_TREE_INLINING_ANON_AGGR_TYPE_P): Override.
      	(objc_init): Update to use c_objc_common_init.
      
      From-SVN: r47388
      0abc6a6a
  3. Nov 15, 2001
    • Neil Booth's avatar
      c-common.c: Include c-lex.h. · f5e99456
      Neil Booth authored
      	* c-common.c: Include c-lex.h.
      	(c_common_lang_init): Change prototype.  Call init_c_lex and
      	init_pragma from here.
      	* c-common.h (c_common_lang_init): Change prototype.
      	* c-decl.c (init_decl_processing): Rename.  Call c_parse_init.
      	* c-lang.c (c_init): Change prototype.  Update.
      	(c_init_options): Update.
      	* c-lex.c (cpp_filename): Remove.
      	(init_c_lex): Update.  Read the main file, and get the original
      	file name.
      	(yyparse): Finish the command line options.
      	* c-parse.in (c_parse_init): Call init_reswords here.
      	(init_parse): Remove.
      	* c-tree.h (c_init_decl_processing): New.
      	* cpphash.c (_cpp_init_hashtable): After initializing the hash
      	table, populate it.
      	* cppinit.c (read_original_filename, cpp_finish_options): New.
      	(cpp_create_reader): New prototype. Defer hash table initialization.
      	(cpp_start_read): Rename cpp_read_main_file.  Initialize the
      	hash table.  Get the original filename.
      	* cpplib.h (cpp_create_reader): Update.
      	(cpp_start_read): Remove.
      	(cpp_read_main_file, cpp_finish_options): New.
      	* cppmain.c (main, do_preprocessing): Update.
      	* langhooks.h (struct langhooks): Update init prototype.
      	* toplev.c (general_init, parse_options_and_default_flags,
      	process_options, lang_indpendent_init, lang_dependent_init,
      	init_asm_output): New; perform the bulk of initialization.
      	(compile_file): Move most of initialization to above functions.
      	(debug_hooks): Initialize statically.
      	(set_Wunused): Relocate.
      	(toplev_main): Move most of initialization to other init functions.
      	Have a clear logic flow.
      	* tree.h (init_parse, init_decl_processing): Remove.
      ada:
      	* misc.c (gnat_init): Change prototype.  Include the
      	functionality of the old init_parse and init_decl_processing.
      	(gnat_init_decl_processing): New prototype.
      	(init_parse): Remove.
      	* utils.c (init_decl_processing): Rename gnat_init_decl_processing.
      cp:	* cp-tree.h (init_reswords, cxx_init_decl_processing): New.
      	(cxx_init): Update prototype.
      	* decl.c (init_decl_processing): Rename.  Move null node init
      	to its creation time.
      	* lex.c (cxx_init_options): Update.
      	(cxx_init): Combine with old init_parse; also call
      	cxx_init_decl_processing.
      f:	* com.c (ffecom_init_decl_processing): Renamed from
      	init_decl_processing.
      	(init_parse): Move contents to ffe_init.
      	(ffe_init): Update prototype.
      java:	* decl.c (init_decl_processing): Rename java_init_decl_processing.
      	* java-tree.h: New prototype.
      	* lang.c (java_init): Update prototype.  Combine with old init_parse.
      objc:	* objc-act.c (objc_init): Update prototype, combine with old
      	init_parse.
      	(objc_init_options): Update.
      
      From-SVN: r47046
      f5e99456
  4. Aug 11, 2001
    • Neil Booth's avatar
      cpphash.c (_cpp_destroy_hashtable): Use ht_destroy. · bef985f3
      Neil Booth authored
      	* cpphash.c (_cpp_destroy_hashtable): Use ht_destroy.
      	* cpphash.h (CPP_IN_SYSTEM_HEADER): Fix.
      	(struct cpp_pool): New member first.
      	* cppinit.c (append_include_chain): Plug memory leaks.
      	* cpplib.c (cpp_register_pragma, cpp_register_pragma_space):
      	Allocate pragma structures from the (aligned) macro pool to
      	avoid leaking memory.
      	* cpplex.c (_cpp_init_pool, _cpp_free_pool): Use pool->first
      	so we don't leak memory.
      	* hashtable.c (ht_destroy): New.
      	* hashtable.h (ht_destroy): New.
      
      From-SVN: r44794
      bef985f3
  5. May 30, 2001
  6. May 20, 2001
    • Neil Booth's avatar
      Makefile.in (OBJS, [...]): Update. · 2a967f3d
      Neil Booth authored
      	* Makefile.in (OBJS, LIBCPP_OBJS, LIBCPP_DEPS,
      	cpplib.o, cpphash.o, fix-header): Update.
      	(hashtable.o): New target.
      	* c-common.h: Include cpplib.h.  Define C_RID_CODE and
      	struct c_common_identifier here.
      	* c-lang.c (c_init_options): Update.  Call set_identifier_size.
      	* c-lex.c (c_lex): Update.
      	* c-pragma.h: Update.
      	* c-tree.h (struct lang_identifier): Contain c_common_identifier.
      	Delete rid_code.
      	(C_RID_CODE): Delete.
      	* cpphash.c: Rewrite to use hashtable.c.
      	* cpphash.h: Update include guards.
      	(struct cpp_reader): Remove hashtab.
      	hash_ob and buffer_ob are no longer pointers.  Add hash_table
      	and our_hashtable.
      	(HASHSTEP, _cpp_init_hashtable,	_cpp_lookup_with_hash): Delete.
      	(_cpp_cleanup_hashtable): Rename _cpp_destroy_hashtable.
      	(_cpp_cleanup_stacks): Rename _cpp_init_directives.
      	* cppinit.c (cpp_create_reader): Update.
      	* cpplex.c (cpp_ideq, parse_identifier, cpp_output_token): Update.
      	(cpp_interpret_charconst): Eliminate warning.
      	* cpplib.c (do_pragma, do_endif, push_conditional,
      	cpp_push_buffer, cpp_pop_buffer): Update.
      	(_cpp_init_stacks): Rename cpp_init_directives.
      	(_cpp_cleanup_stacks): Remove.
      	* cpplib.h: Update include guards.  Include tree-core.h and c-rid.h.
      	(cpp_hashnode, cpp_token, NODE_LEN, NODE_NAME,
      	 cpp_forall_identifiers, cpp_create_reader): Update.
      	(C_RID_CODE, cpp_make_node): New.
      	(c_common_identifier): New identifier node for C front ends.
      	* cppmain.c (main): Update.
      	* fix-header.c (read_scan_file): Update.
      	* flags.h (id_clash_len): Make unsigned.
      	* ggc.h (ggc_mark_nonnull_tree): New.
      	* hashtable.c: New.
      	* hashtable.h: New.
      	* stringpool.c: Update comments and copyright.  Update to use
      	hashtable.c.
      	* toplev.c (approx_sqrt): Move to hashtable.c.
      	(id_clash_len): Make unsigned.
      	* toplev.h (ident_hash): New.
      	* tree.c (gcc_obstack_init): Move to hashtable.c.
      	* tree.h: Include hashtable.h.
      	(IDENTIFIER_POINTER, IDENTIFIER_LENGTH): Update.
      	(GCC_IDENT_TO_HT_IDENT, HT_IDENT_TO_GCC_IDENT): New.
      	(struct tree_identifier): Update.
      	(make_identifier): New.
      cp:
      	* cp-tree.h (struct lang_identifier, C_RID_YYCODE): Update.
      	(C_RID_CODE): Remove.
      	* lex.c (cxx_init_options): Call set_identifier_size.  Update.
      	(init_parse): Don't do it here.
      objc:
      	* objc-act.c (objc_init_options): Call set_identifier_size. Update.
      
      From-SVN: r42334
      2a967f3d
  7. May 16, 2001
    • Neil Booth's avatar
      cppexp.c (lex): Use NODE_NAME and NODE_LEN. · a28c5035
      Neil Booth authored
      	* cppexp.c (lex): Use NODE_NAME and NODE_LEN.
      	* cpphash.c (_cpp_lookup_with_hash): Similarly.
      	* cpplex.c (cpp_ideq, parse_identifier, cpp_token_len,
      	cpp_spell_token, cpp_output_token): Similarly.
      	* cpplib.c (lex_macro_node, do_undef, do_pragma,
      	do_pragma_poison, parse_assertion, do_assert): Similarly.
      	* cppmacro.c (builtin_macro, parse_args, funlike_invocation_p,
      	save_parameter, _cpp_create_definition, check_trad_stringification,
      	cpp_macro_definition): Similarly.
      	* cppmain.c (cb_define, cb_undef, dump_macro): Similarly.
      	* c-lex.c (cb_undef, c_lex): Similarly.
      	* fix-header.c (recognized_function): Similarly.
      	* cpplib.h (NODE_LEN, NODE_NAME): New.
      	(cpp_hashnode): Rename length len.
      
      From-SVN: r42174
      a28c5035
  8. Jan 28, 2001
    • Neil Booth's avatar
      cpphash.c (_cpp_cleanup_hashtable, [...]): Don't set fe_value. · 26ec42ee
      Neil Booth authored
              * cpphash.c (_cpp_cleanup_hashtable, _cpp_lookup_with_hash)
              : Don't set fe_value.
              * cpplib.h (AVOID_LPASTE): New flag.
              (struct cpp_hashnode): Remove fe_value.
              * cpplex.c (cpp_avoid_paste): Don't paste '.' with a number.
              * cppmacro.c (builtin_macro): Don't set flags here.
              (replace_args): Set AVOID_LPASTE flag on first token of an
              argument, and the token following it.
              (cpp_get_token): Set AVOID_LPASTE flag on first token of a
              macro expansion, and on the token following it.  Do it for
              builtins too.
              * cppmain.c (scan_buffer): Avoid pasting only flagged tokens.
      
      From-SVN: r39318
      26ec42ee
  9. Nov 09, 2000
    • Neil Booth's avatar
      cpphash.c: Move cpp_defined here from cpplib.c. · a949941c
      Neil Booth authored
              * cpphash.c: Move cpp_defined here from cpplib.c.
              * cpplib.c: Update comments, move cpp_defined to cpphash.c.
              * cpplex.c (_cpp_lex_token): Don't leave the lexer at EOL.
              * cppmacro.c (cpp_get_token): Update comments, no need now
              to catch the CPP_EOF meaning EOL case.
      
      From-SVN: r37345
      a949941c
  10. Oct 29, 2000
    • Geoff Keating's avatar
      cpphash.c (cpp_forall_identifiers): Add context variable for callback routine. · 926c5678
      Geoff Keating authored
      	* cpphash.c (cpp_forall_identifiers): Add context variable
      	for callback routine.
      	* cppmain.c (dump_macro): Update to match cpp_forall_identifiers
      	change.
      	(main): Call cpp_forall_identifiers with null context.
      	* cpplib.h (cpp_forall_identifiers): Update prototype.
      
      	* cppmain.c: Make `parse_in' and `print' static.
      
      From-SVN: r37119
      926c5678
  11. Oct 28, 2000
    • Neil Booth's avatar
      New macro expander. · 93c80368
      Neil Booth authored
      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
      93c80368
  12. Sep 18, 2000
    • Neil Booth's avatar
      cpphash.h (HASHSTEP): Take character rather than pointer to character. · 0d9f234d
      Neil Booth authored
      	* cpphash.h (HASHSTEP): Take character rather than pointer
      	to character.
      	(_cpp_check_directive, _cpp_check_linemarker): Update prototypes.
      
      	* cpphash.c (cpp_loookup): Update for new HASHSTEP.
      
      	* cpplex.c (auto_expand_name_space, trigraph_replace,
      	backslash_start, handle_newline, parse_name, INIT_TOKEN_STR,
      	IMMED_TOKEN, PREV_TOKEN_TYPE, PUSH_TOKEN, REVISE_TOKEN,
      	BACKUP_TOKEN, BACKUP_TRIGRAPH, MIGHT_BE_DIRECTIVE,
      	KNOWN_DIRECTIVE): Delete.
      
      	(handle_newline, check_long_token, skip_escaped_newlines,
      	unterminated): New functions.
      	(ACCEPT_CHAR, SAVE_STATE, RESTORE_STATE): New macros.
      
      	(parse_identifier): Was parse_name, new implementation.
      	(skip_line_comment, skip_block_comment, skip_whitespace,
      	parse_number, parse_string, trigraph_ok, save_comment,
      	adjust_column, _cpp_get_line): New implementations.
      
      	(lex_token): New function.  Lexes a token at a time, looking
      	forwards.  Contains most of the guts of the old lex_line.
      	(lex_line): New implementation, using lex_token to obtain
      	individual tokens.
      	(cpp_scan_buffer): Use the token's line, not the list's line.
      
      	* cpplib.c (_cpp_check_directive, _cpp_check_linemarker):
      	 New implementations.
      	(do_assert): Don't bother setting the answer's list's line.
      	(cpp_push_buffer): Initialise new pfile and read_ahead members
      	of struct cpp_buffer.
      
      	* cpplib.h (cppchar_t): New typedef.
      	(struct cpp_buffer): read_ahead, pfile and col_adjust are
      	new members.
      	(struct lexer_state): New structure that determines the state
      	and behaviour of the lexer.
      	(IN_DIRECTIVE, KNOWN_DIRECTIVE): New macros.
      	(struct cpp_reader): New member "state". Rename
      	multiline_string_line and multiline_string_column. Delete
      	col_adjust, in_lex_line members.
      	(CPP_BUF_COLUMN): Update.
      
      	* gcc.dg/cpp/cmdlne-C.c: Remove bogus warning test.
      
      From-SVN: r36509
      0d9f234d
  13. Jul 18, 2000
    • Zack Weinberg's avatar
      [multiple changes] · 711b8824
      Zack Weinberg authored
      2000-02-17  Zack Weinberg  <zack@wolery.cumb.org>
      
      	* cpphash.c: Don't include hashtab.h.  Most macro-handling code
      	moved to cppmacro.c.
      	(hash_HASHNODE, eq_HASHNODE, _cpp_dump_macro_hash,
      	dump_hash_helper): Delete.
      	(expand_hash, higher_prime_number, _cpp_lookup_with_hash,
      	cpp_forall_identifiers): New. Implement specialized version of
      	Vlad's expandable hash table.
      	(cpp_lookup): Use new functions.
      	(_cpp_init_macros, _cpp_cleanup_macros): Adjust for new
      	implementation.
      	* cppmacro.c: New file.
      	* cppinit.c (dump_macros_helper): New.
      	(cpp_finish): Iterate over the identifier table directly.
      	* cpplex.c (parse_name): Calculate the hash of the identifier
      	while we scan it.  Use _cpp_lookup_with_hash when we can.
      
      	* cpphash.h: Update prototypes.
      	(xcnewvec, HASHSTEP): New helper macros.
      	* cpplib.h: Update prototypes.
      	* Makefile.in (LIBCPP_OBJS): Add cppmacro.o.
      	(cppmacro.o): New rule.
      	(cpphash.o): Update deps.
      
      	* cppmain.c: Do not set pfile->printer if no_output is on.
      
      2000-02-15  Neil Booth  <neilb@earthling.net>
      
      	* cpplib.c: Change all directive-handler functions to return
      	void, not int.
      	* cpphash.h: Update typedefs.
      
      From-SVN: r35113
      711b8824
  14. Jul 15, 2000
    • Zack Weinberg's avatar
      cpphash.c (save_expansion): Clear PREV_WHITE on tokens immediately following a paste operator. · 2c0accc9
      Zack Weinberg authored
      	* cpphash.c (save_expansion): Clear PREV_WHITE on tokens
      	immediately following a paste operator.
      	* cppinit.c (sort_options): New function (only for HOST_EBCDIC).
      	(cpp_reader_init): Call it, if HOST_EBCDIC.
      	(cpp_handle_options): Do not sort option list here.
      	(handle_option): Rename to cpp_handle_option and export.
      	* cpplex.c (cpp_scan_buffer_nooutput, cpp_scan_buffer): Use
      	_cpp_get_token directly.
      	(cpp_scan_line): Return 0 at EOF, 1 otherwise.
      	* cpplib.c (cpp_push_buffer): Don't set new->lineno to 1.
      	* cpplib.h: Prototype cpp_handle_option.  Update prototype of
      	cpp_scan_line.
      
      From-SVN: r35052
      2c0accc9
  15. Jul 13, 2000
    • Neil Booth's avatar
      cpphash.c (struct macro_info): Add new members. · b30892f9
      Neil Booth authored
      	* cpphash.c (struct macro_info): Add new members.
      	(_cpp_free_definition): Delete the macro directly.
      	(count_params): Return void, with first token of
      	expansion in struct macro_info on success.
      	(parse_define): Return int.  Hoist syntax checking from
      	save_macro_expansion.  Leave call to save_expansion to
      	_cpp_create_definition.
      	(alloc_macro): Needs just 2 arguments.
      	(free_macro): Delete.
      	(save_expansion): Don't perform syntax check.
      	(_cpp_create_definition): Call save_expansion.
      
      From-SVN: r35025
      b30892f9
    • Kaveh R. Ghazi's avatar
      * cpphash.c (macro_info): Don't use the `signed' keyword. · af0d1578
      Kaveh R. Ghazi authored
      From-SVN: r35023
      af0d1578
    • Zack Weinberg's avatar
      cppexp.c, [...]: Eradicate all traces of code dependent on traditional,... · f9a0e96c
      Zack Weinberg authored
      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
      f9a0e96c
  16. Jul 12, 2000
    • Zack Weinberg's avatar
      cppexp.c (LOGICAL): Delete macro. · 0080e892
      Zack Weinberg authored
      	* cppexp.c (LOGICAL): Delete macro.
      	(_cpp_parse_expr): Do not use UNARY for unary +.  Implement ||
      	and && directly.
      
      	* cpphash.c (HASHSIZE): Increase to 4096.
      	(struct hashdummy): Add hash field.
      	(eq_HASHNODE): Compare unreduced hashes, then lengths, then
      	the string values using memcmp.
      	(cpp_lookup): Set dummy.hash.
      
      From-SVN: r34994
      0080e892
    • Neil Booth's avatar
      cpphash.h: (TOKEN_SPELL) Pulled from cpplex.c. · 2964d54f
      Neil Booth authored
      	* cpphash.h: (TOKEN_SPELL) Pulled from cpplex.c.
      	* cpplex.c (TOKEN_SPELL) Move to cpphash.h.
      
      	* cpphash.c: (struct macro_info, alloc_macro, free_macro,
      	struct toklist_dummy): New.
      	(cpp_free_definition): Free macros with free_macro.
      	(count_params): Don't save paramter spellings.  Save macro
      	information in a struct macro_info.
      	(parse_define): Don't allocate a token list.
      	(save_expansion): Allocate the macro's token list, and
      	save parameter spellings if necessary.  Use TOKEN_SPELL.
      	(cpp_create_definition): Make list const.
      
      From-SVN: r34985
      2964d54f
  17. Jul 11, 2000
    • Zack Weinberg's avatar
      [multiple changes] · 417f3e3a
      Zack Weinberg authored
      2000-07-11  Zack Weinberg  <zack@wolery.cumb.org>
      
      	* cpplex.c (parse_name): No longer inline (premature optimization).
      	(do_pop_context): Fold into pop_context.
      	(pop_context): Returns int.
      	(lex_next): Hoist test for end of directive into pop_context.
      	(push_macro_context): Returns int; takes just reader and token.
      	Hoist test for excessive nesting to caller.
      	(push_arg_context): Returns void; takes just reader and token.
      	Do not call stringify_arg or get_raw_token.
      	(get_raw_token): Convert tail recursion through	push_arg_context
      	to a loop at this level.  Call stringify_arg here if appropriate.
      	(maybe_paste_with_next): Convert tail recursion to a while loop.
      	Hoist test of paste_level to caller.
      
      	(stringify_arg): Push arg context at beginning.
      	(cpp_get_token): Split out core into _cpp_get_token.  Call
      	process_directive here.  Throw away CPP_PLACEMARKER tokens.
      	(_cpp_get_token): Convert tail recursion through
      	push_macro_context to a loop at this level.
      	(_cpp_glue_header_name, is_macro_disabled, stringify_arg,
      	_cpp_get_raw_token): Use _cpp_get_token.
      	(_cpp_skip_rest_of_line): Drop the context stack directly; do
      	not call pop_context.
      	(_cpp_run_directive): Call lex_next directly.
      
      	* cpphash.h: Prototype _cpp_get_token.
      	* cppexp.c (lex): Use it.
      	* cpphash.c (parse_define): Use it.
      	* cpplib.c (get_define_node, do_undef, parse_include,
      	read_line_number, do_line, do_ident, do_pragma, do_pragma_gcc,
      	do_pragma_implementation, do_pragma_poison, do_pragma_dependency,
      	parse_ifdef, validate_else): Use it.
      	(cpp_push_buffer): Tweak error message; abort if anyone tries
      	to push a buffer while macro expansions are stacked.
      
      2000-07-11  Donn Terry  <donnte@microsoft.com>
      
      	* cpplex.c (free_macro_args, save_token): Cast arg of free
      	and/or xrealloc to PTR.
      	(_cpp_init_input_buffer): Clear all fields of the base context.
      
      From-SVN: r34972
      417f3e3a
  18. Jul 08, 2000
    • Zack Weinberg's avatar
      cpplib.h (struct cpp_name): Now struct cpp_string. · bfb9dc7f
      Zack Weinberg authored
      	* cpplib.h (struct cpp_name): Now struct cpp_string.
      	(CPP_INT, CPP_FLOAT, CPP_NUMBER, CPP_COMMENT,
      	CPP_HEADER_NAME): Change to type S.
      	(struct cpp_token): Rename 'name' field to 'str'.  Add 'node'
      	field, a cpp_hashnode *.  All references to val.name updated
      	to use val.str or val.node as appropriate.
      	(struct cpp_reader): Add spec_nodes field.
      	(cpp_idcmp): Now cpp_ideq; takes a token * and a char *.
      
      	* cpphash.h (struct spec_nodes): New.
      	(enum spell_type): Reorder.  Only SPELL_STRING tokens use
      	val.str.  All references to 'spelling > SPELL_NONE' updated to
      	match.
      
      	(CPP_IN_SYSTEM_HEADER): Check pfile->buffer and
      	pfile->buffer->inc are not NULL before dereferencing them.
      
      	* cpplex.c (parse_name): Take a pointer to the current token,
      	plus current position and limit as args; return the new
      	position; don't copy the text of a name into the string
      	buffer, instead call cpp_lookup and store the node pointer.
      	If extending a token, copy out the text of the old into a
      	scratch buffer, append the new, look that up and store the new
      	node pointer.  Inline.
      	(maybe_paste_with_next): If the result of paste is a NAME,
      	then look up the pasted text and store its node pointer.
      	(lex_line): Adjust for new parse_name interface.
      	Check for L"str", L'str' using spec_nodes->n_L.
      	(spell_token): SPELL_IDENT tokens have their spelling in
      	val.node->name.  Handle SPELL_STRING tokens that don't have
      	string delimiters.
      	(_cpp_expand_name_space,
      	(can_paste): Check for L ## "str" using spec_nodes->n_L.
      	(cpp_get_token, special_symbol): No need to call cpp_lookup.
      	(cpp_idcmp): Now cpp_ideq; take a token * and a const char *;
      	return 1=equal 0=not, not a tristate.
      
      	* cpphash.c (var_args_str): Delete.
      	(find_param): Compare node fields directly.
      	(is__va_args__): Use CPP_PEDANTIC.  Just compare
      	token->val.node with spec_nodes->n__VA_ARGS__.
      	(dump_funlike_macro): Don't use var_args_str.
      
      	* cpplib.c (_cpp_check_directive): Just walk through
      	spec_nodes->dirs comparing pointers.
      	(get_define_node, do_pragma_poison, detect_if_not_defined,
      	parse_ifdef): The identifier has already been looked up.
      	(do_ifdef, do_ifndef): parse_ifdef won't return a poisoned
      	node.
      	(do_if): Only call detect_if_not_defined at beginning of file.
      	(_cpp_parse_assertion): Only copy string pointers for
      	SPELL_STRING tokens.
      	(pragma_dispatch): Take a node pointer and examine its name
      	field.
      	(_cpp_init_stacks): Also initialize the spec_nodes structure.
      
      	* cppinit.c (cpp_reader_init): Call _cpp_init_stacks after
      	_cpp_init_macros.
      	(cpp_cleanup): Free pfile->spec_nodes.  Call _cpp_cleanup_* in
      	reverse order from the corresponding _cpp_init_* routines.
      
      	* cppexp.c (parse_number, parse_charconst, parse_defined,
      	lex): Check val.node->type instead of calling cpp_defined.
      	Use spec_nodes entries where appropriate.
      
      	* fix-header.c, scan-decls.c: Update for interface changes.
      
      From-SVN: r34926
      bfb9dc7f
    • Neil Booth's avatar
      cpphash.c (is__va_args__): New function. · 563dd08a
      Neil Booth authored
      	* cpphash.c (is__va_args__): New function.
      	(count_params): Fix line reported in error messages.  Use
      	is__va_args__.  Don't return ')' on error.  Flag GNU style
      	rest args macro definitions.
      	(parse_define): Check macro name is not __VA_ARGS__.
      	(save_expansion): Check identifier in non-varargs-macro is
      	not __VA_ARGS__.  Don't flag GNU_VARARGS.
      	* cpplex.c (parse_args): Accept no argument iff GNU_REST_ARGS.
      	(maybe_paste_with_next): Use per-macro GNU_REST_ARGS rather
      	 than per-token GNU_VARARGS.
      	* cpplib.h (GNU_VARARGS): Remove.
      	(GNU_REST_ARGS): New.
      
      	* gcc.dg/cpp/macsyntx.c: New tests.
      
      From-SVN: r34919
      563dd08a
  19. Jul 05, 2000
    • Zack Weinberg's avatar
      cpplex.c: Don't include sys/mman.h. · c71f835b
      Zack Weinberg authored
      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
      c71f835b
  20. Jul 04, 2000
    • Zack Weinberg's avatar
      top level: · 041c3194
      Zack Weinberg 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.
      
      From-SVN: r34859
      041c3194
  21. Jun 21, 2000
    • Zack Weinberg's avatar
      cppfiles.c: Include splay-tree.h, not hashtab.h. · c31a6508
      Zack Weinberg authored
      	* 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
      c31a6508
  22. May 28, 2000
    • Zack Weinberg's avatar
      cppfiles.c: Read files in, using mmap if possible, then prescan them separately. · f8f769ea
      Zack Weinberg authored
      	* 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
      f8f769ea
  23. May 19, 2000
  24. May 18, 2000
    • Zack Weinberg's avatar
      cppexp.c (parse_assertion): New. · 15dad1d9
      Zack Weinberg authored
      	* cppexp.c (parse_assertion): New.
      	(lex): Call it for CPP_HASH.  Remove CPP_ASSERTION case.
      	(_cpp_parse_expr): Remove case '#'.  Don't set
      	parsing_if_directive.
      	* cpphash.c (collect_objlike_expansion,
      	collect_funlike_expansion, collect_params,
      	_cpp_create_definition): The list no longer has a trailing
      	VSPACE token.
      	* cpphash.h (enum node_type): Add T_ASSERTION.
      	(struct hashnode): Remove aschain, add pred.
      	(struct predicate): New.
      	Update prototypes.
      
      	* cpplex.c (expand_token_space): Handle both offset and
      	nonoffset lists.
      	(init_token_list, _cpp_free_token_list, _cpp_parse_assertion): Delete.
      	(_cpp_init_toklist, _cpp_clear_toklist, _cpp_free_toklist,
      	_cpp_slice_toklist, _cpp_squeeze_toklist, _cpp_equiv_tokens,
      	_cpp_equiv_toklists): New.
      	(_cpp_scan_line): Rename to _cpp_scan_until; add ability to
      	stop at any single-character token, not just newline.
      	(_cpp_lex_token): Remove special cases for #define and #if.
      	(cpp_get_token): Expect # as a separate token type.  Remove
      	DIRECTIVE case.
      	(_cpp_get_directive_token): Remove DIRECTIVE case.
      	(_cpp_lex_line, _cpp_lex_file, _cpp_init_input_buffer): Update.
      
      	* cpplib.c (_cpp_check_directive): Set dirno and
      	SYNTAX_INCLUDE bit of flags, not dir_handler and dir_flags.
      	(_cpp_handle_directive): Run # <number> through the same logic
      	as normal directives.
      	(do_define): Don't set parsing_define_directive.  Use
      	_cpp_scan_until.  The list does not have a VSPACE at the end.
      	(do_if): Save, clear, and restore only_seen_white around
      	_cpp_parse_expr.
      	(skip_if_group): s/CPP_DIRECTIVE/CPP_HASH/
      	(do_assert, do_unassert): Rewrite.
      
      	* cpplib.h (TTYPE_TABLE): Remove CPP_ASSERTION.
      	(LIST_OFFSET): New flag.
      	(struct cpp_toklist): Replace dir_handler and dir_flags with
      	dirno and flags.
      	(struct cpp_reader): Remove parsing_if_directive and
      	parsing_define_directive.
      
      From-SVN: r33984
      15dad1d9
  25. May 14, 2000
    • Neil Booth's avatar
      cpphash.c (trad_stringify, [...]): Make some pointers pointers to const. · f617b8e2
      Neil Booth authored
      	* cpphash.c (trad_stringify, warn_trad_stringify,
      	collect_params): Make some pointers pointers to const.
      	* cpplex.c (auto_expand_name_space) Guaranteed to always
      	expand by at least one character.
      	(SPELL_CHAR, SPELL_NONE): Temporarily reverse order.
      	(struct token_spelling): Use const U_CHAR * rather than PTR.
      	(expand_name_space): Fix up token pointers if name space
      	is moved when expanding.
      	(INIT_NAME, cpp_scan_line, parse_name, parse_number,
      	parse_string2, save_comment, spell_token, cpp_output_list):
      	Update so the routines handle tokens with a direct pointer to
      	their text, rather than an offset into the token's list's namebuf.
      	(_cpp_lex_line): Rearrange for clarity.
      
      	* cpplib.c (_cpp_check_directive): Similarly.
      	(do_define): Make SYM a pointer to const.
      	* cpplib.h (struct cpp_name): Replace offset with direct pointer.
      	(CPP_INT, CPP_FLOAT): Spelling type should be SPELL_IDENT.
      	(TOK_OFFSET): Delete.
      	(TOK_NAME): Update.
      
      From-SVN: r33901
      f617b8e2
  26. May 11, 2000
    • Zack Weinberg's avatar
      cpphash.c (collect_funlike_expansion): Make "# is not followed by a macro... · 3ae1c615
      Zack Weinberg authored
      cpphash.c (collect_funlike_expansion): Make "# is not followed by a macro argument name" a pedwarn, not an error.
      
      	* cpphash.c (collect_funlike_expansion): Make "# is not
      	followed by a macro argument name" a pedwarn, not an error.
      	Preserve the # in the output.  Suppress the warning if lang_asm.
      
      	* gcc.dg/dg.exp: Scan .S files as well as .c files.
      	* gcc.dg/20000510-1.S: New.
      
      From-SVN: r33841
      3ae1c615
  27. May 10, 2000
    • Zack Weinberg's avatar
      cpphash.h (struct hashnode): Use struct hack for name member. · fa557271
      Zack Weinberg authored
      	* cpphash.h (struct hashnode): Use struct hack for name
      	member.
      	* cpphash.c (struct hashdummy): New.
      	(eq_HASHNODE): Second argument is a hashdummy, not a HASHNODE.
      	(make_HASHNODE): No need to set ->name pointer.  Correct
      	setting of p.
      	(cpp_lookup): Make 'dummy' a struct hashdummy.  Tidy up a bit.
      
      From-SVN: r33828
      fa557271
  28. May 04, 2000
    • Zack Weinberg's avatar
      cpphash.h (U): New define, to correct type of string constants. · 12cf91fe
      Zack Weinberg authored
      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
      12cf91fe
  29. May 03, 2000
  30. May 02, 2000
    • Zack Weinberg's avatar
      cpphash.c (collect_params): Fix off-by-one error. · 1ce4a39d
      Zack Weinberg authored
      	* cpphash.c (collect_params): Fix off-by-one error.
      	(dump_hash_helper): Dump all four macro nodetypes.
      
      From-SVN: r33613
      1ce4a39d
    • Jakub Jelinek's avatar
      cpphash.c (trad_stringify): Adjust p after stringification as well. · 9900f597
      Jakub Jelinek authored
      	* cpphash.c (trad_stringify): Adjust p after stringification as
      	well.
      
      	* gcc.dg/cpp-tradstringify.c: New test.
      
      From-SVN: r33612
      9900f597
    • Zack Weinberg's avatar
      cpplib.h (CPP_POP, [...]): Delete. · c56c2073
      Zack Weinberg authored
      	* 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
      c56c2073
  31. May 01, 2000
    • Zack Weinberg's avatar
      cpphash.c (_cpp_make_hashnode): Rename make_HASHNODE, now static. · a7abcbbf
      Zack Weinberg authored
      	* cpphash.c (_cpp_make_hashnode): Rename make_HASHNODE, now
      	static.  Allocate the hashnode and its string in the same
      	block of memory.
      	(del_HASHNODE): Don't free h->name.
      	(_cpp_lookup): If there is no entry for this string, create
      	one, of type T_VOID.
      	(_cpp_lookup_slot): Delete.
      	* cpphash.h: Update prototypes.
      
      	* cpplex.c (maybe_macroexpand): Check for hp->type == T_VOID,
      	not hp == NULL.
      	* cpplib.c (do_define, do_undef, do_pragma_poison, do_assert,
      	do_unassert, cpp_defined): Use _cpp_lookup.  Don't create a
      	node here, just fill in the value field properly.  "Delete"
      	entries by setting the value field to T_VOID.  Check for
      	hp->type == T_VOID, not hp == NULL.
      
      	* Makefile.in (cpplib.o): Don't depend on $(HASHTAB_H).
      	* cpperror.c, cppexp.c, cpplex.c, cpplib.c:  Don't include
      	hashtab.h.
      
      From-SVN: r33581
      a7abcbbf
  32. Apr 30, 2000
    • Zack Weinberg's avatar
      cppfiles.c (redundant_include_p): Provide length of token to cpp_defined. · 638d694d
      Zack Weinberg authored
      	* 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
      638d694d
    • Zack Weinberg's avatar
      cpphash.h (enum node_type): Take out T_MCONST. · d2158690
      Zack Weinberg authored
      	* cpphash.h (enum node_type: Take out T_MCONST.
      	(union hashval): Move into struct hashnode.
      	(struct hashnode): Pack tighter.  Remove file, line, col
      	members.
      	* cpphash.c: Constify most of the macro-definition structures.
      	(struct definition): Replace by struct object_defn
      	and struct funct_defn.  Put file, line, column information
      	here.  All users updated to match.
      	(_cpp_create_definition, _cpp_macroexpand): Remove special
      	case for #define WORD OTHERWORD.
      	* cpplib.c (do_undef): Remove T_MCONST case.
      
      From-SVN: r33538
      d2158690
  33. Apr 29, 2000
    • Zack Weinberg's avatar
      cpphash.h: Move struct reflist, struct definition, and the DEFINITION typedef to cpphash.c. · 5cebbd8d
      Zack Weinberg authored
      	* cpphash.h: Move struct reflist, struct definition, and the
      	DEFINITION typedef to cpphash.c.  Use 'struct definition *' in
      	union hashval.  _cpp_free_definition takes a HASHNODE pointer.
      	* cpphash.c (_cpp_free_definition): Free data pointed to by
      	MCONST, XCONST, MACRO, and FMACRO nodes properly.
      	(_cpp_create_definition, del_HASHNODE): Just call
      	_cpp_free_definition to clear out a hashnode.
      	* cpplib.c (do_pragma_poison): Likewise.
      
      From-SVN: r33536
      5cebbd8d
Loading