Skip to content
Snippets Groups Projects
  1. Oct 02, 2001
    • Neil Booth's avatar
      cpphash.h: Update comments. · 644eddaa
      Neil Booth authored
      	* cpphash.h: Update comments.
      	(cpp_context): Update.
      	(spec_nodes): Remove n__Pragma.
      	* cppinit.c (cpp_create_reader): Update.
      	(builtin_array): Add _Pragma.
      	* cpplib.h: Update comments.
      	(NODE_DISABLED, BT_PRAGMA): New.
      	(cpp_start_lookahead, cpp_stop_lookahead): Remove prototypes.
      	* cppmacro.c (struct cpp_macro): Remove disabled.
      	(builtin_macro): Return int, handle _Pragma, push the new token
      	on the context stack.
      	(funlike_invocation_p): Unconstify, update.
      	(enter_macro_context): Handle builtins here.
      	(replace_args, push_token_context, push_ptoken_context):
      	Update for prototype changes.
      	(_cpp_pop_context): Update.
      	(cpp_get_token): Don't handle buitins, nor _Pragma here.
      	(cpp_sys_macro_p): Update.
      	(_cpp_free_definition): Clear disabled flag.
      	(_cpp_create_definition): Upate.
      	* cppmain.c: Update comments.
      
      From-SVN: r45948
      644eddaa
  2. Sep 30, 2001
    • Neil Booth's avatar
      cpphash.h (POOL_ALIGN, [...]): Remove. · 8c3b2693
      Neil Booth authored
      	* cpphash.h (POOL_ALIGN, POOL_FRONT, POOL_LIMIT, POOL_BASE,
      	POOL_SIZE, POOL_ROOM, POOL_COMMIT, struct cpp_chunk,
      	struct cpp_pool, _cpp_init_pool, _cpp_free_pool, _cpp_pool_reserve,
      	_cpp_pool_alloc, _cpp_next_chunk): Remove.
      	(_cpp_extend_buff, BUFF_ROOM): Update.
      	(_cpp_append_extend_buff): New.
      	(struct cpp_reader): Remove macro_pool, add a_buff.
      	* cppinit.c (cpp_create_reader): Initialize a_buff, instead of
      	macro_pool.
      	(cpp_destroy): Free a_buff instead of macro_pool.
      	* cpplex.c (new_chunk, chunk_suitable, _cpp_next_chunk,
      	new_chunk, _cpp_init_pool, _cpp_free_pool, _cpp_pool_reserve,
      	_cpp_pool_alloc, ): Remove.
      	(parse_number, parse_string): Update use of _cpp_extend_buff.
      	(_cpp_extend_buff): Update.
      	(_cpp_append_extend_buff, cpp_aligned_alloc): New.
      	* cpplib.c (glue_header_name, parse_answer):
      	Update use of _cpp_extend_buff.
      	(cpp_register_pragma, cpp_register_pragma_space): Use
      	_cpp_aligned_alloc.
      	(do_assert, do_unassert): Check for EOL, update.
      	* cppmacro.c (stringify_arg, collect_args): Update to use
      	_cpp_extend_buff and _cpp_append_extend_buff.
      	(save_parameter, parse_params, alloc_expansion_token,
      	_cpp_create_definition): Rework memory management.
      
      	* gcc.dg/cpp/redef2.c: Add test.
      
      From-SVN: r45899
      8c3b2693
  3. Sep 28, 2001
    • Neil Booth's avatar
      cpphash.h (struct cpp_buff): Make unsigned. · ece54d54
      Neil Booth authored
      	* cpphash.h (struct cpp_buff): Make unsigned.
      	(_cpp_get_buff): Take length of size_t.
      	(_cpp_unaligned_alloc): New.
      	(BUFF_ROOM, BUFF_FRONT, BUFF_LIMIT): New.
      	(struct cpp_reader): Remove ident_pool.  Add u_buff.
      	* cppinit.c (cpp_create_reader): Initialize u_buff, not ident_pool.
      	(cpp_destroy): Destroy u_buff, not ident_pool.
      	* cpplex.c (parse_number, parse_string, save_comment,
      	cpp_token_as_text): Update to use the unaligned buffer.
      	(new_buff): Make unsigned.
      	(_cpp_unaligned_alloc): New.
      	* cpplib.c (glue_header_name): Update to use the unaligned buffer.
      	* cppmacro.c (new_number_token, builtin_macro, stringify_arg):
      	Similarly.
      	(collect_args): Make unsigned.
      
      From-SVN: r45858
      ece54d54
  4. Sep 26, 2001
    • Neil Booth's avatar
      cpphash.h (struct cpp_pool): Remove locks and locked. · 1e013d2e
      Neil Booth authored
      	* cpphash.h (struct cpp_pool): Remove locks and locked.
      	(struct cpp_context): Add member buff.
      	(struct cpp_reader): Remove member argument_pool.
      	(_cpp_lock_pool, _cpp_unlock_pool): Remove.
      	* cppinit.c (cpp_create_reader, cpp_destroy): Argument_pool is dead.
      	* cpplex.c (chunk_suitable): Remove pool argument.
      	(MIN_BUFF_SIZE, BUFF_SIZE_UPPER_BOUND, EXTENDED_BUFF_SIZE): New.
      	(new_buff, _cpp_extend_buff): Update.
      	(_cpp_get_buff): Fix silly pointer bug.  Be more selective about
      	which buffer is returned.
      	(_cpp_next_chunk, _cpp_init_pool): Pool locking removed.
      	(_cpp_lock_pool, _cpp_unlock_pool): Remove.
      	* cppmacro.c (lock_pools, unlock_pools): Remove.
      	(push_ptoken_context): Take a _cpp_buff.
      	(enter_macro_context): Pool locking removed.
      	(replace_args): Use a _cpp_buff for the replacement list with
      	arguments replaced.
      	(push_token_context): Clear buff.
      	(expand_arg): Use _cpp_pop_context.
      	(_cpp_pop_context): Free a context's buffer, if any.
      
      From-SVN: r45833
      1e013d2e
    • Neil Booth's avatar
      cpphash.h (struct _cpp_buff, [...]): New. · b8af0ca5
      Neil Booth authored
      	* cpphash.h (struct _cpp_buff, _cpp_get_buff, _cpp_release_buff,
      	_cpp_extend_buff, _cpp_free_buff): New.
      	(struct cpp_reader): New member free_buffs.
      	* cppinit.c (cpp_destroy): Free buffers.
      	* cpplex.c (new_buff, _cpp_release_buff, _cpp_get_buff,
      	_cpp_extend_buff, _cpp_free_buff): New.
      	* cpplib.h (struct cpp_options): Remove unused member.
      	* cppmacro.c (collect_args): New.  Combines the old parse_arg
      	and parse_args.  Use _cpp_buff for memory allocation.
      	(funlike_invocation_p, replace_args): Update.
      
      From-SVN: r45827
      b8af0ca5
  5. Sep 24, 2001
    • Neil Booth's avatar
      c-lex.c (cb_def_pragma): Update. · 4ed5bcfb
      Neil Booth authored
      	* c-lex.c (cb_def_pragma): Update.
      	(c_lex): Update, and skip padding.
      	* cppexp.c (lex, parse_defined): Update, remove unused variable.
      	* cpphash.h (struct toklist): Delete.
      	(union utoken): New.
      	(struct cpp_context): Update.
      	(struct cpp_reader): New members eof, avoid_paste.
      	(_cpp_temp_token): New.
      	* cppinit.c (cpp_create_reader): Update.
      	* cpplex.c (_cpp_temp_token): New.
      	(_cpp_lex_direct): Add PREV_WHITE when parsing args.
      	(cpp_output_token): Don't print leading whitespace.
      	(cpp_output_line): Update.
      	* cpplib.c (glue_header_name, parse_include, get__Pragma_string,
      	do_include_common, do_line, do_ident, do_pragma,
      	do_pragma_dependency, _cpp_do__Pragma, parse_answer,
      	parse_assertion): Update.
      	(get_token_no_padding): New.
      	* cpplib.h (CPP_PADDING): New.
      	(AVOID_LPASTE): Delete.
      	(struct cpp_token): New union member source.
      	(cpp_get_token): Update.
      	* cppmacro.c (macro_arg): Convert to use pointers to const tokens.
      	(builtin_macro, paste_all_tokens, paste_tokens, funlike_invocation_p,
      	replace_args, quote_string, stringify_arg, parse_arg, next_context,
      	enter_macro_context, expand_arg, _cpp_pop_context, cpp_scan_nooutput,
      	_cpp_backup_tokens, _cpp_create_definition): Update.
      	(push_arg_context): Delete.
      	(padding_token, push_token_context, push_ptoken_context): New.
      	(make_string_token, make_number_token): Update, rename.
      	(cpp_get_token): Update to handle tokens as pointers to const,
      	and insert padding appropriately.
      	* cppmain.c (struct printer): New member prev.
      	(check_multiline_token): Constify.
      	(do_preprocessing, cb_line_change): Update.
      	(scan_translation_unit): Update to handle spacing.
      	* scan-decls.c (get_a_token): New.
      	(skip_to_closing_brace, scan_decls): Update.
      	* fix-header.c (read_scan_file): Update.
      
      	* doc/cpp.texi: Update.
      
      	* gcc.dg/cpp/macro10.c: New test.
      	* gcc.dg/cpp/strify3.c: New test.
      	* gcc.dg/cpp/spacing1.c: Add tests.
      	* gcc.dg/cpp/19990703-1.c: Remove bogus test.
      	* gcc.dg/cpp/20000625-2.c: Fudge to pass.
      
      From-SVN: r45793
      4ed5bcfb
  6. Sep 15, 2001
    • Neil Booth's avatar
      cpphash.h (struct cpp_reader): Remove lexer_pos, directive_pos. · 50410426
      Neil Booth authored
      	* cpphash.h (struct cpp_reader): Remove lexer_pos, directive_pos.
      	Split mlstring_pos into mls_line and mls_col.
      	* cppinit.c (cpp_create_reader): Initialize line to 1.
      	(cpp_destroy): Free tokenruns.
      	(push_include): Don't update lexer_pos.
      	* cpplex.c (unterminated, parse_string): Update.
      	(lex_token): Don't update lexer_pos, update.
      	* cpplib.c (if_stack): Save line instead of line + col.
      	(start_directive, _cpp_do__Pragma, do_else, do_elif,
      	push_conditional, _cpp_pop_buffer): Update.
      	* cppmacro.c (funlike_invocation_p): Don't save lexer_pos.
      	(_cpp_create_definition): Update.
      
      From-SVN: r45627
      50410426
  7. Sep 14, 2001
    • Neil Booth's avatar
      cpperror.c (print_location): Take line and column, for default positioning use... · 97293897
      Neil Booth authored
      cpperror.c (print_location): Take line and column, for default positioning use the previously lexed token.
      
      	* cpperror.c (print_location): Take line and column, for
      	default positioning use the previously lexed token.
      	(_cpp_begin_message): Take line and column.
      	(cpp_ice, cpp_fatal, cpp_error, cpp_error_with_line, cpp_warning,
      	cpp_warning_with_line, cpp_pedwarn, cpp_pedwarn_with_line): Update.
      	* cpphash.h (_cpp_begin_message): Update prototype.
      	* cppinit.c (push_include): Don't set output line.
      	* cpplex.c (_cpp_lex_token): Callback for start of new output lines.
      	* cpplib.c (do_diagnostic, _cpp_pop_buffer): Update.
      	(do_pragma): Kludge for front ends.  Don't expand macros at all.
      	* cpplib.h (cpp_lookahead, cpp_token_with_pos, cpp_get_line): Remove.
      	(struct cpp_token): Remove output_line.
      	(struct cpp_callbacks): New member line_change.
      	* cppmacro.c (builtin_macro, paste_all_tokens, replace_args,
      	cpp_get_token): Preserve BOL flag.
      	(cpp_get_line): Remove.
      	(_cpp_backup_tokens): Remove useless abort().
      	* cppmain.c (cb_line_change): New.
      	(scan_translation_unit): Don't worry about starting new lines here.
      	* scan-decls.c (scan_decls): Update.
      	* c-lex.c (c_lex, init_c_lex): Update.
      	(cb_line_change, src_lineno): New.
      
      From-SVN: r45613
      97293897
  8. Sep 13, 2001
    • Neil Booth's avatar
      c-parse.in (_yylex): Use _cpp_backup_tokens. · bdcbe496
      Neil Booth authored
      	* c-parse.in (_yylex): Use _cpp_backup_tokens.
      	* cpphash.h (struct tokenrun): Add prev.
      	(struct lexer_state): Remove bol.
      	(struct cpp_reader): Remove old lookahead stuff, add lookaheads.
      	(_cpp_free_lookaheads, _cpp_release_lookahead, _cpp_push_token)
      	: Remove.
      	* cppinit.c (cpp_create_reader): Don't set bol.
      	(cpp_destroy): Don't free lookaheads.
      	* cpplex.c (lex_directive): Remove.
      	(next_tokenrun): Update.
      	(_cpp_lex_token): Clean up logic.
      	(lex_token): Update to return a pointer to lexed token, since it
      	can move to the start of the buffer.  Simpify newline handling.
      	* cpplib.c (SEEN_EOL): Update.
      	(skip_rest_of_line): Remove lookahead stuff.
      	(end_directive): Line numbers are already incremented.  Revert
      	to start of lexed token buffer if we can.
      	(_cpp_handle_directive, do_pragma, do_pragma_dependency,
      	parse_answer): Use _cpp_backup_tokens.
      	(run_directive, cpp_pop_buffer): Don't set bol, set saved_flags
      	instead.  Don't check for EOL.
      	(do_include_common, do_line, do_pragma_system_header): Use
      	skip_rest_of_line.
      	* cpplib.h (BOL, _cpp_backup_tokens): New.
      	* cppmacro.c (save_lookahead_token, take_lookahead_token,
      	alloc_lookahead, free_lookahead, _cpp_free_lookaheads,
      	cpp_start_lookahead, cpp_stop_lookahead, _cpp_push_token): Remove.
      	(builtin_macro): Don't use cpp_get_line.
      	(cpp_get_line): Short term kludge.
      	(parse_arg): Handle directives in arguments here.  Back up when
      	appropriate.  Store EOF at end of argument list.
      	(funlike_invocation_p): Use _cpp_backup_tokens.
      	(push_arg_context): Account for EOF at end of list.
      	(cpp_get_token): Remove lookahead stuff.  Update.
      
      	* gcc.dg/cpp/directiv.c: Update.
      	* gcc.dg/cpp/undef1.c: Update.
      
      From-SVN: r45582
      bdcbe496
  9. Sep 12, 2001
    • Kaveh R. Ghazi's avatar
      c-common.c (c_tree_code_name): Const-ification. · 27c38fbe
      Kaveh R. Ghazi authored
      	* c-common.c (c_tree_code_name): Const-ification.
      	* c-decl.c (c_decode_option): Likewise.
      	* c-typeck.c (warn_for_assignment): Likewise.
      	* collect2.c (libexts, is_ctor_dtor, main, ignore_library):
      	Likewise.
      	* cppinit.c (output_deps): Likewise.
      	* dependence.c (dependence_string, direction_string): Likewise.
      	* dwarf2out.c (output_ranges): Likewise.
      	* fixinc/fixfixes.c (emit_gnu_type): Likewise.
      	* fixinc/gnu-regex.c (re_error_msgid): Likewise.
      	* gcc.c (standard_exec_prefix, standard_exec_prefix_1,
      	standard_startfile_prefix, standard_startfile_prefix_1,
      	standard_startfile_prefix_2, tooldir_base_prefix,
      	standard_bindir_prefix, find_a_file): Likewise.
      	* genattrtab.c (make_length_attrs): Likewise.
      	* gencheck.c (tree_codes): Likewise.
      	* genemit.c (gen_split): Likewise.
      	* genrecog.c (special_mode_pred_table): Likewise.
      	* graph.c (graph_ext): Likewise.
      	* protoize (default_include): Likewise.
      	* reload.c (reload_when_needed_name): Likewise.
      	* sched-vis.c (visualize_stall_cycles): Likewise.
      	* tlink.c (recompile_files): Likewise.
      	* toplev.c (decode_g_option): Likewise.
      	* tradcpp.c (output_deps): Likewise.
      	* varasm.c (decode_reg_name): Likewise.
      
      	* arm.c (arm_condition_codes, strings_fpa, thumb_condition_code):
      	Const-ification.
      	* arm.md: Likewise.
      	* avr.c (avr_regnames, encode_section_info): Likewise.
      	* c4x.c (float_reg_names): Likewise.
      	* darwin.h (ASM_GLOBALIZE_LABEL): Likewise.
      	* elfos.h (const_section): Likewise.
      	* i386.c (ix86_comp_type_attributes): Likewise.
      	* i386/win32.h (STRIP_NAME_ENCODING): Likewise.
      	* ia64/aix.h (UNIQUE_SECTION): Likewise.
      	* ia64.c (type_names): Likewise.
      	* m68hc11.c (reg_class_names): Likewise.
      	* m88k.c (m_options): Likewise.
      	* mips.c (mips_output_conditional_branch, mips_unique_section):
      	Likewise.
      	* rs6000/sysv4.h (ASM_DECLARE_FUNCTION_NAME): Likewise.
      	* sparc.c (sparc_flat_function_prologue, sparc_flat_function_epilogue,
      	ultra_code_names): Likewise.
      	* sparc.h (OVERRIDE_OPTIONS): Likewise.
      
      From-SVN: r45567
      27c38fbe
  10. Sep 11, 2001
    • Neil Booth's avatar
      cpphash.h (struct tokenrun): New. · 5fddcffc
      Neil Booth authored
      	* cpphash.h (struct tokenrun): New.
      	(struct cpp_context): New member bol.
      	(struct cpp_reader): New members.
      	(_cpp_init_tokenrun): New.
      	* cppinit.c (cpp_create_reader): Set up the token runs.
      	* cpplex.c (lex_directive, lex_token, next_tokenrun): New.
      	(lex_token): New internalised version of _cpp_lex_token.  Don't
      	handle directives or the multiple include opimisation here any
      	more.  Simply lex a token.
      	* cpplib.c (run_directive): Clear bol.
      	(_cpp_pop_buffer): Set bol.
      	* cppmacro.c (funlike_invocation_p): Keep tokens whilst parsing
      	arguments.
      
      From-SVN: r45534
      5fddcffc
  11. Sep 01, 2001
  12. Aug 22, 2001
    • Neil Booth's avatar
      cpperror.c (print_location): Don't show _Pragma. · 29401c30
      Neil Booth authored
      	* cpperror.c (print_location): Don't show _Pragma.
      	* cppfiles.c (_cpp_pop_file_buffer): Handle -include file pushing
      	and file change callback generation here.
      	(stack_include_file): Update use of cpp_push_buffer.
      	* cpphash.h (_cpp_pop_file_buffer): Update prototype.
      	(struct cpp_buffer): Remove type, pfile members.
      	* cppinit.c (cpp_handle_option): Use free_chain.
      	* cpplex.c (_cpp_lex_token): Don't do -include file pushing here.
      	(skip_escaped_newlines, get_effective_char, lex_percent): Take
      	a cpp_reader rather than a cpp_buffer.
      	(skip_escaped_newlines, get_effective_char, skip_block_comment,
      	skip_line_comment, parse_string, lex_percent, lex_dot,
      	_cpp_lex_token): Update accordingly.
      	* cpplib.c (_cpp_pop_buffer): Don't do file change callback
      	generation here.
      	(cpp_push_buffer): Update prototype.
      	(run_directive): Update use of cpp_push_buffer.
      	(_cpp_do__Pragma, cpp_define, cpp_define_builtin, cpp_undef,
      	handle_assertion): Update use of run_directive.
      	* cpplib.h (enum cpp_buffer_type): Remove.
      	(cpp_push_buffer): Update prototype.
      	* fix-header.c (read_scan_file): Update.
      
      From-SVN: r45112
      29401c30
  13. Aug 21, 2001
    • Neil Booth's avatar
      cppfiles.c (stack_include_file): Don't handle -H here. · 5993019d
      Neil Booth authored
      	* cppfiles.c (stack_include_file): Don't handle -H here.
      	* cppinit.c (cpp_start_read): Set include tracing after
      	cpp_post_options and after stacking the main file.
      	* line-map.c (trace_include): New.
      	(init_line_maps, add_line_map): Update.
      	* line-map.h (struct line_maps): New member trace_includes.
      
      From-SVN: r45084
      5993019d
    • Neil Booth's avatar
      cpphash.h (_cpp_push_next_buffer): New. · d7bc7a98
      Neil Booth authored
      	* cpphash.h (_cpp_push_next_buffer): New.
      	* cppinit.c (do_includes): Remove.
      	(push_include, free_chain, _cpp_push_next_buffer): New.
      	(cpp_start_read): Use them to rework command line option handling.
      	(cpp_handle_option): Combine handling of -include and -imacros.
      	* cpplex.c (_cpp_lex_token): Push a new -include buffer if
      	appropriate.  Always insert missing \n at EOF.
      	* cpplib.c (start_directive): Get the directive position right.
      	* cppmain.c (cb_file_change): Always print the first line, unless
      	preprocessed.
      
      From-SVN: r45070
      d7bc7a98
  14. Aug 20, 2001
    • Neil Booth's avatar
      cppinit.c (init_standard_includes): The returned buffer is already malloc-ed. · 51c04256
      Neil Booth authored
      	* cppinit.c (init_standard_includes): The returned buffer
      	is already malloc-ed.
      	* gcc.c (add_prefix): Similarly.
      	* prefix.c (translate_name): Update to support clear buffer
      	ownership rules.
      	(update_path): Similarly.  Be sure to free any newly allocated
      	key.  UPDATE_PATH_HOST_CANONICALIZE takes only one argument.
      	(tr): New function.
      	* prefix.h (update_path): Update prototype and document.
      	* config/i386/xm-djgpp.h (UPDATE_PATH_HOST_CANONICALIZE): Clean
      	up and update to new buffer ownership rules.
      	* doc/gcc.texi (UPDATE_PATH_HOST_CANONICALIZE): Update.
      
      From-SVN: r45043
      51c04256
  15. Aug 18, 2001
  16. Aug 17, 2001
    • Neil Booth's avatar
      cpperror.c (print_location): Don't take a file name; use the line map instead. · bb74c963
      Neil Booth authored
      	* cpperror.c (print_location):  Don't take a file name; use the
      	line map instead.
      	(_cpp_begin_message): Similarly.
      	(cpp_ice, cpp_fatal, cpp_error, cpp_error_with_line, cpp_warning,
      	cpp_warning_with_line, cpp_pedwarn, cpp_pedwarn_with_line): Update.
      	(cpp_pedwarn_with_file_and_line): Remove.
      	* cppfiles.c (stack_include_file): Update; set filename to stdin
      	here when appropriate.
      	* cpphash.h (struct cpp_buffer): Remove nominal_fname.
      	(_cpp_begin_message): Don't take a file name.
      	* cppinit.c: Add comment.
      	* cpplex.c: Fix end-of-directive indicator.
      	* cpplib.c: Don't include intl.h.
      	(run_directive, do_diagnostic): Update.
      	(do_line): Update to not use nominal_fname.
      	(cpp_push_buffer): Don't take a filename.
      	* cpplib.h (struct ht): Remove.
      	(cpp_push_buffer): Don't take a filename.
      	(cpp_pedwarn_with_file_and_line): Remove.
      	* cppmacro.c (struct cpp_macro): Remove file.
      	(builtin_macro): Update.
      	(_cpp_create_definition): Update.
      	* cppmain.c: Correct comment.
      	* fix-header.c (read_scan_file): Update.
      
      From-SVN: r44986
      bb74c963
  17. 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
  18. Aug 07, 2001
  19. Aug 05, 2001
    • Neil Booth's avatar
      re PR preprocessor/3081 (Preprocessor merges 2 first lines when -imacros is being used) · 67821e3a
      Neil Booth authored
      	PR preprocessor/3081
      	* c-lex.c (map): New.
      	(cb_file_change): Update map and use it.
      	(cb_def_pragma, cb_define, cb_undef): Use map and line.
      	(c_lex): Update to use map.
      	* cpperror.c (print_location): Move to using logical line numbers.
      	* cppfiles.c (stack_include_file): Update for new _cpp_do_file_change.
      	(cpp_make_system_header): Similarly.
      	(_cpp_execute_include): Stop line numbering hacks.  Store the
      	line we will return to.
      	* cpphash.h (CPP_BUF_LINE): Remove.
      	(struct cpp_buffer): Remove lineno and pseudo_newlines.
      	Add map and return_to_line.
      	(_cpp_do_file_change): Update.
      	* cppinit.c (cpp_start_read): Update line kludge.
      	* cpplex.c (handle_newline): Don't update lineno and pseudo_newlines.
      	(trigraph_ok): Use logical line numbers for diagnostics.
      	(skip_block_comment): Likewise.
      	(skip_whitespace): Likewise.
      	(skip_line_comment): Use pfile->line instead.
      	(_cpp_lex_token): Update to use logical line numbering exclusively.
      	Handle BOL locally.  Accept new lines in directives, but keep
      	pfile->line decremented.  Diagnostics use logical lines.  Update
      	directive handling.
      	* cpplib.c (SEEN_EOL): New.
      	(skip_rest_of_line, check_eol): Use it.
      	(end_directive): Increase line number when accepting the newline
      	at the end of a directive.
      	(run_directive): Simplify.
      	(do_line): Bad LC_LEAVEs become LC_RENAMEs.  Update.
      	(_cpp_do_file_change): Update to take buffer line number as an
      	argument, and store the current map in the cpp_reader.  Remove
      	line number kludges.
      	(_cpp_do__Pragma): Restore output position after a _Pragma.
      	(cpp_push_buffer): Don't set output line or lineno.
      	(_cpp_pop_buffer): Transfer more info from a faked buffer.
      	Remove line kludge.  Set output_line.
      	* cppmacro.c (builtin_macro): Update handling of __LINE__.
      	(parse_arg): Use logical lines.
      	(save_lookahead_token): Save EOFs too now.
      	* cppmain.c (struct printer): Fix comments.
      	(printer_init): Simplify, let caller do errors.
      	(scan_translation_unit, check_multiline_token, dump_macro): Update.
      	(maybe_print_line): Simplify.
      	(print_line): Don't print a linemarker if -P.
      	(cb_define, cb_undef, cb_def_pragma, cb_ident, cb_include): Update.
      	(cb_file_change): Simplify.
      	* line-map.h (LAST_SOURCE_LINE): Fix.
      	(CURRENT_LINE_MAP): New.
      
      	* gcc.dg/cpp/19951025-1.c: Revert.
      	* gcc.dg/cpp/directiv.c: We no longer process directives that
      	interrupt macro arguments.
      
      From-SVN: r44650
      67821e3a
  20. Aug 04, 2001
    • Neil Booth's avatar
      Makefile.in (CPPLIB_H): New, so that dependencies on cpplib.h are also on line-map.h. · ef6e958a
      Neil Booth authored
      	* Makefile.in (CPPLIB_H): New, so that dependencies on cpplib.h
      	are also on line-map.h.
      	* cppfiles.c (stack_include_file): Update.
      	* cpphash.h (struct cpp_buffer): New member return_at_eof.
      	(_cpp_pop_buffer): New.
      	* cppinit.c (cpp_destroy, cpp_finish): Update.
      	(do_includes): Mark each buffer to return at EOF.
      	* cpplex.c (_cpp_lex_token): Pop buffers at EOF.  Continue or
      	return as requested.
      	* cpplib.c (run_directive, do_line, cpp_push_buffer): Update.
      	(cpp_pop_buffer): Rename _cpp_pop_buffer.  Stop skipping.
      	* cpplib.h (cpp_pop_buffer): Remove.
      	(cpp_scan_buffer_nooutput): Rename cpp_scan_nooutput.
      	* cppmacro.c (cpp_scan_buffer_nooutput): Similarly.  No need to pop
      	buffers.
      	* cppmain.c (scan_buffer): Rename scan_translation_unit.  No need
      	to pop buffers.
      	(do_preprocessing): Update.
      	* fix-header.c (read_scan_file): Update.  No need to pop buffers.
      	* c-parse.in (_yylex): Similarly.
      	* scan-decls.c (scan_decls): Similarly.
      	* line-map.h: Update comments.
      
      	* cp/spew.c (read_token): No need to pop buffers.
      
      	* objc/Make-lang.in (objc-act.o): Update dependencies.
      
      From-SVN: r44634
      ef6e958a
  21. Aug 02, 2001
    • Neil Booth's avatar
      line-map.c: New. · d82fc108
      Neil Booth authored
      	* line-map.c: New.
      	* line-map.h: New.
      	* Makefile.in (line-map.o): New.
      	(LIBCPP_OBJS, LIBCPP_DEPS): Update.
      	* c-lex.c (cb_file_change): Update for new cpp_file_change structure.
      	* cpperror.c (print_containing_files): Similarly.
      	(print_location): Update.  Don't output a space before _Pragma.
      	* cppfiles.c (stack_include_file): Set to line 1 immediately.
      	(stack_include_filee, cpp_make_system_header): Update.
      	(_cpp_execute_include): Get logical line number right for calling
      	as-yet-unterminated #include.
      	* cpphash.h (struct cpp_reader): Add line_maps.
      	(_cpp_do_file_change): Update.
      	* cppinit.c (cpp_create_reader): Initialize line maps.
      	(cpp_destroy): Destroy line maps.
      	(cpp_start_read): Get logical line number right.
      	* cpplex.c (parse_string): Only warn once for multi-line strings.
      	Use boolean variable for null warning.
      	* cpplib.c (_cpp_handle_directive): End the directive if it isn't
      	already.
      	(do_include_common): End the directive early.
      	(do_line): Don't warn about out-of-range lines in preprocessed
      	source.  Update.  Remove unused variables.
      	(_cpp_do_file_change): Update for new line mapping.
      	(pragma_cb): New typedef.
      	(cpp_register_pragma): Stop looking ahead before calling the
      	handler.  Clean up.
      	(do_pragma_system_header): End directive early.
      	(cpp_get_line_maps): New.
      	(cpp_pop_buffer): Fudge logical line.  Update.
      	* cpplib.h: Include line-map.h
      	(enum cpp_fc_reason): Remove.
      	(struct cpp_file_change): Update.
      	(cpp_get_line_maps): New.
      	* cppmain.c (struct_printer): New member map.
      	(cb_file_change): Update for new mappings.
      	* fix-header.c (cb_file_change): Similarly.
      testsuite:
      	* gcc.dg/cpp/19951025-1.c: Update.
      
      From-SVN: r44584
      d82fc108
  22. Aug 01, 2001
    • Kazu Hirata's avatar
      alias.c: Fix comment formatting. · ec5c56db
      Kazu Hirata authored
      	* alias.c: Fix comment formatting.
      	* bitmap.c: Likewise.
      	* builtins.c: Likewise.
      	* calls.c: Likewise.
      	* c-common.c: Likewise.
      	* c-decl.c: Likewise.
      	* c-dump.c: Likewise.
      	* c-lex.c: Likewise.
      	* collect2.c: Likewise.
      	* combine.c: Likewise.
      	* conflict.c: Likewise.
      	* cppfiles.c: Likewise.
      	* cppinit.c: Likewise.
      	* cpplex.c: Likewise.
      	* cpplib.c: Likewise.
      	* cppmacro.c: Likewise.
      	* cppspec.c: Likewise.
      	* c-pragma.c: Likewise.
      	* crtstuff.c: Likewise.
      	* cse.c: Likewise.
      	* cselib.c: Likewise.
      	* c-semantics.c: Likewise.
      	* c-typeck.c: Likewise.
      
      From-SVN: r44547
      ec5c56db
  23. Jul 29, 2001
  24. Jul 20, 2001
  25. Jul 04, 2001
  26. Jul 02, 2001
  27. Jun 09, 2001
  28. 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
  29. May 10, 2001
    • Zack Weinberg's avatar
      cppinit.c (cpp_post_options): Shut off macro expansion if -fpreprocessed. · 6d4587f7
      Zack Weinberg authored
      	* cppinit.c (cpp_post_options): Shut off macro expansion if
      	-fpreprocessed.
      	* cpplib.c (_cpp_handle_directive): If -fpreprocessed, accept
      	IN_I directives only if the # is in column 1 and the directive
      	name begins in column 2.
      	* cppmain.c (scan_buffer): Insert a space between # and an
      	identifier, when that identifier is a directive name.
      
      	* tradcpp.c (struct file_buf): Add a pointer to the next entry
      	in the header search path.
      	(enum node_type): Add T_INCLUDE_NEXT.
      	(directive_table): Add entry for include_next.
      	(do_include_next): New function.
      	(process_include): New routine, broken out of do_include.
      	(finclude): Insert 'nhd' argument, to be copied into
      	next_header_dir of the new buffer.
      	(main): Adjust to match.
      	* gsyslimits.h, limity.h: Un-indent #include_next.
      
      testsuite:
      	* gcc.dg/cpp/direct2.c: New test.
      	* gcc.dg/cpp/direct2s.c: New test.
      
      	* gcc.c-torture/execute/920730-1t.c: #undef __GNUC__ at head.
      
      From-SVN: r41932
      6d4587f7
  30. Apr 06, 2001
    • Neil Booth's avatar
      configure.in: Add check for lstat. · f9200da2
      Neil Booth authored
      	* configure.in: Add check for lstat.
      	* configure, config.in: Regenerate.
      	* cppinit.c (append_include_chain): Make empty path ".".
              * cpplib.c (do_line): Don't simplify #line paths.
              * cppfiles.c (remove_component_p): New function.
      	(find_or_create_entry): Acknowledge stat () errors during
      	path simplification.
      	(handle_missing_header): Don't simplify paths.
              (_cpp_simplify_pathname): Don't simplify VMS paths.  Return
              the empty path untouched.  Don't leave a trailing '/'.
      
      From-SVN: r41148
      f9200da2
  31. Mar 15, 2001
    • Neil Booth's avatar
      cpp.texi: Update documentation for -include and -imacros. · ba133c96
      Neil Booth authored
      	* cpp.texi: Update documentation for -include and -imacros.
      	* cppfiles.c (struct include_file): Remove "defined" memeber.
      	(find_or_create_entry): Make a copy of the file name, and
      	simplify it.
      	(open_file): Update to ensure we use the simplified filename.
      	(stack_include_file): Don't set search_from.
      	(cpp_included): Don't simplify the path name here.
      	(find_include_file): New prototype.  Call search_from to
      	get the start of the "" include chain.  Don't simplify the
      	filenames here.
      	(_cpp_execute_include): New prototype.  Move diagnostics to
      	do_include_common.  Update.
      	(_cpp_pop_file_buffer): Don't set defined.
      	(search_from): New prototype.  Use the preprocessor's cwd
      	for files included from the command line.
      	(read_name_map): Don't simplify the pathname here.
      	* cpphash.h (enum include_type): New.
      	(struct buffer): Delete search from.  New search_cached.
      	(_cpp_execute_include): Update prototype.
      	* cppinit.c (do_includes): Use _cpp_execute_include.
      	* cpplib.c (do_include_common): New function.
      	(do_include, do_include_next, do_import): Use it.
      
      From-SVN: r40486
      ba133c96
  32. Mar 04, 2001
    • Neil Booth's avatar
      cppfiles.c (_cpp_execute_include): Don't make a null-terminated copy of the filename. · 7868b4a2
      Neil Booth authored
      	* cppfiles.c (_cpp_execute_include): Don't make a null-terminated
      	copy of the filename.  Don't use CPP_PREV_BUFFER.  Don't call
      	strlen or strcpy; we already know the length.
      	(_cpp_compare_file_date): Similarly.
      	* cpphash.h (struct cpp_reader): Delete done_initialising.
      	(CPP_PREV_BUFFER): Delete.
      	* cppinit.c (cpp_start_read): Don't set done_initialising.
      	* cpplex.c (parse_string): Guarantee null-termination.
      	(_cpp_equiv_toklists): Remove.
      	* cpplib.c (glue_header_name): Null-terminate.
      	(do_line): Don't leak memory.
      	* cpplib.h (BT_WEAK): Delete.
      	* cppmain.c (cb_ident): Strings are now null-terminated.
      
      From-SVN: r40233
      7868b4a2
  33. Mar 02, 2001
    • Christopher Faylor's avatar
      cppinit.c (append_include_chain): Mark "after" include file name list as a system directory. · 4737b274
      Christopher Faylor authored
      * cppinit.c (append_include_chain): Mark "after" include file name list as a
      system directory.
      * cpp.texi: Document new behavior.
      
      From-SVN: r40189
      4737b274
    • Neil Booth's avatar
      cppfiles.c (struct include_file): Update. · 591e15a1
      Neil Booth authored
              * cppfiles.c (struct include_file): Update.
              (stack_include_file): Use search_from.
              (cpp_included, find_include_file): Update.
              (cpp_execute_include): Update.  ptr->name may not be
              null terminated.  Use the new search_from member variable
              of cpp_buffer.
              (_cpp_compare_file_date): Similarly.
              (search_from): New function, similiar to actual_directory.
              (actual_directory): Delete.
              (remap_filename): Update.  loc->name may not be null terminated.
              (struct file_name_list): Rename search_path.  Update.
              * cpphash.h (struct cpp_buffer): Delete actual_dir.  New members
              search_from and dir.
              (struct cpp_reader): Remove actual_dirs.
              * cppinit.c (struct cpp_pending): Update for renamed objects.
              (append_include_chain, remove_dup_dir, remove_dup_dirs,
              merge_include_chains, cpp_destroy, cpp_start_read): Similarly.
              * cpplib.h (struct cpp_options): Similarly.
      
      From-SVN: r40178
      591e15a1
    • John David Anglin's avatar
      cpplib.c (_cpp_init_stacks): Cast enum for comparison. · 37b8524c
      John David Anglin authored
      	* cpplib.c (_cpp_init_stacks): Cast enum for comparison.
      	* cppexp.c (lex): Cast enums for comparison.
      	* cppinit.c (parse_option): Cast enum for comparison.
      	* cpplex.c (cpp_spell_token): Cast enums to int for minus.
      	(cpp_output_token): Likewise.
      	(cpp_can_paste): Cast enums for comparsion and plus/minus.
      	(cpp_avoid_paste): Cast enums for minus and comparison.
      
      From-SVN: r40174
      37b8524c
    • Zack Weinberg's avatar
      cpphash.h (struct cpp_reader): Add print_version field. · cb773845
      Zack Weinberg authored
      	* cpphash.h (struct cpp_reader): Add print_version field.
      	* cppinit.c (cpp_handle_option): For -v, -version, and --version,
      	just set print_version and other flags as appropriate.
      	(cpp_post_options): Print version here if print_version is set.
      
      	* toplev.c (exit_after_options): New flag.
      	(independent_decode_option): Don't exit here; just set
      	exit_after_options.
      	(main): Exit after calling lang_hooks.post_options if
      	exit_after_options is true.
      
      	* cppinit.c (append_include_chain): Drop never-used case QUOTE.
      	(merge_include_chains): Adjust comment to match code.
      
      From-SVN: r40171
      cb773845
  34. Feb 25, 2001
    • Neil Booth's avatar
      cppinit.c (builtin_array): Update. · 618cdda7
      Neil Booth authored
              * cppinit.c (builtin_array): Update.
              (init_builtins): Flag builtins to warn if redefined or
              undefined.  Define __GXX_WEAK as a normal macro.
              * cpplib.c (do_undef): Warn if flagged NODE_WARN.
              * cpplib.h (NODE_WARN): New flag.
              * cppmacro.c (builtin_macro): Remove handling of __GXX_WEAK__.
              Handle __STDC__ as a builtin only on Solaris.
              (warn_of_redefinition): Renamed from check_macro_definition.
              Reverse sense of test.  Always warn if NODE_WARN.
              (_cpp_create_definition): Use warn_of_redefinition.  Flag
              any macro beginning with "__STDC_" to require a mandatory
              warning if redefined or undefined.
      
      From-SVN: r40053
      618cdda7
  35. Feb 21, 2001
    • Neil Booth's avatar
      cppfiles.c: Update comments. · 373e2177
      Neil Booth authored
              * cppfiles.c: Update comments.
              (_cpp_read_file): Don't check for NULL filenames any more.
              * cppinit.c (cpp_start_read): Don't do canonicalization of
              in_fname and out_fname.  Use the passed file name exclusively.
              (_cpp_handle_options): Don't treat "-" as a command line option,
              but as a normal filename.
              (_cpp_post_options): Canonicalize in_fname and out_fname.
              * cppmain.c (printer_init): Don't check out_fname for NULL.
              * c-lex.c (orig_filename): Rename cpp_filename for clarity.
              (init_c_lex): Update, and use "" to represent stdin to CPP.
              (yyparse): Update.
      
      From-SVN: r39938
      373e2177
Loading