This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: PATCH to use cpplib's source_location for location_t


Here is the updated patch, incorporating some of RTH's suggestions.
I looked at the various places that LOCATION_LINE and LOCATION_FILE
are directly and indirectly called, and improved many of them.
This allowed me to redefined those macros as wrappers for
expand_location.

Attached is also the fix for the gcc/cp directory.

No regressions with --disable-mapped-location; a moderate number
of regressions with --enable-mapped-location.

OK to check in?
--
	--Per Bothner
per@bothner.com   http://per.bothner.com/
2004-06-30  Per Bothner  <per@bothner.com>

	Conditionally compile support for --enable-mapped_location.
	* 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.
	* basic-block.h (struct edge_def):  Use new source_locus typedef.
	* c-common.c (fname_decl):  Update save/clear/store of input_location.
	(c_do_switch_warnings):  Update for USE_MAPPED_LOCATION case.
	* c-decl.c:  Likewise.
	* c-dump.c (dump_stmt):  Likewise.
	* c-gimplify.c (c-gimplify.c):  Generalize using SET_EXPR_LOCATION.
	* c-lex.c (cb_line_change):  If USE_MAPPED_LOCATION use token's	src_loc
	to set input_location direction, rather than using linemap_lookup.
	(fe_file_change, cb_def_pragma):  Again use source_location directly.
	* c-opts.c (saved_lineno):  Remove static variable.
	(c_common_post_options, c_common_init):  Don't bothner to save,
	clear and restore input_Location - now handled by lang_dependent_init.
	* function.c (init_function_start):  Use new DECL_IS_BUILTIN macro.
	* xcoffout.c (xcoff_assign_fundamental_type_number):  Likewise.
	* c-parse.in:  Use SET_EXPR_LOCATION macro.
	* gimple-low.c:  Likewise.
	* tree-mudflap.c:  Likewise.
	* gimplify.c:  Likewise.  Also use EXPR_LOCATION and EXPR_HAS_LOCATION.
	* c-ppoutput.c:  Use new source_location typedef instead of fileline.
	* c-semantics.c:  Use new macros.
	* c-typeck.c:  Likewise.
	* cfgexpand.c:  Handle USE_MAPPED_LOCATION case for function_end_locus.
	* cfglayout.c (insn_locators_initialize):  Const cleanup.  New macros.
	* cfgrtl.c (delete_insn):  Use new NOTE_DELETED_LABEL_NAME macro.
	* print-rtl.c (print_rtx):  Likewise.
	* emit-rtl.c:  Don't clear NOTE_SOURCE_FILE if USE_MAPPED_LOCATION.
	* combine.c:  Use new SET_INSN_DELETED macro.
	* flow.c:  Likewise.
	* haifa-sched.c:  Likewise.
	* ifcvt.c:  Likewise.
	* recog.c:  Likewise.
	* reload1.c:  Likewise.
	* diagnostic.c:  Use expand_location macro.
	* pretty-print.c (pp_base_format_text):  Likewise.
	* profile.c:  Likewise.
 	* dwarf2out.c:  Likewise.  Also use expand_location, DECL_IS_BUILTIN.
 	* dwarf2out.c (dwarf2out_decl:  Use BUILTINS_LOCATION.
	* emit-rtl.c (emit_line_note):  Simplify if USE_MAPPED_LOCATION.
	(force_next_line_note, insn_emit):  Handle USE_MAPPED_LOCATION case.
	* final.c (final):  Likewise.
	* haifa-sched.c:  Likewise.
	* integrate.c:  Likewise.
	* jump.c:  Likewise.
	* rtl-error.c:  Likewise.
	* stmt.c (check_seenlabel):  Likewise.
	* tree-pretty-print.c:  Likewise.
	* gengtype-lex.l:  Temporary kludge to avoid duplicate typedef.
	* gengtype.c:  Update for now typdefs in input.h.  More kludges.
	* modulo-sched.c (sms_schedule):  Use NOTE_EXPANDED_LOCATION macro.
	* ra-debug.c (ra_print_rtl):  Likewise.
	* sched-rgn.c:  Likewise.
	* sched-vis.c:  Likewise.
	* rtl.h (gen_rtx_ASM_OPERANDS):  Redefine if USE_MAPPED_LOCATION.
	* stmt.c (expand_asm_operands):  Adjust calls to gen_rtx_ASM_OPERANDS.
	* 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.
	* tree-cfg.c:  Use new macros and typedefs.
	* tree-flow-inline.h:  Likewise.
	* tree-mudflap.c (mf_file_function_line_tree):  Take a location_t
	rather than a pointer to one.  Use expand_location.
	(mf_varname_tree):  Use expand_location.
	* tree-dump.c:  Use expand_location on DECL_SOURCE_LOCATION.
	* coverage.c:  Likewise.
	* print-tree.c:  Likewise.
	* c-aux-info.c (gen_aux_info_record):  Likewise.

Index: basic-block.h
===================================================================
RCS file: /cvs/gcc/gcc/gcc/basic-block.h,v
retrieving revision 1.199
diff -u -p -r1.199 basic-block.h
--- basic-block.h	14 Jun 2004 12:09:06 -0000	1.199
+++ basic-block.h	30 Jun 2004 16:25:29 -0000
@@ -143,7 +143,7 @@ struct edge_def GTY((chain_next ("%h.pre
   PTR GTY ((skip (""))) aux;
 
   /* Location of any goto implicit in the edge, during tree-ssa.  */
-  location_t *goto_locus;
+  source_locus goto_locus;
 
   int flags;			/* see EDGE_* below  */
   int probability;		/* biased by REG_BR_PROB_BASE */
Index: c-aux-info.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/c-aux-info.c,v
retrieving revision 1.28
diff -u -p -r1.28 c-aux-info.c
--- c-aux-info.c	1 Apr 2004 03:50:26 -0000	1.28
+++ c-aux-info.c	30 Jun 2004 16:25:30 -0000
@@ -554,6 +554,7 @@ gen_aux_info_record (tree fndecl, int is
   if (flag_gen_aux_info)
     {
       static int compiled_from_record = 0;
+      expanded_location xloc = expand_location (DECL_SOURCE_LOCATION (fndecl));
 
       /* Each output .X file must have a header line.  Write one now if we
 	 have not yet done so.  */
@@ -569,8 +570,7 @@ gen_aux_info_record (tree fndecl, int is
       /* Write the actual line of auxiliary info.  */
 
       fprintf (aux_info_file, "/* %s:%d:%c%c */ %s;",
-	       DECL_SOURCE_FILE (fndecl),
-	       DECL_SOURCE_LINE (fndecl),
+	       xloc.file, xloc.line,
 	       (is_implicit) ? 'I' : (is_prototyped) ? 'N' : 'O',
 	       (is_definition) ? 'F' : 'C',
 	       gen_decl (fndecl, is_definition, ansi));
Index: c-common.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/c-common.c,v
retrieving revision 1.523
diff -u -p -r1.523 c-common.c
--- c-common.c	28 Jun 2004 02:11:55 -0000	1.523
+++ c-common.c	30 Jun 2004 16:25:31 -0000
@@ -801,8 +801,12 @@ fname_decl (unsigned int rid, tree id)
 	 To avoid this problem set the lineno to 0 here; that prevents
 	 it from appearing in the RTL.  */
       tree stmts;
-      location_t saved_locus = input_location;
+      location_t saved_location = input_location;
+#ifdef USE_MAPPED_LOCATION
+      input_location = UNKNOWN_LOCATION;
+#else
       input_line = 0;
+#endif
 
       stmts = push_stmt_list ();
       decl = (*make_fname_decl) (id, fname_vars[ix].pretty);
@@ -811,7 +815,7 @@ fname_decl (unsigned int rid, tree id)
 	saved_function_name_decls
 	  = tree_cons (decl, stmts, saved_function_name_decls);
       *fname_vars[ix].decl = decl;
-      input_location = saved_locus;
+      input_location = saved_location;
     }
   if (!ix && !current_function_decl)
     pedwarn ("%J'%D' is not defined outside of function scope", decl, decl);
@@ -3599,20 +3603,22 @@ void
 c_do_switch_warnings (splay_tree cases, tree switch_stmt)
 {
   splay_tree_node default_node;  
-  location_t *switch_locus;
+  location_t switch_location;
   tree type;
 
   if (!warn_switch && !warn_switch_enum && !warn_switch_default)
     return;
 
-  switch_locus = EXPR_LOCUS (switch_stmt);
-  if (!switch_locus)
-    switch_locus = &input_location;
+  if (EXPR_HAS_LOCATION (switch_stmt))
+    switch_location = EXPR_LOCATION (switch_stmt);
+  else
+    switch_location = input_location;
+
   type = SWITCH_TYPE (switch_stmt);
 
   default_node = splay_tree_lookup (cases, (splay_tree_key) NULL);
   if (warn_switch_default && !default_node)
-    warning ("%Hswitch missing default case", switch_locus);
+    warning ("%Hswitch missing default case", &switch_location);
 
   /* If the switch expression was an enumerated type, check that
      exactly all enumeration literals are covered by the cases.
@@ -3647,7 +3653,7 @@ c_do_switch_warnings (splay_tree cases, 
 	      /* Warn if there are enumerators that don't correspond to
 		 case expressions.  */
 	      warning ("%Henumeration value `%E' not handled in switch",
-		       switch_locus, TREE_PURPOSE (chain));
+		       &switch_location, TREE_PURPOSE (chain));
 	    }
 	}
 
Index: c-decl.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/c-decl.c,v
retrieving revision 1.520
diff -u -p -r1.520 c-decl.c
--- c-decl.c	27 Jun 2004 20:47:14 -0000	1.520
+++ c-decl.c	30 Jun 2004 16:25:33 -0000
@@ -1114,7 +1114,7 @@ diagnose_mismatched_decls (tree newdecl,
 	    }
 	}
       else if (TREE_CODE (olddecl) == FUNCTION_DECL
-	       && DECL_SOURCE_LINE (olddecl) == 0)
+	       && DECL_IS_BUILTIN (olddecl))
 	{
 	  /* A conflicting function declaration for a predeclared
 	     function that isn't actually built in.  Objective C uses
@@ -1223,7 +1223,7 @@ diagnose_mismatched_decls (tree newdecl,
 	     default.  Objective C uses these.  See also above.
 	     FIXME: Make Objective C use normal builtins.  */
 	  if (TREE_CODE (olddecl) == FUNCTION_DECL
-	      && DECL_SOURCE_LINE (olddecl) == 0)
+	      && DECL_IS_BUILTIN (olddecl))
 	    return false;
 	  else
 	    {
@@ -1671,7 +1671,7 @@ warn_if_shadowing (tree new)
   /* Shadow warnings wanted?  */
   if (!warn_shadow
       /* No shadow warnings for internally generated vars.  */
-      || DECL_SOURCE_LINE (new) == 0
+      || DECL_IS_BUILTIN (new)
       /* No shadow warnings for vars made for inlining.  */
       || DECL_FROM_INLINE (new)
       /* Don't warn about the parm names in function declarator
@@ -1755,7 +1755,7 @@ warn_if_shadowing (tree new)
 static void
 clone_underlying_type (tree x)
 {
-  if (DECL_SOURCE_LINE (x) == 0)
+  if (DECL_IS_BUILTIN (x))
     {
       if (TYPE_NAME (TREE_TYPE (x)) == 0)
 	TYPE_NAME (TREE_TYPE (x)) = x;
@@ -1963,7 +1963,7 @@ implicitly_declare (tree functionid)
 	 in the external scope because they're pushed before the file
 	 scope gets created.  Catch this here and rebind them into the
 	 file scope.  */
-      if (!DECL_BUILT_IN (decl) && DECL_SOURCE_LINE (decl) == 0)
+      if (!DECL_BUILT_IN (decl) && DECL_IS_BUILTIN (decl))
 	{
 	  bind (functionid, decl, file_scope);
 	  return decl;
@@ -2290,8 +2290,12 @@ c_init_decl_processing (void)
   /* Declarations from c_common_nodes_and_builtins must not be associated
      with this input file, lest we get differences between using and not
      using preprocessed headers.  */
-  input_location.file = "<internal>";
+#ifdef USE_MAPPED_LOCATION
+  input_location = BUILTINS_LOCATION;
+#else
+  input_location.file = "<built-in>";
   input_location.line = 0;
+#endif
 
   build_common_tree_nodes (flag_signed_char);
 
Index: c-dump.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/c-dump.c,v
retrieving revision 1.26
diff -u -p -r1.26 c-dump.c
--- c-dump.c	26 Jun 2004 21:11:10 -0000	1.26
+++ c-dump.c	30 Jun 2004 16:25:33 -0000
@@ -32,9 +32,8 @@ Software Foundation, 59 Temple Place - S
 void
 dump_stmt (dump_info_p di, tree t)
 {
-  location_t *locus = EXPR_LOCUS (t);
-  if (locus)
-    dump_int (di, "line", locus->line);
+  if (EXPR_HAS_LOCATION (t))
+    dump_int (di, "line", EXPR_LINENO (t));
 }
 
 /* Dump any C-specific tree codes and attributes of common codes.  */
Index: c-gimplify.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/c-gimplify.c,v
retrieving revision 2.20
diff -u -p -r2.20 c-gimplify.c
--- c-gimplify.c	26 Jun 2004 21:11:10 -0000	2.20
+++ c-gimplify.c	30 Jun 2004 16:25:34 -0000
@@ -458,7 +458,7 @@ gimplify_switch_stmt (tree *stmt_p)
 
   *stmt_p = build (SWITCH_EXPR, SWITCH_TYPE (stmt), SWITCH_COND (stmt),
 		   body, NULL_TREE);
-  annotate_with_locus (*stmt_p, stmt_locus);
+  SET_EXPR_LOCATION (*stmt_p, stmt_locus);
   gimplify_stmt (stmt_p);
 
   *stmt_p = finish_bc_block (break_block, *stmt_p);
Index: c-lex.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/c-lex.c,v
retrieving revision 1.222
diff -u -p -r1.222 c-lex.c
--- c-lex.c	15 Jun 2004 21:43:20 -0000	1.222
+++ c-lex.c	30 Jun 2004 16:25:34 -0000
@@ -197,11 +197,15 @@ cb_line_change (cpp_reader *pfile ATTRIB
 		int parsing_args)
 {
   if (token->type != CPP_EOF && !parsing_args)
+#ifdef USE_MAPPED_LOCATION
+    input_location = token->src_loc;
+#else
     {
       source_location loc = token->src_loc;
       const struct line_map *map = linemap_lookup (&line_table, loc);
       input_line = SOURCE_LINE (map, loc);
     }
+#endif
 }
 
 void
@@ -216,10 +220,17 @@ fe_file_change (const struct line_map *n
 	 we already did in compile_file.  */
       if (! MAIN_FILE_P (new_map))
 	{
+#ifdef USE_MAPPED_LOCATION
+          int included_at = LAST_SOURCE_LINE_LOCATION (new_map - 1);
+
+	  input_location = included_at;
+	  push_srcloc (new_map->start_location);
+#else
           int included_at = LAST_SOURCE_LINE (new_map - 1);
 
 	  input_line = included_at;
 	  push_srcloc (new_map->to_file, 1);
+#endif
 	  (*debug_hooks->start_source_file) (included_at, new_map->to_file);
 #ifndef NO_IMPLICIT_EXTERN_C
 	  if (c_header_level)
@@ -249,8 +260,12 @@ fe_file_change (const struct line_map *n
 
   update_header_times (new_map->to_file);
   in_system_header = new_map->sysp != 0;
+#ifdef USE_MAPPED_LOCATION
+  input_location = new_map->start_location;
+#else
   input_filename = new_map->to_file;
   input_line = new_map->to_line;
+#endif
 
   /* Hook for C++.  */
   extract_interface_info ();
@@ -264,7 +279,9 @@ cb_def_pragma (cpp_reader *pfile, source
      -Wunknown-pragmas has been given.  */
   if (warn_unknown_pragmas > in_system_header)
     {
+#ifndef USE_MAPPED_LOCATION
       const struct line_map *map = linemap_lookup (&line_table, loc);
+#endif
       const unsigned char *space, *name;
       const cpp_token *s;
 
@@ -278,7 +295,11 @@ cb_def_pragma (cpp_reader *pfile, source
 	    name = cpp_token_as_text (pfile, s);
 	}
 
+#ifdef USE_MAPPED_LOCATION
+      input_location = loc;
+#else
       input_line = SOURCE_LINE (map, loc);
+#endif
       warning ("ignoring #pragma %s %s", space, name);
     }
 }
Index: c-opts.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/c-opts.c,v
retrieving revision 1.118
diff -u -p -r1.118 c-opts.c
--- c-opts.c	25 Jun 2004 21:24:21 -0000	1.118
+++ c-opts.c	30 Jun 2004 16:25:34 -0000
@@ -51,8 +51,6 @@ Software Foundation, 59 Temple Place - S
 #define TARGET_OPTF(ARG)
 #endif
 
-static int saved_lineno;
-
 /* CPP's options.  */
 static cpp_options *cpp_opts;
 
@@ -998,7 +996,7 @@ c_common_post_options (const char **pfil
       init_c_lex ();
 
       /* Yuk.  WTF is this?  I do know ObjC relies on it somewhere.  */
-      input_line = 0;
+      input_location = UNKNOWN_LOCATION;
     }
 
   cb = cpp_get_callbacks (parse_in);
@@ -1006,8 +1004,7 @@ c_common_post_options (const char **pfil
   cb->dir_change = cb_dir_change;
   cpp_post_options (parse_in);
 
-  saved_lineno = input_line;
-  input_line = 0;
+  input_location = UNKNOWN_LOCATION;
 
   /* If an error has occurred in cpplib, note it so we fail
      immediately.  */
@@ -1033,8 +1030,6 @@ c_common_post_options (const char **pfil
 bool
 c_common_init (void)
 {
-  input_line = saved_lineno;
-
   /* Set up preprocessor arithmetic.  Must be done after call to
      c_common_nodes_and_builtins for type nodes to be good.  */
   cpp_opts->precision = TYPE_PRECISION (intmax_type_node);
Index: c-parse.in
===================================================================
RCS file: /cvs/gcc/gcc/gcc/c-parse.in,v
retrieving revision 1.221
diff -u -p -r1.221 c-parse.in
--- c-parse.in	26 Jun 2004 21:11:09 -0000	1.221
+++ c-parse.in	30 Jun 2004 16:25:35 -0000
@@ -2092,19 +2092,19 @@ lineno_stmt:
 		     because (recursively) all of the component statments
 		     should already have line numbers assigned.  */
 		  if ($2 && EXPR_P ($2))
-		    annotate_with_locus ($2, $1);
+		    SET_EXPR_LOCATION ($2, $1);
 		}
 	;
 
 lineno_label:
 	  save_location label
-		{ if ($2) annotate_with_locus ($2, $1); }
+		{ if ($2) SET_EXPR_LOCATION ($2, $1); }
 	;
 
 condition: save_location expr
 		{ $$ = lang_hooks.truthvalue_conversion ($2);
 		  if (EXPR_P ($$))
-		    annotate_with_locus ($$, $1); }
+		    SET_EXPR_LOCATION ($$, $1); }
 	;
 
 /* Implement -Wparenthesis by special casing IF statement directly nested
@@ -2191,7 +2191,7 @@ for_cond_expr: save_location xexpr
 		    {
 		      $$ = lang_hooks.truthvalue_conversion ($2);
 		      if (EXPR_P ($$))
-			annotate_with_locus ($$, $1);
+			SET_EXPR_LOCATION ($$, $1);
 		    }
 		  else
 		    $$ = NULL;
Index: c-ppoutput.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/c-ppoutput.c,v
retrieving revision 1.20
diff -u -p -r1.20 c-ppoutput.c
--- c-ppoutput.c	22 Jun 2004 06:51:50 -0000	1.20
+++ c-ppoutput.c	30 Jun 2004 16:25:35 -0000
@@ -51,12 +51,12 @@ static void maybe_print_line (source_loc
 /* Callback routines for the parser.   Most of these are active only
    in specific modes.  */
 static void cb_line_change (cpp_reader *, const cpp_token *, int);
-static void cb_define (cpp_reader *, fileline, cpp_hashnode *);
-static void cb_undef (cpp_reader *, fileline, cpp_hashnode *);
-static void cb_include (cpp_reader *, fileline, const unsigned char *,
+static void cb_define (cpp_reader *, source_location, cpp_hashnode *);
+static void cb_undef (cpp_reader *, source_location, cpp_hashnode *);
+static void cb_include (cpp_reader *, source_location, const unsigned char *,
 			const char *, int);
-static void cb_ident (cpp_reader *, fileline, const cpp_string *);
-static void cb_def_pragma (cpp_reader *, fileline);
+static void cb_ident (cpp_reader *, source_location, const cpp_string *);
+static void cb_def_pragma (cpp_reader *, source_location);
 static void cb_read_pch (cpp_reader *pfile, const char *name,
 			 int fd, const char *orig_name);
 
@@ -300,7 +300,7 @@ cb_line_change (cpp_reader *pfile, const
 }
 
 static void
-cb_ident (cpp_reader *pfile ATTRIBUTE_UNUSED, fileline line,
+cb_ident (cpp_reader *pfile ATTRIBUTE_UNUSED, source_location line,
 	  const cpp_string *str)
 {
   maybe_print_line (line);
@@ -309,7 +309,7 @@ cb_ident (cpp_reader *pfile ATTRIBUTE_UN
 }
 
 static void
-cb_define (cpp_reader *pfile, fileline line, cpp_hashnode *node)
+cb_define (cpp_reader *pfile, source_location line, cpp_hashnode *node)
 {
   maybe_print_line (line);
   fputs ("#define ", print.outf);
@@ -401,7 +401,7 @@ pp_file_change (const struct line_map *m
 
 /* Copy a #pragma directive to the preprocessed output.  */
 static void
-cb_def_pragma (cpp_reader *pfile, fileline line)
+cb_def_pragma (cpp_reader *pfile, source_location line)
 {
   maybe_print_line (line);
   fputs ("#pragma ", print.outf);
Index: c-semantics.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/c-semantics.c,v
retrieving revision 1.89
diff -u -p -r1.89 c-semantics.c
--- c-semantics.c	24 Jun 2004 23:12:28 -0000	1.89
+++ c-semantics.c	30 Jun 2004 16:25:35 -0000
@@ -132,8 +132,8 @@ add_stmt (tree t)
 
   if ((EXPR_P (t) || STATEMENT_CODE_P (code)) && code != LABEL_EXPR)
     {
-      if (!EXPR_LOCUS (t))
-	annotate_with_locus (t, input_location);
+      if (!EXPR_HAS_LOCATION (t))
+	SET_EXPR_LOCATION (t, input_location);
 
       /* When we expand a statement-tree, we must know whether or not the
 	 statements are full-expressions.  We record that fact here.  */
@@ -149,7 +149,7 @@ add_stmt (tree t)
 
 /* Build a generic statement based on the given type of node and
    arguments. Similar to `build_nt', except that we set
-   EXPR_LOCUS to be the current source location.  */
+   EXPR_LOCATION to be the current source location.  */
 /* ??? This should be obsolete with the lineno_stmt productions
    in the grammar.  */
 
@@ -166,7 +166,7 @@ build_stmt (enum tree_code code, ...)
   ret = make_node (code);
   TREE_TYPE (ret) = void_type_node;
   length = TREE_CODE_LENGTH (code);
-  annotate_with_locus (ret, input_location);
+  SET_EXPR_LOCATION (ret, input_location);
 
   /* Most statements have implicit side effects all on their own, 
      such as control transfer.  For those that do, we'll compute
Index: c-typeck.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/c-typeck.c,v
retrieving revision 1.332
diff -u -p -r1.332 c-typeck.c
--- c-typeck.c	26 Jun 2004 05:03:47 -0000	1.332
+++ c-typeck.c	30 Jun 2004 16:25:37 -0000
@@ -6540,7 +6540,7 @@ c_finish_if_stmt (location_t if_locus, t
     }
 
   stmt = build3 (COND_EXPR, NULL_TREE, cond, then_block, else_block);
-  annotate_with_locus (stmt, if_locus);
+  SET_EXPR_LOCATION (stmt, if_locus);
   add_stmt (stmt);
 }
 
@@ -6584,7 +6584,7 @@ c_finish_loop (location_t start_locus, t
                 }
               else
                 t = build1 (GOTO_EXPR, void_type_node, clab);
-	      annotate_with_locus (t, start_locus);
+	      SET_EXPR_LOCATION (t, start_locus);
               add_stmt (t);
             }
  
@@ -6592,9 +6592,9 @@ c_finish_loop (location_t start_locus, t
           exit = build (COND_EXPR, void_type_node, cond, exit, t);
           exit = fold (exit);
 	  if (cond_is_first)
-            annotate_with_locus (exit, start_locus);
+            SET_EXPR_LOCATION (exit, start_locus);
 	  else
-            annotate_with_locus (exit, input_location);
+            SET_EXPR_LOCATION (exit, input_location);
         }
  
       add_stmt (top);
@@ -6687,7 +6687,7 @@ c_process_expr_stmt (tree expr)
     expr = build1 (NOP_EXPR, TREE_TYPE (expr), expr);
 
   if (EXPR_P (expr))
-    annotate_with_locus (expr, input_location);
+    SET_EXPR_LOCATION (expr, input_location);
 
   return expr;
 }
Index: cfgexpand.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/cfgexpand.c,v
retrieving revision 2.2
diff -u -p -r2.2 cfgexpand.c
--- cfgexpand.c	26 Jun 2004 05:03:47 -0000	2.2
+++ cfgexpand.c	30 Jun 2004 16:25:38 -0000
@@ -319,7 +319,11 @@ construct_exit_block (void)
 
   /* Make sure the locus is set to the end of the function, so that 
      epilogue line numbers and warnings are set properly.  */
+#ifdef USE_MAPPED_LOCATION
+  if (cfun->function_end_locus != UNKNOWN_LOCATION)
+#else
   if (cfun->function_end_locus.file)
+#endif
     input_location = cfun->function_end_locus;
 
   /* The following insns belong to the top scope.  */
Index: cfglayout.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/cfglayout.c,v
retrieving revision 1.63
diff -u -p -r1.63 cfglayout.c
--- cfglayout.c	29 Jun 2004 10:19:42 -0000	1.63
+++ cfglayout.c	30 Jun 2004 16:25:38 -0000
@@ -254,7 +254,7 @@ insn_locators_initialize (void)
   rtx insn, next;
   int loc = 0;
   int line_number = 0, last_line_number = 0;
-  char *file_name = NULL, *last_file_name = NULL;
+  const char *file_name = NULL, *last_file_name = NULL;
 
   prologue_locator = epilogue_locator = 0;
 
@@ -293,7 +293,7 @@ insn_locators_initialize (void)
 	    {
 	      loc++;
 	      VARRAY_PUSH_INT (file_locators_locs, loc);
-	      VARRAY_PUSH_CHAR_PTR (file_locators_files, file_name);
+	      VARRAY_PUSH_CHAR_PTR (file_locators_files, (char *) file_name);
 	      last_file_name = file_name;
 	    }
 	}
@@ -324,8 +324,10 @@ insn_locators_initialize (void)
 	    default:
 	      if (NOTE_LINE_NUMBER (insn) > 0)
 		{
-		  line_number = NOTE_LINE_NUMBER (insn);
-		  file_name = (char *)NOTE_SOURCE_FILE (insn);
+		  expanded_location xloc;
+		  NOTE_EXPANDED_LOCATION (xloc, insn);
+		  line_number = xloc.line;
+		  file_name = xloc.file;
 		}
 	      break;
 	    }
Index: cfgrtl.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/cfgrtl.c,v
retrieving revision 1.122
diff -u -p -r1.122 cfgrtl.c
--- cfgrtl.c	20 Jun 2004 17:03:03 -0000	1.122
+++ cfgrtl.c	30 Jun 2004 16:25:39 -0000
@@ -130,7 +130,7 @@ delete_insn (rtx insn)
 	  really_delete = false;
 	  PUT_CODE (insn, NOTE);
 	  NOTE_LINE_NUMBER (insn) = NOTE_INSN_DELETED_LABEL;
-	  NOTE_SOURCE_FILE (insn) = name;
+	  NOTE_DELETED_LABEL_NAME (insn) = name;
 	}
 
       remove_node_from_expr_list (insn, &nonlocal_goto_handler_labels);
Index: combine.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/combine.c,v
retrieving revision 1.438
diff -u -p -r1.438 combine.c
--- combine.c	30 Jun 2004 13:02:35 -0000	1.438
+++ combine.c	30 Jun 2004 16:25:43 -0000
@@ -2770,19 +2770,13 @@ try_combine (rtx i3, rtx i2, rtx i1, int
 	PATTERN (i2) = newi2pat;
       }
     else
-      {
-	PUT_CODE (i2, NOTE);
-	NOTE_LINE_NUMBER (i2) = NOTE_INSN_DELETED;
-	NOTE_SOURCE_FILE (i2) = 0;
-      }
+      SET_INSN_DELETED (i2);
 
     if (i1)
       {
 	LOG_LINKS (i1) = 0;
 	REG_NOTES (i1) = 0;
-	PUT_CODE (i1, NOTE);
-	NOTE_LINE_NUMBER (i1) = NOTE_INSN_DELETED;
-	NOTE_SOURCE_FILE (i1) = 0;
+	SET_INSN_DELETED (i1);
       }
 
     /* Get death notes for everything that is now used in either I3 or
@@ -12045,9 +12039,7 @@ distribute_notes (rtx notes, rtx from_in
 			  distribute_notes (old_notes, tem, tem, NULL_RTX);
 			  distribute_links (LOG_LINKS (tem));
 
-			  PUT_CODE (tem, NOTE);
-			  NOTE_LINE_NUMBER (tem) = NOTE_INSN_DELETED;
-			  NOTE_SOURCE_FILE (tem) = 0;
+			  SET_INSN_DELETED (tem);
 
 #ifdef HAVE_cc0
 			  /* Delete the setter too.  */
@@ -12061,10 +12053,7 @@ distribute_notes (rtx notes, rtx from_in
 						cc0_setter, NULL_RTX);
 			      distribute_links (LOG_LINKS (cc0_setter));
 
-			      PUT_CODE (cc0_setter, NOTE);
-			      NOTE_LINE_NUMBER (cc0_setter)
-				= NOTE_INSN_DELETED;
-			      NOTE_SOURCE_FILE (cc0_setter) = 0;
+			      SET_INSN_DELETED (cc0_setter);
 			    }
 #endif
 			}
Index: coverage.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/coverage.c,v
retrieving revision 1.37
diff -u -p -r1.37 coverage.c
--- coverage.c	22 Jun 2004 03:06:33 -0000	1.37
+++ coverage.c	30 Jun 2004 16:25:43 -0000
@@ -500,10 +500,11 @@ coverage_checksum_string (unsigned chksu
 static unsigned
 compute_checksum (void)
 {
-  unsigned chksum = DECL_SOURCE_LINE (current_function_decl);
+  expanded_location xloc
+    = expand_location (DECL_SOURCE_LOCATION (current_function_decl));
+  unsigned chksum = xloc.line;
 
-  chksum = coverage_checksum_string (chksum,
-      				     DECL_SOURCE_FILE (current_function_decl));
+  chksum = coverage_checksum_string (chksum, xloc.file);
   chksum = coverage_checksum_string
     (chksum, IDENTIFIER_POINTER (DECL_ASSEMBLER_NAME (current_function_decl)));
 
@@ -523,8 +524,8 @@ coverage_begin_output (void)
 
   if (!bbg_function_announced)
     {
-      const char *file = DECL_SOURCE_FILE (current_function_decl);
-      unsigned line = DECL_SOURCE_LINE (current_function_decl);
+      expanded_location xloc
+	= expand_location (DECL_SOURCE_LOCATION (current_function_decl));
       unsigned long offset;
 
       if (!bbg_file_opened)
@@ -546,8 +547,8 @@ coverage_begin_output (void)
       gcov_write_unsigned (compute_checksum ());
       gcov_write_string (IDENTIFIER_POINTER
 			 (DECL_ASSEMBLER_NAME (current_function_decl)));
-      gcov_write_string (file);
-      gcov_write_unsigned (line);
+      gcov_write_string (xloc.file);
+      gcov_write_unsigned (xloc.line);
       gcov_write_length (offset);
 
       bbg_function_announced = 1;
Index: diagnostic.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/diagnostic.c,v
retrieving revision 1.139
diff -u -p -r1.139 diagnostic.c
--- diagnostic.c	14 Jun 2004 14:17:50 -0000	1.139
+++ diagnostic.c	30 Jun 2004 16:25:43 -0000
@@ -173,13 +173,13 @@ diagnostic_build_prefix (diagnostic_info
 #undef DEFINE_DIAGNOSTIC_KIND
     "must-not-happen"
   };
-   if (diagnostic->kind >= DK_LAST_DIAGNOSTIC_KIND)
-     abort();
+  expanded_location s = expand_location (diagnostic->location);
+  if (diagnostic->kind >= DK_LAST_DIAGNOSTIC_KIND)
+    abort();
 
-  return diagnostic->location.file
+  return s.file
     ? build_message_string ("%s:%d: %s",
-                            diagnostic->location.file,
-                            diagnostic->location.line,
+                            s.file, s.line,
                             _(diagnostic_kind_text[diagnostic->kind]))
     : build_message_string ("%s: %s", progname,
                             _(diagnostic_kind_text[diagnostic->kind]));
@@ -206,8 +206,9 @@ diagnostic_count_diagnostic (diagnostic_
 	   || diagnostic_kind_count (context, DK_SORRY) > 0)
 	  && !context->abort_on_error)
 	{
+	  expanded_location s = expand_location (diagnostic->location);
 	  fnotice (stderr, "%s:%d: confused by earlier errors, bailing out\n",
-		   diagnostic->location.file, diagnostic->location.line);
+		   s.file, s.line);
 	  exit (FATAL_EXIT_CODE);
 	}
 #endif
@@ -313,16 +314,20 @@ diagnostic_report_current_module (diagno
       pp_needs_newline (context->printer) = false;
     }
 
-  if (input_file_stack && diagnostic_last_module_changed (context))
+  p = input_file_stack;
+  if (p && diagnostic_last_module_changed (context))
     {
-      p = input_file_stack;
+      expanded_location xloc = expand_location (p->location);
       pp_verbatim (context->printer,
                    "In file included from %s:%d",
-                   p->location.file, p->location.line);
+		   xloc.file, xloc.line);
       while ((p = p->next) != NULL)
-	pp_verbatim (context->printer,
-                     ",\n                 from %s:%d",
-                     p->location.file, p->location.line);
+	{
+	  xloc = expand_location (p->location);
+	  pp_verbatim (context->printer,
+		       ",\n                 from %s:%d",
+		       xloc.file, xloc.line);
+	}
       pp_verbatim (context->printer, ":\n");
       diagnostic_set_last_module (context);
     }
Index: dwarf2out.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/dwarf2out.c,v
retrieving revision 1.522
diff -u -p -r1.522 dwarf2out.c
--- dwarf2out.c	15 Jun 2004 18:02:15 -0000	1.522
+++ dwarf2out.c	30 Jun 2004 16:25:47 -0000
@@ -10501,10 +10501,11 @@ add_pure_or_virtual_attribute (dw_die_re
 static void
 add_src_coords_attributes (dw_die_ref die, tree decl)
 {
-  unsigned file_index = lookup_filename (DECL_SOURCE_FILE (decl));
+  expanded_location s = expand_location (DECL_SOURCE_LOCATION (decl));
+  unsigned file_index = lookup_filename (s.file);
 
   add_AT_unsigned (die, DW_AT_decl_file, file_index);
-  add_AT_unsigned (die, DW_AT_decl_line, DECL_SOURCE_LINE (decl));
+  add_AT_unsigned (die, DW_AT_decl_line, s.line);
 }
 
 /* Add a DW_AT_name attribute and source coordinate attribute for the
@@ -11199,7 +11200,8 @@ gen_subprogram_die (tree decl, dw_die_re
     }
   else if (old_die)
     {
-      unsigned file_index = lookup_filename (DECL_SOURCE_FILE (decl));
+      expanded_location s = expand_location (DECL_SOURCE_LOCATION (decl));
+      unsigned file_index = lookup_filename (s.file);
 
       if (!get_AT_flag (old_die, DW_AT_declaration)
 	  /* We can have a normal definition following an inline one in the
@@ -11228,7 +11230,7 @@ gen_subprogram_die (tree decl, dw_die_re
 	  && (DECL_ARTIFICIAL (decl)
 	      || (get_AT_unsigned (old_die, DW_AT_decl_file) == file_index
 		  && (get_AT_unsigned (old_die, DW_AT_decl_line)
-		      == (unsigned) DECL_SOURCE_LINE (decl)))))
+		      == (unsigned) s.line))))
 	{
 	  subr_die = old_die;
 
@@ -11247,9 +11249,9 @@ gen_subprogram_die (tree decl, dw_die_re
 	  if (get_AT_unsigned (old_die, DW_AT_decl_file) != file_index)
 	    add_AT_unsigned (subr_die, DW_AT_decl_file, file_index);
 	  if (get_AT_unsigned (old_die, DW_AT_decl_line)
-	      != (unsigned) DECL_SOURCE_LINE (decl))
+	      != (unsigned) s.line)
 	    add_AT_unsigned
-	      (subr_die, DW_AT_decl_line, DECL_SOURCE_LINE (decl));
+	      (subr_die, DW_AT_decl_line, s.line);
 	}
     }
   else
@@ -11476,16 +11478,16 @@ gen_variable_die (tree decl, dw_die_ref 
       add_AT_specification (var_die, old_die);
       if (DECL_NAME (decl))
 	{
-	  unsigned file_index = lookup_filename (DECL_SOURCE_FILE (decl));
+	  expanded_location s = expand_location (DECL_SOURCE_LOCATION (decl));
+	  unsigned file_index = lookup_filename (s.file);
 
 	  if (get_AT_unsigned (old_die, DW_AT_decl_file) != file_index)
 	    add_AT_unsigned (var_die, DW_AT_decl_file, file_index);
 
 	  if (get_AT_unsigned (old_die, DW_AT_decl_line)
-	      != (unsigned) DECL_SOURCE_LINE (decl))
+	      != (unsigned) s.line)
 
-	    add_AT_unsigned (var_die, DW_AT_decl_line,
-			     DECL_SOURCE_LINE (decl));
+	    add_AT_unsigned (var_die, DW_AT_decl_line, s.line);
 	}
     }
   else
@@ -12776,6 +12778,7 @@ dwarf2out_imported_module_or_decl (tree 
   dw_die_ref imported_die, at_import_die;
   dw_die_ref scope_die;
   unsigned file_index;
+  expanded_location xloc;
   
   if (debug_info_level <= DINFO_LEVEL_TERSE)
     return;
@@ -12807,10 +12810,11 @@ dwarf2out_imported_module_or_decl (tree 
     imported_die = new_die (DW_TAG_imported_module, scope_die, context);
   else
     imported_die = new_die (DW_TAG_imported_declaration, scope_die, context);
-  
-  file_index = lookup_filename (input_filename);
+
+  xloc = expand_location (input_location);
+  file_index = lookup_filename (xloc.file);
   add_AT_unsigned (imported_die, DW_AT_decl_file, file_index);
-  add_AT_unsigned (imported_die, DW_AT_decl_line, input_line);
+  add_AT_unsigned (imported_die, DW_AT_decl_line, xloc.line);
   add_AT_die_ref (imported_die, DW_AT_import, at_import_die);
 }
 
@@ -12898,7 +12902,7 @@ dwarf2out_decl (tree decl)
 
       /* Don't bother trying to generate any DIEs to represent any of the
 	 normal built-in types for the language we are compiling.  */
-      if (DECL_SOURCE_LINE (decl) == 0)
+      if (DECL_IS_BUILTIN (decl))
 	{
 	  /* OK, we need to generate one for `bool' so GDB knows what type
 	     comparisons have.  */
Index: emit-rtl.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/emit-rtl.c,v
retrieving revision 1.397
diff -u -p -r1.397 emit-rtl.c
--- emit-rtl.c	26 Jun 2004 10:10:25 -0000	1.397
+++ emit-rtl.c	30 Jun 2004 16:25:48 -0000
@@ -4131,7 +4131,9 @@ emit_note_before (int subtype, rtx befor
 {
   rtx note = rtx_alloc (NOTE);
   INSN_UID (note) = cur_insn_uid++;
+#ifndef USE_MAPPED_LOCATION
   NOTE_SOURCE_FILE (note) = 0;
+#endif
   NOTE_LINE_NUMBER (note) = subtype;
   BLOCK_FOR_INSN (note) = NULL;
 
@@ -4354,7 +4356,9 @@ emit_note_after (int subtype, rtx after)
 {
   rtx note = rtx_alloc (NOTE);
   INSN_UID (note) = cur_insn_uid++;
+#ifndef USE_MAPPED_LOCATION
   NOTE_SOURCE_FILE (note) = 0;
+#endif
   NOTE_LINE_NUMBER (note) = subtype;
   BLOCK_FOR_INSN (note) = NULL;
   add_insn_after (note, after);
@@ -4629,10 +4633,15 @@ emit_line_note (location_t location)
   
   set_file_and_line_for_stmt (location);
   
+#ifdef USE_MAPPED_LOCATION
+  if (location == last_location)
+    return NULL_RTX;
+#else
   if (location.file && last_location.file
       && !strcmp (location.file, last_location.file)
       && location.line == last_location.line)
     return NULL_RTX;
+#endif
   last_location = location;
   
   if (no_line_numbers)
@@ -4641,8 +4650,12 @@ emit_line_note (location_t location)
       return NULL_RTX;
     }
 
+#ifdef USE_MAPPED_LOCATION
+  note = emit_note ((int) location);
+#else
   note = emit_note (location.line);
   NOTE_SOURCE_FILE (note) = location.file;
+#endif
   
   return note;
 }
@@ -4694,7 +4707,11 @@ emit_note (int note_no)
 void
 force_next_line_note (void)
 {
+#ifdef USE_MAPPED_LOCATION
+  last_location = -1;
+#else
   last_location.line = -1;
+#endif
 }
 
 /* Place a note of KIND on insn INSN with DATUM as the datum. If a
@@ -5154,8 +5171,7 @@ init_emit (void)
   seq_rtl_expr = NULL;
   cur_insn_uid = 1;
   reg_rtx_no = LAST_VIRTUAL_REGISTER + 1;
-  last_location.line = 0;
-  last_location.file = 0;
+  last_location = UNKNOWN_LOCATION;
   first_label_num = label_num;
   last_label_num = 0;
   seq_stack = NULL;
Index: final.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/final.c,v
retrieving revision 1.315
diff -u -p -r1.315 final.c
--- final.c	15 Jun 2004 18:02:19 -0000	1.315
+++ final.c	30 Jun 2004 16:25:50 -0000
@@ -1520,8 +1520,13 @@ final (rtx first, FILE *file, int optimi
 	if (GET_CODE (insn) == NOTE && NOTE_LINE_NUMBER (insn) > 0)
 	  {
 	    if (last != 0
+#ifdef USE_MAPPED_LOCATION
+		&& NOTE_SOURCE_LOCATION (insn) == NOTE_SOURCE_LOCATION (last)
+#else
 		&& NOTE_LINE_NUMBER (insn) == NOTE_LINE_NUMBER (last)
-		&& NOTE_SOURCE_FILE (insn) == NOTE_SOURCE_FILE (last))
+		&& NOTE_SOURCE_FILE (insn) == NOTE_SOURCE_FILE (last)
+#endif)
+	      )
 	      {
 		delete_insn (insn);	/* Use delete_note.  */
 		continue;
Index: flow.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/flow.c,v
retrieving revision 1.589
diff -u -p -r1.589 flow.c
--- flow.c	15 Jun 2004 18:02:20 -0000	1.589
+++ flow.c	30 Jun 2004 16:25:51 -0000
@@ -3391,8 +3391,7 @@ attempt_auto_inc (struct propagate_block
 	}
 
       PUT_CODE (incr, NOTE);
-      NOTE_LINE_NUMBER (incr) = NOTE_INSN_DELETED;
-      NOTE_SOURCE_FILE (incr) = 0;
+      SET_INSN_DELETED (incr);
     }
 
   if (regno >= FIRST_PSEUDO_REGISTER)
Index: function.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/function.c,v
retrieving revision 1.530
diff -u -p -r1.530 function.c
--- function.c	29 Jun 2004 03:54:07 -0000	1.530
+++ function.c	30 Jun 2004 16:25:54 -0000
@@ -6315,7 +6315,7 @@ init_function_start (tree subr)
      function.  Also tell final how to output a linenum before the
      function prologue.  Note linenums could be missing, e.g. when
      compiling a Java .class file.  */
-  if (DECL_SOURCE_LINE (subr))
+  if (! DECL_IS_BUILTIN (subr))
     emit_line_note (DECL_SOURCE_LOCATION (subr));
 
   /* Make sure first insn is a note even if we don't want linenums.
Index: gengtype-lex.l
===================================================================
RCS file: /cvs/gcc/gcc/gcc/gengtype-lex.l,v
retrieving revision 1.22
diff -u -p -r1.22 gengtype-lex.l
--- gengtype-lex.l	28 Jun 2004 10:30:21 -0000	1.22
+++ gengtype-lex.l	30 Jun 2004 16:25:54 -0000
@@ -88,7 +88,12 @@ ITYPE	{IWORD}({WS}{IWORD})*
   t = find_structure (xmemdup (tagstart, taglen, taglen+1), union_p);
   if (is_pointer)
     t = create_pointer (t);
-  do_typedef (xmemdup (namestart, namelen, namelen+1), t, &lexer_line);
+  namestart = xmemdup (namestart, namelen, namelen+1);
+#ifdef USE_MAPPED_LOCATION
+  /* temporary kludge - gentype doesn't handle cpp conditionals */
+  if (strcmp (namestart, "location_t") != 0)
+#endif
+  do_typedef (namestart, t, &lexer_line);
   update_lineno (yytext, yyleng);
 }
 
Index: gengtype.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/gengtype.c,v
retrieving revision 1.52
diff -u -p -r1.52 gengtype.c
--- gengtype.c	30 Jun 2004 15:37:40 -0000	1.52
+++ gengtype.c	30 Jun 2004 16:25:54 -0000
@@ -1104,7 +1104,7 @@ open_base_files (void)
     /* The order of files here matters very much.  */
     static const char *const ifiles [] = {
       "config.h", "system.h", "coretypes.h", "tm.h", "varray.h", 
-      "hashtab.h", "splay-tree.h", "bitmap.h", "tree.h", "rtl.h",
+      "hashtab.h", "splay-tree.h", "bitmap.h", "input.h", "tree.h", "rtl.h",
       "function.h", "insn-config.h", "expr.h", "hard-reg-set.h",
       "basic-block.h", "cselib.h", "insn-addr.h", "optabs.h",
       "libfuncs.h", "debug.h", "ggc.h", "cgraph.h",
@@ -2988,6 +2988,10 @@ main(int argc ATTRIBUTE_UNUSED, char **a
   do_scalar_typedef ("uint8", &pos);
   do_scalar_typedef ("jword", &pos);
   do_scalar_typedef ("JCF_u2", &pos);
+#ifdef USE_MAPPED_LOCATION
+  do_scalar_typedef ("location_t", &pos);
+  do_scalar_typedef ("source_locus", &pos);
+#endif
   do_scalar_typedef ("void", &pos);
 
   do_typedef ("PTR", create_pointer (resolve_typedef ("void", &pos)), &pos);
@@ -3010,6 +3014,12 @@ main(int argc ATTRIBUTE_UNUSED, char **a
         }
       if (!dupflag)
         parse_file (all_files[i]);
+#ifndef USE_MAPPED_LOCATION
+      /* temporary kludge - gengtype doesn't handle conditionals.
+	 Manually add source_locus *after* we've processed input.h. */
+      if (i == 0)
+	do_typedef ("source_locus", create_pointer (resolve_typedef ("location_t", &pos)), &pos);
+#endif
     }
 
   if (hit_error != 0)
Index: gimple-low.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/gimple-low.c,v
retrieving revision 2.6
diff -u -p -r2.6 gimple-low.c
--- gimple-low.c	22 Jun 2004 03:06:39 -0000	2.6
+++ gimple-low.c	30 Jun 2004 16:25:55 -0000
@@ -94,7 +94,7 @@ lower_function_body (void)
           || TREE_OPERAND (TREE_VALUE (data.return_statements), 0) != NULL))
     {
       x = build (RETURN_EXPR, void_type_node, NULL);
-      annotate_with_locus (x, cfun->function_end_locus);
+      SET_EXPR_LOCATION (x, cfun->function_end_locus);
       tsi_link_after (&i, x, TSI_CONTINUE_LINKING);
     }
 
@@ -109,7 +109,11 @@ lower_function_body (void)
 	 It now fills in for many such returns.  Failure to remove this
 	 will result in incorrect results for coverage analysis.  */
       x = TREE_VALUE (t);
+#ifdef USE_MAPPED_LOCATION
+      SET_EXPR_LOCATION (x, UNKNOWN_LOCATION);
+#else
       SET_EXPR_LOCUS (x, NULL);
+#endif
       tsi_link_after (&i, x, TSI_CONTINUE_LINKING);
     }
 
Index: gimplify.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/gimplify.c,v
retrieving revision 2.36
diff -u -p -r2.36 gimplify.c
--- gimplify.c	30 Jun 2004 00:38:18 -0000	2.36
+++ gimplify.c	30 Jun 2004 16:25:56 -0000
@@ -453,10 +453,10 @@ internal_get_tmp_var (tree val, tree *pr
   mod = build (MODIFY_EXPR, TREE_TYPE (t), t, val);
 
   class = TREE_CODE_CLASS (TREE_CODE (val));
-  if (EXPR_LOCUS (val))
+  if (EXPR_HAS_LOCATION (val))
     SET_EXPR_LOCUS (mod, EXPR_LOCUS (val));
   else
-    annotate_with_locus (mod, input_location);
+    SET_EXPR_LOCATION (mod, input_location);
 
   /* gimplify_modify_expr might want to reduce this further.  */
   gimplify_and_add (mod, pre_p);
@@ -559,7 +559,7 @@ annotate_one_with_locus (tree t, locatio
   if (IS_EXPR_CODE_CLASS (TREE_CODE_CLASS (TREE_CODE (t)))
       && ! EXPR_HAS_LOCATION (t)
       && should_carry_locus_p (t))
-    annotate_with_locus (t, locus);
+    SET_EXPR_LOCATION (t, locus);
 }
 
 void
@@ -1832,8 +1832,8 @@ gimplify_call_expr (tree *expr_p, tree *
 
   /* For reliable diagnostics during inlining, it is necessary that 
      every call_expr be annotated with file and line.  */
-  if (!EXPR_LOCUS (*expr_p))
-    annotate_with_locus (*expr_p, input_location);
+  if (! EXPR_HAS_LOCATION (*expr_p))
+    SET_EXPR_LOCATION (*expr_p, input_location);
 
   /* This may be a call to a builtin function.
 
@@ -3435,7 +3435,6 @@ gimplify_expr (tree *expr_p, tree *pre_p
   tree internal_post = NULL_TREE;
   tree save_expr;
   int is_statement = (pre_p == NULL);
-  location_t *locus;
   location_t saved_location;
   enum gimplify_status ret;
 
@@ -3455,12 +3454,9 @@ gimplify_expr (tree *expr_p, tree *pre_p
     post_p = &internal_post;
 
   saved_location = input_location;
-  if (save_expr == error_mark_node)
-    locus = NULL;
-  else
-    locus = EXPR_LOCUS (save_expr);
-  if (locus)
-    input_location = *locus;
+  if (save_expr != error_mark_node
+      && EXPR_HAS_LOCATION (*expr_p))
+    input_location = EXPR_LOCATION (*expr_p);
 
   /* Loop over the specific gimplifiers until the toplevel node
      remains the same.  */
Index: haifa-sched.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/haifa-sched.c,v
retrieving revision 1.245
diff -u -p -r1.245 haifa-sched.c
--- haifa-sched.c	15 Jun 2004 18:02:23 -0000	1.245
+++ haifa-sched.c	30 Jun 2004 16:25:57 -0000
@@ -1559,8 +1559,13 @@ restore_line_notes (rtx head, rtx tail)
 	     && (note = LINE_NOTE (insn)) != 0
 	     && note != line
 	     && (line == 0
+#ifdef USE_MAPPED_LOCATION
+		 || NOTE_SOURCE_LOCATION (note) != NOTE_SOURCE_LOCATION (line)
+#else
 		 || NOTE_LINE_NUMBER (note) != NOTE_LINE_NUMBER (line)
-		 || NOTE_SOURCE_FILE (note) != NOTE_SOURCE_FILE (line)))
+		 || NOTE_SOURCE_FILE (note) != NOTE_SOURCE_FILE (line)
+#endif
+		 ))
       {
 	line = note;
 	prev = PREV_INSN (insn);
@@ -1577,7 +1582,9 @@ restore_line_notes (rtx head, rtx tail)
 	  {
 	    added_notes++;
 	    new = emit_note_after (NOTE_LINE_NUMBER (note), prev);
+#ifndef USE_MAPPED_LOCATION
 	    NOTE_SOURCE_FILE (new) = NOTE_SOURCE_FILE (note);
+#endif
 	  }
       }
   if (sched_verbose && added_notes)
@@ -1605,17 +1612,20 @@ rm_redundant_line_notes (void)
 	if (active_insn == 0)
 	  {
 	    notes++;
-	    NOTE_SOURCE_FILE (insn) = 0;
-	    NOTE_LINE_NUMBER (insn) = NOTE_INSN_DELETED;
+	    SET_INSN_DELETED (insn);
 	  }
 	/* If the line number is unchanged, LINE is redundant.  */
 	else if (line
+#ifdef USE_MAPPED_LOCATION
+		 && NOTE_SOURCE_LOCATION (line) == NOTE_SOURCE_LOCATION (insn)
+#else
 		 && NOTE_LINE_NUMBER (line) == NOTE_LINE_NUMBER (insn)
-		 && NOTE_SOURCE_FILE (line) == NOTE_SOURCE_FILE (insn))
+		 && NOTE_SOURCE_FILE (line) == NOTE_SOURCE_FILE (insn)
+#endif
+)
 	  {
 	    notes++;
-	    NOTE_SOURCE_FILE (line) = 0;
-	    NOTE_LINE_NUMBER (line) = NOTE_INSN_DELETED;
+	    SET_INSN_DELETED (line);
 	    line = insn;
 	  }
 	else
Index: ifcvt.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/ifcvt.c,v
retrieving revision 1.149
diff -u -p -r1.149 ifcvt.c
--- ifcvt.c	26 Jun 2004 01:43:57 -0000	1.149
+++ ifcvt.c	30 Jun 2004 16:25:58 -0000
@@ -260,9 +260,7 @@ cond_exec_process_insns (ce_if_block_t *
 	{
 	  /* ??? Ug.  Actually unlinking the thing is problematic,
 	     given what we'd have to coordinate with our callers.  */
-	  PUT_CODE (insn, NOTE);
-	  NOTE_LINE_NUMBER (insn) = NOTE_INSN_DELETED;
-	  NOTE_SOURCE_FILE (insn) = 0;
+	  SET_INSN_DELETED (insn);
 	  goto insn_done;
 	}
 
Index: input.h
===================================================================
RCS file: /cvs/gcc/gcc/gcc/input.h,v
retrieving revision 1.18
diff -u -p -r1.18 input.h
--- input.h	13 May 2004 06:39:43 -0000	1.18
+++ input.h	30 Jun 2004 16:25:58 -0000
@@ -22,19 +22,41 @@ Software Foundation, 59 Temple Place - S
 #ifndef GCC_INPUT_H
 #define GCC_INPUT_H
 
+#include "line-map.h"
 extern struct line_maps line_table;
 
-/* The data structure used to record a location in a translation unit.  */
-/* Long-term, we want to get rid of this and typedef fileline location_t.  */
-struct location_s GTY (())
+/* The location for declarations in "<built-in>" */
+#define BUILTINS_LOCATION ((source_location) 2)
+
+typedef struct location_s GTY(())
 {
   /* The name of the source file involved.  */
   const char *file;
 
   /* The line-location in the source file.  */
   int line;
-};
+
+  /* FUTURE (but confuses gentype): int column. */
+} expanded_location;
+
+#ifdef USE_MAPPED_LOCATION
+
+extern expanded_location expand_location (source_location);
+
+#define UNKNOWN_LOCATION ((source_location) 0)
+typedef source_location location_t; /* deprecated typedef */
+typedef source_location source_locus; /* to be removed */
+
+#else /* ! USE_MAPPED_LOCATION */
+
 typedef struct location_s location_t;
+typedef location_t *source_locus;
+
+#define expand_location(FILELINE) (FILELINE)
+extern location_t unknown_location;
+#define UNKNOWN_LOCATION unknown_location
+
+#endif /* ! USE_MAPPED_LOCATION */
 
 struct file_stack
 {
@@ -46,8 +68,18 @@ struct file_stack
 extern const char *main_input_filename;
 
 extern location_t input_location;
-#define input_line (input_location.line)
-#define input_filename (input_location.file)
+#ifdef USE_MAPPED_LOCATION
+extern void push_srcloc (location_t);
+#else /* ! USE_MAPPED_LOCATION */
+extern void push_srcloc (const char *name, int line);
+#endif /* ! USE_MAPPED_LOCATION */
+extern void pop_srcloc (void);
+
+#define LOCATION_FILE(LOC) ((expand_location (LOC)).file)
+#define LOCATION_LINE(LOC) ((expand_location (LOC)).line)
+
+#define input_line LOCATION_LINE(input_location)
+#define input_filename LOCATION_FILE(input_location)
 
 /* Stack of currently pending input files.
    The line member is not accurate for the innermost file on the stack.  */
@@ -56,7 +88,4 @@ extern struct file_stack *input_file_sta
 /* Incremented on each change to input_file_stack.  */
 extern int input_file_stack_tick;
 
-extern void push_srcloc (const char *name, int line);
-extern void pop_srcloc (void);
-
 #endif
Index: integrate.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/integrate.c,v
retrieving revision 1.258
diff -u -p -r1.258 integrate.c
--- integrate.c	20 Jun 2004 17:03:03 -0000	1.258
+++ integrate.c	30 Jun 2004 16:25:58 -0000
@@ -505,8 +505,13 @@ copy_rtx_and_substitute (rtx orig, struc
 	  ASM_OPERANDS_INPUT_VEC (copy) = map->copy_asm_operands_vector;
 	  ASM_OPERANDS_INPUT_CONSTRAINT_VEC (copy)
 	    = map->copy_asm_constraints_vector;
+#ifdef USE_MAPPED_LOCATION
+	  ASM_OPERANDS_SOURCE_LOCATION (copy)
+	    = ASM_OPERANDS_SOURCE_LOCATION (orig);
+#else
 	  ASM_OPERANDS_SOURCE_FILE (copy) = ASM_OPERANDS_SOURCE_FILE (orig);
 	  ASM_OPERANDS_SOURCE_LINE (copy) = ASM_OPERANDS_SOURCE_LINE (orig);
+#endif
 	  return copy;
 	}
       break;
Index: jump.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/jump.c,v
retrieving revision 1.247
diff -u -p -r1.247 jump.c
--- jump.c	15 Jun 2004 18:02:26 -0000	1.247
+++ jump.c	30 Jun 2004 16:25:59 -0000
@@ -142,8 +142,13 @@ purge_line_number_notes (rtx f)
 	  {
 	    /* Delete this note if it is identical to previous note.  */
 	    if (last_note
+#ifdef USE_MAPPED_LOCATION
+		&& NOTE_SOURCE_LOCATION (insn) == NOTE_SOURCE_LOCATION (last_note)
+#else
 		&& NOTE_SOURCE_FILE (insn) == NOTE_SOURCE_FILE (last_note)
-		&& NOTE_LINE_NUMBER (insn) == NOTE_LINE_NUMBER (last_note))
+		&& NOTE_LINE_NUMBER (insn) == NOTE_LINE_NUMBER (last_note)
+#endif
+)
 	      {
 		delete_related_insns (insn);
 		continue;
Index: modulo-sched.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/modulo-sched.c,v
retrieving revision 1.4
diff -u -p -r1.4 modulo-sched.c
--- modulo-sched.c	26 Jun 2004 05:03:52 -0000	1.4
+++ modulo-sched.c	30 Jun 2004 16:25:59 -0000
@@ -900,8 +900,12 @@ sms_schedule (FILE *dump_file)
 	      rtx line_note = find_line_note (tail);
 
 	      if (line_note)
-	    	fprintf (stats_file, "SMS bb %s %d (file, line)\n",
-		     	 NOTE_SOURCE_FILE (line_note), NOTE_LINE_NUMBER (line_note));
+		{
+		  expanded_location xloc;
+		  NOTE_EXPANDED_LOCATION (xloc, line_note);
+		  fprintf (stats_file, "SMS bb %s %d (file, line)\n",
+			   xloc.file, xloc.line);
+		}
 	      fprintf (stats_file, "SMS single-bb-loop\n");
 	      if (profile_info && flag_branch_probabilities)
 	    	{
@@ -996,8 +1000,12 @@ sms_schedule (FILE *dump_file)
 	  rtx line_note = find_line_note (tail);
 
 	  if (line_note)
-	    fprintf (stats_file, "SMS bb %s %d (file, line)\n",
-		     NOTE_SOURCE_FILE (line_note), NOTE_LINE_NUMBER (line_note));
+	    {
+	      expanded_location xloc;
+	      NOTE_EXPANDED_LOCATION (xloc, line_note);
+	      fprintf (stats_file, "SMS bb %s %d (file, line)\n",
+		       xloc.file, xloc.line);
+	    }
 	  fprintf (stats_file, "SMS single-bb-loop\n");
 	  if (profile_info && flag_branch_probabilities)
 	    {
Index: pretty-print.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/pretty-print.c,v
retrieving revision 2.14
diff -u -p -r2.14 pretty-print.c
--- pretty-print.c	29 May 2004 20:10:10 -0000	2.14
+++ pretty-print.c	30 Jun 2004 16:26:00 -0000
@@ -305,11 +305,12 @@ pp_base_format_text (pretty_printer *pp,
 
         case 'H':
           {
-            const location_t *locus = va_arg (*text->args_ptr, location_t *);
+            location_t *locus = va_arg (*text->args_ptr, location_t *);
+	    expanded_location s = expand_location (*locus);
             pp_string (pp, "file '");
-            pp_string (pp, locus->file);
+            pp_string (pp, s.file);
             pp_string (pp, "', line ");
-            pp_decimal_int (pp, locus->line);
+            pp_decimal_int (pp, s.line);
           }
           break;
 
Index: print-rtl.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/print-rtl.c,v
retrieving revision 1.110
diff -u -p -r1.110 print-rtl.c
--- print-rtl.c	15 Jun 2004 18:02:29 -0000	1.110
+++ print-rtl.c	30 Jun 2004 16:26:00 -0000
@@ -272,10 +272,13 @@ print_rtx (rtx in_rtx)
 		break;
 
 	      case NOTE_INSN_DELETED_LABEL:
-		if (NOTE_SOURCE_FILE (in_rtx))
-		  fprintf (outfile, " (\"%s\")", NOTE_SOURCE_FILE (in_rtx));
-		else
-		  fprintf (outfile, " \"\"");
+		{
+		  const char *label = NOTE_DELETED_LABEL_NAME (in_rtx);
+		  if (label)
+		    fprintf (outfile, " (\"%s\")", label);
+		  else
+		    fprintf (outfile, " \"\"");
+		}
 		break;
 
 	      case NOTE_INSN_PREDICTION:
Index: print-tree.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/print-tree.c,v
retrieving revision 1.86
diff -u -p -r1.86 print-tree.c
--- print-tree.c	14 May 2004 02:32:58 -0000	1.86
+++ print-tree.c	30 Jun 2004 16:26:00 -0000
@@ -160,6 +160,7 @@ print_node (FILE *file, const char *pref
   int len;
   int first_rtl;
   int i;
+  expanded_location xloc;
 
   if (node == 0)
     return;
@@ -372,8 +373,8 @@ print_node (FILE *file, const char *pref
 	fputs (" decl_7", file);
 
       fprintf (file, " %s", GET_MODE_NAME (mode));
-      fprintf (file, " file %s line %d",
-	       DECL_SOURCE_FILE (node), DECL_SOURCE_LINE (node));
+      xloc = expand_location (DECL_SOURCE_LOCATION (node));
+      fprintf (file, " file %s line %d", xloc.file, xloc.line);
 
       print_node (file, "size", DECL_SIZE (node), indent + 4);
       print_node (file, "unit size", DECL_SIZE_UNIT (node), indent + 4);
@@ -745,10 +746,9 @@ print_node (FILE *file, const char *pref
 
   if (EXPR_HAS_LOCATION (node))
     {
+      expanded_location xloc = expand_location (EXPR_LOCATION (node));
       indent_to (file, indent+4);
-      fprintf (file, "%s:%d",
-	       EXPR_FILENAME (node),
-	       EXPR_LINENO (node));
+      fprintf (file, "%s:%d", xloc.file, xloc.line);
     }
 
   fprintf (file, ">");
Index: profile.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/profile.c,v
retrieving revision 1.132
diff -u -p -r1.132 profile.c
--- profile.c	13 May 2004 06:39:44 -0000	1.132
+++ profile.c	30 Jun 2004 16:26:00 -0000
@@ -922,23 +922,26 @@ branch_prob (void)
 		    ignore_next_note = 0;
 		  else
 		    {
+		      expanded_location s;
+
 		      if (!offset)
 			{
 			  offset = gcov_write_tag (GCOV_TAG_LINES);
 			  gcov_write_unsigned (BB_TO_GCOV_INDEX (bb));
 			}
 
+		      NOTE_EXPANDED_LOCATION (s, insn);
+
 		      /* If this is a new source file, then output the
 			 file's name to the .bb file.  */
 		      if (!prev_file_name
-			  || strcmp (NOTE_SOURCE_FILE (insn),
-				     prev_file_name))
+			  || strcmp (s.file, prev_file_name))
 			{
-			  prev_file_name = NOTE_SOURCE_FILE (insn);
+			  prev_file_name = s.file;
 			  gcov_write_unsigned (0);
 			  gcov_write_string (prev_file_name);
 			}
-		      gcov_write_unsigned (NOTE_LINE_NUMBER (insn));
+		      gcov_write_unsigned (s.line);
 		    }
 		}
 	      insn = NEXT_INSN (insn);
Index: ra-debug.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/ra-debug.c,v
retrieving revision 1.19
diff -u -p -r1.19 ra-debug.c
--- ra-debug.c	15 Jun 2004 18:02:31 -0000	1.19
+++ ra-debug.c	30 Jun 2004 16:26:01 -0000
@@ -389,9 +389,11 @@ ra_print_rtx (FILE *file, rtx x, int wit
 	    fprintf (file, " %s", GET_NOTE_INSN_NAME (ln));
 	  else
 	    {
-	      fprintf (file, " line %d", ln);
-	      if (NOTE_SOURCE_FILE (x))
-		fprintf (file, ":%s", NOTE_SOURCE_FILE (x));
+	      expanded_location s;
+	      NOTE_EXPANDED_LOCATION (s, x);
+	      fprintf (file, " line %d", s.line);
+	      if (s.file != NULL)
+		fprintf (file, ":%s", s.file);
 	    }
 	}
       else
Index: recog.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/recog.c,v
retrieving revision 1.202
diff -u -p -r1.202 recog.c
--- recog.c	15 Jun 2004 18:02:31 -0000	1.202
+++ recog.c	30 Jun 2004 16:26:02 -0000
@@ -2677,9 +2677,7 @@ split_insn (rtx insn)
     return NULL_RTX;
 
   /* try_split returns the NOTE that INSN became.  */
-  PUT_CODE (insn, NOTE);
-  NOTE_SOURCE_FILE (insn) = 0;
-  NOTE_LINE_NUMBER (insn) = NOTE_INSN_DELETED;
+  SET_INSN_DELETED (insn);
 
   /* ??? Coddle to md files that generate subregs in post-reload
      splitters instead of computing the proper hard register.  */
Index: reload1.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/reload1.c,v
retrieving revision 1.437
diff -u -p -r1.437 reload1.c
--- reload1.c	15 Jun 2004 18:02:34 -0000	1.437
+++ reload1.c	30 Jun 2004 16:26:04 -0000
@@ -1059,11 +1059,7 @@ reload (rtx first, int global)
 	      else if (reg_set_p (regno_reg_rtx[i], PATTERN (equiv_insn)))
 		delete_dead_insn (equiv_insn);
 	      else
-		{
-		  PUT_CODE (equiv_insn, NOTE);
-		  NOTE_SOURCE_FILE (equiv_insn) = 0;
-		  NOTE_LINE_NUMBER (equiv_insn) = NOTE_INSN_DELETED;
-		}
+		SET_INSN_DELETED (equiv_insn);
 	    }
 	}
     }
@@ -1911,9 +1907,7 @@ delete_dead_insn (rtx insn)
       && ! side_effects_p (SET_SRC (PATTERN (prev))))
     delete_dead_insn (prev);
 
-  PUT_CODE (insn, NOTE);
-  NOTE_LINE_NUMBER (insn) = NOTE_INSN_DELETED;
-  NOTE_SOURCE_FILE (insn) = 0;
+  SET_INSN_DELETED (insn);
 }
 
 /* Modify the home of pseudo-reg I.
Index: rtl-error.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/rtl-error.c,v
retrieving revision 1.12
diff -u -p -r1.12 rtl-error.c
--- rtl-error.c	6 Jul 2003 09:56:08 -0000	1.12
+++ rtl-error.c	30 Jun 2004 16:26:04 -0000
@@ -59,10 +59,14 @@ location_for_asm (rtx insn)
     asmop = NULL;
 
   if (asmop)
+#ifdef USE_MAPPED_LOCATION
+    loc = ASM_OPERANDS_SOURCE_LOCATION (asmop);
+#else
     {
       loc.file = ASM_OPERANDS_SOURCE_FILE (asmop);
       loc.line = ASM_OPERANDS_SOURCE_LINE (asmop);
     }
+#endif
   else
     loc = input_location;
   return loc;
Index: rtl.def
===================================================================
RCS file: /cvs/gcc/gcc/gcc/rtl.def,v
retrieving revision 1.85
diff -u -p -r1.85 rtl.def
--- rtl.def	3 Jun 2004 22:17:20 -0000	1.85
+++ rtl.def	30 Jun 2004 16:26:05 -0000
@@ -640,11 +640,19 @@ DEF_RTL_EXPR(BARRIER, "barrier", "iuu000
    7: is the user-given name of the label, if any.  */
 DEF_RTL_EXPR(CODE_LABEL, "code_label", "iuuB00is", RTX_EXTRA)
 
+#ifdef USE_MAPPED_LOCATION
+/* Say where in the code a source line starts, for symbol table's sake.
+   Operand:
+   4: unused if line number > 0, note-specific data otherwise.
+   5: line number if > 0, enum note_insn otherwise.
+   6: CODE_LABEL_NUMBER if line number == NOTE_INSN_DELETED_LABEL.  */
+#else
 /* Say where in the code a source line starts, for symbol table's sake.
    Operand:
    4: filename, if line number > 0, note-specific data otherwise.
    5: line number if > 0, enum note_insn otherwise.
    6: unique number if line number == note_insn_deleted_label.  */
+#endif
 DEF_RTL_EXPR(NOTE, "note", "iuuB0ni", RTX_EXTRA)
 
 /* ----------------------------------------------------------------------
@@ -671,6 +679,20 @@ DEF_RTL_EXPR(PARALLEL, "parallel", "E", 
      as a convenient way to hold a string.  */
 DEF_RTL_EXPR(ASM_INPUT, "asm_input", "s", RTX_EXTRA)
 
+#ifdef USE_MAPPED_LOCATION
+/* An assembler instruction with operands.
+   1st operand is the instruction template.
+   2nd operand is the constraint for the output.
+   3rd operand is the number of the output this expression refers to.
+     When an insn stores more than one value, a separate ASM_OPERANDS
+     is made for each output; this integer distinguishes them.
+   4th is a vector of values of input operands.
+   5th is a vector of modes and constraints for the input operands.
+     Each element is an ASM_INPUT containing a constraint string
+     and whose mode indicates the mode of the input operand.
+   6th is the source line number.  */
+DEF_RTL_EXPR(ASM_OPERANDS, "asm_operands", "ssiEEi", RTX_EXTRA)
+#else
 /* An assembler instruction with operands.
    1st operand is the instruction template.
    2nd operand is the constraint for the output.
@@ -684,6 +706,7 @@ DEF_RTL_EXPR(ASM_INPUT, "asm_input", "s"
    6th is the name of the containing source file.
    7th is the source line number.  */
 DEF_RTL_EXPR(ASM_OPERANDS, "asm_operands", "ssiEEsi", RTX_EXTRA)
+#endif
 
 /* A machine-specific operation.
    1st operand is a vector of operands being used by the operation so that
Index: rtl.h
===================================================================
RCS file: /cvs/gcc/gcc/gcc/rtl.h,v
retrieving revision 1.481
diff -u -p -r1.481 rtl.h
--- rtl.h	20 Jun 2004 17:03:04 -0000	1.481
+++ rtl.h	30 Jun 2004 16:26:06 -0000
@@ -914,7 +914,22 @@ extern const char * const reg_note_name[
 
 /* Opaque data.  */
 #define NOTE_DATA(INSN)	        RTL_CHECKC1 (INSN, 4, NOTE)
+#define NOTE_DELETED_LABEL_NAME(INSN) XCSTR (INSN, 4, NOTE)
+#ifdef USE_MAPPED_LOCATION
+#define NOTE_SOURCE_LOCATION(INSN) XCUINT (INSN, 5, NOTE)
+#define NOTE_EXPANDED_LOCATION(XLOC, INSN)	\
+  (XLOC) = expand_location (NOTE_SOURCE_LOCATION (INSN))
+#define SET_INSN_DELETED(INSN) \
+  (PUT_CODE (INSN, NOTE), NOTE_LINE_NUMBER (INSN) = NOTE_INSN_DELETED)
+#else
+#define NOTE_EXPANDED_LOCATION(XLOC, INSN)	\
+  ((XLOC).file = NOTE_SOURCE_FILE (INSN),	\
+   (XLOC).line = NOTE_LINE_NUMBER (INSN))
 #define NOTE_SOURCE_FILE(INSN)	XCSTR (INSN, 4, NOTE)
+#define SET_INSN_DELETED(INSN) \
+  (PUT_CODE (INSN, NOTE),  NOTE_SOURCE_FILE (INSN) = 0, \
+   NOTE_LINE_NUMBER (INSN) = NOTE_INSN_DELETED)
+#endif
 #define NOTE_BLOCK(INSN)	XCTREE (INSN, 4, NOTE)
 #define NOTE_EH_HANDLER(INSN)	XCINT (INSN, 4, NOTE)
 #define NOTE_BASIC_BLOCK(INSN)	XCBBDEF (INSN, 4, NOTE)
@@ -1247,8 +1262,12 @@ do {									\
   XSTR (XCVECEXP (RTX, 4, N, ASM_OPERANDS), 0)
 #define ASM_OPERANDS_INPUT_MODE(RTX, N)  \
   GET_MODE (XCVECEXP (RTX, 4, N, ASM_OPERANDS))
+#ifdef USE_MAPPED_LOCATION
+#define ASM_OPERANDS_SOURCE_LOCATION(RTX) XCUINT (RTX, 5, ASM_OPERANDS)
+#else
 #define ASM_OPERANDS_SOURCE_FILE(RTX) XCSTR (RTX, 5, ASM_OPERANDS)
 #define ASM_OPERANDS_SOURCE_LINE(RTX) XCINT (RTX, 6, ASM_OPERANDS)
+#endif
 
 /* 1 if RTX is a mem and we should keep the alias set for this mem
    unchanged when we access a component.  Set to 1, or example, when we
@@ -2001,6 +2020,11 @@ extern GTY(()) rtx return_address_pointe
 
 #ifndef NO_GENRTL_H
 #include "genrtl.h"
+#ifndef USE_MAPPED_LOCATION
+#undef gen_rtx_ASM_OPERANDS
+#define gen_rtx_ASM_OPERANDS(MODE, ARG0, ARG1, ARG2, ARG3, ARG4, LOC) \
+  gen_rtx_fmt_ssiEEsi (ASM_OPERANDS, (MODE), (ARG0), (ARG1), (ARG2), (ARG3), (ARG4), (LOC).file, (LOC).line)
+#endif
 #endif
 
 /* There are some RTL codes that require special attention; the
Index: sched-rgn.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/sched-rgn.c,v
retrieving revision 1.74
diff -u -p -r1.74 sched-rgn.c
--- sched-rgn.c	15 Jun 2004 18:02:36 -0000	1.74
+++ sched-rgn.c	30 Jun 2004 16:26:07 -0000
@@ -2321,8 +2321,12 @@ debug_dependencies (void)
 		      if (n < 0)
 			fprintf (sched_dump, "%s\n", GET_NOTE_INSN_NAME (n));
 		      else
-			fprintf (sched_dump, "line %d, file %s\n", n,
-				 NOTE_SOURCE_FILE (insn));
+			{
+			  expanded_location xloc;
+			  NOTE_EXPANDED_LOCATION (xloc, insn);
+			  fprintf (sched_dump, "line %d, file %s\n",
+				   xloc.line, xloc.file);
+			}
 		    }
 		  else
 		    fprintf (sched_dump, " {%s}\n", GET_RTX_NAME (GET_CODE (insn)));
Index: sched-vis.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/sched-vis.c,v
retrieving revision 1.30
diff -u -p -r1.30 sched-vis.c
--- sched-vis.c	20 Mar 2004 04:52:57 -0000	1.30
+++ sched-vis.c	30 Jun 2004 16:26:07 -0000
@@ -787,8 +787,12 @@ print_insn (char *buf, rtx x, int verbos
       break;
     case NOTE:
       if (NOTE_LINE_NUMBER (x) > 0)
-	sprintf (buf, "%4d note \"%s\" %d", INSN_UID (x),
-		 NOTE_SOURCE_FILE (x), NOTE_LINE_NUMBER (x));
+	{
+	  expanded_location xloc;
+	  NOTE_EXPANDED_LOCATION (xloc, x);
+	  sprintf (buf, "%4d note \"%s\" %d", INSN_UID (x),
+		   xloc.file, xloc.line);
+	}
       else
 	sprintf (buf, "%4d %s", INSN_UID (x),
 		 GET_NOTE_INSN_NAME (NOTE_LINE_NUMBER (x)));
Index: stmt.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/stmt.c,v
retrieving revision 1.362
diff -u -p -r1.362 stmt.c
--- stmt.c	22 Jun 2004 03:06:39 -0000	1.362
+++ stmt.c	30 Jun 2004 16:26:10 -0000
@@ -1565,7 +1565,7 @@ expand_asm_operands (tree string, tree o
 				: GET_MODE (output_rtx[0])),
 			       TREE_STRING_POINTER (string),
 			       empty_string, 0, argvec, constraintvec,
-			       locus.file, locus.line);
+			       locus);
 
   MEM_VOLATILE_P (body) = vol;
 
@@ -1715,7 +1715,7 @@ expand_asm_operands (tree string, tree o
 			   (GET_MODE (output_rtx[i]),
 			    TREE_STRING_POINTER (string),
 			    constraints[i], i, argvec, constraintvec,
-			    locus.file, locus.line));
+			    locus));
 
 	  MEM_VOLATILE_P (SET_SRC (XVECEXP (body, 0, i))) = vol;
 	}
@@ -3871,8 +3871,12 @@ check_seenlabel (void)
 	      if (insn)
                 {
                   location_t locus;
+#ifdef USE_MAPPED_LOCATION
+                  locus = NOTE_SOURCE_LOCATION (insn);
+#else
                   locus.file = NOTE_SOURCE_FILE (insn);
                   locus.line = NOTE_LINE_NUMBER (insn);
+#endif
                   warning ("%Hunreachable code at beginning of %s", &locus,
                            case_stack->data.case_stmt.printname);
                 }
Index: toplev.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/toplev.c,v
retrieving revision 1.907
diff -u -p -r1.907 toplev.c
--- toplev.c	20 Jun 2004 21:31:28 -0000	1.907
+++ toplev.c	30 Jun 2004 16:26:10 -0000
@@ -140,6 +140,10 @@ static const char **save_argv;
 
 const char *main_input_filename;
 
+#ifndef USE_MAPPED_LOCATION
+location_t unknown_location = { NULL, 0 };
+#endif
+
 /* Used to enable -fvar-tracking, -fweb and -frename-registers according
    to optimize and default_debug_hooks in process_options ().  */
 #define AUTODETECT_FLAG_VAR_TRACKING 2
@@ -879,9 +883,12 @@ warn_deprecated_use (tree node)
     return;
 
   if (DECL_P (node))
-    warning ("`%s' is deprecated (declared at %s:%d)",
-	     IDENTIFIER_POINTER (DECL_NAME (node)),
-	     DECL_SOURCE_FILE (node), DECL_SOURCE_LINE (node));
+    {
+      expanded_location xloc = expand_location (DECL_SOURCE_LOCATION (node));
+      warning ("`%s' is deprecated (declared at %s:%d)",
+	       IDENTIFIER_POINTER (DECL_NAME (node)),
+	       xloc.file, xloc.line);
+    }
   else if (TYPE_P (node))
     {
       const char *what = NULL;
@@ -893,19 +900,24 @@ warn_deprecated_use (tree node)
 	       && DECL_NAME (TYPE_NAME (node)))
 	what = IDENTIFIER_POINTER (DECL_NAME (TYPE_NAME (node)));
 
-      if (what)
+      if (decl)
 	{
-	  if (decl)
+	  expanded_location xloc
+	    = expand_location (DECL_SOURCE_LOCATION (decl));
+	  if (what)
 	    warning ("`%s' is deprecated (declared at %s:%d)", what,
-		     DECL_SOURCE_FILE (decl), DECL_SOURCE_LINE (decl));
+		       xloc.file, xloc.line);
 	  else
-	    warning ("`%s' is deprecated", what);
+	    warning ("type is deprecated (declared at %s:%d)",
+		     xloc.file, xloc.line);
 	}
-      else if (decl)
-	warning ("type is deprecated (declared at %s:%d)",
-		 DECL_SOURCE_FILE (decl), DECL_SOURCE_LINE (decl));
       else
-	warning ("type is deprecated");
+	{
+	  if (what)
+	    warning ("type is deprecated");
+	  else
+	    warning ("`%s' is deprecated", what);
+	}
     }
 }
 
@@ -914,15 +926,23 @@ warn_deprecated_use (tree node)
    INPUT_LOCATION accordingly.  */
 
 void
+#ifdef USE_MAPPED_LOCATION
+push_srcloc (location_t fline)
+#else
 push_srcloc (const char *file, int line)
+#endif
 {
   struct file_stack *fs;
 
   fs = xmalloc (sizeof (struct file_stack));
   fs->location = input_location;
   fs->next = input_file_stack;
+#ifdef USE_MAPPED_LOCATION
+  input_location = fline;
+#else
   input_filename = file;
   input_line = line;
+#endif
   input_file_stack = fs;
   input_file_stack_tick++;
 }
@@ -1607,7 +1627,9 @@ process_options (void)
      sets the original filename if appropriate (e.g. foo.i -> foo.c)
      so we can correctly initialize debug output.  */
   no_backend = lang_hooks.post_options (&main_input_filename);
+#ifndef USE_MAPPED_LOCATION
   input_filename = main_input_filename;
+#endif
 
 #ifdef OVERRIDE_OPTIONS
   /* Some machines may reject certain combinations of options.  */
@@ -1928,12 +1950,20 @@ backend_init (void)
 static int
 lang_dependent_init (const char *name)
 {
+  location_t save_loc = input_location;
   if (dump_base_name == 0)
     dump_base_name = name ? name : "gccdump";
 
   /* Other front-end initialization.  */
+#ifdef USE_MAPPED_LOCATION
+  input_location = BUILTINS_LOCATION;
+#else
+  input_filename = "<built-in>";
+  input_line = 0;
+#endif
   if (lang_hooks.init () == 0)
     return 0;
+  input_location = save_loc;
 
   init_asm_output (name);
 
Index: tree-cfg.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/tree-cfg.c,v
retrieving revision 2.22
diff -u -p -r2.22 tree-cfg.c
--- tree-cfg.c	29 Jun 2004 06:59:33 -0000	2.22
+++ tree-cfg.c	30 Jun 2004 16:26:12 -0000
@@ -666,7 +666,11 @@ make_goto_expr_edges (basic_block bb)
       if (simple_goto_p (goto_t))
 	{
 	  edge e = make_edge (bb, label_to_block (dest), EDGE_FALLTHRU);
+#ifdef USE_MAPPED_LOCATION
+	  e->goto_locus = EXPR_LOCATION (goto_t);
+#else
 	  e->goto_locus = EXPR_LOCUS (goto_t);
+#endif
 	  bsi_remove (&last);
 	  return;
 	}
@@ -1115,9 +1119,10 @@ static void remove_useless_stmts_1 (tree
 static bool
 remove_useless_stmts_warn_notreached (tree stmt)
 {
-  if (EXPR_LOCUS (stmt))
+  if (EXPR_HAS_LOCATION (stmt))
     {
-      warning ("%Hwill never be executed", EXPR_LOCUS (stmt));
+      location_t loc = EXPR_LOCATION (stmt);
+      warning ("%Hwill never be executed", &loc);
       return true;
     }
 
@@ -1776,7 +1781,7 @@ static void
 remove_bb (basic_block bb)
 {
   block_stmt_iterator i;
-  location_t *loc = NULL;
+  source_locus loc = 0;
 
   if (dump_file)
     {
@@ -1799,8 +1804,12 @@ remove_bb (basic_block bb)
 	 jump threading, thus resulting in bogus warnings.  Not great,
 	 since this way we lose warnings for gotos in the original
 	 program that are indeed unreachable.  */
-      if (TREE_CODE (stmt) != GOTO_EXPR && EXPR_LOCUS (stmt) && !loc)
+      if (TREE_CODE (stmt) != GOTO_EXPR && EXPR_HAS_LOCATION (stmt) && !loc)
+#ifdef USE_MAPPED_LOCATION
+	loc = EXPR_LOCATION (stmt);
+#else
 	loc = EXPR_LOCUS (stmt);
+#endif
     }
 
   /* If requested, give a warning that the first statement in the
@@ -1808,7 +1817,11 @@ remove_bb (basic_block bb)
      loop above, so the last statement we process is the first statement
      in the block.  */
   if (warn_notreached && loc)
+#ifdef USE_MAPPED_LOCATION
+    warning ("%Hwill never be executed", &loc);
+#else
     warning ("%Hwill never be executed", loc);
+#endif
 
   remove_phi_nodes_and_edges_for_unreachable_block (bb);
 }
@@ -2641,7 +2654,11 @@ disband_implicit_edges (void)
       label = tree_block_label (e->dest);
 
       stmt = build1 (GOTO_EXPR, void_type_node, label);
+#ifdef USE_MAPPED_LOCATION
+      SET_EXPR_LOCATION (stmt, e->goto_locus);
+#else
       SET_EXPR_LOCUS (stmt, e->goto_locus);
+#endif
       bsi_insert_after (&last, stmt, BSI_NEW_STMT);
       e->flags &= ~EDGE_FALLTHRU;
     }
@@ -4759,7 +4776,11 @@ struct tree_opt_pass pass_split_crit_edg
 static void
 execute_warn_function_return (void)
 {
+#ifdef USE_MAPPED_LOCATION
+  source_location location;
+#else
   location_t *locus;
+#endif
   tree last;
   edge e;
 
@@ -4774,17 +4795,31 @@ execute_warn_function_return (void)
   if (TREE_THIS_VOLATILE (cfun->decl)
       && EXIT_BLOCK_PTR->pred != NULL)
     {
+#ifdef USE_MAPPED_LOCATION
+      location = UNKNOWN_LOCATION;
+#else
       locus = NULL;
+#endif
       for (e = EXIT_BLOCK_PTR->pred; e ; e = e->pred_next)
 	{
 	  last = last_stmt (e->src);
 	  if (TREE_CODE (last) == RETURN_EXPR
+#ifdef USE_MAPPED_LOCATION
+	      && (location = EXPR_LOCATION (last)) != UNKNOWN_LOCATION)
+#else
 	      && (locus = EXPR_LOCUS (last)) != NULL)
+#endif
 	    break;
 	}
+#ifdef USE_MAPPED_LOCATION
+      if (location == UNKNOWN_LOCATION)
+	location = cfun->function_end_locus;
+      warning ("%H`noreturn' function does return", &location);
+#else
       if (!locus)
 	locus = &cfun->function_end_locus;
       warning ("%H`noreturn' function does return", locus);
+#endif
     }
 
   /* If we see "return;" in some basic block, then we do reach the end
@@ -4799,10 +4834,17 @@ execute_warn_function_return (void)
 	  if (TREE_CODE (last) == RETURN_EXPR
 	      && TREE_OPERAND (last, 0) == NULL)
 	    {
+#ifdef USE_MAPPED_LOCATION
+	      location = EXPR_LOCATION (last);
+	      if (location == UNKNOWN_LOCATION)
+		  location = cfun->function_end_locus;
+	      warning ("%Hcontrol reaches end of non-void function", &location);
+#else
 	      locus = EXPR_LOCUS (last);
 	      if (!locus)
 		locus = &cfun->function_end_locus;
 	      warning ("%Hcontrol reaches end of non-void function", locus);
+#endif
 	      break;
 	    }
 	}
Index: tree-dump.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/tree-dump.c,v
retrieving revision 1.24
diff -u -p -r1.24 tree-dump.c
--- tree-dump.c	28 Jun 2004 22:26:22 -0000	1.24
+++ tree-dump.c	30 Jun 2004 16:26:12 -0000
@@ -315,6 +315,7 @@ dequeue_and_dump (dump_info_p di)
     }
   else if (DECL_P (t))
     {
+      expanded_location xloc;
       /* All declarations have names.  */
       if (DECL_NAME (t))
 	dump_child ("name", DECL_NAME (t));
@@ -325,18 +326,19 @@ dequeue_and_dump (dump_info_p di)
       queue_and_dump_type (di, t);
       dump_child ("scpe", DECL_CONTEXT (t));
       /* And a source position.  */
-      if (DECL_SOURCE_FILE (t))
+      xloc = expand_location (DECL_SOURCE_LOCATION (t));
+      if (xloc.file)
 	{
-	  const char *filename = strrchr (DECL_SOURCE_FILE (t), '/');
+	  const char *filename = strrchr (xloc.file, '/');
 	  if (!filename)
-	    filename = DECL_SOURCE_FILE (t);
+	    filename = xloc.file;
 	  else
 	    /* Skip the slash.  */
 	    ++filename;
 
 	  dump_maybe_newline (di);
 	  fprintf (di->stream, "srcp: %s:%-6d ", filename,
-		   DECL_SOURCE_LINE (t));
+		   xloc.line);
 	  di->column += 6 + strlen (filename) + 8;
 	}
       /* And any declaration can be compiler-generated.  */
Index: tree-flow-inline.h
===================================================================
RCS file: /cvs/gcc/gcc/gcc/tree-flow-inline.h,v
retrieving revision 2.12
diff -u -p -r2.12 tree-flow-inline.h
--- tree-flow-inline.h	29 Jun 2004 01:53:03 -0000	2.12
+++ tree-flow-inline.h	30 Jun 2004 16:26:12 -0000
@@ -126,7 +126,7 @@ get_lineno (tree expr)
   if (TREE_CODE (expr) == COMPOUND_EXPR)
     expr = TREE_OPERAND (expr, 0);
 
-  if (! EXPR_LOCUS (expr))
+  if (! EXPR_HAS_LOCATION (expr))
     return -1;
 
   return EXPR_LINENO (expr);
@@ -137,14 +137,15 @@ get_lineno (tree expr)
 static inline const char *
 get_filename (tree expr)
 {
+  const char *filename;
   if (expr == NULL_TREE)
     return "???";
 
   if (TREE_CODE (expr) == COMPOUND_EXPR)
     expr = TREE_OPERAND (expr, 0);
 
-  if (EXPR_LOCUS (expr) && EXPR_FILENAME (expr))
-    return EXPR_FILENAME (expr);
+  if (EXPR_HAS_LOCATION (expr) && (filename = EXPR_FILENAME (expr)))
+    return filename;
   else
     return "???";
 }
Index: tree-mudflap.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/tree-mudflap.c,v
retrieving revision 2.10
diff -u -p -r2.10 tree-mudflap.c
--- tree-mudflap.c	26 Jun 2004 05:03:52 -0000	2.10
+++ tree-mudflap.c	30 Jun 2004 16:26:13 -0000
@@ -50,7 +50,7 @@ Software Foundation, 59 Temple Place - S
 /* Helpers.  */
 static tree mf_build_string (const char *string);
 static tree mf_varname_tree (tree);
-static tree mf_file_function_line_tree (location_t *);
+static tree mf_file_function_line_tree (location_t);
 
 /* Initialization of all the mf-runtime.h extern decls.  */
 static void mf_init_extern_trees (void);
@@ -117,10 +117,11 @@ mf_varname_tree (tree decl)
 
   /* Add FILENAME[:LINENUMBER].  */
   {
+    expanded_location xloc = expand_location (DECL_SOURCE_LOCATION (decl));
     const char *sourcefile;
-    unsigned sourceline;
+    unsigned sourceline = xloc.line;
 
-    sourcefile = DECL_SOURCE_FILE (decl);
+    sourcefile = xloc.file;
     if (sourcefile == NULL && current_function_decl != NULL_TREE)
       sourcefile = DECL_SOURCE_FILE (current_function_decl);
     if (sourcefile == NULL)
@@ -128,7 +129,6 @@ mf_varname_tree (tree decl)
 
     pp_string (buf, sourcefile);
 
-    sourceline = DECL_SOURCE_LINE (decl);
     if (sourceline != 0)
       {
         pp_string (buf, ":");
@@ -188,25 +188,23 @@ mf_varname_tree (tree decl)
 /* And another friend, for producing a simpler message.  */
 
 static tree
-mf_file_function_line_tree (location_t *locus)
+mf_file_function_line_tree (location_t location)
 {
+  expanded_location xloc = expand_location (location);
   const char *file = NULL, *colon, *line, *op, *name, *cp;
   char linebuf[18];
   char *string;
   tree result;
 
-  /* Add FILENAME.  */
-  if (locus != NULL)
-    file = locus->file;
-  if (file == NULL && current_function_decl != NULL_TREE)
-    file = DECL_SOURCE_FILE (current_function_decl);
-  if (file == NULL)
-    file = "<unknown file>";
+  /* Add FILENAME[:LINENUMBER]. */
+  if (xloc.file == NULL && current_function_decl != NULL_TREE)
+    xloc.file = DECL_SOURCE_FILE (current_function_decl);
+  if (xloc.file == NULL)
+    xloc.file = "<unknown file>";
 
-  /* Add :LINENUMBER.  */
-  if (locus != NULL && locus->line > 0)
+  if (xloc.line > 0)
     {
-      sprintf (linebuf, "%d", locus->line);
+      sprintf (linebuf, "%d", xloc.line);
       colon = ":";
       line = linebuf;
     }
@@ -348,13 +346,13 @@ mf_decl_cache_locals (void)
      globals into the cache variables.  */
   t = build (MODIFY_EXPR, TREE_TYPE (mf_cache_shift_decl_l),
              mf_cache_shift_decl_l, mf_cache_shift_decl);
-  annotate_with_locus (t, DECL_SOURCE_LOCATION (current_function_decl));
+  SET_EXPR_LOCATION (t, DECL_SOURCE_LOCATION (current_function_decl));
   gimplify_to_stmt_list (&t);
   shift_init_stmts = t;
 
   t = build (MODIFY_EXPR, TREE_TYPE (mf_cache_mask_decl_l),
              mf_cache_mask_decl_l, mf_cache_mask_decl);
-  annotate_with_locus (t, DECL_SOURCE_LOCATION (current_function_decl));
+  SET_EXPR_LOCATION (t, DECL_SOURCE_LOCATION (current_function_decl));
   gimplify_to_stmt_list (&t);
   mask_init_stmts = t;
 
@@ -548,7 +546,10 @@ mf_build_check_statement_for (tree addr,
 
      This is the body of the conditional.  */
   
-  u = tree_cons (NULL_TREE, mf_file_function_line_tree (locus), NULL_TREE);
+  u = tree_cons (NULL_TREE,
+		 mf_file_function_line_tree (locus == NULL ? UNKNOWN_LOCATION
+					     : *locus),
+		 NULL_TREE);
   u = tree_cons (NULL_TREE, dirflag, u);
   u = tree_cons (NULL_TREE, size, u);
   u = tree_cons (NULL_TREE, mf_value, u);
@@ -920,7 +921,7 @@ mx_register_decls (tree decl, tree *stmt
                                                       register_fncall_params);
 
           /* Accumulate the two calls.  */
-          /* ??? Set EXPR_LOCUS.  */
+          /* ??? Set EXPR_LOCATION.  */
           gimplify_stmt (&register_fncall);
           gimplify_stmt (&unregister_fncall);
 
Index: tree-pretty-print.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/tree-pretty-print.c,v
retrieving revision 2.15
diff -u -p -r2.15 tree-pretty-print.c
--- tree-pretty-print.c	28 Jun 2004 12:08:20 -0000	2.15
+++ tree-pretty-print.c	30 Jun 2004 16:26:13 -0000
@@ -231,13 +231,14 @@ dump_generic_node (pretty_printer *buffe
       && (flags & TDF_LINENO)
       && EXPR_HAS_LOCATION (node))
     {
+      expanded_location xloc = expand_location (EXPR_LOCATION (node));
       pp_character (buffer, '[');
-      if (EXPR_FILENAME (node))
+      if (xloc.file)
 	{
-	  pp_string (buffer, EXPR_FILENAME (node));
+	  pp_string (buffer, xloc.file);
 	  pp_string (buffer, " : ");
 	}
-      pp_decimal_int (buffer, EXPR_LINENO (node));
+      pp_decimal_int (buffer, xloc.line);
       pp_string (buffer, "] ");
     }
 
@@ -556,7 +557,7 @@ dump_generic_node (pretty_printer *buffe
       break;
 
     case TYPE_DECL:
-      if (strcmp (DECL_SOURCE_FILE (node), "<built-in>") == 0)
+      if (DECL_IS_BUILTIN (node))
 	{
 	  /* Don't print the declaration of built-in types.  */
 	  break;
@@ -2224,15 +2225,27 @@ dump_implicit_edges (pretty_printer *buf
     {
       INDENT (indent);
 
-      if ((flags & TDF_LINENO) && e->goto_locus)
+      if ((flags & TDF_LINENO)
+#ifdef USE_MAPPED_LOCATION
+	  && e->goto_locus != UNKNOWN_LOCATION
+#else
+	  && e->goto_locus
+#endif
+	  )
 	{
+	  expanded_location goto_xloc;
+#ifdef USE_MAPPED_LOCATION
+	  goto_xloc = expand_location (e->goto_locus);
+#else
+	  goto_xloc = *e->goto_locus;
+#endif
 	  pp_character (buffer, '[');
-	  if (e->goto_locus->file)
+	  if (goto_xloc.file)
 	    {
-	      pp_string (buffer, e->goto_locus->file);
+	      pp_string (buffer, goto_xloc.file);
 	      pp_string (buffer, " : ");
 	    }
-	  pp_decimal_int (buffer, e->goto_locus->line);
+	  pp_decimal_int (buffer, goto_xloc.line);
 	  pp_string (buffer, "] ");
 	}
 
Index: tree.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/tree.c,v
retrieving revision 1.382
diff -u -p -r1.382 tree.c
--- tree.c	28 Jun 2004 22:26:23 -0000	1.382
+++ tree.c	30 Jun 2004 16:26:15 -0000
@@ -2438,7 +2438,11 @@ build1_stat (enum tree_code code, tree t
   TREE_SET_CODE (t, code);
 
   TREE_TYPE (t) = type;
+#ifdef USE_MAPPED_LOCATION
+  SET_EXPR_LOCATION (t, UNKNOWN_LOCATION);
+#else
   SET_EXPR_LOCUS (t, NULL);
+#endif
   TREE_COMPLEXITY (t) = 0;
   TREE_OPERAND (t, 0) = node;
   TREE_BLOCK (t) = NULL_TREE;
@@ -2748,7 +2752,28 @@ build_block (tree vars, tree tags ATTRIB
   return block;
 }
 
+#if 1 /* ! defined(USE_MAPPED_LOCATION) */
+/* ??? gengtype doesn't handle conditionals */
 static GTY(()) tree last_annotated_node;
+#endif
+
+#ifdef USE_MAPPED_LOCATION
+
+expanded_location
+expand_location (source_location loc)
+{
+  expanded_location xloc;
+  if (loc == 0) { xloc.file = NULL; xloc.line = 0; }
+  else
+    {
+      const struct line_map *map = linemap_lookup (&line_table, loc);
+      xloc.file = map->to_file;
+      xloc.line = SOURCE_LINE (map, loc);
+    };
+  return xloc;
+}
+
+#else
 
 /* Record the exact location where an expression or an identifier were
    encountered.  */
@@ -2792,6 +2817,7 @@ annotate_with_locus (tree node, location
 {
   annotate_with_file_line (node, locus.file, locus.line);
 }
+#endif
 
 /* Return a declaration like DDECL except that its DECL_ATTRIBUTES
    is ATTRIBUTE.  */
Index: tree.h
===================================================================
RCS file: /cvs/gcc/gcc/gcc/tree.h,v
retrieving revision 1.532
diff -u -p -r1.532 tree.h
--- tree.h	29 Jun 2004 01:53:03 -0000	1.532
+++ tree.h	30 Jun 2004 16:26:16 -0000
@@ -1073,6 +1073,31 @@ struct tree_vec GTY(())
 /* In a LOOP_EXPR node.  */
 #define LOOP_EXPR_BODY(NODE) TREE_OPERAND_CHECK_CODE (NODE, LOOP_EXPR, 0)
 
+#ifdef USE_MAPPED_LOCATION
+/* The source location of this expression.  Non-tree_exp nodes such as
+   decls and constants can be shared among multiple locations, so
+   return nothing.  */
+#define EXPR_LOCATION(NODE)					\
+  (IS_EXPR_CODE_CLASS (TREE_CODE_CLASS (TREE_CODE (NODE)))	\
+   ? (NODE)->exp.locus						\
+   : UNKNOWN_LOCATION)
+#define SET_EXPR_LOCATION(NODE, FROM) \
+  (EXPR_CHECK (NODE)->exp.locus = (FROM))
+#define EXPR_HAS_LOCATION(NODE) (EXPR_LOCATION (NODE) != UNKNOWN_LOCATION)
+/* EXPR_LOCUS and SET_EXPR_LOCUS are deprecated. */
+#define EXPR_LOCUS(NODE)					\
+  (IS_EXPR_CODE_CLASS (TREE_CODE_CLASS (TREE_CODE (NODE)))	\
+   ? &(NODE)->exp.locus						\
+   : (location_t *)NULL)
+#define SET_EXPR_LOCUS(NODE, FROM) \
+  do { source_location *loc_tmp = FROM; \
+       EXPR_CHECK (NODE)->exp.locus \
+       = loc_tmp == NULL ? UNKNOWN_LOCATION : *loc_tmp; } while (0)
+#define EXPR_FILENAME(NODE) \
+  LOCATION_FILE (EXPR_CHECK (NODE)->exp.locus)
+#define EXPR_LINENO(NODE) \
+  LOCATION_LINE (EXPR_CHECK (NODE)->exp.locus)
+#else
 /* The source location of this expression.  Non-tree_exp nodes such as
    decls and constants can be shared among multiple locations, so
    return nothing.  */
@@ -1082,19 +1107,14 @@ struct tree_vec GTY(())
    : (location_t *)NULL)
 #define SET_EXPR_LOCUS(NODE, FROM) \
   (EXPR_CHECK (NODE)->exp.locus = (FROM))
+#define SET_EXPR_LOCATION(NODE, FROM) annotate_with_locus (NODE, FROM)
 #define EXPR_FILENAME(NODE) \
   (EXPR_CHECK (NODE)->exp.locus->file)
 #define EXPR_LINENO(NODE) \
   (EXPR_CHECK (NODE)->exp.locus->line)
-#ifdef USE_MAPPED_LOCATION
-#define EXPR_LOCATION(NODE)					\
-  (IS_EXPR_CODE_CLASS (TREE_CODE_CLASS (TREE_CODE (NODE)))	\
-   ? (NODE)->exp.locus						\
-   : UNKNOWN_LOCATION)
-#define EXPR_HAS_LOCATION(NODE) (EXPR_LOCATION (NODE) != UNKNOWN_LOCATION)
-#else
-#define EXPR_LOCATION(NODE) (*EXPR_LOCUS (NODE))
 #define EXPR_HAS_LOCATION(NODE) (EXPR_LOCUS (NODE) != NULL)
+#define EXPR_LOCATION(NODE) \
+  (EXPR_HAS_LOCATION(NODE) ? *(NODE)->exp.locus : UNKNOWN_LOCATION)
 #endif
 
 /* In a TARGET_EXPR node.  */
@@ -1172,7 +1192,7 @@ struct tree_vec GTY(())
 struct tree_exp GTY(())
 {
   struct tree_common common;
-  location_t *locus;
+  source_locus locus;
   int complexity;
   tree block;
   tree GTY ((special ("tree_exp"),
@@ -1773,8 +1793,14 @@ struct tree_type GTY(())
    function that is declared first and then defined later), this
    information should refer to the definition.  */
 #define DECL_SOURCE_LOCATION(NODE) (DECL_CHECK (NODE)->decl.locus)
-#define DECL_SOURCE_FILE(NODE) (DECL_SOURCE_LOCATION (NODE).file)
-#define DECL_SOURCE_LINE(NODE) (DECL_SOURCE_LOCATION (NODE).line)
+#define DECL_SOURCE_FILE(NODE) LOCATION_FILE (DECL_SOURCE_LOCATION (NODE))
+#define DECL_SOURCE_LINE(NODE) LOCATION_LINE (DECL_SOURCE_LOCATION (NODE))
+#ifdef USE_MAPPED_LOCATION
+#define DECL_IS_BUILTIN(DECL) \
+  (DECL_SOURCE_LOCATION (DECL) <= BUILTINS_LOCATION)
+#else
+#define DECL_IS_BUILTIN(DECL) (DECL_SOURCE_LINE(DECL) == 0)
+#endif
 /* Holds the size of the datum, in bits, as a tree expression.
    Need not be constant.  */
 #define DECL_SIZE(NODE) (DECL_CHECK (NODE)->decl.size)
@@ -2665,8 +2691,10 @@ extern tree build_tree_list_stat (tree, 
 extern tree build_decl_stat (enum tree_code, tree, tree MEM_STAT_DECL);
 #define build_decl(c,t,q) build_decl_stat (c,t,q MEM_STAT_INFO)
 extern tree build_block (tree, tree, tree, tree, tree);
+#ifndef USE_MAPPED_LOCATION
 extern void annotate_with_file_line (tree, const char *, int);
 extern void annotate_with_locus (tree, location_t);
+#endif
 extern tree build_empty_stmt (void);
 
 /* Construct various nodes representing data types.  */
Index: xcoffout.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/xcoffout.c,v
retrieving revision 1.41
diff -u -p -r1.41 xcoffout.c
--- xcoffout.c	18 Feb 2004 15:05:07 -0000	1.41
+++ xcoffout.c	30 Jun 2004 16:26:16 -0000
@@ -156,7 +156,7 @@ xcoff_assign_fundamental_type_number (tr
   size_t i;
 
   /* Do not waste time searching the list for non-intrinsic types.  */
-  if (DECL_NAME (decl) == 0 || DECL_SOURCE_LINE (decl) > 0)
+  if (DECL_NAME (decl) == 0 || ! DECL_IS_BUILTIN (decl))
     return 0;
 
   name = IDENTIFIER_POINTER (DECL_NAME (decl));
2004-06-30  Per Bothner  <per@bothner.com>

	* decl.c (pop_label):  Handle (imperfectly) USE_MAPPED_LOCATION case.
	* decl2.c:  If USE_MAPPED_LOCATION, don't do some line number
	adjustments - which I don't understand.
	* error.c (dump_decl):  Rename "<interrnal>" to "<built-in>".
	* error.c:  Use LOCATION_FILE and EXPR_LOCATION macros.
	(print_instantiation_partial_context):  Use expand_location.
	* decl.c (duplicate_decl):  Use new DECL_IS_BUILTIN macro.
	* name-lookup.c:  Likewise.
	* lex.c (cxx_init):  Likewise.  Also use BUILTINS_LOCATION.
	* name-lookup.c:  Use input_line macro.
	* parser.c (cp_lexer_get_preprocessor_token):  Use UNKNOWN_LOCATION.
	(cp_parser_statement):  Rename locaal variable statement_locus to
	statement_location and use SET_EXPR_LOCATION macro.
	* pt.c:  Handle USE_MAPPED_LOCATION case.  Use new macros.
	* tree.c (cp_walk_subtrees):  Likewise.

Index: cp/decl.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/cp/decl.c,v
retrieving revision 1.1230
diff -u -p -r1.1230 decl.c
--- cp/decl.c	28 Jun 2004 10:34:41 -0000	1.1230
+++ cp/decl.c	30 Jun 2004 16:26:22 -0000
@@ -363,8 +363,12 @@ pop_label (tree label, tree old_value)
 	  location_t location;
 
 	  cp_error_at ("label `%D' used but not defined", label);
+#ifdef USE_MAPPED_LOCATION
+	  location = input_location; /* FIXME want (input_filename, (line)0) */
+#else
  	  location.file = input_filename;
 	  location.line = 0;
+#endif
 	  /* Avoid crashing later.  */
 	  define_label (location, DECL_NAME (label));
 	}
@@ -1635,7 +1639,7 @@ duplicate_decls (tree newdecl, tree oldd
 							 TYPE_RAISES_EXCEPTIONS (oldtype));
 
 	  if ((pedantic || ! DECL_IN_SYSTEM_HEADER (olddecl))
-	      && DECL_SOURCE_LINE (olddecl) != 0
+	      && ! DECL_IS_BUILTIN (olddecl)
 	      && flag_exceptions
 	      && !comp_except_specs (TYPE_RAISES_EXCEPTIONS (TREE_TYPE (newdecl)),
 	                             TYPE_RAISES_EXCEPTIONS (TREE_TYPE (olddecl)), 1))
Index: cp/decl2.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/cp/decl2.c,v
retrieving revision 1.723
diff -u -p -r1.723 decl2.c
--- cp/decl2.c	27 Jun 2004 03:03:55 -0000	1.723
+++ cp/decl2.c	30 Jun 2004 16:26:23 -0000
@@ -2419,7 +2419,11 @@ generate_ctor_or_dtor_function (bool con
   size_t i;
 
   input_location = *locus;
+#ifdef USE_MAPPED_LOCATION
+  /* ??? */
+#else
   locus->line++;
+#endif
   
   /* We use `I' to indicate initialization and `D' to indicate
      destruction.  */
@@ -2556,9 +2560,13 @@ finish_file (void)
   if (pch_file)
     c_common_write_pch ();
 
+#ifdef USE_MAPPED_LOCATION
+  /* FIXME - huh? */
+#else
   /* Otherwise, GDB can get confused, because in only knows
      about source for LINENO-1 lines.  */
   input_line -= 1;
+#endif
 
   interface_unknown = 1;
   interface_only = 0;
@@ -2714,7 +2722,11 @@ finish_file (void)
 	     instantiations, etc.  */
 	  reconsider = true;
 	  ssdf_count++;
+#ifdef USE_MAPPED_LOCATION
+	  /* ??? */
+#else
 	  locus.line++;
+#endif
 	}
       
       for (i = 0; i < deferred_fns_used; ++i)
Index: cp/error.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/cp/error.c,v
retrieving revision 1.254
diff -u -p -r1.254 error.c
--- cp/error.c	27 Jun 2004 21:35:59 -0000	1.254
+++ cp/error.c	30 Jun 2004 16:26:25 -0000
@@ -835,7 +835,7 @@ dump_decl (tree t, int flags)
       if (DECL_GLOBAL_CTOR_P (t) || DECL_GLOBAL_DTOR_P (t))
 	dump_global_iord (t);
       else if (! DECL_LANG_SPECIFIC (t))
-	pp_identifier (cxx_pp, "<internal>");
+	pp_identifier (cxx_pp, "<built-in>");
       else
         dump_function_decl (t, flags);
       break;
@@ -2145,9 +2145,8 @@ cp_print_error_function (diagnostic_cont
   if (diagnostic_last_function_changed (context))
     {
       const char *old_prefix = context->printer->prefix;
-      char *new_prefix = diagnostic->location.file
-        ? file_name_as_prefix (diagnostic->location.file)
-        : NULL;
+      const char *file = LOCATION_FILE (diagnostic->location);
+      char *new_prefix = file ? file_name_as_prefix (file) : NULL;
 
       pp_base_set_prefix (context->printer, new_prefix);
 
@@ -2208,11 +2207,12 @@ print_instantiation_full_context (diagno
 	    /* Avoid redundancy with the the "In function" line.  */;
 	  else
 	    pp_verbatim (context->printer,
-                         "%s: In instantiation of `%s':\n", location.file,
+                         "%s: In instantiation of `%s':\n",
+			 LOCATION_FILE (location),
                          decl_as_string (TINST_DECL (p),
                                          TFF_DECL_SPECIFIERS | TFF_RETURN_TYPE));
 
-	  location = *EXPR_LOCUS (p);
+	  location = EXPR_LOCATION (p);
 	  p = TREE_CHAIN (p);
 	}
     }
@@ -2225,16 +2225,20 @@ static void
 print_instantiation_partial_context (diagnostic_context *context,
                                      tree t, location_t loc)
 {
-  for (; t; t = TREE_CHAIN (t))
+  expanded_location xloc;
+  for (; ; t = TREE_CHAIN (t))
     {
+      xloc = expand_location (loc);
+      if (t == NULL_TREE)
+	break;
       pp_verbatim (context->printer, "%s:%d:   instantiated from `%s'\n",
-                   loc.file, loc.line,
+                   xloc.file, xloc.line,
                    decl_as_string (TINST_DECL (t),
                                    TFF_DECL_SPECIFIERS | TFF_RETURN_TYPE));
-      loc = *EXPR_LOCUS (t);
+      loc = EXPR_LOCATION (t);
     }
   pp_verbatim (context->printer, "%s:%d:   instantiated from here\n",
-               loc.file, loc.line);
+               xloc.file, xloc.line);
 }
 
 /* Called from cp_thing to print the template context for an error.  */
Index: cp/lex.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/cp/lex.c,v
retrieving revision 1.332
diff -u -p -r1.332 lex.c
--- cp/lex.c	28 Jun 2004 10:41:12 -0000	1.332
+++ cp/lex.c	30 Jun 2004 16:26:25 -0000
@@ -336,7 +336,11 @@ cxx_init (void)
   /* We cannot just assign to input_filename because it has already
      been initialized and will be used later as an N_BINCL for stabs+
      debugging.  */
-  push_srcloc ("<internal>", 0);
+#ifdef USE_MAPPED_LOCATION
+  push_srcloc (BUILTINS_LOCATION);
+#else
+  push_srcloc ("<built-in>", 0);
+#endif
 
   init_reswords ();
   init_tree ();
Index: cp/name-lookup.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/cp/name-lookup.c,v
retrieving revision 1.62
diff -u -p -r1.62 name-lookup.c
--- cp/name-lookup.c	26 Jun 2004 21:11:19 -0000	1.62
+++ cp/name-lookup.c	30 Jun 2004 16:26:27 -0000
@@ -781,7 +781,7 @@ pushdecl (tree x)
       if (TREE_CODE (x) == TYPE_DECL)
 	{
 	  tree type = TREE_TYPE (x);
-	  if (DECL_SOURCE_LINE (x) == 0)
+	  if (DECL_IS_BUILTIN (x))
             {
 	      if (TYPE_NAME (type) == 0)
 	        TYPE_NAME (type) = x;
@@ -1328,7 +1328,7 @@ begin_scope (scope_kind kind, tree entit
     {
       scope->binding_depth = binding_depth;
       indent (binding_depth);
-      cxx_scope_debug (scope, input_location.line, "push");
+      cxx_scope_debug (scope, input_line, "push");
       is_class_level = 0;
       binding_depth++;
     }
@@ -1354,7 +1354,7 @@ leave_scope (void)
   if (ENABLE_SCOPE_CHECKING)
     {
       indent (--binding_depth);
-      cxx_scope_debug (scope, input_location.line, "leave");
+      cxx_scope_debug (scope, input_line, "leave");
       if (is_class_level != (scope == class_binding_level))
         {
           indent (binding_depth);
@@ -1407,7 +1407,7 @@ resume_scope (struct cp_binding_level* b
     {
       b->binding_depth = binding_depth;
       indent (binding_depth);
-      cxx_scope_debug (b, input_location.line, "resume");
+      cxx_scope_debug (b, input_line, "resume");
       is_class_level = 0;
       binding_depth++;
     }
@@ -1600,7 +1600,7 @@ print_binding_level (struct cp_binding_l
 	    continue;
 	  if (no_print_builtins
 	      && (TREE_CODE (t) == TYPE_DECL)
-	      && (!strcmp (DECL_SOURCE_FILE (t),"<built-in>")))
+	      && DECL_IS_BUILTIN (t))
 	    continue;
 
 	  /* Function decls tend to have longer names.  */
Index: cp/parser.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/cp/parser.c,v
retrieving revision 1.222
diff -u -p -r1.222 parser.c
--- cp/parser.c	29 Jun 2004 11:10:11 -0000	1.222
+++ cp/parser.c	30 Jun 2004 16:26:31 -0000
@@ -597,8 +597,7 @@ cp_lexer_get_preprocessor_token (cp_lexe
   if (lexer != NULL && !lexer->main_lexer_p)
     {
       token->type = CPP_EOF;
-      token->location.line = 0;
-      token->location.file = NULL;
+      token->location = UNKNOWN_LOCATION;
       token->value = NULL_TREE;
       token->keyword = RID_MAX;
 
@@ -5890,14 +5889,14 @@ cp_parser_statement (cp_parser* parser, 
 {
   tree statement;
   cp_token *token;
-  location_t statement_locus;
+  location_t statement_location;
 
   /* There is no statement yet.  */
   statement = NULL_TREE;
   /* Peek at the next token.  */
   token = cp_lexer_peek_token (parser->lexer);
   /* Remember the location of the first token in the statement.  */
-  statement_locus = token->location;
+  statement_location = token->location;
   /* If this is a keyword, then that will often determine what kind of
      statement we have.  */
   if (token->type == CPP_KEYWORD)
@@ -5973,10 +5972,7 @@ cp_parser_statement (cp_parser* parser, 
 
   /* Set the line number for the statement.  */
   if (statement && STATEMENT_CODE_P (TREE_CODE (statement)))
-    {
-      SET_EXPR_LOCUS (statement, NULL);
-      annotate_with_locus (statement, statement_locus);
-    }
+    SET_EXPR_LOCATION (statement, statement_location);
 }
 
 /* Parse a labeled-statement.
Index: cp/pt.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/cp/pt.c,v
retrieving revision 1.876
diff -u -p -r1.876 pt.c
--- cp/pt.c	26 Jun 2004 21:11:19 -0000	1.876
+++ cp/pt.c	30 Jun 2004 16:26:35 -0000
@@ -4871,7 +4871,7 @@ push_tinst_level (tree d)
     }
 
   new = make_node (TINST_LEVEL);
-  annotate_with_locus (new, input_location);
+  SET_EXPR_LOCATION (new, input_location);
   TINST_DECL (new) = d;
   TREE_CHAIN (new) = current_tinst_level;
   current_tinst_level = new;
@@ -4896,7 +4896,7 @@ pop_tinst_level (void)
 
   /* Restore the filename and line number stashed away when we started
      this instantiation.  */
-  input_location = *EXPR_LOCUS (old);
+  input_location = EXPR_LOCATION (old);
   extract_interface_info ();
   
   current_tinst_level = TREE_CHAIN (old);
@@ -6930,8 +6930,12 @@ tsubst (tree t, tree args, tsubst_flags_
 	       message to avoid spewing a ton of messages during a
 	       single bad template instantiation.  */
 	    if (complain & tf_error
+#ifdef USE_MAPPED_LOCATION
+		&& last_loc != input_location)
+#else
 		&& (last_loc.line != input_line
 		    || last_loc.file != input_filename))
+#endif
 	      {
 		if (TREE_CODE (type) == VOID_TYPE)
 		  error ("forming reference to void");
@@ -7713,8 +7717,8 @@ tsubst_expr (tree t, tree args, tsubst_f
   if (t == NULL_TREE || t == error_mark_node)
     return t;
 
-  if (EXPR_LOCUS (t))
-    input_location = *EXPR_LOCUS (t);
+  if (EXPR_HAS_LOCATION (t))
+    input_location = EXPR_LOCATION (t);
   if (STATEMENT_CODE_P (TREE_CODE (t)))
     current_stmt_tree ()->stmts_are_full_exprs_p = STMT_IS_FULL_EXPR_P (t);
 
Index: cp/tree.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/cp/tree.c,v
retrieving revision 1.384
diff -u -p -r1.384 tree.c
--- cp/tree.c	30 Jun 2004 06:42:42 -0000	1.384
+++ cp/tree.c	30 Jun 2004 16:26:36 -0000
@@ -1973,8 +1973,8 @@ cp_walk_subtrees (tree *tp, int *walk_su
   /* Set input_location here so we get the right instantiation context
      if we call instantiate_decl from inlinable_function_p.  */
   save_locus = input_location;
-  if (EXPR_LOCUS (*tp))
-    input_location = *EXPR_LOCUS (*tp);
+  if (EXPR_HAS_LOCATION (*tp))
+    input_location = EXPR_LOCATION (*tp);
 
   /* Not one of the easy cases.  We must explicitly go through the
      children.  */

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]