1. 04 Jan, 2016 1 commit
  2. 15 Sep, 2015 1 commit
    • Change of location_get_source_line signature · 31bdd08a
      gcc/ChangeLog:
      	* input.h (location_get_source_line): Drop "expanded_location"
      	param in favor of a file and line number.
      	* input.c (location_get_source_line): Likewise.
      	(dump_location_info): Update for change in signature of
      	location_get_source_line.
      	* diagnostic.c (diagnostic_print_caret_line): Likewise.
      
      gcc/c-family/ChangeLog:
      	* c-format.c (location_from_offset): Update for change in
      	signature of location_get_source_line.
      	* c-indentation.c (get_visual_column): Likewise.
      	(line_contains_hash_if): Likewise.
      
      From-SVN: r227800
      David Malcolm committed
  3. 13 May, 2015 1 commit
    • libcpp/input.c: Add a way to visualize the linemaps (-fdump-internal-locations) · ba4ad400
      gcc/ChangeLog:
      	* common.opt (fdump-internal-locations): New option.
      	* input.c: Include diagnostic-core.h.
      	(get_end_location): New function.
      	(write_digit): New function.
      	(write_digit_row): New function.
      	(dump_location_range): New function.
      	(dump_labelled_location_range): New function.
      	(dump_location_info): New function.
      	* input.h (dump_location_info): New prototype.
      	* toplev.c (compile_file): Handle flag_dump_locations.
      
      libcpp/ChangeLog:
      	* include/line-map.h (source_location): Add a reference to
      	location-example.txt to the descriptive comment.
      	* location-example.txt: New file.
      
      From-SVN: r223163
      David Malcolm committed
  4. 24 Apr, 2015 1 commit
  5. 05 Jan, 2015 1 commit
  6. 15 Aug, 2014 1 commit
  7. 16 Jul, 2014 1 commit
    • Support location tracking for built-in macro tokens · c468587a
      When a built-in macro is expanded, the location of the token in the
      epansion list is the location of the expansion point of the built-in
      macro.
      
      This patch creates a virtual location for that token instead,
      effectively tracking locations of tokens resulting from built-in macro
      tokens.
      
      libcpp/
      	* include/line-map.h (line_maps::builtin_location): New data
      	member.
      	(line_map_init): Add a new parameter to initialize the new
      	line_maps::builtin_location data member.
      	* line-map.c (linemap_init): Initialize the
      	line_maps::builtin_location data member.
      	* macro.c (builtin_macro): Create a macro map and track the token
      	resulting from the expansion of a built-in macro.
      gcc/
      	* input.h (is_location_from_builtin_token): New function
      	declaration.
      	* input.c (is_location_from_builtin_token): New function
      	definition.
      	* toplev.c (general_init): Tell libcpp what the pre-defined
      	spelling location for built-in tokens is.
      
      Signed-off-by: Dodji Seketeli <dodji@redhat.com>
      
      From-SVN: r212637
      Dodji Seketeli committed
  8. 23 Jan, 2014 1 commit
    • PR preprocessor/58580 - preprocessor goes OOM with warning for zero literals · 7ecc3eb9
      In this problem report, the compiler is fed a (bogus) translation unit
      in which some literals contain bytes whose value is zero.  The
      preprocessor detects that and proceeds to emit diagnostics for that
      king of bogus literals.  But then when the diagnostics machinery
      re-reads the input file again to display the bogus literals with a
      caret, it attempts to calculate the length of each of the lines it got
      using fgets.  The line length calculation is done using strlen.  But
      that doesn't work well when the content of the line can have several
      zero bytes.  The result is that the read_line never sees the end of
      the line because strlen repeatedly reports that the line ends before
      the end-of-line character; so read_line thinks its buffer for reading
      the line is too small; it thus increases the buffer, leading to a huge
      memory consumption and disaster.
      
      Here is what this patch does.
      
      location_get_source_line is modified to return the length of a source
      line that can now contain bytes with zero value.
      diagnostic_show_locus() is then modified to consider that a line can
      have characters of value zero, and so just shows a white space when
      instructed to display one of these characters.
      
      Additionally location_get_source_line is modified to avoid re-reading
      each and every line from the beginning of the file until it reaches
      the line number N that it is instructed to get; this was leading to
      annoying quadratic behaviour when reading adjacent lines near the end
      of (big) files.  So a cache is now associated to the file opened in
      text mode.  When the content of the file is read, that content is
      stashed in the file cache.  That file cache is searched for line
      delimiters.  A number of line positions are saved in the cache and a
      number of file caches are kept in memory.  That way when
      location_get_source_line is asked to read line N + 1, it just has to
      start reading from line N that it has already read.
      
      libcpp/ChangeLog:
      
      	* include/line-map.h (linemap_get_file_highest_location): Declare
      	new function.
      	* line-map.c (linemap_get_file_highest_location): Define it.
      
      gcc/ChangeLog:
      
      	* input.h (location_get_source_line): Take an additional line_size
      	parameter.
      	(void diagnostics_file_cache_fini): Declare new function.
      	* input.c (struct fcache): New type.
      	(fcache_tab_size, fcache_buffer_size, fcache_line_record_size):
      	New static constants.
      	(diagnostic_file_cache_init, total_lines_num)
      	(lookup_file_in_cache_tab, evicted_cache_tab_entry)
      	(add_file_to_cache_tab, lookup_or_add_file_to_cache_tab)
      	(needs_read, needs_grow, maybe_grow, read_data, maybe_read_data)
      	(get_next_line, read_next_line, goto_next_line, read_line_num):
      	New static function definitions.
      	(diagnostic_file_cache_fini): New function.
      	(location_get_source_line): Take an additional output line_len
      	parameter.  Re-write using lookup_or_add_file_to_cache_tab and
      	read_line_num.
      	* diagnostic.c (diagnostic_finish): Call
      	diagnostic_file_cache_fini.
      	(adjust_line): Take an additional input parameter for the length
      	of the line, rather than calculating it with strlen.
      	(diagnostic_show_locus): Adjust the use of
      	location_get_source_line and adjust_line with respect to their new
      	signature.  While displaying a line now, do not stop at the first
      	null byte.  Rather, display the zero byte as a space and keep
      	going until we reach the size of the line.
      	* Makefile.in: Add vec.o to OBJS-libcommon
      
      gcc/testsuite/ChangeLog:
      
      	* c-c++-common/cpp/warning-zero-in-literals-1.c: New test file.
      
      Signed-off-by: Dodji Seketeli <dodji@seketeli.org>
      
      From-SVN: r206957
      Dodji Seketeli committed
  9. 02 Jan, 2014 1 commit
  10. 22 Nov, 2013 1 commit
    • Remove macros that implicitly use input_location · 8400e75e
      gcc/
      	* input.h (input_line): Remove.
      	(input_filename): Likewise.
      	(in_system_header): Likewise.
      	* tree.h (EXPR_LOC_OR_HERE): Remove.
      	* config/bfin/bfin.c (output_file_start): Remove use of
      	input_filename macro.
      	* builtins.c (c_strlen): Remove use of EXPR_LOC_OR_HERE macro.
      	* gimplify.c (internal_get_tmp_var): Likewise.
      	EXPR_LOC_OR_HERE macro.
      	(shortcut_cond_expr): Likewise.
      	* tree-diagnostic.c (diagnostic_report_current_function): Remove
      	use of input_filename macro.
      	* tree.c (get_file_function_name): Likewise.
      
      gcc/ada
      	* gcc-interface/utils2.c (build_call_raise): Remove use of
      	input_line macro.
      	(build_call_raise_range): Likewise.
      	(build_call_raise_column): Likewise.
      
      gcc/c-family
      	* c-common.c (unsafe_conversion_p): Remove use of
      	EXPR_LOC_OR_HERE macro.
      	(conversion_warning): Likewise.
      	(warnings_for_convert_and_check): Likewise.
      	(warn_for_collisions_1): Likewise.
      	(shorten_compare): Likewise, and remove use of in_system_header
      	macro, using the location from the former.
      	* c-lex.c (dump_one_header): Remove use of input_filename macro.
      	(cb_def_pragma): Remove use of in_system_header macro.
      	(lex_string): Likewise.
      	* c-pragma.c (handle_pragma_float_const_decimal64): Likewise.
      
      gcc/c
      	* c-decl.c (define_label, shadow_tag_warned)
      	(check_bitfield_type_and_width, grokdeclarator, grokparms,
      	store_parm_decls_newstyle, store_parm_decls_oldstyle)
      	(declspecs_add_type): Remove use of in_system_header macro.
      	* c-parser.c (c_parser_unary_expression): Likewise.
      	* c-typeck.c (store_init_value, process_init_element)
      	(c_start_case): Likewise.
      
      	* c-decl.c (build_enumerator): Remove use of EXPR_LOC_OR_HERE
      	macro.
      
      	* c-parser.c (c_parser_set_source_position_from_token): Remove
      	reference to in_system_header from comment.
      
      gcc/cp
      	* call.c (build_integral_nontype_arg_conv): Remove use of
      	EXPR_LOC_OR_HERE macro.
      	(convert_like_real): Likewise.
      	(convert_arg_to_ellipsis): Likewise.
      	(build_cxx_call): Likewise.
      	(perform_implicit_conversion_flags): Likewise.
      	(initialize_reference): Likewise.
      	* cvt.c (cp_convert_to_pointer): Likewise.
      	(convert_to_reference): Likewise.
      	(ocp_convert): Likewise.
      	(convert_to_void): Likewise.
      	* decl.c (pop_label): Update comment.
      	(pop_switch): Remove use of EXPR_LOC_OR_HERE macro.
      	(check_tag_decl): Remove use of in_system_header macro.
      	(make_rtl_for_nonlocal_decl): Remove use of input_filename
      	macro.
      	(compute_array_index_type): Remove use of in_system_header
      	macro.
      	(grokdeclarator): Likewise.
      	* error.c (dump_global_iord): Remove use of input_filename
      	macro.
      	(location_of): Remove use of EXPR_LOC_OR_HERE macro.
      	(maybe_warn_cpp0x): Remove use of in_system_header macro.
      	* init.c (build_new_1): Remove use of EXPR_LOC_OR_HERE macro.
      	* lex.c (handle_pragma_interface): Remove use of input_filename
      	macro.
      	(handle_pragma_implementation): Likewise.
      	(cxx_make_type): Likewise.
      	(in_main_input_context): Likewise.
      	* name-lookup.c (push_binding_level): Remove use of
      	input_line macro.
      	(leave_scope): Likewise.
      	(resume_scope): Likewise.
      	* parser.c (cp_parser_unqualified_id): Remove use of
      	in_system_header macro.
      	(cp_parser_cast_expression): Likewise.
      	(cp_parser_declaration_seq_opt): Likewise.
      	(cp_parser_enumerator_list): Likewise.
      	(cp_parser_parameter_declaration_clause): Likewise.
      	(cp_parser_exception_specification_opt): Likewise.
      	* pt.c (unify_arg_conversion): Remove use of EXPR_LOC_OR_HERE
      	macro.
      	(convert_nontype_argument): Likewise.
      	(push_tinst_level): Remove use of in_system_header macro.
      	(tsubst_copy_and_build): Remove use of EXPR_LOC_OR_HERE
      	macros.
      	(do_decl_instantiation): Remove use of in_system_header macro.
      	(do_type_instantiation): Likewise.
      	* semantics.c (finish_call_expr): Remove use of EXPR_LOC_OR_HERE
      	macro.
      	(begin_class_definition): Remove use of input_filename macro.
      	(cxx_eval_call_expression): Remove use of EXPR_LOC_OR_HERE
      	macro.
      	(cxx_eval_constant_expression): Likewise.
      	(potential_constant_expression_1): Likewise.
      	* typeck.c (decay_conversion): Likewise.
      	(rationalize_conditional_expr): Likewise.
      	(build_x_compound_expr_from_list): Likewise.
      	(convert_for_assignment): Likewise.
      	* typeck2.c (check_narrowing): Likewise.
      
      gcc/fortran
      	* trans.c (trans_runtime_error_vararg): Remove use of input_line
      	macro.
      
      gcc/java
      	* class.c (maybe_layout_super_class): Update comment.
      	* decl.c (java_add_stmt): Remove use of input_filename macro.
      	* jcf-parse.c (set_source_filename): Remove use of
      	input_filename macro.
      	(parse_class_file): Remove use of input_line and input_filename
      	macros.
      	(java_parse_file): Remove use of input_filename macro.
      
      From-SVN: r205262
      David Malcolm committed
  11. 06 Nov, 2013 2 commits
    • Revert "preprocessor/58580 - preprocessor goes OOM with warning for zero literals" · 7f4d640c
      This reverts commit fc3eff8854861fcd70d33d26095b17fe456fae31.
      
      From-SVN: r204490
      Dodji Seketeli committed
    • preprocessor/58580 - preprocessor goes OOM with warning for zero literals · 9789a912
      In this problem report, the compiler is fed a (bogus) translation unit
      in which some literals contain bytes whose value is zero.  The
      preprocessor detects that and proceeds to emit diagnostics for that
      king of bogus literals.  But then when the diagnostics machinery
      re-reads the input file again to display the bogus literals with a
      caret, it attempts to calculate the length of each of the lines it got
      using fgets.  The line length calculation is done using strlen.  But
      that doesn't work well when the content of the line can have several
      zero bytes.  The result is that the read_line never sees the end of
      the line because strlen repeatedly reports that the line ends before
      the end-of-line character; so read_line thinks its buffer for reading
      the line is too small; it thus increases the buffer, leading to a huge
      memory consumption, pain and disaster.
      
      The patch below introduces a new get_line function that returns the
      next line of a file and return the length of that line even if the
      line contains zero bytes.  That get_line function has been adapted
      from the getline function from the GNU C Library because getline being
      a GNU extension it is not necessarily supported on all platforms.
      read_line is then modified to return the length of the line along with
      the line itself, as the line can now contain zero bytes.  Callers of
      read_line are adjusted consequently.
      
      diagnostic_show_locus() is modified to consider that a line can have
      characters of value zero, and so just shows a white space when
      instructed to display one of these characters.
      
      gcc/ChangeLog:
      
      	* input.h (location_get_source_line): Take an additional line_size
      	parameter.
      	* input.c (get_line): New static function definition.
      	(read_line): Take an additional line_length output parameter to be
      	set to the size of the line.  Use the new get_line function do the
      	actual line reading.
      	(location_get_source_line): Take an additional output line_len
      	parameter.  Update the use of read_line to pass it the line_len
      	parameter.
      	* diagnostic.c (adjust_line): Take an additional input parameter
      	for the length of the line, rather than calculating it with
      	strlen.
      	(diagnostic_show_locus): Adjust the use of
      	location_get_source_line and adjust_line with respect to their new
      	signature.  While displaying a line now, do not stop at the first
      	null byte.  Rather, display the zero byte as a space and keep
      	going until we reach the size of the line.
      
      gcc/testsuite/ChangeLog:
      
      	* c-c++-common/cpp/warning-zero-in-literals-1.c: New test file.
      
      From-SVN: r204453
      Dodji Seketeli committed
  12. 28 Sep, 2013 1 commit
    • alloc-pool.c, [...]: Add missing whitespace before "(". · c3284718
      gcc/
      	* alloc-pool.c, asan.c, auto-inc-dec.c, basic-block.h, bb-reorder.c,
      	bitmap.c, bitmap.h, bt-load.c, builtins.c, calls.c, cfgcleanup.c,
      	cfgexpand.c, cfghooks.c, cfgloop.c, cfgloopmanip.c, cfgrtl.c, cgraph.c,
      	cgraph.h, cgraphbuild.c, cgraphclones.c, cgraphunit.c, collect2.c,
      	combine-stack-adj.c, combine.c, compare-elim.c, context.c, context.h,
      	cprop.c, cse.c, cselib.c, dbxout.c, dce.c, defaults.h, df-core.c,
      	df-problems.c, df-scan.c, df.h, diagnostic.c, double-int.c, dse.c,
      	dumpfile.c, dwarf2asm.c, dwarf2cfi.c, dwarf2out.c, emit-rtl.c,
      	errors.c, except.c, expmed.c, expr.c, file-find.c, final.c,
      	fixed-value.c, fold-const.c, function.c, fwprop.c, gcc-ar.c, gcc.c,
      	gcov-io.c, gcov-io.h, gcov.c, gcse.c, genattr-common.c, genattr.c,
      	genattrtab.c, genautomata.c, genconfig.c, genemit.c, genextract.c,
      	genflags.c, gengenrtl.c, gengtype-state.c, gengtype.c, genmodes.c,
      	genopinit.c, genoutput.c, genpeep.c, genpreds.c, genrecog.c,
      	gensupport.c, ggc-common.c, ggc-page.c, gimple-fold.c, gimple-low.c,
      	gimple-pretty-print.c, gimple-ssa-strength-reduction.c, gimple.c,
      	gimple.h, godump.c, graphite-clast-to-gimple.c,
      	graphite-optimize-isl.c, graphite-poly.h, graphite-sese-to-poly.c,
      	graphite.c, haifa-sched.c, hash-table.c, hash-table.h, hwint.c,
      	hwint.h, ifcvt.c, incpath.c, init-regs.c, input.h, intl.c, intl.h,
      	ipa-cp.c, ipa-devirt.c, ipa-inline-analysis.c, ipa-inline.c,
      	ipa-profile.c, ipa-pure-const.c, ipa-reference.c, ipa-split.c,
      	ipa-utils.c, ipa.c, ira-build.c, ira.c, jump.c, loop-doloop.c,
      	loop-init.c, loop-invariant.c, loop-iv.c, lower-subreg.c, lto-cgraph.c,
      	lto-streamer-in.c, lto-streamer-out.c, lto-wrapper.c, mcf.c,
      	mode-switching.c, modulo-sched.c, omp-low.c, optabs.c, opts.c,
      	pass_manager.h, passes.c, plugin.c, postreload-gcse.c, postreload.c,
      	predict.c, prefix.c, pretty-print.c, print-rtl.c, print-tree.c,
      	profile.c, read-md.c, real.c, real.h, recog.c, ree.c, reg-stack.c,
      	regcprop.c, reginfo.c, regmove.c, regrename.c, regs.h, regstat.c,
      	reload1.c, reorg.c, rtl.c, rtl.h, rtlanal.c, sbitmap.c, sched-rgn.c,
      	sdbout.c, sel-sched-ir.c, sel-sched.c, sparseset.c, stack-ptr-mod.c,
      	statistics.c, stmt.c, stor-layout.c, store-motion.c, streamer-hooks.h,
      	system.h, target-hooks-macros.h, targhooks.c, targhooks.h, toplev.c,
      	tracer.c, trans-mem.c, tree-browser.c, tree-call-cdce.c, tree-cfg.c,
      	tree-cfgcleanup.c, tree-complex.c, tree-data-ref.c, tree-data-ref.h,
      	tree-eh.c, tree-emutls.c, tree-flow.h, tree-if-conv.c, tree-into-ssa.c,
      	tree-iterator.c, tree-loop-distribution.c, tree-mudflap.c,
      	tree-nested.c, tree-nomudflap.c, tree-nrv.c, tree-object-size.c,
      	tree-optimize.c, tree-pass.h, tree-pretty-print.c, tree-profile.c,
      	tree-scalar-evolution.c, tree-sra.c, tree-ssa-ccp.c,
      	tree-ssa-coalesce.c, tree-ssa-copy.c, tree-ssa-copyrename.c,
      	tree-ssa-dce.c, tree-ssa-dom.c, tree-ssa-dse.c, tree-ssa-forwprop.c,
      	tree-ssa-ifcombine.c, tree-ssa-live.c, tree-ssa-loop-ch.c,
      	tree-ssa-loop-im.c, tree-ssa-loop-ivopts.c, tree-ssa-loop-prefetch.c,
      	tree-ssa-loop.c, tree-ssa-math-opts.c, tree-ssa-operands.c,
      	tree-ssa-phiopt.c, tree-ssa-phiprop.c, tree-ssa-pre.c,
      	tree-ssa-reassoc.c, tree-ssa-sink.c, tree-ssa-strlen.c,
      	tree-ssa-structalias.c, tree-ssa-threadedge.c, tree-ssa-threadupdate.c,
      	tree-ssa-uncprop.c, tree-ssa-uninit.c, tree-ssa.c, tree-ssanames.c,
      	tree-stdarg.c, tree-switch-conversion.c, tree-tailcall.c,
      	tree-vect-data-refs.c, tree-vect-generic.c, tree-vect-loop-manip.c,
      	tree-vect-stmts.c, tree-vectorizer.c, tree-vectorizer.h, tree-vrp.c,
      	tree.c, tree.h, tsan.c, tsystem.h, value-prof.c, var-tracking.c,
      	varasm.c, vec.h, vmsdbgout.c, vtable-verify.c, web.c: Add missing
      	whitespace before "(".
      
      From-SVN: r203004
      Richard Sandiford committed
  13. 10 Jan, 2013 1 commit
  14. 04 Jan, 2013 1 commit
  15. 27 Sep, 2012 1 commit
    • tree.h (tree_constructor): Remove IS_UNKNOWN_LOCATION. · 2f13f2de
      2012-09-27  Dehao Chen  <dehao@google.com>
      
      	* tree.h (tree_constructor): Remove IS_UNKNOWN_LOCATION.
      	(extern void protected_set_expr_location): Likewise.
      	(function_args_iter_next): Likewise.
      	(inlined_function_outer_scope_p): Likewise.
      	* input.h (IS_UNKNOWN_LOCATION): Likewise.
      	* fold-const.c (expr_location_or): Likewise.
      	* lto-cgraph.c (output_node_opt_summary): Likewise.
      	* dwarf2out.c (add_src_coords_attributes): Likewise.
      	* tree-eh.c (lower_try_finally_dup_block): Likewise.
      	* profile.c (branch_prob):
      	* cfgexpand.c (expand_gimple_cond): Likewise.
      	(expand_gimple_basic_block): Likewise.
      	(construct_exit_block): Likewise.
      	(gimple_expand_cfg): Likewise.
      	* cfgcleanup.c (try_forward_edges): Likewise.
      	* tree-ssa-live.c (remove_unused_scope_block_p): Likewise.
      	(dump_scope_block): Likewise.
      	* ipa-prop.c (ipa_write_jump_function): Likewise.
      	* rtl.h (extern void rtl_check_failed_flag): Likewise.
      	* gimple.h (gimple_set_location): Likewise.
      	(gimple_has_location): Likewise.
      	* cfgrtl.c (unique_locus_on_edge_between_p): Likewise.
      	(force_nonfallthru_and_redirect): Likewise.
      	(fixup_reorder_chain): Likewise.
      	(cfg_layout_merge_blocks): Likewise.
      
      From-SVN: r191810
      Dehao Chen committed
  16. 19 Sep, 2012 1 commit
    • Integrate lexical block into source_location. · 5368224f
      gcc:
      	2012-09-19  Dehao Chen  <dehao@google.com>
      
      	* toplev.c (general_init): Init block_locations.
      	* tree.c (tree_set_block): New.
      	(tree_block): Change to use LOCATION_BLOCK.
      	* tree.h (TREE_SET_BLOCK): New.
      	* final.c (reemit_insn_block_notes): Change to use LOCATION_BLOCK.
      	(final_start_function): Likewise.
      	* input.c (expand_location_1): Likewise.
      	* input.h (LOCATION_LOCUS): New.
      	(LOCATION_BLOCK): New.
      	(IS_UNKNOWN_LOCATION): New.
      	* fold-const.c (expr_location_or): Change to use new location.
      	* reorg.c (emit_delay_sequence): Likewise.
      	(try_merge_delay_insns): Likewise.
      	* modulo-sched.c (dump_insn_location): Likewise.
      	* lto-streamer-out.c (lto_output_location_bitpack): Likewise.
      	* lto-cgraph.c (output_node_opt_summary): Likewise.
      	* jump.c (rtx_renumbered_equal_p): Likewise.
      	* ifcvt.c (noce_try_move): Likewise.
      	(noce_try_store_flag): Likewise.
      	(noce_try_store_flag_constants): Likewise.
      	(noce_try_addcc): Likewise.
      	(noce_try_store_flag_mask): Likewise.
      	(noce_try_cmove): Likewise.
      	(noce_try_cmove_arith): Likewise.
      	(noce_try_minmax): Likewise.
      	(noce_try_abs): Likewise.
      	(noce_try_sign_mask): Likewise.
      	(noce_try_bitop): Likewise.
      	(noce_process_if_block): Likewise.
      	(cond_move_process_if_block): Likewise.
      	(find_cond_trap): Likewise.
      	* ipa-prop.c (ipa_set_jf_constant): Likewise.
      	(ipa_write_jump_function): Likewise.
      	* dwarf2out.c (add_src_coords_attributes): Likewise.
      	* expr.c (expand_expr_real): Likewise.
      	* tree-parloops.c (create_loop_fn): Likewise.
      	* recog.c (peep2_attempt): Likewise.
      	* function.c (free_after_compilation): Likewise.
      	(expand_function_end): Likewise.
      	(set_insn_locations): Likewise.
      	(thread_prologue_and_epilogue_insns): Likewise.
      	* print-rtl.c (print_rtx): Likewise.
      	* profile.c (branch_prob): Likewise.
      	* trans-mem.c (ipa_tm_scan_irr_block): Likewise.
      	* gimplify.c (gimplify_call_expr): Likewise.
      	* except.c (duplicate_eh_regions_1): Likewise.
      	* emit-rtl.c (try_split): Likewise.
      	(make_insn_raw): Likewise.
      	(make_debug_insn_raw): Likewise.
      	(make_jump_insn_raw): Likewise.
      	(make_call_insn_raw): Likewise.
      	(emit_pattern_after_setloc): Likewise.
      	(emit_pattern_after): Likewise.
      	(emit_debug_insn_after): Likewise.
      	(emit_pattern_before): Likewise.
      	(emit_insn_before_setloc): Likewise.
      	(emit_jump_insn_before): Likewise.
      	(emit_call_insn_before_setloc): Likewise.
      	(emit_call_insn_before): Likeise.
      	(emit_debug_insn_before_setloc): Likewise.
      	(emit_copy_of_insn_after): Likewise.
      	(insn_locators_alloc): Remove.
      	(insn_locators_finalize): Remove.
      	(insn_locators_free): Remove.
      	(set_curr_insn_source_location): Remove.
      	(get_curr_insn_source_location): Remove.
      	(set_curr_insn_block): Remove.
      	(get_curr_insn_block): Remove.
      	(locator_scope): Remove.
      	(insn_scope): Change to use new location.
      	(locator_location): Remove.
      	(insn_line): Change to use new location.
      	(locator_file): Remove.
      	(insn_file): Change to use new location.
      	(locator_eq): Remove.
      	(insn_locations_init): New.
      	(insn_locations_finalize): New.
      	(set_curr_insn_location): New.
      	(curr_insn_location): New.
      	* cfgexpand.c (gimple_assign_rhs_to_tree): Change to use new location.
      	(expand_gimple_cond): Likewise.
      	(expand_call_stmt): Likewise.
      	(expand_gimple_stmt_1): Likewise.
      	(expand_gimple_basic_block): Likewise.
      	(construct_exit_block): Likewise.
      	(gimple_expand_cfg): Likewise.
      	* cfgcleanup.c (try_forward_edges): Likewise.
      	* tree-ssa-live.c (remove_unused_scope_block_p): Likewise.
      	(dump_scope_block): Likewise.
      	(remove_unused_locals): Likewise.
      	* rtl.c (rtx_equal_p_cb): Likewise.
      	(rtx_equal_p): Likewise.
      	* rtl.h (XUINT): New.
      	(INSN_LOCATOR): Remove.
      	(CURR_INSN_LOCATION): Remove.
      	(INSN_LOCATION): New.
      	(INSN_HAS_LOCATION): New.
      	* tree-inline.c (remap_gimple_op_r): Change to use new location.
      	(copy_tree_body_r): Likewise.
      	(copy_phis_for_bb): Likewise.
      	(expand_call_inline): Likewise.
      	* tree-streamer-in.c (lto_input_ts_exp_tree_pointers): Likewise.
      	* tree-streamer-out.c (write_ts_decl_minimal_tree_pointers): Likewise.
      	* gimple-streamer-out.c (output_gimple_stmt): Likewise.
      	* combine.c (try_combine): Likewise.
      	* tree-outof-ssa.c (set_location_for_edge): Likewise.
      	(insert_partition_copy_on_edge): Likewise.
      	(insert_value_copy_on_edge): Likewise.
      	(insert_rtx_to_part_on_edge): Likewise.
      	(insert_part_to_rtx_on_edge): Likewise.
      	* basic-block.h (edge_def): Remove field.
      	* gimple.h (gimple_statement_base): Remove field.
      	(gimple_bb): Change to use new location.
      	(gimple_set_block): Likewise.
      	(gimple_has_location): Likewise.
      	* tree-cfg.c (make_cond_expr_edges): Likewise.
      	(make_goto_expr_edges): Likewise.
      	(gimple_can_merge_blocks_p): Likewise.
      	(move_stmt_op): Likewise.
      	(move_block_to_fn): Likewise.
      	* config/alpha/alpha.c (alpha_output_mi_thunk_osf): Likewise.
      	* config/sparc/sparc.c (sparc_output_mi_thunk): Likewise.
      	* config/i386/i386.c (x86_output_mi_thunk): Likewise.
      	* config/tilegx/tilegx.c (tilegx_output_mi_thunk): Likewise.
      	* config/sh/sh.c (sh_output_mi_thunk): Likewise.
      	* config/ia64/ia64.c (ia64_output_mi_thunk): Likewise.
      	* config/rs6000/rs6000.c (rs6000_output_mi_thunk): Likewise.
      	* config/score/score.c (score_output_mi_thunk): Likewise.
      	* config/tilepro/tilepro.c (tilepro_asm_output_mi_thunk): Likewise.
      	* config/mips/mips.c (mips_output_mi_thunk): Likewise.
      	* cfgrtl.c (unique_locus_on_edge_between_p): Likewise.
      	(unique_locus_on_edge_between_p): Likewise.
      	(emit_nop_for_unique_locus_between): Likewise.
      	(force_nonfallthru_and_redirect): Likewise.
      	(fixup_reorder_chain): Likewise.
      	(cfg_layout_merge_blocks): Likewise.
      	* stmt.c (emit_case_nodes): Likewise.
      
      gcc/lto:
      	2012-09-19  Dehao Chen  <dehao@google.com>
      
      	* lto/lto.c (lto_fixup_prevailing_decls): Remove tree.exp.block field.
      
      libcpp:
      	2012-09-19  Dehao Chen  <dehao@google.com>
      
      	* include/line-map.h (MAX_SOURCE_LOCATION): New value.
      	(location_adhoc_data_fini): New.
      	(get_combined_adhoc_loc): New.
      	(get_data_from_adhoc_loc): New.
      	(get_location_from_adhoc_loc): New.
      	(location_adhoc_data_map): New.
      	(COMBINE_LOCATION_DATA): New.
      	(IS_ADHOC_LOC): New.
      	(expanded_location): New field.
      	(line_maps): New field.
      	* line-map.c (location_adhoc_data): New.
      	(location_adhoc_data_hash): New.
      	(location_adhoc_data_eq): New.
      	(location_adhoc_data_update): New.
      	(get_combined_adhoc_loc): New.
      	(get_data_from_adhoc_loc): New.
      	(get_location_from_adhoc_loc): New.
      	(location_adhoc_data_init): New.
      	(location_adhoc_data_fini): New.
      	(linemap_init): Initialize location_adhoc_data.
      	(linemap_lookup): Change to use new location.
      	(linemap_ordinary_map_lookup): Likewise.
      	(linemap_macro_map_lookup): Likewise.
      	(linemap_macro_map_loc_to_def_point): Likewise.
      	(linemap_macro_map_loc_unwind_toward_spel): Likewise.
      	(linemap_get_expansion_line): Likewise.
      	(linemap_get_expansion_filename): Likewise.
      	(linemap_location_in_system_header_p): Likewise.
      	(linemap_location_from_macro_expansion_p): Likewise.
      	(linemap_macro_loc_to_spelling_point): Likewise.
      	(linemap_macro_loc_to_def_point): Likewise.
      	(linemap_macro_loc_to_exp_point): Likewise.
      	(linemap_resolve_location): Likewise.
      	(linemap_unwind_toward_expansion): Likewise.
      	(linemap_unwind_to_first_non_reserved_loc): Likewise.
      	(linemap_expand_location): Likewise.
      	(linemap_dump_location): Likewise.
      	(linemap_line_start): Likewise.
      
      From-SVN: r191494
      Dehao Chen committed
  17. 30 Apr, 2012 2 commits
    • Make conversion warnings work on NULL with -ftrack-macro-expansion · 70dc395a
      There are various conversion related warnings that trigger on
      potentially dangerous uses of NULL (or __null).  NULL is defined as a
      macro in a system header, so calling warning or warning_at on a
      virtual location of NULL yields no diagnostic.  So the test
      accompanying this patch (as well as others), was failling when run
      with -ftrack-macro-expansion.
      
      I think it's necessary to use the location of NULL that is in the main
      source code (instead of, e.g, the spelling location that is in the
      system header where the macro is defined) in those cases.  Note that
      for __null, we don't have the issue.
      
      I have augmented the test of this patch to check that we don't regress
      when handling __null.
      
      Tested on x86_64-unknown-linux-gnu against trunk.
      
      Note that the bootstrap with -ftrack-macro-expansion exhibits other
      separate issues that are addressed in subsequent patches.  This patch
      just fixes one class of problems.
      
      The patch does pass bootstrap with -ftrack-macro-expansion turned off,
      though.
      
      gcc/
      	* input.h (expansion_point_location_if_in_system_header): Declare
      	new function.
      	* input.c (expansion_point_location_if_in_system_header): Define it.
      gcc/cp/
      
      	* call.c (conversion_null_warnings): Use the new
      	expansion_point_location_if_in_system_header.
      	* cvt.c (build_expr_type_conversion): Likewise.
      	* typeck.c (cp_build_binary_op): Likewise.
      
      gcc/testsuite/
      
      	* g++.dg/warn/Wconversion-null-2.C: Add testing for __null,
      	alongside the previous testing for NULL.
      
      From-SVN: r186972
      Dodji Seketeli committed
    • Make expand_location resolve to locus in main source file · 7eb918cc
      Apparently, quite some places in the compiler (like the C/C++
      preprocessor, the debug info machinery) expect expand_location to
      resolve to locations that are in the main source file, even if the
      token at stake comes from a macro that was defined in a header
      somewhere.  Turning on -ftrack-macro-expansion by default was
      triggering a lot of failures (not necessarily related to diagnostics)
      because expand_location resolves to spelling locations instead.
      
      So I have changed expand_location to honour the initial expectation.
      
      In addition, I came up with the new expand_location_to_spelling_point
      used in diagnostic_build_prefix because the diagnostic system, on the
      other hand, wants to point to the location of the token where it was
      spelled, and then display the error context involving all the macro
      whose expansion led to that spelling point - if we are in the context
      of a macro expansion there.
      
      This seems to me like a reasonable balance.
      
      Tested and bootstrapped on x86_64-unknown-linux-gnu against trunk and
      whitnessed that a lot more tests were PASSing.
      
      Note that the bootstrap with -ftrack-macro-expansion exhibits other
      separate issues that are addressed in subsequent patches.  This patch
      just fixes one class of problems.
      
      The patch does pass bootstrap with -ftrack-macro-expansion turned off,
      though.
      
      gcc/
      
      	* input.c (expand_location_1): New.  Takes a parameter to choose
      	whether to resolve the location to spelling or expansion point.
      	Was factorized from ...
      	(expand_location): ... here.
      	(expand_location_to_spelling_point): New.  Implemented in terms of
      	expand_location_1.
      	* diagnostic.c (diagnostic_build_prefix): Use the new
      	expand_location_to_spelling_point instead of expand_location.
      
      From-SVN: r186969
      Dodji Seketeli committed
  18. 11 Apr, 2012 1 commit
    • re PR c++/24985 (caret diagnostics) · 9fec0042
      2012-04-11  Manuel López-Ibáñez  <manu@gcc.gnu.org>
      
      	PR 24985
      gcc/
              * diagnostic.h (show_caret): Declare.
      	(caret_max_width): Declare.
      	(diagnostic_show_locus): Declare.
              * diagnostic.c (diagnostic_initialize): Initialize to false.
              (diagnostic_show_locus): New.
              (diagnostic_report_diagnostic): Call it.
      	(getenv_columns): New.
      	(adjust_line): New.
      	(diagnostic_set_caret_max_width): New.
              * input.c (read_line): New.
      	(location_get_source_line): New.
              * input.h (location_get_source_line): Declare.
              * toplev.c (general_init): Initialize show_caret from options.
              * dwarf2out.c (gen_producer_string): Handle fdiagnostics-show-caret.
              * opts.c (common_handle_option): Likewise.
      	* pretty-print.h (pp_get_prefix): New.
      	(pp_base_get_prefix): New.
              * common.opt (fdiagnostics-show-caret): New option.
      	* doc/invoke.texi (fdiagnostics-show-caret): Document it.
      testsuite/
              * lib/prune.exp: Add -fno-diagnostics-show-caret.
      libstdc++-v3/
      	* testsuite/lib/prune.exp: Handle caret.
      libmudflap/
      	* testsuite/lib/libmudflap.exp: Handle caret.
      
      From-SVN: r186305
      Manuel López-Ibáñez committed
  19. 17 Oct, 2011 2 commits
    • Add line map statistics to -fmem-report output · 64a1a422
      This patch adds statistics about line maps' memory consumption and
      macro expansion to the output of -fmem-report.  It has been useful in
      trying to reduce the memory consumption of the macro maps support.
      
      Co-Authored-By: Dodji Seketeli <dodji@redhat.com>
      
      From-SVN: r180085
      Tom Tromey committed
    • Linemap infrastructure for virtual locations · 46427374
      This is the first instalment of a set which goal is to track locations
      of tokens across macro expansions.  Tom Tromey did the original work
      and attached the patch to PR preprocessor/7263.  This opus is a
      derivative of that original work.
      
      This patch modifies the linemap module of libcpp to add virtual
      locations support.
      
      A virtual location is a mapped location that can resolve to several
      different physical locations.  It can always resolve to the spelling
      location of a token.  For tokens resulting from macro expansion it can
      resolve to:
        - either the location of the expansion point of the macro.
        - or the location of the token in the definition of the
        macro
        - or, if the token is an argument of a function-like macro,
        the location of the use of the matching macro parameter in
        the definition of the macro
      
      The patch creates a new type of line map called a macro map.  For every
      single macro expansion, there is a macro map that generates a virtual
      location for every single resulting token of the expansion.
      
      The good old type of line map we all know is now called an ordinary
      map.  That one still encodes spelling locations as it has always had.
      
      As a result linemap_lookup as been extended to return a macro map when
      given a virtual location resulting from a macro expansion.  The layout
      of structs line_map has changed to support this new type of map.  So
      did the layout of struct line_maps.  Accessor macros have been
      introduced to avoid messing with the implementation details of these
      datastructures directly.  This helped already as we have been testing
      different ways of arranging these datastructure.  Having to constantly
      adjust client code that is too tied with the internals of line_map and
      line_maps would have been even more painful.
      
      Of course, many new public functions have been added to the linemap
      module to handle the resolution of virtual locations.
      
      This patch introduces the infrastructure but no part of the compiler
      uses virtual locations yet.
      
      However the client code of the linemap data structures has been
      adjusted as per the changes.  E.g, it's not anymore reliable for a
      client code to manipulate struct line_map directly if it just wants to
      deal with spelling locations, because struct line_map can now
      represent a macro map as well.  In that case, it's better to use the
      convenient API to resolve the initial (possibly virtual) location to a
      spelling location (or to an ordinary map) and use that.
      
      This is the reason why the patch adjusts the Java, Ada and Fortran
      front ends.
      
      Also, note that virtual locations are not supposed to be ordered for
      relations '<' and '>' anymore.  To test if a virtual location appears
      "before" another one, one has to use a new operator exposed by the
      line map interface.  The patch updates the only spot (in the
      diagnostics module) I have found that was making the assumption that
      locations were ordered for these relations.  This is the only change
      that introduces a use of the new line map API in this patch, so I am
      adding a regression test for it only.
      
      From-SVN: r180081
      Tom Tromey committed
  20. 03 Dec, 2010 1 commit
    • tree.h (struct call_expr_arg_iterator_d): Remove GTY tag. · 1aa67003
      2010-11-30  Laurynas Biveinis  <laurynas.biveinis@gmail.com>
      
      	* tree.h (struct call_expr_arg_iterator_d): Remove GTY tag.
      	(const_call_expr_arg_iterator_d): Likewise.
      	(expanded_location): Likewise.
      	* c-tree.h (struct c_arg_tag_d): Likewise.
      	* dwarf2out.c (struct cfa_loc): Likewise.
      	(struct skeleton_chain_struct): Likewise.
      	* except.c (struct ttypes_filter): Likewise.
      	* cselib.h (struct cselib_val_struct): Likewise.
      	(elt_loc_list): Likewise.
      	(elt_list): Likewise.
      	* varasm.c (struct addr_const): Likewise.
      	* tree-flow.h (struct edge_prediction): Likewise.
      	(struct int_tree_map): Likewise.
      	(struct _edge_var_map): Likewise.
      
      ada:
      
      2010-11-30  Laurynas Biveinis  <laurynas.biveinis@gmail.com>
      
      	* gcc-interface/decl.c (struct subst_pair_d): Remove GTY tag.
      	(variant_desc_d): Likewise.
      
      cp:
      
      2010-11-30  Laurynas Biveinis  <laurynas.biveinis@gmail.com>
      
      	* cp-tree.h (struct aggr_init_expr_arg_iterator_d): Remove GTY
      	tag.
      
      From-SVN: r167406
      Laurynas Biveinis committed
  21. 27 May, 2010 1 commit
    • input.c: New file. · 447924ef
      	* input.c: New file.
      	* input.h (main_input_filename): Move declaration to toplev.h.
      	* toplev.c (input_location, line_table): Move to input.c
      	* toplev.h (main_input_filename): Move declaration from input.h.
      	* tree.c (expand_location): Move to input.c.
      	* Makefile.in (OBJS-common): Add input.o.
      	(input.o): Add dependencies.
      
      From-SVN: r159914
      Joseph Myers committed
  22. 14 Oct, 2009 1 commit
    • re PR preprocessor/41543 (BUILTINS_LOCATION wrong with -fpreprocessed) · 96c169e1
      	PR preprocessor/41543
      	* input.h (BUILTINS_LOCATION): Change to 1 from 2.
      	Assert BUILTINS_LOCATION < RESERVED_LOCATION_COUNT.
      	* tree.c: Include intl.h.
      	(expand_location): Handle BUILTINS_LOCATION.
      	* Makefile.in (tree.o): Depend on intl.h.
      
      	* include/line-map.h (RESERVED_LOCATION_COUNT): Define.
      	* line-map.c (linemap_init): Initialize highest_location and
      	highest_line to RESERVED_LOCATION_COUNT-1 instead of 0.
      
      	* gcc.dg/debug/dwarf2/pr41543.c: New test.
      
      From-SVN: r152761
      Jakub Jelinek committed
  23. 21 Jul, 2008 1 commit
    • Makefile.in: Replace toplev.h with TOPLEV_H. · aa14403d
      2007-07-21  Rafael Avila de Espindola  <espindola@google.com>
      
      	* Makefile.in: Replace toplev.h with TOPLEV_H.
      	* c-decl.c (merge_decls): Don't set DECL_IN_SYSTEM_HEADER.
      	* c-lex.c (fe_file_change): Don't set in_system_header.
      	* c-parser.c (c_token): Remove in_system_header.
      	(c_lex_one_token): Don't set in_system_header.
      	(c_parser_set_source_position_from_token): Don't set in_system_header.
      	* diagnostic.c (diagnostic_report_diagnostic): Use location from
      	diagnostic_info.
      	(warning_at): New.
      	* diagnostic.h (diagnostic_report_warnings_p): Add LOC argument.
      	* flags.h (in_system_header): Remove.
      	* function.c (saved_in_system_header): Remove.
      	(push_cfun): Don't set in_system_header.
      	(pop_cfun): Don't set in_system_header.
      	(push_struct_function): Don't set in_system_header.
      	* input.h (expanded_location): Add sysp.
      	(in_system_header_at): New.
      	(in_system_header): New.
      	* toplev.c (in_system_header): Remove.
      	* toplev.h: Include input.h
      	(warning_at): New.
      	* tree-cfg.c (execute_warn_function_return): Call warning_at.
      	* tree-ssa.c (warn_uninit): Call warning_at.
      	(warn_uninitialized_var): Update calls to warn_uninit.
      	(warn_uninitialized_phi): Update calls to warn_uninit.
      	* tree.c (make_node_stat): Don't set DECL_IN_SYSTEM_HEADER.
      	(expand_location): Initialize xloc.sysp.
      	* tree.h (DECL_IN_SYSTEM_HEADER): Use in_system_header_at.
      	(tree_decl_with_vis): Remove in_system_header_flag.
      
      2007-07-21  Rafael Avila de Espindola  <espindola@google.com>
      
      	* parser.c (cp_token): Remove in_system_header.
      	(eof_token): Remove in_system_header.
      	(cp_lexer_get_preprocessor_token): Don't set in_system_header.
      	(cp_lexer_set_source_position_from_token): Don't set in_system_header.
      	(cp_parser_member_declaration):  Use in_system_header_at.
      	* pt.c (lookup_template_class): Don't set DECL_IN_SYSTEM_HEADER.
      	(pop_tinst_level): Don't set in_system_header.
      	(instantiate_class_template): Don't set in_system_header.
      	(instantiate_decl): Don't set in_system_header.
      	(instantiate_pending_templates): Don't set in_system_header.
      
      From-SVN: r138031
      Rafael Avila de Espindola committed
  24. 29 Feb, 2008 1 commit
    • toplev.c (input_file_stack, [...]): Remove. · 966e8f4d
      gcc
      	* toplev.c (input_file_stack, input_file_stack_tick, fs_p,
      	input_file_stack_history, input_file_stack_restored): Remove.
      	(push_srcloc, pop_srcloc, restore_input_file_stack): Likewise.
      	* input.h (struct file_stack): Remove.
      	(push_srcloc, pop_srcloc, restore_input_file_stack): Likewise.
      	(input_file_stack, input_file_stack_tick, INPUT_FILE_STACK_BITS):
      	Likewise.
      	* diagnostic.h (struct diagnostic_context) <last_module>: Change
      	type.
      	(diagnostic_last_module_changed): Add 'map' argument.
      	(diagnostic_set_last_function): Likewise.
      	* diagnostic.c (undiagnostic_report_current_module): Iterate using
      	line map, not input_file_stack.
      	* c-lex.c (fe_file_change): Don't use push_srcloc or pop_srcloc.
      gcc/cp
      	* parser.c (struct cp_token) <input_file_stack_index>: Remove.
      	(cp_lexer_get_preprocessor_token): Update.
      	(cp_lexer_set_source_position_from_token): Don't call
      	restore_input_file_stack.
      	* lex.c (cxx_init): Don't use push_srcloc or pop_srcloc.
      gcc/testsuite
      	* g++.dg/warn/pragma-system_header2.C: Ignore "included from"
      	line.
      
      From-SVN: r132775
      Tom Tromey committed
  25. 26 Feb, 2008 1 commit
    • system.h (USE_MAPPED_LOCATION): Poison. · 2d593c86
      gcc
      	* system.h (USE_MAPPED_LOCATION): Poison.
      	* Makefile.in (GTFILES): Put CPP_ID_DATA_H first.
      	* tree-cfg.c (make_cond_expr_edges): Remove old location code.
      	(make_goto_expr_edges): Likewise.
      	(remove_bb): Likewise.
      	(execute_warn_function_return): Likewise.
      	* basic-block.h (struct edge_def) <goto_locus>: Change type to
      	location_t.
      	* c-common.c (fname_decl): Remove old location code.
      	* tree-vect-transform.c (vect_finish_stmt_generation): Remove old
      	location code.
      	* rtl.h (ASM_OPERANDS_SOURCE_LOCATION): Remove old-location
      	variant.
      	(ASM_INPUT_SOURCE_LOCATION): Likewise.
      	(gen_rtx_ASM_INPUT): Likewise.
      	(gen_rtx_ASM_INPUT_loc): Likewise.
      	(get_rtx_asm_OPERANDS): Remove.
      	* cfglayout.c (insn_locators_alloc): Remove old location code.
      	(set_curr_insn_source_location): Likewise.
      	(curr_insn_locator): Likewise.
      	* print-tree.c (print_node): Remove old location code.
      	* tree-mudflap.c (mf_varname_tree): Remove old location code.
      	(mf_file_function_line_tree): Remove test of USE_MAPPED_LOCATION.
      	* cfgexpand.c (expand_gimple_cond_expr): Don't use
      	location_from_locus.
      	(construct_exit_block): Remove old location code.
      	* emit-rtl.c (force_next_line_note): Remove old location code.
      	* profile.c (branch_prob): Remove old location code.
      	* tree-vectorizer.h (LOC, UNKNOWN_LOC, EXPR_LOC, LOC_FILE,
      	LOC_LINE): Remove old-location variants.
      	* langhooks.c (lhd_print_error_function): Remove old location
      	code.
      	* configure, config.in: Rebuilt.
      	* configure.ac (--enable-mapped-location): Remove.
      	* c-decl.c (c_init_decl_processing): Remove old location code.
      	(finish_function): Likewise.
      	* recog.c (decode_asm_operands): Remove old location code.
      	* c-pch.c (c_common_read_pch): Remove old location code.
      	* rtl.def (ASM_INPUT, ASM_OPERANDS): Remove old location
      	variants.
      	* gimple-low.c (lower_function_body): Remove old location code.
      	* toplev.c (unknown_location): Remove.
      	(push_srcloc): Remove old-location variant.
      	(process_options): Remove old location code.
      	(lang_dependent_init): Likewise.
      	* input.h (UNKNOWN_LOCATION): Move definition.
      	(location_t): Undeprecate.
      	(source_locus): Remove.
      	(location_from_locus): Remove.
      	(struct location_s): Remove.
      	Remove all old-location code.
      	(input_line, input_filename): Remove.
      	* final.c (final_scan_insn): Remove old location code.
      	* diagnostic.c (diagnostic_build_prefix): Remove
      	USE_MAPPED_LOCATION test.
      	* tree.h (gimple_stmt) <locus>: Now a location_t.
      	(tree_exp) <locus>: Likewise.
      	(DECL_IS_BUILTIN): Remove old-location variant.
      	(annotate_with_file_line, annotate_with_locus): Likewise.
      	(expr_locus, set_expr_locus): Update.
      	* tree.c (build1_stat): Remove old location code.
      	(last_annotated_node): Remove.
      	(annotate_with_file_line): Remove old-location variant.
      	(annotate_with_locus): Likewise.
      	(expr_location): Remove old location code.
      	(set_expr_location): Likewise.
      	(expr_has_location): Likewise.
      	(expr_locus): Likewise.
      	(set_expr_locus): Likewise.
      	(expr_filename): Don't use location_from_locus.
      	(expr_lineno): Likewise.
      	* rtl-error.c (location_for_asm): Remove old location code.
      	* c-lex.c (cb_line_change): Remove old location code.
      	(fe_file_change): Likewise.
      	(cb_def_pragma): Likewise.
      	(c_lex_with_flags): Likewise.
      	* gengtype.c (do_typedef): Don't special-case location types.
      	(define_location_structures): Remove.
      	(main): Don't call define_location_structures.
      	* tree-pretty-print.c (dump_implicit_edges): Remove old location
      	code.
      gcc/ada
      	* misc.c (internal_error_function): Remove test of
      	USE_MAPPED_LOCATION.
      	* trans.c (gigi): Remove test of USE_MAPPED_LOCATION.
      	(Sloc_to_locus): Remove old location code.
      gcc/cp
      	* parser.c (eof_token): Remove old location code.
      	(check_empty_body): Remove test of USE_MAPPED_LOCATION.
      	* decl2.c (generate_ctor_or_dtor_function): Remove old location
      	code.
      	(cp_write_global_declarations): Likewise.
      	* lex.c (cxx_init): Remove old location code.
      	(handle_pragma_implementation): Remove test of
      	USE_MAPPED_LOCATION.
      	* pt.c (tsubst): Remove old location code.
      	* error.c (cp_print_error_function): Remove test of
      	USE_MAPPED_LOCATION.
      	* decl.c (pop_label): Remove old location code.
      	(finish_function): Likewise.
      gcc/fortran
      	* trans-io.c (set_error_locus): Remove old location code.
      	* trans-decl.c (gfc_set_decl_location): Remove old location code.
      	* f95-lang.c (gfc_init): Remove test of USE_MAPPED_LOCATION.
      	* scanner.c (gfc_gobble_whitespace): Remove old location code.
      	(get_file): Likewise.
      	(preprocessor_line): Likewise.
      	(load_file): Likewise.
      	(gfc_new_file): Likewise.
      	* trans.c (gfc_trans_runtime_check): Remove old location code.
      	(gfc_get_backend_locus): Likewise.
      	(gfc_set_backend_locus): Likewise.
      	* data.c (gfc_assign_data_value): Remove old location code.
      	* error.c (show_locus): Remove old location code.
      	* gfortran.h (gfc_linebuf): Remove old location code.
      	(gfc_linebuf_linenum): Remove old-location variant.
      gcc/java
      	* lang.c (java_post_options): Remove conditional.
      	* expr.c (expand_byte_code): Remove old location code.
      	* jcf-parse.c (set_source_filename): Remove old location code.
      	(give_name_to_class): Likewise.
      	(jcf_parse): Likewise.
      	(duplicate_class_warning): Likewise.
      	(parse_class_file): Likewise.
      	(java_parse_file): Likewise.
      	* decl.c (finish_method): Remove old location code.
      	* class.c (push_class): Remove old location code.
      gcc/objc
      	* objc-act.c (objc_init): Remove old location code.
      gcc/treelang
      	* tree1.c (treelang_init): Remove old location code.
      	(treelang_parse_file): Likewise.
      	* lex.l (LINEMAP_POSITION_FOR_COLUMN): Remove.
      	(update_lineno_charno): Remove old location code.
      
      From-SVN: r132679
      Tom Tromey committed
  26. 06 Sep, 2007 1 commit
    • tree-cfg.c (remove_bb): Only warn if line is non-zero. · 5ffeb913
      gcc:
      	* tree-cfg.c (remove_bb): Only warn if line is non-zero.
      	* c-pch.c (c_common_read_pch): Restore current location after
      	reading PCH file.
      	* tree.c (expand_location): Update.
      	(expr_filename): Changed return type.  Unified the two cases.
      	(expr_lineno): Likewise.
      	(annotate_with_file_line): Don't use EXPR_LINENO and EXPR_FILENAME
      	as lvalues.
      	* toplev.c (line_table): Changed type.
      	(general_init): Update.
      	(realloc_for_line_map): New function.
      	(general_init): Allocate line_table using GC.
      	* fix-header.c (line_table): Changed type.
      	(read_scan_file): Update.
      	(read_scan_file): Update.
      	* c-ppoutput.c (maybe_print_line): Update.
      	(print_line): Update.
      	(cb_line_change): Update.
      	(cb_define): Update.
      	(pp_file_change): Update.
      	* c-opts.c (c_common_init_options): Update.
      	(finish_options): Update.
      	(push_command_line_include): Update.
      	* c-lex.c (cb_line_change): Update.
      	(cb_def_pragma): Update.
      	(cb_define): Update.
      	(cb_undef): Update.
      	(c_lex_with_flags): Use cpp_get_token_with_location.
      	* input.h (line_table): Changed type.
      	(location_from_locus): New macro.
      	* tree.h (EXPR_FILENAME): No longer an lvalue.
      	(EXPR_LINENO): Likewise.
      	(expr_locus, set_expr_locus): Declare separately for
      	USE_MAPPED_LOCATION.
      	(expr_filename, expr_lineno): Changed return type.
      	* gimplify.c (tree_to_gimple_tuple): Use SET_EXPR_LOCUS.
      	* cfgexpand.c (expand_gimple_cond_expr): Use location_from_locus.
      	(expand_gimple_basic_block): Likewise.
      	* final.c (final_scan_insn): Use expanded_location.
      gcc/cp:
      	* decl.c (finish_function): Put return's location on line zero of
      	file.
      gcc/fortran:
      	* scanner.c (get_file): Update.
      	(load_file): Update.
      	(gfc_next_char_literal): Use gfc_linebuf_linenum.
      	* f95-lang.c (gfc_init): Update.
      	* gfortran.h (gfc_linebuf_linenum): New macro.
      gcc/java:
      	* lang.c (java_post_options): Update.
      	* jcf-parse.c (set_source_filename): Update.
      	(give_name_to_class): Update.
      	(jcf_parse): Update.
      	(duplicate_class_warning): Update.
      	(parse_class_file): Update.
      	(java_parse_file): Update.
      	* expr.c (expand_byte_code): Update.
      gcc/testsuite:
      	* lib/g++.exp (g++_target_compile): Use -fno-show-column.
      gcc/treelang:
      	* tree1.c (treelang_init): Update.
      	(treelang_parse_file): Update.
      	(treelang_parse_file): Update.
      	(treelang_parse_file): Update.
      	* lex.l: Update.
      	(update_lineno_charno): Likewise.
      libcpp:
      	* internal.h (struct cpp_reader) <invocation_location>: New
      	field.
      	(struct cpp_reader) <set_invocation_location>: Likewise.
      	* init.c (cpp_set_line_map): New function.
      	* line-map.c (linemap_add): Use linemap's allocator.
      	* include/line-map.h (GTY): Define.
      	(line_map_realloc): New typedef.
      	(struct line_map): Mark with GTY.
      	(struct line_maps): Likewise.
      	(struct line_maps) <maps>: Likewise.
      	(struct line_maps) <reallocator>: New field.
      	* include/symtab.h (GTY): Conditionally define.
      	* include/cpplib.h (cpp_set_line_map): Declare.
      	(cpp_get_token_with_location): Declare.
      	* macro.c (cpp_get_token): Set invocation_location on the reader.
      	(cpp_get_token_with_location): New function.
      
      From-SVN: r128190
      Tom Tromey committed
  27. 26 Jul, 2007 1 commit
  28. 26 Mar, 2007 1 commit
    • gengtype-parse.c: New file. · 01d419ae
      	* gengtype-parse.c: New file.
      	* gengtype-yacc.y: Delete.
      	* gengtype-lex.l: Don't include gengtype-yacc.h.
      	Define YY_DECL and yyterminate appropriately for recursive
      	descent parser.  yylval is now a string out-parameter to yylex.
      	(HWS, EOID): New shorthand.
      	(IWORD): Add a couple more types.
      	(yylex): Add a setup stanza.  Remove the complex rules for
      	detecting GTY'ed types and typedefs; replace with simple
      	keyword detectors.  Adjust everything for the changed
      	definition of yylval.  Ignore all pp-directives, not just #define.
      	(yyerror): Delete.
      	(parse_file): Rename yybegin; do not call yyparse.
      	(yyend): New.
      	* gengtype.c (xasprintf): Export again.
      	(this_file): New.  Use everywhere __FILE__ was being used.
      	(get_lang_bitmap): Special case types defined in gengtype.c.
      	(do_typedef, new_structure): Suppress definition of certain types.
      	(new_structure): Improve diagnostics of duplicate definitions.
      	Make sure location_s is associated with input.h.
      	(nreverse_pairs, define_location_structures): New functions.
      	(main): Improve tagging of kludge types.  Remove old kludges
      	for input.h types; use define_location_structures.
      	* gengtype.h: Update prototypes.  Define token codes here.
      	* Makefile.in: Remove all references to gengtype-yacc.
      	Add rules for gengtype-parse.o.  Adjust rules for gengtype-lex.o
      	and gengtype.
      	* bitmap.h (struct bitmap_head_def): Coalesce definitions,
      	add GTY((skip)) to the field that's only conditionally there.
      	* doc/install.texi: Document that Bison is no longer required
      	unless building treelang.
      
      From-SVN: r123235
      Zack Weinberg committed
  29. 26 Aug, 2006 1 commit
    • re PR c++/24009 (C++ fails to print #include stack) · 02ec74b9
      	PR c++/24009
      	* input.h (restore_input_file_stack): Declare.
      	(INPUT_FILE_STACK_BITS): Define.
      	* toplev.c (fs_p, input_file_stack_history,
      	input_file_stack_restored, restore_input_file_stack): New.
      	(push_srcloc, pop_srcloc): Check for input_file_stack_tick
      	overflowing INPUT_FILE_STACK_BITS bits.  Save new state of stack.
      	(pop_srcloc): Don't free old state of stack.
      
      cp:
      	* parser.c (struct cp_token): Add input_file_stack_index.
      	(eof_token): Update.
      	(cp_lexer_get_preprocessor_token): Save input_file_stack_tick.
      	(cp_lexer_set_source_position_from_token): Restore input file
      	stack.
      
      From-SVN: r116479
      Joseph Myers committed
  30. 25 Jun, 2005 1 commit
  31. 15 Jul, 2004 1 commit
    • input.h: If USE_MAPPED_LOCATION... · aa3c6dc1
      	* input.h:  If USE_MAPPED_LOCATION, define separate expanded_location
      	structure with extra column field.
      	* tree.c (expand_location):  Also fill in column field.
      	* gengtype-lex.l:  Ignore expanded_location typedef, sinze gengtype
      	gets confused by the two conditionally-compiled definitions.
      
      From-SVN: r84721
      Per Bothner committed
  32. 30 Jun, 2004 1 commit
    • Conditionally compile support for --enable-mapped_location. · c1667470
      	* input.h:  #include line-map.h for source_location typedef.
      	(BUILTINS_LOCATION, UNKNOWN_LOCATION, expand_location,
      	LOCATION_FILE, LOCATION_LINE):  New macros and functions.
      	(expanded_location, source_locus):  New typedefs.
      	(push_srcloc):  Change parameter list if USE_MAPPED_LOCATION.
      	* rtl.def (NOTE, ASM_OPERANDS):  Modify specifcation, if
      	USE_MAPPED_LOCATION.
      	* rtl.h (NOTE_DELETED_LABEL_NAME):  New macro.
      	(NOTE_SOURCE_LOCATION, NOTE_EXPNDED_LOCATION, SET_INSN_DELETED):
      	New conditional macros.
      	(ASM_OPERANDS_SOURCE_FILE, ASM_OPERANDS_SOURCE_LINE):  Replace
      	by ASM_OPERANDS_SOURCE_LOCATION if USE_MAPPED_LOCATION.
      	* tree.h (EXPR_LOCATION, SET_EXPR_LOCATION, EXPR_HAS_LOCATION,
      	EXPR_LOCUS, SET_EXPR_LOCUS, EXPR_FILENAME, EXPR_LINENO,
      	DECL_IS_BUILTIN):  New macros, most depending on USE_MAPPED__LOCATION.
      	(tree_exp):  Change type of locus to use new source_locus typedef.
      	* tree.c (build1_stat):  Use SET_EXPR_LOCATION.
      	(annotate_with_locus, annotate_with_file_line):  Conditionalize.
      	(expand_location):  New function.
      	* toplev.c (unknown_location):  New static, when USE_MAPPED_LOCATION.
      	(push_srcloc, pop_loc):  Adjust parameter handling.
      	(process_options):  Don't set input_filename by itself.
      	(lang_dependent_init):  Save, set input_location to <built-in>.
      	(warn_deprecated_use):  Use expand_location.
      
      From-SVN: r83918
      Per Bothner committed
  33. 13 May, 2004 1 commit
  34. 20 Feb, 2004 1 commit
    • input.h: Don't #include line-map.h. · 2ae5c785
      	* input.h:  Don't #include line-map.h.  It may cause link problems
      	with undefined linemap_line_start when line-map.h is included but
      	line-map.o is not linked, as currently happens with gengtype on
      	compilers that don't support inline.
      	* toplev.c:  So we do have to explicitly #include line-map.h here.
      
      From-SVN: r78185
      Per Bothner committed
  35. 21 Jan, 2004 1 commit
    • alias.c, [...]: Update copyright. · d9221e01
      	* alias.c, basic-block.h, c-common.c, c-common.h,
      	c-cppbuiltin.c, c-opts.c, c-pragma.c, c-pretty-print.c,
      	calls.c, cfg.c, cfgcleanup.c, cfgrtl.c, cgraph.h, collect2.c,
      	combine.c, cppcharset.c, cpphash.h, cppinit.c, cpplib.c,
      	cpplib.h, cppmacro.c, crtstuff.c, cselib.c, cselib.h,
      	defaults.h, df.c, dominance.c, et-forest.c, expmed.c, expr.c,
      	expr.h, fix-header.c, function.h, gcc.c, gcse.c, genattrtab.c,
      	genautomata.c, genconditions.c, genemit.c, genflags.c,
      	gengtype.c, gengtype.h, genopinit.c, genrecog.c, gensupport.c,
      	ggc-zone.c, graph.c, haifa-sched.c, input.h, integrate.c,
      	langhooks-def.h, langhooks.c, langhooks.h, line-map.c,
      	line-map.h, local-alloc.c, optabs.c, optabs.h, postreload.c,
      	ra.h, recog.c, reg-stack.c, regmove.c, reload.c, reorg.c,
      	rtl.c, sched-deps.c, sched-ebb.c, sdbout.c, system.h,
      	target.h, targhooks.c, toplev.h, tree-inline.c, unwind-pe.h,
      	unwind.h, varray.c, varray.h: Update copyright.
      
      From-SVN: r76302
      Kazu Hirata committed
  36. 20 Jan, 2004 1 commit
    • Move cpp_reader's line_maps field to a shared global. · 50f59cd7
      	* cpphash.h (cpp_reader):  Rename line_maps field to line_table
      	and change the type to a pointer rather than a struct.
      	* cppinit.c (cpp_push_main_field):  Adjust accordingly.
      	* cpplib.c (do_include_common, _cpp_do_file_change, cpp_get_callbacks):
      	Likewise.
      	* cppfiles.c (validate_pch):  Likewise.
      	* cppmacro.c (_cpp_warn_if_unused_macro, _cpp_builtin_macro_text):
      	Likewise.
      	* cpperror.c (print_location):  Likewise.
      	* cpplib.h (cpp_create_reader):  New line_maps pointer parameter.
      	* cppinit.c (cpp_create_reader):  Handle new parameter.
      	(cpp_destroy):  Don't free line_maps - that's no longer our job.
      	* input.h (line_table):  New variable.
      	* toplev.c (line_table):  Declare variable.
      	(general_init):  Initialize line_table.
      	* c-opts.c (c_common_init_options):  Pass line_table to
      	cpp_create_reader.
      	* fix-header.c (read_scan_file):  New local variable line_table.
      	Initialize, and pass it to cpp_create_reader.
      	* Makefile.in (LIBS, LIBDEPS):  Add libcpp.a.
      	(C_AND_OBJC_OBJS, fix-header):  Remove redundant libcpp.a.
      
      From-SVN: r76198
      Per Bothner committed
  37. 16 Sep, 2003 1 commit
    • c-common.c (handle_warn_unused_result_attribute): New function. · 72954a4f
      	* c-common.c (handle_warn_unused_result_attribute): New function.
      	(c_common_attribute_table): Add warn_unused_result.
      	(c_expand_expr): Issue warning when result of inlined function
      	with warn_unused_result attribute is ignored.
      	* calls.c (expand_call): Issue warning when result of function
      	with warn_unused_result attribute is ignored.
      	* c-common.h (STMT_EXPR_WARN_UNUSED_RESULT): Define.
      	* expr.c (expr_wfl_stack): Define.
      	(expand_expr) <case EXPR_WITH_FILE_LOCATION>: If ignore,
      	pass const0_rtx as target.  Chain locations into expr_wfl_stack.
      	* tree-inline.c (expand_call_inline): Set STMT_EXPR_WARN_UNUSED_RESULT
      	bit if inlined function has warn_unused_result attribute.
      	* input.h (expr_wfl_stack): Declare.
      	* doc/extend.texi: Document warn_unused_result attribute.
      
      	* gcc.dg/attr-warn-unused-result.c: New test.
      
      Co-Authored-By: Jakub Jelinek <jakub@redhat.com>
      
      From-SVN: r71424
      Jason Merrill committed