Skip to content
Snippets Groups Projects
  1. Jan 14, 2013
  2. Jan 03, 2013
    • Marc Glisse's avatar
      re PR bootstrap/50167 (gmp memory functions are extern "C" (graphite)) · 8ac16127
      Marc Glisse authored
      2013-01-03  Marc Glisse  <marc.glisse@inria.fr>
      
      	PR bootstrap/50167
      gcc/
      	* graphite-interchange.c (pdr_stride_in_loop): Use gmp_fprintf.
      	* graphite-poly.c (debug_gmp_value): Likewise.
      
      	PR bootstrap/50177
      libcpp/
      	* line-map.c (get_combined_adhoc_loc): Cast from extern "C" type.
      	(new_linemap): Likewise.
      	(linemap_enter_macro): Likewise.
      
      From-SVN: r194868
      8ac16127
  3. Sep 25, 2012
    • Dehao Chen's avatar
      re PR middle-end/54704 (three-fold increase in compile-time between r191483 and r191569) · ec6e0399
      Dehao Chen authored
      libcpp:
      	2012-09-25  Dehao Chen  <dehao@google.com>
      
      	PR middle-end/54704
      	* line-map.c (location_adhoc_data_hash): Fix the hash function.
      
      From-SVN: r191747
      ec6e0399
    • Dehao Chen's avatar
      re PR middle-end/54645 (Many testsuite failures) · 52187008
      Dehao Chen authored
      gcc:
      	2012-09-25  Dehao Chen  <dehao@google.com>
      
      	PR middle-end/54645
      	* c-family/c-pch.c (c_common_read_pch): Rebuild the location_adhoc_data
      	map when read in the pch.
      
      libcpp:
      	2012-09-25  Dehao Chen  <dehao@google.com>
      
      	PR middle-end/54645
      	* include/line-map.h (location_adhoc_data): Move location_adhoc_data
      	into GC.
      	(location_adhoc_data_map): Likewise.
      	(line_maps): Likewise.
      	(rebuild_location_adhoc_htab): New Function.
      	* line-map.c (+rebuild_location_adhoc_htab): new Funcion.
      	(get_combined_adhoc_loc): Move location_adhoc_data into GC.
      	(location_adhoc_data_fini): Likewise.
      	(linemap_init): Likewise.
      	(location_adhoc_data_init): Remove Function.
      
      From-SVN: r191706
      52187008
  4. Sep 19, 2012
    • Dehao Chen's avatar
      Integrate lexical block into source_location. · 5368224f
      Dehao Chen authored
      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
      5368224f
  5. Jun 05, 2012
  6. Jun 04, 2012
    • Dodji Seketeli's avatar
      PR preprocessor/53463 - Fix system header detection for built-in macro tokens · 7ca643e1
      Dodji Seketeli authored
      The location for a built-in macro token is BUILTIN_LOCATION.  When we
      see that location value, we cannot know if that token was used in a
      system header or not.  And that can trigger some unwanted warnings on
      e.g, the use of __LONG_LONG_MAX__ built-in macro in system headers
      when we compile with -pedantic, like in the test case accompanying
      this patch.
      
      In that case, I think we ought to step-up to see where the built-in
      macro has been expanded, until we see a location that is not for a
      built-in macro.  Then we can check if the resulting location is in a
      system header or not.
      
      Now that we step up to the location of first non-built-in-macro token,
      it appeared that for
      testsuite/c-c++-common/dfp/convert-int-saturate.c, G++ then fails to
      emit the warning in:
      
          volatile unsigned int usi;
          int
          main ()
          {
            usi = DEC32_MAX;  /* { dg-warning "overflow in implicit constant conversion" } */
           ...
          }
      
      Because DEC32_MAX is defined in the system header float.h as a
      built-in macro:
      
          #define DEC32_MAX	__DEC32_MAX__
      
      And during the parsing of the assignment expression that should have
      led to the warning above, input_location is set to the location for
      the DEC32_MAX, which is actually the location for the built-in
      __DECL32_MAX_EXP.
      
      A possible fix is to use the location of the "=" operator as the
      default location for assignment expressions.  This is what the patch
      does.
      
      I had to adjust a couple of tests to arrange for this.
      
      Bootstrapped and tested on x86_64-unknown-linux-gnu against trunk.
      
      libcpp/
      
      	PR preprocessor/53463
      	* line-map.c (linemap_location_in_system_header_p): For built-in
      	macro tokens, check the first expansion point location for that is
      	not for a token coming from a built-in macro.
      
      gcc/cp/
      
      	PR preprocessor/53463
      	* parser.c (cp_parser_assignment_expression): Use the location
      	for the LHS as the default location for the expression.
      
      gcc/testsuite/
      
      	PR preprocessor/53463
      	* g++.dg/cpp/limits.C: New test.
      	* g++.dg/parse/error19.C: Adjust.
      	* g++.dg/warn/Wconversion-real-integer2.C: Likewise.
      	* g++.dg/warn/pr35635.C: Likewise.
      	* g++.old-deja/g++.pt/assign1.C: Likewise.
      
      From-SVN: r188203
      7ca643e1
  7. May 29, 2012
    • Joseph Myers's avatar
      directives.c: Fix typos. · 7d9641cc
      Joseph Myers authored
      	* directives.c: Fix typos.
      	* include/line-map.h: Fix typos.
      	* line-map.c: Fix typos.
      	* macro.c: Fix typos.
      
      From-SVN: r187966
      7d9641cc
  8. Apr 30, 2012
    • Dodji Seketeli's avatar
      Strip "<built-in>" loc from displayed expansion context · c4ca1a09
      Dodji Seketeli authored
      Now that diagnostics for tokens coming from macro expansions point to
      the spelling location of the relevant token (and then displays the
      context of the expansion), some ugly (not so seldom) corner cases can
      happen.
      
      When the relevant token is a built-in token (which means the location
      of that token is BUILTINS_LOCATION) the location prefix displayed to
      the user in the diagnostic line is the "<built-in>:0:0" string.  For
      instance:
      
          <built-in>:0:0: warning: conversion to 'float' alters 'int' constant value
      
      For the user, I think this is surprising and useless.
      
      A more user-friendly approach would be to refer to the first location
      that (in the reported macro expansion context) is for a location in
      real source code, like what is shown in the new test case
      gcc/testsuite/g++.dg/warn/Wconversion-real-integer2.C accompanying
      this patch.
      
      To do this, I am making the line-map module provide a new
      linemap_unwind_to_first_non_reserved_loc function that resolves a
      virtual location to the first spelling location that is in real source
      code.
      
      I am then using that facility in the diagnostics printing module and
      in the macro unwinder to avoid printing diagnostics lines that refer
      to the locations for built-ins or more generally for reserved
      locations.  Note that when I start the dance of skipping a built-in
      location I also skip locations that are in system headers, because it
      turned out that a lot of those built-ins are actually used in system
      headers (e.g, "#define INT_MAX __INT_MAX__" where __INT_MAX__ is a
      built-in).
      
      Besides the user-friendliness gain, this patch allows a number of
      regression tests to PASS unchanged with and without
      -ftrack-macro-expansion.
      
      Tested and bootstrapped 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.
      
      libcpp/
      
      	* include/line-map.h (linemap_unwind_toward_expansion): Fix typo
      	in comment.
      	(linemap_unwind_to_first_non_reserved_loc): Declare new function.
      	* line-map.c (linemap_unwind_to_first_non_reserved_loc): Define
      	new function.
      
      gcc/
      
      	* input.c (expand_location_1): When expanding to spelling location
      	in a context of a macro expansion, skip reserved system header
      	locations.  Update comments.  * tree-diagnostic.c
      	(maybe_unwind_expanded_macro_loc): Likewise.
      
      gcc/testsuite/
      
      	* g++.dg/warn/Wconversion-real-integer2.C: New test.
      	* g++.dg/warn/Wconversion-real-integer-3.C: Likewise.
      	* g++.dg/warn/conversion-real-integer-3.h: New header used by the
      	new test above.
      
      From-SVN: r186970
      c4ca1a09
  9. Apr 26, 2012
    • Manuel López-Ibáñez's avatar
      tree-diagnostic.c (maybe_unwind_expanded_macro_loc): Fix comment. · 1d72e96f
      Manuel López-Ibáñez authored
      2012-04-26  Manuel López-Ibáñez  <manu@gcc.gnu.org>
      
      	* tree-diagnostic.c (maybe_unwind_expanded_macro_loc): Fix
      	comment. Delete unused parameter first_exp_point_map.
      	(virt_loc_aware_diagnostic_finalizer): Update call.
      libcpp/
      	* line-map.c (linemap_resolve_location): Synchronize comments with
      	those in line-map.h.
      	* include/line-map.h (linemap_resolve_location): Fix spelling in
      	comment.
      
      From-SVN: r186860
      1d72e96f
  10. Nov 22, 2011
  11. Oct 25, 2011
    • Dodji Seketeli's avatar
      Fix lookup of macro maps · 3bb0c8db
      Dodji Seketeli authored
      	* line-map.c (linemap_macro_map_lookup): Fix logic.
      
      From-SVN: r180427
      3bb0c8db
    • Dodji Seketeli's avatar
      Support expansion of reserved locations wrapped in virtual locations · 84756fd4
      Dodji Seketeli authored
      libcpp/
      
      	* include/line-map.h (linemap_expand_location): Take a line table
      	parameter.  Update comment.
      	(linemap_resolve_location): Update comment.
      	(linemap_expand_location_full): Remove.
      	* line-map.c (linemap_resolve_location):  Handle reserved
      	locations; return a NULL map in those cases.
      	(linemap_expand_location): If location is reserved, return a
      	zeroed expanded location.  Update comment.  Take a line table to
      	assert that the function takes non-virtual locations only.
      	(linemap_expand_location_full): remove.
      	(linemap_dump_location): Handle the fact that
      	linemap_resolve_location can return NULL line maps when the
      	location resolves to a reserved location.
      
      gcc/
      	* input.c (expand_location): Rewrite using
      	linemap_resolve_location and linemap_expand_location.  Add a
      	comment.
      
      From-SVN: r180426
      84756fd4
  12. Oct 18, 2011
    • Dodji Seketeli's avatar
      Fix bootstrap on !NO_IMPLICIT_EXTERN_C and ia32 targets · d17687f6
      Dodji Seketeli authored
      libcpp/
      
      	* include/line-map.h (struct linemap_stats): Change the type of
      	the members from size_t to long.
      	* macro.c (macro_arg_token_iter_init): Unconditionally initialize
      	iter->location_ptr.
      
      gcc/c-family/
      
      	* c-lex.c (fe_file_change): Use LINEMAP_SYSP when
      	!NO_IMPLICIT_EXTERN_C.
      
      gcc/
      	* input.c (dump_line_table_statistics): Use long, not size_t.
      
      From-SVN: r180124
      d17687f6
  13. Oct 17, 2011
    • Dodji Seketeli's avatar
      Fix bootstrapping with --disable-checking · 411f92de
      Dodji Seketeli authored
      libcpp/ChangeLog
      
      	* line-map.c (linemap_macro_map_loc_to_exp_point): Avoid setting a
      	variable without using it if ENABLE_CHECKING is not defined.  Mark
      	the LOCATION parameter as being unused.
      
      From-SVN: r180090
      411f92de
    • Tom Tromey's avatar
      Reduce memory waste due to non-power-of-2 allocs · b9bd6f74
      Tom Tromey authored
      
      This patch basically arranges for the allocation size of line_map
      buffers to be as close as possible to a power of two.  This
      *significantly* decreases peak memory consumption as (macro) maps are
      numerous and stay live during all the compilation.
      
      The patch adds a new ggc_round_alloc_size interface to the ggc
      allocator.  In each of the two main allocator implementations ('page'
      and 'zone') the function has been extracted from the main allocation
      function code and returns the actual size of the allocated memory
      region, thus giving a chance to the caller to maximize the amount of
      memory it actually uses from the allocated memory region.  In the
      'none' allocator implementation (that uses xmalloc) the
      ggc_round_alloc_size just returns the requested allocation size.
      
      Co-Authored-By: default avatarDodji Seketeli <dodji@redhat.com>
      
      From-SVN: r180086
      b9bd6f74
    • Tom Tromey's avatar
      Add line map statistics to -fmem-report output · 64a1a422
      Tom Tromey authored
      
      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: default avatarDodji Seketeli <dodji@redhat.com>
      
      From-SVN: r180085
      64a1a422
    • Tom Tromey's avatar
      Support -fdebug-cpp option · 847e697a
      Tom Tromey authored
      
      This patch adds -fdebug-cpp option. When used with -E this dumps the
      relevant macro map before every single token. This clutters the output
      a lot but has proved to be invaluable in tracking some bugs during the
      development of the virtual location support.
      
      Co-Authored-By: default avatarDodji Seketeli <dodji@redhat.com>
      
      From-SVN: r180084
      847e697a
    • Tom Tromey's avatar
      Generate virtual locations for tokens · 92582b75
      Tom Tromey authored
      This second instalment uses the infrastructure of the previous patch
      to allocate a macro map for each macro expansion and assign a virtual
      location to each token resulting from the expansion.
      
      To date when cpp_get_token comes across a token that happens to be a
      macro, the macro expander kicks in, expands the macro, pushes the
      resulting tokens onto a "token context" and returns a dummy padding
      token. The next call to cpp_get_token goes look into the token context
      for the next token [which is going to result from the previous macro
      expansion] and returns it.  If the token is a macro, the macro expander
      kicks in and you know the story.
      
      This patch piggy-backs on that macro expansion process, so to speak.
      First it modifies the macro expander to make it create a macro map for
      each macro expansion. It then allocates a virtual location for each
      resulting token.  Virtual locations of tokens resulting from macro
      expansions are then stored on a special kind of context called an
      "expanded tokens context".  In other words, in an expanded tokens
      context, there are tokens resulting from macro expansion and their
      associated virtual locations.  cpp_get_token_with_location is modified
      to return the virtual location of tokens resulting from macro
      expansion.  Note that once all tokens from an expanded token context have
      been consumed and the context and is freed, the memory used to store the
      virtual locations of the tokens held in that context is freed as well.
      This helps reducing the overall peak memory consumption.
      
      The client code that was getting macro expansion point location from
      cpp_get_token_with_location now gets virtual location from it. Those
      virtual locations can in turn be resolved into the different
      interesting physical locations thanks to the linemap API exposed by
      the previous patch.
      
      Expensive progress. Possibly. So this whole virtual location
      allocation business is switched off by default. So by default no
      extended token is created. No extended token context is created
      either. One has to use -ftrack-macro-expansion to switch this on. This
      complicates the code but I believe it can be useful as some of our
      friends found out at http://llvm.org/bugs/show_bug.cgi?id=5610
      
      
      
      The patch tries to reduce the memory consumption by freeing some token
      context memory that was being reused before. I didn't notice any
      compilation slow down due to this immediate freeing on my GNU/Linux
      system.
      
      As no client code tries to resolve virtual locations to anything but
      what was being done before, no new test case has been added.
      
      Co-Authored-By: default avatarDodji Seketeli <dodji@redhat.com>
      
      From-SVN: r180082
      92582b75
    • Tom Tromey's avatar
      Linemap infrastructure for virtual locations · 46427374
      Tom Tromey authored
      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
      46427374
  14. Aug 28, 2011
    • Dodji Seketeli's avatar
      Fix the use of linemap_add and remove unnecessary kludge · 892a371f
      Dodji Seketeli authored
      libcpp/
      
      	* line-map.c (linemap_add): Assert that reason must not be
      	LC_RENAME when called for the first time on a "main input file".
      
      c-family/
      
      	* c-pch.c (c_common_read_pch): Call linemap_add with LC_ENTER as it's
      	the first time it's being called on this main TU.
      
      gcc/lto/
      
      	* lto-lang.c (lto_init): Likewise.  Also, avoid calling
      	linemap_add twice.
      
      gcc/fortran/
      
      	* scanner.c (load_file): Don't abuse LC_RENAME reason while
      	(indirectly) calling linemap_add.
      
      From-SVN: r178146
      892a371f
  15. Jul 28, 2011
  16. Mar 25, 2011
    • Kai Tietz's avatar
      files.c (file_hash_eq): Use filename_cmp instead of strcmp. · 4489800d
      Kai Tietz authored
      2011-03-25  Kai Tietz  <ktietz@redhat.com>
      
      	* files.c (file_hash_eq): Use filename_cmp
      	instead of strcmp.
      	(nonexistent_file_hash_eq): Likewise.
      	(remap_filename): Likewise.
      	Handle absolute DOS-path,
      	(append_file_to_dir): Check for IS_DIR_SEPARATOR
      	instead of slash.
      	(read_name_map): Likewise.
      	* linemap.c (linemap_add): Use filename_cmp
      	instead of strcmp.
      	* mkdeps.c (apply_vpath): Use filename_ncmp
      	instead of strncmp.
      	(deps_restore): Use filename_cmp instead of
      	strcmp.
      	* init.c (read_original_directory): Use
      	IS_DIR_SEPARATOR instead of checking for slash.
      
      From-SVN: r171521
      4489800d
  17. Oct 14, 2009
    • Jakub Jelinek's avatar
      re PR preprocessor/41543 (BUILTINS_LOCATION wrong with -fpreprocessed) · 96c169e1
      Jakub Jelinek authored
      	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
      96c169e1
  18. Apr 18, 2009
    • Joseph Myers's avatar
      re PR preprocessor/39646 (__FILE__ breaks for empty file name) · c7f9c0b9
      Joseph Myers authored
      libcpp:
      	PR preprocessor/39646
      	* include/line-map.h (enum lc_reason): Add LC_RENAME_VERBATIM.
      	* line-map.c (linemap_add): Handle LC_RENAME_VERBATIM.
      	* directives.c (do_line, do_linemarker): Use LC_RENAME_VERBATIM in
      	place of LC_RENAME.
      
      gcc/testsuite:
      	* gcc.dg/cpp/line8.c: New test.
      
      From-SVN: r146319
      c7f9c0b9
  19. Apr 09, 2009
  20. Mar 30, 2009
  21. Mar 29, 2009
    • Joseph Myers's avatar
      re PR preprocessor/34695 (Preprocessor warning->error conversion from -Werror is silent) · 148e4216
      Joseph Myers authored
      	PR preprocessor/34695
      
      gcc:
      	* Makefile.in (c-opts.o): Depend on c-tree.h.
      	* c-common.c: Move down include of diagnostic.h.
      	(done_lexing, c_cpp_error): New.
      	* c-common.h (done_lexing): Declare.
      	* c-decl.c (c_write_global_declarations): Don't check cpp_errors
      	(parse_in).
      	* c-opts.c: Include c-tree.h.
      	(c_common_init_options): Set preprocessor error callback.
      	(c_common_handle_option): Do not set preprocessor
      	inhibit_warnings, warnings_are_errors, warn_system_headers,
      	pedantic_errors or inhibit_warnings flags.
      	(c_common_post_options): Do not check cpp_errors (parse_in).
      	(c_common_finish): Do not output dependencies if there were
      	errors.  Do not check return value of cpp_finish.
      	* c-ppoutput.c (pp_file_change): Set input_location.
      	* c-tree.h (c_cpp_error): Declare.
      	* diagnostic.c (diagnostic_set_info_translated): Also initialize
      	override_column.
      	(diagnostic_build_prefix): Check override_column.
      	* diagnostic.h (diagnostic_info): Add override_column field.
      	(diagnostic_override_column): Define.
      
      gcc/cp:
      	* cp-tree.h (cp_cpp_error): Remove.
      	* error.c (cp_cpp_error): Remove.
      	* parser.c (cp_lexer_new_main): Set done_lexing instead of
      	client_diagnostic and error callback.
      
      gcc/fortran:
      	* cpp.c (cb_cpp_error): New.
      	(gfc_cpp_post_options): Don't set cpp_option->inhibit_warnings.
      	Don't check cpp_errors (cpp_in).
      	(gfc_cpp_init_0): Set cb->error.
      
      gcc/testsuite:
      	* gcc.dg/builtin-redefine.c, gcc.dg/cpp/redef2.c,
      	gcc.dg/cpp/redef3.c, gcc.dg/cpp/trad/redef2.c: Use dg-message
      	instead of dg-warning for "previous definition" messages.
      	* gcc.dg/cpp/Wvariadic-1.c, gcc.dg/cpp/Wvariadic-3.c: Expect
      	"warnings being treated as errors" message.
      	* gcc.dg/fltconst-1.c: Use -fshow-column.
      
      libcpp:
      	* makedepend.c: Remove.
      	* Makefile.in (makedepend_OBJS, makedepend$(EXEEXT)): Remove.
      	(all, clean, TAGS_SOURCES, include): Remove makedepend handling.
      	* directives.c (cpp_errors): Remove.
      	* errors.c (print_location, _cpp_begin_message, v_message):
      	Remove.
      	(cpp_error, cpp_error_with_line): Always use error callback.
      	(cpp_error, cpp_error_with_line, cpp_errno): Return bool.
      	* include/cpplib.h (cpp_options): Remove pedantic_errors,
      	inhibit_warnings, warn_system_headers, inhibit_errors,
      	warnings_are_errors, client_diagnostic.
      	(cpp_callbacks): Add extra arguments to error callback; make it
      	return bool.
      	(cpp_finish): Return void.
      	(cpp_destroy): Remove inaccurate comment about return value.
      	(cpp_errors, CPP_DL_EXTRACT, CPP_DL_WARNING_P): Remove.
      	(CPP_DL_NOTE): Define.
      	* include/line-map.h (linemap_print_containing_files): Remove.
      	* init.c (cpp_finish): Do not check for or return number of
      	errors.
      	* internal.h (cpp_reader): Remove errors field.
      	* line-map.c (linemap_print_containing_files): Remove.
      	* macro.c (_cpp_create_definition): Use CPP_DL_NOTE for message
      	about previous definition.  Only emit it if previous diagnostic
      	was emitted.
      
      From-SVN: r145263
      148e4216
  22. Jul 21, 2008
    • Manuel López-Ibáñez's avatar
      line-map.h (linenum_type): New typedef. · 1bb64668
      Manuel López-Ibáñez authored
      2008-07-21  Manuel Lopez-Ibanez  <manu@gcc.gnu.org>
      
      	* include/line-map.h (linenum_type): New typedef.
      	(struct line_map): Use it.
      	(SOURCE_LINE): Second arguments is a LOCATION not a LINE.
      	(SOURCE_COLUMN): Likewise.
      	* macro.c (_cpp_builtin_macro_text): Use linenum_type. Don't store
      	source_location values in a variable of type linenum_type.
      	* directives.c (struct if_stack): Use linenum_type.
      	(strtoul_for_line): Rename as strtolinenum.
      	(do_line): Use linenum_type.
      	(do_linemarker): Use linenum_type and strtolinenum.
      	(_cpp_do_file_change): Use linenum_t.
      	* line-map.c (linemap_add): Likewise.
      	(linemap_line_start): Likewise.
      	* traditional.c (struct fun_macro): 'line' is a source_location.
      	* errors.c (print_location): Use linenum_type.
      	* directives-only.c (_cpp_preprocess_dir_only): Likewise.
      	* internal.h (CPP_INCREMENT_LINE): Likewise.
      	* lex.c (_cpp_skip_block_comment): Use source_location.
      
      From-SVN: r138026
      1bb64668
  23. Feb 20, 2008
    • Tom Tromey's avatar
      traditional.c (lex_identifier): Use CPP_HASHNODE. · 2bf41bf0
      Tom Tromey authored
      	* traditional.c (lex_identifier): Use CPP_HASHNODE.
      	* lex.c (lex_identifier): Use CPP_HASHNODE.
      	* include/line-map.h (LINEMAP_POSITION_FOR_COLUMN): Wrap in
      	do-while.
      	* identifiers.c (alloc_node): Change return type.
      	(_cpp_init_hashtable): Don't cast 'alloc_node'.
      	(proxy_assertion_broken): New declaration.
      	(cpp_forall_identifiers): Move comment.
      	* line-map.c (linemap_add): Comment fix.
      	(linemap_line_start): Indentation fix.
      
      From-SVN: r132467
      2bf41bf0
  24. Sep 06, 2007
    • Tom Tromey's avatar
      tree-cfg.c (remove_bb): Only warn if line is non-zero. · 5ffeb913
      Tom Tromey authored
      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
      5ffeb913
  25. Jun 29, 2005
  26. May 28, 2005
    • Gabriel Dos Reis's avatar
      configure.ac: Check declarations for asprintf and vasprintf. · c3f829c1
      Gabriel Dos Reis authored
      	* configure.ac: Check declarations for asprintf and vasprintf.
      	* config.in: Regenerate.
      	* configure: Likewise.
      
      	* charset.c (conversion_loop): Use XRESIZEVEC.
      	(convert_no_conversion): Likewise.
      	(convert_using_iconv): Likewise.
      	(init_iconv_desc): Cast return value of alloca.
      	(cpp_host_to_exec_charset): Use XNEWVEC.
      	(emit_numeric_escape): Use XRESIZEVEC.
      	(cpp_interpret_string): Use XNEWVEC.
      	(cpp_interpret_string): Use XRESIZEVEC.
      	(_cpp_interpret_identifier): Cast return value of alloca.
      	(_cpp_convert_input): Use XNEWVEC and XRESIZEVEC.
      	* directives.c (glue_header_name): Use XNEWVEC and XRESIZEVEC.
      	(parse_include): Use XNEWVEC.
      	(insert_pragma_entry): Rename local variable "new" to
      	"new_entry".
      	(save_registered_pragmas): Cast return value of xmemdup.
      	(destringize_and_run): Same for alloca.
      	(parse_assertion): Likewise.
      	(do_assert): Cast allocated storage to proper type.
      	(cpp_define): Likewise.
      	(_cpp_define_builtin): Likewise.
      	(cpp_undef): Likewise.
      	(handle_assertion): Likewise.
      	(cpp_push_buffer): Rename local variable "new" to "new_buffer".
      	* expr.c (CPP_UPLUS): Cast value to type cpp_ttype.
      	(CPP_UMINUS): Likewise.
      	(struct cpp_operator): Rename from struct operator.
      	(_cpp_expand_op_stack): Use XRESIZEVEC.
      	* files.c (pch_open_file): Use XNEWVEC.
      	(pch_open_file): Use XRESIZEVEC.
      	(read_file_guts): Use XNEWVEC and XRESIZEVEC.
      	(dir_name_of_file): Use XNEWVEC.
      	(make_cpp_file): Use XCNEW.
      	(make_cpp_dir): Likewise.
      	(allocate_file_hash_entries): USE XNEWVEC.
      	(cpp_included): Cast return value of htab_find_with_hash.
      	(append_file_to_dir): Use XNEWVEC.
      	(read_filename_string): Likewise. Use XRESIZEVEC too.
      	(read_name_map): Cast return value of alloca.  Use XRESIZEVEC.
      	(remap_filename): Use XNEWVEC.
      	(struct pchf_entry): Move definition out of struct pchf_data.
      	(_cpp_save_file_entries): Use XCNEWVAR.
      	(_cpp_read_file_entries): Use XNEWVAR.
      	* identifiers.c (alloc_node): Use XOBNEW.
      	* init.c (cpp_create_reader): Use XCNEW.
      	(cpp_init_builtins): Cast of b->value to enum builtin_type.
      	(read_original_directory): Cast return value of alloca.
      	* lex.c (add_line_note): Use XRESIZEVEC.
      	(warn_about_normalization): Use XNEWVEC.
      	(_cpp_lex_direct): Cast node->directive_index to (enum cpp_ttype).
      	(new_buff): Use XNEWVEC.
      	* line-map.c (linemap_add): Use XRESIZEVEC.
      	* macro.c (builtin_macro): Cast return value of alloca.
      	(paste_tokens): Likewise.
      	(expand_arg): Use XNEWVEC and XRESIZEVEC.
      	(_cpp_save_parameter): Use XRESIZEVEC.
      	(create_iso_definition): Cast allocated storage to proper type.
      	(_cpp_create_definition): Likewise.
      	(cpp_macro_definition): Use XRESIZEVEC.
      	* makedepend.c (add_clm): Use XNEW.
      	(add_dir): Likewise.
      	* mkdeps.c (munge): Use XNEWVEC.
      	(deps_init): Use XCNEW.
      	(deps_add_target): Use XRESIZEVEC.
      	(deps_add_default_target): Cast return value of alloca.
      	(deps_add_dep): Use XRESIZEVEC.
      	(deps_add_vpath): Likewise.  Use XNEWVEC too.
      	(deps_restore): Likewise.
      	* pch.c (save_idents): Use XNEW and XNEWVEC.
      	(cpp_save_state): Use XNEW.
      	(count_defs): Cast return value of htab_find.
      	(write_defs): Likewise.
      	(cpp_write_pch_deps): Use XNEWVEC.
      	(collect_ht_nodes): Use XRESIZEVEC.
      	(cpp_valid_state): Use XNEWVEC.
      	(save_macros): Use XRESIZEVEC.  Cast return value of xmemdup.
      	* symtab.c (ht_create): Use XCNEW.
      	(ht_lookup_with_hash): Cast return value of obstack_copy0.
      	(ht_expand): Use XCNEWVEC.
      	* system.h (HAVE_DESIGNATED_INITIALIZERS): False if __cplusplus.
      	(bool): Do not define if __cplusplus.
      
      From-SVN: r100295
      c3f829c1
  27. Apr 21, 2005
  28. May 24, 2004
    • Paolo Bonzini's avatar
      Makefile.def (host_modules): add libcpp. · 4f4e53dd
      Paolo Bonzini authored
      ChangeLog:
      
      2004-05-23  Paolo Bonzini  <bonzini@gnu.org>
      
      	* Makefile.def (host_modules): add libcpp.
      	* Makefile.tpl: Add dependencies on and for libcpp.
      	* Makefile.in: Regenerate.
      	* configure.in: Add libcpp host module.
      	* configure: Regenerate.
      
      config/ChangeLog:
      
      2004-05-23  Paolo Bonzini  <bonzini@gnu.org>
      
      	* acx.m4 (ACX_HEADER_STDBOOL, ACX_HEADER_STRING):
      	From gcc.
      
      gcc/ChangeLog:
      
      2004-05-23  Paolo Bonzini  <bonzini@gnu.org>
      
      	Move libcpp to the toplevel.
      	* Makefile.in: Remove references to libcpp files,
      	use CPPLIBS instead of libcpp.a.  Define SYMTAB_H
      	and change hashtable.h to that.
      	* aclocal.m4 (gcc_AC_HEADER_STDBOOL,
      	gcc_AC_HEADER_STRING, gcc_AC_C__BOOL): Remove.
      	* configure.ac (gcc_AC_C__BOOL, HAVE_UCHAR): Remove tests.
      	* configure: Regenerate.
      	* config.in: Regenerate.
      	* c-ppoutput.c: Include ../libcpp/internal.h instead of cpphash.h.
      	* cppcharset.c: Removed.
      	* cpperror.c: Removed.
      	* cppexp.c: Removed.
      	* cppfiles.c: Removed.
      	* cpphash.c: Removed.
      	* cpphash.h: Removed.
      	* cppinit.c: Removed.
      	* cpplex.c: Removed.
      	* cpplib.c: Removed.
      	* cpplib.h: Removed.
      	* cppmacro.c: Removed.
      	* cpppch.c: Removed.
      	* cpptrad.c: Removed.
      	* cppucnid.h: Removed.
      	* cppucnid.pl: Removed.
      	* cppucnid.tab: Removed.
      	* hashtable.c: Removed.
      	* hashtable.h: Removed.
      	* line-map.c: Removed.
      	* line-map.h: Removed.
      	* mkdeps.c: Removed.
      	* mkdeps.h: Removed.
      	* stringpool.h: Include symtab.h instead of hashtable.h.
      	* tree.h: Include symtab.h instead of hashtable.h.
      	* system.h (O_NONBLOCK, O_NOCTTY): Do not define.
      
      gcc/cp/ChangeLog:
      
      2004-05-23  Paolo Bonzini  <bonzini@gnu.org>
      
      	* Make-lang.in: No need to specify $(LIBCPP).
      
      gcc/java/ChangeLog:
      
      2004-05-23  Paolo Bonzini  <bonzini@gnu.org>
      
      	* Make-lang.in: Link in $(LIBCPP) instead of mkdeps.o.
      
      libcpp/ChangeLog:
      
      2004-05-23  Paolo Bonzini  <bonzini@gnu.org>
      
      	Moved libcpp from the gcc subdirectory to the toplevel.
      	* Makefile.am: New file.
      	* Makefile.in: Regenerate.
      	* configure.ac: New file.
      	* configure: Regenerate.
      	* config.in: Regenerate.
      	* charset.c: Moved from gcc/cppcharset.c.  Add note about
      	brokenness of input charset detection.  Adjust for change
      	in name of cppucnid.h.
      	* errors.c: Moved from gcc/cpperror.c.  Do not include intl.h.
      	* expr.c: Moved from gcc/cppexp.c.
      	* files.c: Moved from gcc/cppfiles.c.  Do not include intl.h.
      	Remove #define of O_BINARY, it is in system.h.
      	* identifiers.c: Moved from gcc/cpphash.c.
      	* internal.h: Moved from gcc/cpphash.h.  Change header
      	guard name.  All other files adjusted to match name change.
      	* init.c: Moved from gcc/cppinit.c.
      	(init_library) [ENABLE_NLS]: Call bindtextdomain.
      	* lex.c: Moved from gcc/cpplex.c.
      	* directives.c: Moved from gcc/cpplib.c.
      	* macro.c: Moved from gcc/cppmacro.c.
      	* pch.c: Moved from gcc/cpppch.c.  Do not include intl.h.
      	* traditional.c: Moved from gcc/cpptrad.c.
      	* ucnid.h: Moved from gcc/cppucnid.h.  Change header
      	guard name.
      	* ucnid.pl: Moved from gcc/cppucnid.pl.
      	* ucnid.tab: Moved from gcc/cppucnid.tab.  Change header
      	guard name.
      	* symtab.c: Moved from gcc/hashtable.c.
      	* line-map.c: Moved from gcc.  Do not include intl.h.
      	* mkdeps.c: Moved from gcc.
      	* system.h: New file.
      
      libcpp/include/ChangeLog:
      
      2004-05-23  Paolo Bonzini  <bonzini@gnu.org>
      
      	* cpplib.h: Moved from gcc.  Change header guard name.
      	* line-map.h: Moved from gcc.  Change header guard name.
      	* mkdeps.h: Moved from gcc.  Change header guard name.
      	* symtab.h: Moved from gcc/hashtable.h.  Change header
      	guard name.
      
      libcpp/po/ChangeLog:
      
      2004-05-23  Paolo Bonzini  <bonzini@gnu.org>
      
      	* be.po: Extracted from gcc/po/be.po.
      	* ca.po: Extracted from gcc/po/ca.po.
      	* da.po: Extracted from gcc/po/da.po.
      	* de.po: Extracted from gcc/po/de.po.
      	* el.po: Extracted from gcc/po/el.po.
      	* es.po: Extracted from gcc/po/es.po.
      	* fr.po: Extracted from gcc/po/fr.po.
      	* ja.po: Extracted from gcc/po/ja.po.
      	* nl.po: Extracted from gcc/po/nl.po.
      	* sv.po: Extracted from gcc/po/sv.po.
      	* tr.po: Extracted from gcc/po/tr.po.
      
      From-SVN: r82199
      4f4e53dd
  29. Apr 23, 2004
    • Per Bothner's avatar
      line-map.h (struct line_maps): New field highest_line. · 500bee0a
      Per Bothner authored
      	* line-map.h (struct line_maps):  New field highest_line.
      	(linemap_position_for_column):  Make non-inline function.
      	(LINEMAP_POSITION_FOR_COLUMN):  New macro.
      	* line-map.c (linemap_init):  Clear highest_line field.
      	(linemap_add):  Set highest_line field.
      	(linemap_line_start):  Minor optimization - use highest_line field.
      	Reduce maximum column hint to 10000.  Update highest_line field.
      	(linemap_position_for_column):  Moved from line-map.h.  Optimize a bit.
      	* cpphash.h (struct cpp_reader):  Remove line field - instead use
      	line_table->highest_line.
      	(saved_line):  Remove unused field.
      	(CPP_INCREMENT_FILE):  Don't do linemap_lookup - just use newest map.
      	Use  line_table's highest_line field instead of cpp_reader's line.
      	* cpplib.c (start_directive):  Likewise use highest_line field.
      	(do_line, do_linemarker):  Likewise just use newest map.
      	(_cpp_do_file_change):  Don't need to set cpp_reader's line field.
      	* cpperror.c (cpp_error):  Likewise use highest_line field.
      	* cppfiles.c (open_file_failed:  Likewise.
      	(cpp_make_system_header):  Likewise use newest map and highest_line.
      	* cppinit.c (cpp_create_reader):  Don't initialize removed field.
      	* cpplex.c (_cpp_process_line_notes, _cpp_skip_block_comment,
      	skip_line_comment, skip_whitespace, _cpp_get_fresh_line,
      	_cpp_lex_direct):  Likewise use highest_line.
      	(_cpp_lex_direct):  Use new LINEMAP_POSITION_FOR_COLUMN macro.
      	* cppmacro.c (_cpp_builtin_macro_text):  Likewise use highest_line,
      	and use newest map.
      	* cpppch.c (cpp_read_state):  Don't save+restore cpp_reader's line.
      	* cpptrad.c (_cpp_overlay_buffer):  Don't save cpp_reader's line.
      	(copy_comment, _cpp_scan_out_logical_line):  Likewise use highest_line.
      
      From-SVN: r81074
      500bee0a
  30. Feb 16, 2004
  31. Feb 11, 2004
    • Per Bothner's avatar
      Represent column numbers using line-map's source_location. · 12f9df4e
      Per Bothner authored
      	The "next available source_location" is now managed internally by
      	line-maps.c rather than by clients.
      	* line-map.h (struct line_map):  New field column_bits.
      	<from_line>:  Rename field to start_location.
      	(struct line_maps):  New fields highest_location and max_column_hint.
      	(linemap_check_files_exited):  New declaration.
      	(linemap_line_start):  New declaration.
      	(linemap_add):  Remove from_line parameter; use highest_location field.
      	(SOURCE_LINE, LAST_SOURCE_LINE):  Modify to use column_bits.
      	(SOURCE_COLUMN, LAST_SOURCE_LINE_LOCATION):  New macros.
      	(CURRENT_LINE_MAP):  Remove macro.
      	(linemap_position_for_column):  New inline function.
      	* line-map.c (linemap_init):  Clear new fields.
      	(linemap_check_files_exited):  New function, extracted from ...
      	(linemap_free):  Use linemap_check_files_exited.
      	(linemap_add):  Remove from_line parameter.  Various updates.
      	(linemap_line_start):  New function.
      	(linemap_lookeup):  Update for new field names.
      	* cpphash.h (struct cpp_reader) <map>:  Field removed.  Because
      	linemap_position_for_column may unpredictably change the current map,
      	it is cleaner and simpler for us to not cache it in cpp_reader.
      	(struct cpp_buffer):  New sysp field.
      	Changed warned_cplusplus_comments and from_stage3 to bitfields.
      	* cppinit.c (cpp_read_min_file):  pfile->map no longer exists.
      	* cpplib.c (do_line, do_linemarker, _cpp_do_file_change):  Get
      	current map using linemap_lookup.
      	(do_linemarker):  Also set buffer's sysp field.
      	(destringize_and_run):  No longer need to decrement current line.
      	* cppfiles.c (_cpp_stack_file):  Set sysp from and in buffer.
      	(search_path_head, open_file_failed):  Use buffer's sysp.
      	(cpp_make_system_header):  Get current map using linemap_lookup.
      	Also set buffer's sysp flag.
      	* cppmacro.c (_cpp_builtin_macro_text):  Likewise use linemap_lookup.
      	* cpphash.h (CPP_INCREMENT_LINE):  New macro.
      	(struct cpp_buffer):  Moved fields saved_cur, saved_rlimit to ...
      	(struct cpp_reader):  ... and adding saved_line_base field.
      	* cpptrad.c (_cpp_overlay_buffer, _cpp_remove_overlay):
      	Update accordingly.  Don't adjust line.
      	(_cpp_scan_out_logical_line):  Use CPP_INCREMENT_LINE.
      	* cpphash.c (CPP_IN_SYSTEM_HEADER):  Replaced macro by ...
      	(cpp_in_system_header):  ... new inline function, using buffer's sysp.
      	* cpperror.c (_cpp_begin_message):  Update to use cpp_in_system_header.
      	* cpplex.c (_cpp_lex_direct):  Likewise.
      	* cppmacro.c (_cpp_builtin_macro_text):  Likewise.
      	* cppmacro.c (_cpp_create_definition):  Use buffer's sysp field.
      	* cpplib.h (struct cpp_token):  Rename line field to src_loc.
      	Remove col field as it is now subsumed by src_loc.
      	* cpperror.c:  Update various field, parameter, and macro names.
      	(print_location):  If col==0, try SOURCE_COLUMN of line.
      	(cpp_error):  Use cur_token's src_loc field, rather than line+col.
      	* cpplib.c (do_diagnostic):  Token's src_loc fields replaces line+col.
      	* cpplex.c (_cpp_process_line_notes, _cpp_lex_direct,
      	_cpp_skip_block_comment):  Use CPP_INCREMENT_LINE.
      	(_cpp_temp_token):  Replace cpp_token's line+col fields by src_loc.
      	(_cpp_get_fresh_line):  Don't need to adjust line for missing newline.
      	(_cpp_lex_direct):  Use linemap_position_for_column.
      	* c-ppoutput.c (maybe_print_line, print_line):  Don't take map
      	parameter.  Instead get it from the line_table global.  Adjust callers.
      	(print):  Remove map field.  Replace line field to src_line.
      	(init_pp_output, account_for_newlines, maybe_print_line):  Adjust.
      	(cb_line_change):  Use SOURCE_COLUMN.  Minor optimizations.
      	(pp_file_change):  Use MAIN_FILE_P since we cannot checked print.map.
      	Use LAST_SOURCE_LINE_LOCATION to "catch up" after #include.
      	* cpptrad.c (copy_comment):  Rename variable.
      	* c-lex.c (map):  Remove static variable, for same reason we removed
      	cpp_reader's map field.
      	(cb_line_change, cb_def_pragma, cb_define, cb_undef):  Hence we need
      	to call linemap_lookup.
      	(cb_line_change):  Token's line field replaced by src_loc.
      	(fe_file_change):  Use MAINFILE_P and LAST_SOURCE_LINE macros.
      	Don't save new_map.
      
      	* cpphash.h, cpperror.c, cpplib.h:  Some renames of fileline to
      	source_location.
      
      From-SVN: r77663
      12f9df4e
  32. Jan 21, 2004
    • Kazu Hirata's avatar
      alias.c, [...]: Update copyright. · d9221e01
      Kazu Hirata authored
      	* 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
      d9221e01
  33. Jan 20, 2004
    • Per Bothner's avatar
      Implement a cache for linemap_lookup. · 9132fbb7
      Per Bothner authored
      	* line-map.h (struct_line_maps):  Add cache field.
      	* line-map.c (linemap_init):  Zero cache field.
      	(linemap_add):  Set cache field to offset of newly allocated map.
      	(linemap_lookup):  Use and set cache field.
      
      From-SVN: r76197
      9132fbb7
Loading