1. 04 Sep, 2000 1 commit
  2. 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
  3. 28 Aug, 2000 1 commit
  4. 25 Aug, 2000 1 commit
  5. 23 Aug, 2000 1 commit
  6. 20 Aug, 2000 1 commit
    • zack's avatar
      2000-08-20 Zack Weinberg <zack@wolery.cumb.org> · bad6bf53
      zack authored
      	* cppinit.c (cpp_init): Set global flag when called.
      	(cpp_reader_init): Bomb out if cpp_init hasn't been called.
      
      Sun Aug 20 01:41:35 MSD 2000 Dennis Chernoivanov <cdi@sparc.spb.su>
      
              * cpplex.c (cpp_scan_buffer): Move `output_line_command' just
              before `process_directive' so that newlines won't be missed
              for directives.
              (cpp_printf): Increment `print->lineno' when newline is emitted.
      
              * cppmain.c (cb_ident): Likewise.
              (cb_define): Likewise.
              (cb_undef): Likewise.
              (cb_include): Likewise.
              (cb_def_pragma): Likewise.
              (dump_macros_helper): Likewise.
      
      	* gcc.dg/cpp/pragma-1.c: New test.
      	* gcc.dg/cpp/pragma-2.c: New test.
      
      
      git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@35825 138bc75d-0d04-0410-961f-82ee72b054a4
      bad6bf53
  7. 18 Aug, 2000 1 commit
    • neil's avatar
      * cpphash.h: Use HAVE_DESIGNATED_INITIALIZERS. · b3954366
      neil authored
      	(_cpp_trigraph_map): Declaration moved from cpplex.c
      
      	* cppinit.c: Define _cpp_trigraph_map.  Use UCHAR_MAX + 1
      	instead	of 256.  Use consistent test for designated initializers.
      	(cpp_init): Initialize trigraph_map.
      	(initialize_standard_includes, parse_option):  Use memcmp
      	instead of strncmp.
      
      	* cpplex.c (init_trigraph_map): Remove.
      	(trigraph_ok, trigraph_replace, lex_line): Refer to
      	_cpp_trigraph_map.
      
      	* cpplib.c (str_match, WARNING, ERROR, ICE): Delete.
      	(do_unassert): Remove unused "next" local.
      
      	* system.h (HAVE_DESIGNATED_INITIALIZERS): New prototype.
      
      
      git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@35789 138bc75d-0d04-0410-961f-82ee72b054a4
      b3954366
  8. 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
  9. 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
  10. 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
  11. 31 Jul, 2000 1 commit
    • zack's avatar
      2000-07-31 Jakub Jelinek <jakub@redhat.com> · c2cce424
      zack authored
      	* cpplex.c (_cpp_get_line): If index is 0, return line 0 col 0.
      	(_cpp_get_token): Don't macro expand a just pasted token if it
      	was pasted at no_expand_level.
      
      	* testsuite/gcc.dg/cpp/paste7.c: New test.
      
      2000-07-31  Zack Weinberg  <zack@wolery.cumb.org>
      
      	* cppmacro.c (find_param, count_params, save_expansion):
      	Permit 'defined' as a macro parameter name.
      
      
      git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@35394 138bc75d-0d04-0410-961f-82ee72b054a4
      c2cce424
  12. 24 Jul, 2000 1 commit
  13. 20 Jul, 2000 1 commit
    • zack's avatar
      * cppmacro.c (CAN_PASTE_AFTER): New macro. · 35677230
      zack authored
      	(count_params): Don't set GNU_REST_ARGS on anything.
      	(save_expansion): Set PASTE_LEFT only on tokens for which
      	CAN_PASTE_AFTER is true, or which are named operators.
      
      	* cpplex.c (parse_args): Distinguish between a rest argument
      	given one empty argument, and a rest argument given zero arguments.
      	(maybe_paste_with_next): Look for VOID_REST tag, and trigger
      	deletion of previous token based on that.
      	(get_raw_token): Flatten some control structure.
      
      	* cpplib.h (CPP_LAST_EQ): Correct.
      	(VOID_REST): New token flag.
      	(GNU_REST_ARGS): Delete.
      
      	* gcc.dg/cpp/20000625-2.c, gcc.dg/cpp/macsyntx.c: Update error
      	regexps.
      	* gcc.dg/cpp/paste6.c: New test.
      
      
      git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@35146 138bc75d-0d04-0410-961f-82ee72b054a4
      35677230
  14. 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
  15. 18 Jul, 2000 3 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
    • jakub's avatar
      * cpplex.c (cpp_scan_buffer): Output line command even at the stop · e9d42dd4
      jakub authored
      	buffer, provided it is not NULL.
      
      
      git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@35123 138bc75d-0d04-0410-961f-82ee72b054a4
      e9d42dd4
    • 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
  16. 16 Jul, 2000 1 commit
  17. 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
  18. 13 Jul, 2000 2 commits
    • neil's avatar
      * cpplex.c (adjust_column): New funcion. · b86584f6
      neil authored
      	(skip_whitespace): Use it.
      	(skip_block_comment): Use it, and warn about /*/* with
      	-Wcomments.
      
      
      git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@35026 138bc75d-0d04-0410-961f-82ee72b054a4
      b86584f6
    • 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
  19. 12 Jul, 2000 3 commits
  20. 11 Jul, 2000 3 commits
    • 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
    • ghazi's avatar
      * cpplex.c (T, I, S, C, N): Avoid non-constant initializers. · 5e93e9fe
      ghazi authored
      git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@34959 138bc75d-0d04-0410-961f-82ee72b054a4
      5e93e9fe
    • neil's avatar
      * cppinit.c: (cpp_reader_init): Allow digraphs by default. · 27fdc0b6
      neil authored
      	(handle_option): Set digraphs according to standard.
      	Merge OPT_lang_c89 handler with OPT_std_c89.
      
      	* cpplex.c: (lex_line, can_paste): Honour digraphs in
      	accordance with	the digraphs flag.
      
      	* cpplib.h: (struct cpp_options): New option digraphs.
      
      
      git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@34956 138bc75d-0d04-0410-961f-82ee72b054a4
      27fdc0b6
  21. 09 Jul, 2000 1 commit
    • neil's avatar
      * cpphash.h: ISvspace, is_vspace, is_nvspace: New. · 78719282
      neil authored
      	IShspace, ISspace: Update.
      
      	* cppinit.c: ISTABLE: Update.
      	V: New.
      
      	* cpplex.c (IS_HSPACE, S_NEWLINE): Remove.
      	(IS_DIRECTIVE): Rename KNOWN_DIRECTIVE.
      	(skip_block_comment, skip_line_comment,	parse_string,
      	lex_line): Use is_vspace rather than IS_NEWLINE.
      	(skip_whitespace, lex_line): Clean up to use is_nvspace.
      	(lex_line): Use KNOWN_DIRECTIVE.  Any kind of directive
      	gets a BOL flag.
      	(lex_next): Unconditionally stop if within a directive.
      	Treat directives within macro invocations as directives
      	(after parse_args emits error), not as the argument.
      
      	* testsuite/gcc.dg/cpp/directiv.c: New tests.
      	* testsuite/gcc.dg/cpp/undef1.c: Update.
      
      
      git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@34933 138bc75d-0d04-0410-961f-82ee72b054a4
      78719282
  22. 08 Jul, 2000 3 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
    • neil's avatar
      * cpphash.c (is__va_args__): New function. · 57ba19ba
      neil authored
      	(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.
      
      
      git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@34919 138bc75d-0d04-0410-961f-82ee72b054a4
      57ba19ba
  23. 07 Jul, 2000 1 commit
  24. 05 Jul, 2000 1 commit
    • zack's avatar
      toplevel: · f51c2148
      zack authored
      	* cpplex.c: Don't include sys/mman.h.
      	(cpp_push_buffer, cpp_pop_buffer): Moved to cpplib.c.
      
      	* cpplib.c: Include sys/mman.h and obstack.h.
      	(cpp_push_buffer): Moved from cpplex.c; allocate buffers on an
      	obstack.
      	(cpp_pop_buffer): Moved from cpplex.c; free buffers from an obstack.
      	(_cpp_unwind_if_stack): Now static, unwind_if_stack.  Don't
      	bother freeing if stack entries (they will be freed with their buffer).
      	(do_endif): Free if stack entries from the buffer obstack.
      	(push_conditional): Allocate if stack entries from the buffer obstack.
      
      	(find_answer): Rename to _cpp_find_answer.
      	(do_assert, do_unassert): Update.
      
      	* cpphash.h: Update prototypes.
      	(xobnew): New convenience macro.
      	* cpplib.h (struct cpp_reader): Add hash_ob and buffer_ob fields.
      	Update comments.
      	(struct cpp_hashnode): Remove disabled field.
      
      	* cppinit.c: Don't include hashtab.h or splay-tree.h.
      	(report_missing_guard): Moved to cppfiles.c.
      	(cpp_reader_init): Call cpp_init_stacks, cpp_init_macros,
      	cpp_init_includes.
      	(cpp_cleanup): Call cpp_cleanup_stacks, cpp_cleanup_macros,
      	cpp_cleanup_includes.  Don't destroy hashtab or
      	all_include_files here.
      	(cpp_finish): Use _cpp_report_missing_guards.
      
      	* cppfiles.c (report_missing_guard): Moved from cppinit.c.
      	(_cpp_init_include_table): Rename _cpp_init_includes.
      	(_cpp_cleanup_includes, _cpp_report_missing_guards): New.
      
      	* cppexp.c (parse_assertion): Update for new name of
      	find_answer.
      
      	* Makefile.in (cpplib.o, cpphash.o, cppinit.o): Update deps.
      
      	* cpplib.c (do_ident): s/VSPACE/EOF/
      
      testsuite:
      	* gcc.dg/cpp/ident.c: New test.
      
      
      git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@34870 138bc75d-0d04-0410-961f-82ee72b054a4
      f51c2148
  25. 04 Jul, 2000 2 commits
    • neil's avatar
      * cpplex.c: Fix trigraph replacement within strings. · ba064df2
      neil authored
      	* gcc.dg/cpp/lexident.c, gcc.dg/cpp/lexnum.c,
      	  gcc.dg/cpp/lexstrng.c: New tests.
      
      
      git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@34868 138bc75d-0d04-0410-961f-82ee72b054a4
      ba064df2
    • 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
  26. 02 Jul, 2000 1 commit
    • jakub's avatar
      * cpplib.h (struct cpp_reader): New field include_depth. · 7609e3aa
      jakub authored
      	(struct cpp_printer): Rename last_bsd to last_id.
      	* cppfiles.c (read_include_file): Bump include_depth.
      	* cpplex.c (cpp_pop_buffer): Decrement include_depth.
      	(output_line_command): Output correct #line if a header
      	is including itself and is not protected against multiple inclusion.
      	Use include_depth instead of buffer_stack_depth, last_id instead of
      	last_bsd.
      	* cppinit.c (cpp_start_read): Initialize last_id instead of
      	last_bsd.
      
      
      git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@34831 138bc75d-0d04-0410-961f-82ee72b054a4
      7609e3aa
  27. 28 Jun, 2000 2 commits
  28. 21 Jun, 2000 1 commit
    • 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