1. 29 Aug, 2000 1 commit
    • zack's avatar
      * cpperror.c (print_file_and_line): If line is (unsigned int)-1, · a336277c
      zack authored
      	print just the filename.
      	* cpplex.c (_cpp_run_directive): Add additional argument, the
      	name to give the synthetic buffer.  This defaults to
      	translated "<command line>".
      	* cpplib.c (cpp_define, cpp_undef, cpp_assert, cpp_unassert):
      	Adjust to match.
      	(_cpp_define_builtin): New function.
      	* cppinit.c (initialize_builtins): Use _cpp_define_builtin.
      	* cpphash.h: Update prototypes.
      
      	* tradcpp.c (main): Process -D and -U simultaneously, in the
      	order they appeared on the command line.
      
      
      git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@36043 138bc75d-0d04-0410-961f-82ee72b054a4
      a336277c
  2. 23 Aug, 2000 1 commit
  3. 18 Aug, 2000 2 commits
  4. 17 Aug, 2000 1 commit
  5. 09 Aug, 2000 1 commit
    • zack's avatar
      * configure.in (--enable-c-cpplib): Uncomment. Use AC_DEFINE · 0653b94e
      zack authored
      	instead of extra_c_flags.
      	(--enable-c-mbchar): Use AC_DEFINE instead of extra_c_flags.
      	* configure: Regenerate.
      	* config.in: Regenerate.
      
      	* cpperror.c (cpp_type2name): New function.
      	* cpplex.c (lex_line): If we issued an error for an invalid
      	preprocessing directive, discard that logical line.
      	* cpplib.c (do_line): Call a hook function if the current file
      	is renamed by #line.
      	(do_ident): Pass the contents of the string, not the entire
      	token, to the callback function.
      	* cpplib.h (CPP_LAST_PUNCTUATOR): New #define.
      	(cb.rename_file): New hook function.
      	(cb.ident): Adjust prototype.
      	(cpp_type2name): Prototype.
      	* cppmacro.c (dump_macro_args): Correct precedence lossage.
      
      	* cppmain.c (cb_ident): Update for changed interface.
      	(cb_rename_file): New function.
      	(main): Set rename callback.
      
      
      git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@35593 138bc75d-0d04-0410-961f-82ee72b054a4
      0653b94e
  6. 04 Aug, 2000 1 commit
    • zack's avatar
      * cpplex.c (parse_name): Might have to glue a CPP_OTHER token · 71aa9da4
      zack authored
      	before the name.
      	(lex_line): Glue @ onto the beginning of identifiers and
      	string constants, in Objective-C mode.
      	(output_token, spell_token): Handle CPP_OSTRING.
      	(can_paste, maybe_paste_with_next): Handle pasting @ onto the
      	beginning of a NAME or a STRING, in objc mode.
      
      	* cpplib.c (get_define_node): Do not permit identifiers that
      	begin with @ to be #defined.
      	* cppmacro.c (CAN_PASTE_AFTER): Add CPP_OTHER.
      	* cpplib.h (TTYPE_TABLE): Add CPP_OSTRING.
      
      	* c-lang.c, objc/objc-act.c (build_objc_string): Delete.
      	* c-tree.h (build_objc_string): Delete prototype.
      	* objc/objc-tree.def: Delete OBJC_STRING_CST.
      	* c-lex.c (yylex): Use build_string for all three kinds of strings.
      
      	* gcc.dg/cpp/20000625-2.c: Don't expect a warning on line 4.
      
      
      git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@35470 138bc75d-0d04-0410-961f-82ee72b054a4
      71aa9da4
  7. 02 Aug, 2000 2 commits
    • zack's avatar
      * cppexp.c, cppinit.c, cpplex.c, cpplib.c, cppmacro.c, · e0a859f1
      zack authored
      	cppspec.c: Do not use 'legal' or 'illegal' in error messages
      	and comments.
      
      	* cppmain.c (cb_define, cb_undef): Don't generate any output
      	if not done_initializing.
      	* cpplex.c (maybe_paste_with_next): When the token after a ##
      	is an omitted rest argument, only delete the token before it
      	if that token is a comma.  Do not warn about bogus token
      	pastes for , ## rest_arg.
      
      	* cpp.texi: Update.
      	* cpp.1: Regenerate.
      
      	* gcc.dg/cpp/macsyntx.c: Fix error regexp.
      
      
      git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@35421 138bc75d-0d04-0410-961f-82ee72b054a4
      e0a859f1
    • zack's avatar
      * cpperror.c (v_message): Split into _cpp_begin_message and · 6cae2504
      zack authored
      	v_message macro.  All callers updated.
      	(_cpp_begin_message): Do inhibit_errors/inhibit_warnings
      	checks here.
      
      	* cppfiles.c (cpp_syshdr_flags): New function.
      	(read_include_file): Don't call cpp_output_tokens.  Call
      	enter_file hook.
      	* cppinit.c (dump_macros_helper): Moved to cppmain.c.
      	(cpp_reader_init): Don't initialize token_buffer.  Call
      	_cpp_init_internal_pragmas.
      	(cpp_cleanup): Don't clear token_buffer.
      	(cpp_start_read): Don't worry about output from -D processing.
      	Don't call cpp_output_tokens.
      	(cpp_finish): Don't dump macros here.  Don't call
      	cpp_output_tokens.
      	* cppmacro.c (_cpp_dump_definition): Rename
      	cpp_dump_definition.  Write directly to a FILE *.
      	(dump_funlike_macro): Delete.
      	(dump_macro_args): New.
      
      	* cpplex.c (TOKEN_LEN): Convert to inline function.
      	(_cpp_grow_token_buffer, safe_fwrite, cpp_output_tokens,
      	cpp_scan_line, _cpp_dump_list): Delete.
      	(cpp_printf, cpp_output_list): New.
      	(output_line_command): Don't worry about entering or leaving files.
      	(cpp_scan_buffer): Just output each token as we hit it.
      	(process_directive): Don't call cpp_output_tokens.
      	(_cpp_glue_header_name): Don't use token_buffer.
      	(output_token, dump_param_spelling): Write directly to a FILE *.
      
      	* cpplib.c (pass_thru_directive, dump_macro_name,
      	pragma_dispatch, do_pragma_gcc): Delete.
      	(do_define, do_undef, parse_include, do_line, do_ident, do_pragma,
      	do_pragma_poison, cpp_pop_buffer): Call the appropriate hook
      	functions.
      	(do_error, do_warning, pragma_dependency): Call
      	_cpp_begin_message, then cpp_output_list.
      	(cpp_register_pragma, cpp_register_pragma_space,
      	_cpp_init_internal_pragmas): New.
      	(do_pragma): Walk the pragmas table here.
      	(do_pragma_once, do_pragma_poison, do_pragma_system_header,
      	do_pragma_dependency): Return void.
      	(do_pragma_implementation): Moved to cppmain.c.
      
      	* cpplib.h: Update prototypes.
      	 (struct cpp_reader): Remove printer, token_buffer,
      	token_buffer_size, and limit.  Add struct cb, and pragmas.
      	(struct cpp_printer): Remove last_id and written.
      	(CPP_WRITTEN, CPP_PWRITTEN, CPP_SET_WRITTEN,
      	CPP_ADJUST_WRITTEN): Delete.
      	* cpphash.h: Update prototypes.
      	(ufputs): New wrapper.
      
      	* cppmain.c (cb_define, cb_undef, cb_include, cb_ident,
      	cb_enter_file, cb_leave_file, cb_def_pragma): New functions.
      	(main): Set up callbacks.  Register #pragma implementation.
      	Dump macros from here.
      
      
      git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@35415 138bc75d-0d04-0410-961f-82ee72b054a4
      6cae2504
  8. 25 Jul, 2000 1 commit
  9. 19 Jul, 2000 1 commit
    • zack's avatar
      * cpplib.h (TTYPE_TABLE): Move CPP_MIN and CPP_MAX into block · 31674461
      zack authored
      	of operators allowed in #if and having an _EQ variant.  Add
      	CPP_MIN_EQ, CPP_MAX_EQ, and CPP_DEFINED.
      	(cpp_token flags): Add NAMED_OP.
      	(enum node_type): Add T_OPERATOR.
      	(struct cpp_hashnode): Add code slot to value union.
      	* cpphash.h (spec_nodes): Remove n_defined.
      
      	* cpplex.c (lex_line): Convert T_OPERATOR nodes to their proper types.
      	(spell_token, can_paste, maybe_paste_with_next): Handle named operators.
      	(is_macro_disabled): Tweak error messages.
      
      	* cpplib.c (get_define_node): Disallow all named operators as
      	macro names.  Tweak error messages.
      	(_cpp_init_stacks): Don't set up spec_nodes->n_defined.
      
      	* cppinit.c (builtin_array): Add entries for the named operators.
      	* cppexp.c (lex): Check for CPP_DEFINED token.
      	(priority table): Add entries for CPP_MIN and CPP_MAX.
      	(_cpp_parse_expr): Handle CPP_MIN and CPP_MAX.
      
      testsuite:
      	* gcc.dg/cpp/directiv.c, gcc.dg/cpp/macsyntx.c,
      	gcc.dg/cpp/undef1.c: Tweak error regexps.
      
      
      git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@35137 138bc75d-0d04-0410-961f-82ee72b054a4
      31674461
  10. 18 Jul, 2000 2 commits
    • zack's avatar
      * cpplib.h (TTYPE_TABLE): Rearrange to use only two per-entry · 7e842f95
      zack authored
                macros, not five.
      
      	* cpphash.h (TOKEN_NAME): New macro.
      	(_cpp_spell_operator): Deleted.
      	(token_spellings): Now _cpp_token_spellings.
      
      	* cppexp.c: Use TOKEN_NAME or TYPE_NAME, not _cpp_spell_operator.
      	* cpplex.c: Use OP and TK macros when expanding the
      	TTYPE_TABLE.  Eliminate token_names.  For non-OPERATOR tokens,
      	store the stringification of the enumeration name (CPP_CHAR,
      	etc.) in the name slot of token_spellings.
      	Use TOKEN_NAME and/or TOKEN_SPELL, do not reference
      	token_spellings directly.
      	* cpplib.c: Use TOKEN_SPELL.
      
      	* cpplex.c (_cpp_push_token): If the token being pushed back
      	is the previous token in this context, just subtract one from
      	context->posn.
      	* cppmacro.c (save_expansion): Clear aux field when storing a
      	placemarker.
      
      	* gcc.dg/cpp/paste5.c: New test.
      	* gcc.dg/cpp/vararg1.c: New test.
      
      
      git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@35124 138bc75d-0d04-0410-961f-82ee72b054a4
      7e842f95
    • zack's avatar
      2000-02-17 Zack Weinberg <zack@wolery.cumb.org> · 69461e0d
      zack authored
      	* 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.
      
      
      git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@35113 138bc75d-0d04-0410-961f-82ee72b054a4
      69461e0d
  11. 15 Jul, 2000 1 commit
    • zack's avatar
      * cpphash.c (save_expansion): Clear PREV_WHITE on tokens · dfa5c7fa
      zack authored
      	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.
      
      
      git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@35052 138bc75d-0d04-0410-961f-82ee72b054a4
      dfa5c7fa
  12. 14 Jul, 2000 1 commit
  13. 13 Jul, 2000 1 commit
    • zack's avatar
      * cppexp.c, cpphash.c, cpphash.h, cppinit.c, cpplex.c, · 241e762e
      zack authored
      	cpplib.c, cpplib.h: Eradicate all traces of code dependent on
      	traditional, lang_chill, or lang_fortran.
      
      	* cppfiles.c: #undef strcmp to suppress warning about macros
      	used without arguments.
      	(_cpp_execute_include): Use f, not fname, in "No include path"
      	error.
      	(_cpp_pop_file_buffer): New function.
      	* cpplib.c: Don't include <sys/mman.h>.
      	(cpp_push_buffer): Set line_base and lineno in new buffer.
      	(cpp_pop_buffer): Use _cpp_pop_file_buffer.
      
      	* cpplex.c: Move all prototypes and structure declarations to the
      	top of the file.  Properly parenthesise some macro arguments.
      	(cpp_scan_line): New function.
      	(special_symbol [case T_INCLUDE_DEPTH]): Use pfile->include_depth,
      	don't need to walk up the stack counting.
      
      
      git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@35003 138bc75d-0d04-0410-961f-82ee72b054a4
      241e762e
  14. 11 Jul, 2000 1 commit
    • zack's avatar
      2000-07-11 Zack Weinberg <zack@wolery.cumb.org> · deb356cf
      zack authored
      	* 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.
      
      
      git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@34972 138bc75d-0d04-0410-961f-82ee72b054a4
      deb356cf
  15. 08 Jul, 2000 2 commits
    • zack's avatar
      * cpplib.h (struct cpp_name): Now struct cpp_string. · 76faa4c0
      zack authored
      	(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.
      
      
      git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@34926 138bc75d-0d04-0410-961f-82ee72b054a4
      76faa4c0
    • zack's avatar
      * cppexp.c: Update all code for new lexer interface. · c5ea33a8
      zack authored
      	(op_t, operator codes, struct token, tokentab2, op_to_str): Remove.
      	(struct suffix, vsuf_1, vsuf_2, vsuf_3, op_to_prio): New.
      	* cpplex.c (token_names): Trim leading CPP_ from names; make
      	the strings unsigned.
      	(_cpp_spell_operator): New.
      	(is_macro_disabled): Disable all macros if rescanning
      	preprocessed text.
      	(_cpp_get_directive_token): Remove.
      
      	* cppinit.c: Don't set no_macro_expand.
      	* cpplib.c (read_line_number, do_line): Check only for EOF,
      	not VSPACE.
      	* cpphash.h: Update prototypes.
      	* cpplib.h (CPP_VSPACE): Remove.
      	(struct cpp_reader): Remove no_macro_expand.
      
      testsuite:
      	* gcc.dg/cpp/19951227-1.c, gcc.dg/cpp/assert2.c,
      	gcc.dg/cpp/if-1.c, gcc.dg/cpp/if-4.c: Tweak error regexps.
      
      
      git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@34920 138bc75d-0d04-0410-961f-82ee72b054a4
      c5ea33a8
  16. 06 Jul, 2000 1 commit
  17. 05 Jul, 2000 2 commits
    • zack's avatar
      * cpplib.c (_cpp_parse_assertion): Fix buffer overrun. · 612817ca
      zack authored
      git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@34872 138bc75d-0d04-0410-961f-82ee72b054a4
      612817ca
    • zack's avatar
      toplevel: · f51c2148
      zack authored
      	* cpplex.c: Don't include sys/mman.h.
      	(cpp_push_buffer, cpp_pop_buffer): Moved to cpplib.c.
      
      	* cpplib.c: Include sys/mman.h and obstack.h.
      	(cpp_push_buffer): Moved from cpplex.c; allocate buffers on an
      	obstack.
      	(cpp_pop_buffer): Moved from cpplex.c; free buffers from an obstack.
      	(_cpp_unwind_if_stack): Now static, unwind_if_stack.  Don't
      	bother freeing if stack entries (they will be freed with their buffer).
      	(do_endif): Free if stack entries from the buffer obstack.
      	(push_conditional): Allocate if stack entries from the buffer obstack.
      
      	(find_answer): Rename to _cpp_find_answer.
      	(do_assert, do_unassert): Update.
      
      	* cpphash.h: Update prototypes.
      	(xobnew): New convenience macro.
      	* cpplib.h (struct cpp_reader): Add hash_ob and buffer_ob fields.
      	Update comments.
      	(struct cpp_hashnode): Remove disabled field.
      
      	* cppinit.c: Don't include hashtab.h or splay-tree.h.
      	(report_missing_guard): Moved to cppfiles.c.
      	(cpp_reader_init): Call cpp_init_stacks, cpp_init_macros,
      	cpp_init_includes.
      	(cpp_cleanup): Call cpp_cleanup_stacks, cpp_cleanup_macros,
      	cpp_cleanup_includes.  Don't destroy hashtab or
      	all_include_files here.
      	(cpp_finish): Use _cpp_report_missing_guards.
      
      	* cppfiles.c (report_missing_guard): Moved from cppinit.c.
      	(_cpp_init_include_table): Rename _cpp_init_includes.
      	(_cpp_cleanup_includes, _cpp_report_missing_guards): New.
      
      	* cppexp.c (parse_assertion): Update for new name of
      	find_answer.
      
      	* Makefile.in (cpplib.o, cpphash.o, cppinit.o): Update deps.
      
      	* cpplib.c (do_ident): s/VSPACE/EOF/
      
      testsuite:
      	* gcc.dg/cpp/ident.c: New test.
      
      
      git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@34870 138bc75d-0d04-0410-961f-82ee72b054a4
      f51c2148
  18. 04 Jul, 2000 1 commit
    • zack's avatar
      top level: · f80e83a9
      zack authored
      2000-07-03  Zack Weinberg  <zack@wolery.cumb.org>
      
      	* fix-header.c (struct partial_proto): Remove unnecessary fields.
      	(recognized_extern, recognized_function, read_scan_file):
      	Update for new scheme.
      	(check_protection): It's still a multiple include guard even
      	if it doesn't always trigger.
      	* scan-decls.c (skip_to_closing_brace, scan_decls): Update for
      	new scheme.
      	* scan.h: Declare struct cpp_token.  Update prototypes.
      
      2000-07-03  Neil Booth  <neilb@earthling.net>
      	    Zack Weinberg  <zack@wolery.cumb.org>
      
      	Complete overhaul of the lexer and macro expander.
      
      	* cpphash.c (object_defn, funct_defn, push_macro_expansion,
      	arg, arglist, argdata, reflist, collect_objlike_expansion,
      	collect_funlike_expansion, collect_params,
      	warn_trad_stringify, trad_stringify, duplicate_arg_p, add_pat,
      	unsafe_chars, macarg, compare_defs, special_symbol,
      	scan_arguments, stringify, funlike_macroexpand,
      	_cpp_quote_string, monthnames): Delete.
      	(cpp_lookup, _cpp_free_definition, dump_funlike_macro,
      	_cpp_create_definition, _cpp_dump_definition,
      	dump_hash_helper): Adjust.
      	(find_param, count_params, parse_define, var_args_str,
      	check_macro_redefinition, save_expansion): New.
      
      	* cpplex.c (skip_block_comment, skip_line_comment, parse_name,
              parse_string, output_line_command, trigraph_replace,
              lex_line, cpp_push_buffer, cpp_pop_buffer, cpp_output_tokens,
              cpp_scan_buffer_nooutput, cpp_scan_buffer, cpp_free_toklist,
              cpp_idcmp, _cpp_get_directive_token, _cpp_init_input_buffer,
      	_cpp_skip_rest_of_line): Modify.
      
              (maybe_macroexpand, skip_comment, copy_comment, skip_string,
      	find_position, null_warning, bump_column, expand_name_space,
      	pedantic_whitespace, _cpp_output_list, _cpp_slice_toklist,
      	_cpp_squeeze_toklist, _cpp_scan_until, _cpp_skip_hspace,
      	_cpp_parse_name, _cpp_lex_token, cpp_get_non_space_token,
      	_cpp_prescan): Delete.
      
      	(dump_param_spelling, process_directive, lex_next,
              is_macro_disabled, stringify_arg, expand_context_stack,
              output_token, make_string_token, alloc_number_token,
              special_symbol, duplicate_token, maybe_paste_with_next,
              can_paste, prevent_macro_expansion, restore_macro_expansion,
              get_temp_token, release_temp_tokens, quote_string,
              token_names, token_spellings, _cpp_expand_name_space,
              _cpp_glue_header_name, _cpp_reserve_name_space,
              digraph_spellings, trigraph_ok, skip_whitespace, save_comment,
              placemarker_token, eof_token, cpp_context, macro_args,
              get_raw_token, parse_arg, parse_args, save_token,
              push_arg_context, push_macro_context, pop_context,
              do_pop_context, free_macro_args, _cpp_get_line,
              _cpp_run_directive): New.
      
      	* cpplib.c (validate_else, parse_include, push_conditional,
      	pass_thru_directive, read_line_number, parse_ifdef,
      	detect_if_not_defined, _cpp_check_directive, do_define,
      	do_undef, do_include, do_import, do_include_next, do_error,
      	do_warning, do_ident, do_pragma, pragma_dispatch, gcc_pragmas,
      	top_pragmas, do_pragma_gcc, do_pragma_implementation,
      	do_pragma_poison, do_pragma_system_header,
      	do_pragma_dependency, do_sccs, do_ifdef, do_ifndef, do_else,
      	dl_elif, do_endif, _cpp_unwind_if_stack, do_assert,
      	do_unassert, cpp_define, cpp_undef, cpp_assert, cpp_unassert,
      	cpp_defined): Update for new scheme.
      	(strtoul_for_line, get_define_node, dump_macro_name,
      	_cpp_check_linemarker, _cpp_parse_assertion): New.
      	(_cpp_handle_directive, do_pragma_default): Delete.
      
      	* cpphash.h (struct predicate): Now struct answer.
      	(enum spell_type, struct token_spelling, struct directive,
      	directive_handler): New.
      	Update prototypes.  Remove unused macros.
      	* cpplib.h: Update prototypes.  Remove unused macros,
      	structure definitions, and fields.
      
      	* cpperror.c (print_containing_files, v_message): Adjust.
      	* cppexp.c (parse_assertion, lex, parse_escape,
      	_cpp_parse_expr): Adjust.
      	* cppfiles.c (open_include_file, _cpp_execute_include,
      	_cpp_compare_file_date, cpp_read_file, read_include_file):
      	Adjust.
      	* cppinit.c (dump_special_to_buffer): Delete.
      	(append_include_chain, merge_include_chains, cpp_reader_init,
      	cpp_cleanup, initialize_builtins, builtin_array, cpp_start_read,
      	cpp_finish, handle_option, print_help): Adjust.
      	* cppmain.c (main): Adjust.
      
      testsuite:
      2000-07-03  Zack Weinberg  <zack@wolery.cumb.org>
      
      	* testsuite/gcc.dg/cpp/19951025-1.c: Adjust regexps.
      	* testsuite/gcc.dg/cpp/19990703-1.c: Likewise.
      	* testsuite/gcc.dg/cpp/20000625-1.c: Likewise.
      	* testsuite/gcc.dg/cpp/20000625-2.c: Likewise.
      
      	* testsuite/gcc.dg/cpp/macro1.c,
      	testsuite/gcc.dg/cpp/paste1.c, testsuite/gcc.dg/cpp/paste2.c,
      	testsuite/gcc.dg/cpp/paste3.c, testsuite/gcc.dg/cpp/paste4.c,
      	testsuite/gcc.dg/cpp/strify1.c,
      	testsuite/gcc.dg/cpp/strify2.c: New tests.
      
      
      git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@34859 138bc75d-0d04-0410-961f-82ee72b054a4
      f80e83a9
  19. 30 Jun, 2000 1 commit
    • nathan's avatar
      * cpp.texi: Document #pragma GCC dependency · e485814b
      nathan authored
      	* cppfiles.c (open_include_file): Set date to unknown.
      	(_cpp_compare_file_date): New function.
      	(read_include_file): Set file date.
      	* cpphash.h (struct include_file): Add date member.
      	(_cpp_compare_file_date): Prototype.
      	* cpplib.c (parse_include): Add trail parameter. Adjust.
      	(do_include): Adjust parse_include call.
      	(do_import): Likewise.
      	(do_include_next): Likewise.
      	(gcc_pragmas): Add dependency pragma.
      	(do_pragma_dependancy): New pragma.
      
      
      git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@34808 138bc75d-0d04-0410-961f-82ee72b054a4
      e485814b
  20. 23 Jun, 2000 1 commit
  21. 21 Jun, 2000 2 commits
    • zack's avatar
      * cppfiles.c (cpp_make_system_header): New function. · 6af24d0a
      zack authored
      	* cpplib.h: Prototype it.
      	* cpplib.c (do_line, do_pragma_system_header): Use it.
      	* fix-header.c (read_scan_file): Use it.
      
      	* fix-header.c (check_macro_names): Cast second arg of
      	cpp_defined to const unsigned char *.
      	(read_scan_file): Make getchar_call const unsigned char.
      
      
      git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@34641 138bc75d-0d04-0410-961f-82ee72b054a4
      6af24d0a
    • zack's avatar
      * cppfiles.c: Include splay-tree.h, not hashtab.h. · c95d8aaa
      zack authored
      	(redundant_include_p, make_IHASH, hash_IHASH, eq_IHASH): Delete.
      	(destroy_include_file_node): New.
      	(_cpp_init_include_hash): Rename _cpp_init_include_table.
      	Create a splay tree, not a hash table.
      	(open_include_file): Look up the path in the include table,
      	do the multiple include optimization here, etc.
      	(cpp_included): Walk the path.
      	(find_include_file): Just walk the path calling
      	open_include_file, or call it directly for an absolute path.
      	(_cpp_fake_ihash): Rename _cpp_fake_include and update for new
      	scheme.
      	(read_include_file): Update for new scheme.  Don't close the
      	file unless reading fails.
      	(_cpp_execute_include, cpp_read_file): Tweak for new scheme.
      
      	* cpphash.h (struct ihash, NEVER_REINCLUDE): Delete.
      	(struct include_file): New.
      	(NEVER_REREAD, DO_NOT_REREAD, CPP_IN_SYSTEM_HEADER): New
      	macros.
      	(CPP_PEDANTIC, CPP_WTRADITIONAL): Update.
      	Update prototypes.
      
      	* cppinit.c: Include splay-tree.h.
      	(cpp_reader_init, cpp_cleanup): Update.
      
      	* cpplib.h (struct cpp_buffer): Change ihash field to
      	'struct include_file *inc'.  Remove system_header_p.
      	(struct cpp_reader): Change all_include_files to a
      	struct splay_tree_s *.
      
      	* cpplex.c: Update all references to cpp_buffer->ihash and/or
      	cpp_buffer->system_header_p.
      	(cpp_pop_buffer): Close file here, only if DO_NOT_REREAD.
      
      
      git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@34636 138bc75d-0d04-0410-961f-82ee72b054a4
      c95d8aaa
  22. 13 Jun, 2000 1 commit
  23. 07 Jun, 2000 1 commit
  24. 01 Jun, 2000 1 commit
    • zack's avatar
      2000-06-01 Zack Weinberg <zack@wolery.cumb.org> · 5b1b3ffb
      zack authored
      	* cpplex.c (maybe_macroexpand): Use CPP_WTRADITIONAL.  Improve
      	error message.
      	* cpplib.c (parse_include): Remove support for VAX-C
      	"#include starlet" misfeature.
      
      	* gcc.dg/cpp-tradwarn2.c: Update egrep pattern.
      
      2000-05-31 Laurynas Biveinis <lauras@softhome.net>
      
      	* cppfiles.c: conditionally define O_BINARY.
      	(open_include_file): pass O_BINARY to open().
      
      
      git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@34344 138bc75d-0d04-0410-961f-82ee72b054a4
      5b1b3ffb
  25. 30 May, 2000 1 commit
  26. 29 May, 2000 1 commit
    • zack's avatar
      * cpplib.h (cpp_reader): Remove if_stack. Change · c4357c92
      zack authored
      	potential_control_macro to a cpp_hashnode *.  Add skipping flag.
      	* cpphash.h (struct ihash): Change control_macro to a
      	cpp_hashnode * and shorten name to cmacro.
      	Add NEVER_REINCLUDE constant.
      
      	* cppfiles.c (redundant_include_p): Drop cpp_reader argument.
      	Examine the cmacro node directly, no need to call cpp_defined.
      	(_cpp_execute_include, read_include_file): Set cmacro to
      	NEVER_REINCLUDE, not U"".
      	* cpplex.c (cpp_push_buffer): Don't set new->if_stack.
      	(cpp_get_token): If pfile->skipping is true, discard text and
      	keep scanning until we hit a directive; don't expand macros.
      
      	* cpplib.c (struct if_stack): Remove if_succeeded, add
      	was_skipping. Change control_macro to a cpp_hashnode * and
      	shorten name to cmacro.  Remove typedef IF_STACK.
      	(parse_ifdef), detect_if_not_defined): Return a cpp_hashnode *.
      	(conditional_skip, skip_if_group,
      	consider_directive_while_skipping): Delete.
      	(push_conditional): New.
      	(_cpp_handle_directive): Don't process directives other than
      	conditionals if we are skipping.
      
      	(do_ifdef, do_ifndef, do_if, do_else, do_elif, do_endif):
      	Update to new scheme.
      	(validate_else): Skip rest of line here, unconditionally.
      	(_cpp_unwind_if_stack): The stack is per-buffer.  Force
      	pfile->skipping off.
      
      	(all): Remove `scare quotes' from error messages.
      
      	* gcc.dg/cpp-mi.c: Add another case, cpp-mix.h, where the
      	guard macro is already defined when the header is first
      	included.
      	* gcc.dg/cpp-mix.h: New file.
      	* gcc.dg/endif-label.c: Update patterns to match compiler.
      
      	* g++.brendan/complex1.C: Declare abort.
      	* g++.law/refs4.C: Remove XFAIL.
      	* g++.oliva/expr2.C: Declare abort and exit.
      
      
      git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@34253 138bc75d-0d04-0410-961f-82ee72b054a4
      c4357c92
  27. 28 May, 2000 1 commit
    • zack's avatar
      * cppfiles.c: Read files in, using mmap if possible, then · c4abf88d
      zack authored
      	prescan them separately.
      	(read_file, read_with_read): New functions.
      	* cpplex.c: Don't define UCHAR_MAX.
      	(_cpp_read_and_prescan): Rename to _cpp_prescan.  Don't read
      	the file here.
      
      	* cppinit.c (handle_option): Automatically define __cplusplus,
      	__OBJC__, __ASEEMBLER__, _LANGUAGE_FORTRAN here when we see
      	the respective -lang switch.
      
      	* cpphash.h (enum node_type, struct hashnode, _cpp_lookup
      	prototype): Move to...
      	* cpplib.h: ... here.  Rename struct hashnode to struct
      	cpp_hashnode and give it a typedef.  Rename _cpp_lookup to
      	cpp_lookup.  Add 'fe_value' slot, a union tree_node *.
      
      
      git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@34228 138bc75d-0d04-0410-961f-82ee72b054a4
      c4abf88d
  28. 27 May, 2000 1 commit
    • neil's avatar
      * cppexp.c (parse_assertion): Supply extra argument to · d2efb5ed
      neil authored
      	_cpp_init_toklist.
      	* cpplib.c (do_assert, do_unassert): Similarly.
      	* cpphash.h (_cpp_init_toklist) Update.
      	(_cpp_expand_token_space): New.
      	(DUMMY_TOKEN, NO_DUMMY_TOKEN): New.
      	* cpplex.c (_cpp_init_toklist): New argument.
      	(parse_string2): New argument multiline_ok.
      	(spell_token): Take a const cpp_token *.
      	(INIT_NAME): Replace with INIT_TOKEN_NAME.  Update tokens_used.
      	(SPELL_ macros): Replace with enum.
      	(expand_token_space): Replace with _cpp_expand_token_space.
      	Take COUNT argument.
      	(IS_DIRECTIVE): Update.
      	(_cpp_lex_line): Update token structure before parsing number.
      	Don't assume start at beginning of token list.
      	(save_comment): Use INIT_TOKEN_NAME.
      
      
      git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@34214 138bc75d-0d04-0410-961f-82ee72b054a4
      d2efb5ed
  29. 19 May, 2000 1 commit
  30. 18 May, 2000 1 commit
    • zack's avatar
      * cppexp.c (parse_assertion): New. · bce8e0c0
      zack authored
      	(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.
      
      
      git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@33984 138bc75d-0d04-0410-961f-82ee72b054a4
      bce8e0c0
  31. 17 May, 2000 1 commit
  32. 15 May, 2000 1 commit
  33. 14 May, 2000 1 commit
    • neil's avatar
      * cpphash.c (trad_stringify, warn_trad_stringify, · e916a356
      neil authored
      	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.
      
      
      git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@33901 138bc75d-0d04-0410-961f-82ee72b054a4
      e916a356
  34. 04 May, 2000 1 commit
    • zack's avatar
      gcc: · e057cf7c
      zack authored
      	* cpphash.h (U): New define, to correct type of string constants.
      	(ustrcmp, ustrncmp, ustrlen, uxstrdup, ustrchr): New wrapper
      	routines, to do casts when passing unsigned strings to libc.
      	* cppexp.c, cppfiles.c, cpphash.c, cppinit.c, cpplib.c: Use them.
      
      	* cppfiles.c (_cpp_execute_include): Make filename an U_CHAR *.
      	* cpphash.c (_cpp_quote_string): Make string an U_CHAR *.
      	* cppinit.c (dump_special_to_buffer): Make macro name an U_CHAR *.
      	* cpplex.c (parse_ifdef, parse_include, validate_else): Make
      	second argument an U_CHAR *.
      
      	* cppinit.c (builtin_array): Make name and value U_CHAR *, add
      	length field, clean up initializer.
      	(ISTABLE): Add __extension__ to designated-
      	initializers version.
      	* cpplex.c (CHARTAB): Likewise.
      
      	* mbchar.c: Add dummy external declaration to the !MULTIBYTE_CHARS
      	case so the file won't be empty.
      
      include:
      	* symcat.h: Remove #endif label.
      
      
      git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@33657 138bc75d-0d04-0410-961f-82ee72b054a4
      e057cf7c