Commit a281759f by Per Bothner Committed by Per Bothner

Conditionally compile support for --enable-mapped_location.

	* 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.
	* 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.

From-SVN: r83920
parent 3c20847b
...@@ -40,6 +40,20 @@ ...@@ -40,6 +40,20 @@
clear and restore input_Location - now handled by lang_dependent_init. clear and restore input_Location - now handled by lang_dependent_init.
* function.c (init_function_start): Use new DECL_IS_BUILTIN macro. * function.c (init_function_start): Use new DECL_IS_BUILTIN macro.
* xcoffout.c (xcoff_assign_fundamental_type_number): Likewise. * xcoffout.c (xcoff_assign_fundamental_type_number): 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.
* 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.
2004-06-30 Richard Sandiford <rsandifo@redhat.com> 2004-06-30 Richard Sandiford <rsandifo@redhat.com>
Eric Christopher <echristo@redhat.com> Eric Christopher <echristo@redhat.com>
......
...@@ -554,6 +554,7 @@ gen_aux_info_record (tree fndecl, int is_definition, int is_implicit, ...@@ -554,6 +554,7 @@ gen_aux_info_record (tree fndecl, int is_definition, int is_implicit,
if (flag_gen_aux_info) if (flag_gen_aux_info)
{ {
static int compiled_from_record = 0; 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 /* Each output .X file must have a header line. Write one now if we
have not yet done so. */ have not yet done so. */
...@@ -569,8 +570,7 @@ gen_aux_info_record (tree fndecl, int is_definition, int is_implicit, ...@@ -569,8 +570,7 @@ gen_aux_info_record (tree fndecl, int is_definition, int is_implicit,
/* Write the actual line of auxiliary info. */ /* Write the actual line of auxiliary info. */
fprintf (aux_info_file, "/* %s:%d:%c%c */ %s;", fprintf (aux_info_file, "/* %s:%d:%c%c */ %s;",
DECL_SOURCE_FILE (fndecl), xloc.file, xloc.line,
DECL_SOURCE_LINE (fndecl),
(is_implicit) ? 'I' : (is_prototyped) ? 'N' : 'O', (is_implicit) ? 'I' : (is_prototyped) ? 'N' : 'O',
(is_definition) ? 'F' : 'C', (is_definition) ? 'F' : 'C',
gen_decl (fndecl, is_definition, ansi)); gen_decl (fndecl, is_definition, ansi));
......
...@@ -2092,19 +2092,19 @@ lineno_stmt: ...@@ -2092,19 +2092,19 @@ lineno_stmt:
because (recursively) all of the component statments because (recursively) all of the component statments
should already have line numbers assigned. */ should already have line numbers assigned. */
if ($2 && EXPR_P ($2)) if ($2 && EXPR_P ($2))
annotate_with_locus ($2, $1); SET_EXPR_LOCATION ($2, $1);
} }
; ;
lineno_label: lineno_label:
save_location label save_location label
{ if ($2) annotate_with_locus ($2, $1); } { if ($2) SET_EXPR_LOCATION ($2, $1); }
; ;
condition: save_location expr condition: save_location expr
{ $$ = lang_hooks.truthvalue_conversion ($2); { $$ = lang_hooks.truthvalue_conversion ($2);
if (EXPR_P ($$)) if (EXPR_P ($$))
annotate_with_locus ($$, $1); } SET_EXPR_LOCATION ($$, $1); }
; ;
/* Implement -Wparenthesis by special casing IF statement directly nested /* Implement -Wparenthesis by special casing IF statement directly nested
...@@ -2191,7 +2191,7 @@ for_cond_expr: save_location xexpr ...@@ -2191,7 +2191,7 @@ for_cond_expr: save_location xexpr
{ {
$$ = lang_hooks.truthvalue_conversion ($2); $$ = lang_hooks.truthvalue_conversion ($2);
if (EXPR_P ($$)) if (EXPR_P ($$))
annotate_with_locus ($$, $1); SET_EXPR_LOCATION ($$, $1);
} }
else else
$$ = NULL; $$ = NULL;
......
...@@ -51,12 +51,12 @@ static void maybe_print_line (source_location); ...@@ -51,12 +51,12 @@ static void maybe_print_line (source_location);
/* Callback routines for the parser. Most of these are active only /* Callback routines for the parser. Most of these are active only
in specific modes. */ in specific modes. */
static void cb_line_change (cpp_reader *, const cpp_token *, int); static void cb_line_change (cpp_reader *, const cpp_token *, int);
static void cb_define (cpp_reader *, fileline, cpp_hashnode *); static void cb_define (cpp_reader *, source_location, cpp_hashnode *);
static void cb_undef (cpp_reader *, fileline, cpp_hashnode *); static void cb_undef (cpp_reader *, source_location, cpp_hashnode *);
static void cb_include (cpp_reader *, fileline, const unsigned char *, static void cb_include (cpp_reader *, source_location, const unsigned char *,
const char *, int); const char *, int);
static void cb_ident (cpp_reader *, fileline, const cpp_string *); static void cb_ident (cpp_reader *, source_location, const cpp_string *);
static void cb_def_pragma (cpp_reader *, fileline); static void cb_def_pragma (cpp_reader *, source_location);
static void cb_read_pch (cpp_reader *pfile, const char *name, static void cb_read_pch (cpp_reader *pfile, const char *name,
int fd, const char *orig_name); int fd, const char *orig_name);
...@@ -300,7 +300,7 @@ cb_line_change (cpp_reader *pfile, const cpp_token *token, ...@@ -300,7 +300,7 @@ cb_line_change (cpp_reader *pfile, const cpp_token *token,
} }
static void 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) const cpp_string *str)
{ {
maybe_print_line (line); maybe_print_line (line);
...@@ -309,7 +309,7 @@ cb_ident (cpp_reader *pfile ATTRIBUTE_UNUSED, fileline line, ...@@ -309,7 +309,7 @@ cb_ident (cpp_reader *pfile ATTRIBUTE_UNUSED, fileline line,
} }
static void 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); maybe_print_line (line);
fputs ("#define ", print.outf); fputs ("#define ", print.outf);
...@@ -401,7 +401,7 @@ pp_file_change (const struct line_map *map) ...@@ -401,7 +401,7 @@ pp_file_change (const struct line_map *map)
/* Copy a #pragma directive to the preprocessed output. */ /* Copy a #pragma directive to the preprocessed output. */
static void static void
cb_def_pragma (cpp_reader *pfile, fileline line) cb_def_pragma (cpp_reader *pfile, source_location line)
{ {
maybe_print_line (line); maybe_print_line (line);
fputs ("#pragma ", print.outf); fputs ("#pragma ", print.outf);
......
...@@ -132,8 +132,8 @@ add_stmt (tree t) ...@@ -132,8 +132,8 @@ add_stmt (tree t)
if ((EXPR_P (t) || STATEMENT_CODE_P (code)) && code != LABEL_EXPR) if ((EXPR_P (t) || STATEMENT_CODE_P (code)) && code != LABEL_EXPR)
{ {
if (!EXPR_LOCUS (t)) if (!EXPR_HAS_LOCATION (t))
annotate_with_locus (t, input_location); SET_EXPR_LOCATION (t, input_location);
/* When we expand a statement-tree, we must know whether or not the /* When we expand a statement-tree, we must know whether or not the
statements are full-expressions. We record that fact here. */ statements are full-expressions. We record that fact here. */
...@@ -149,7 +149,7 @@ add_stmt (tree t) ...@@ -149,7 +149,7 @@ add_stmt (tree t)
/* Build a generic statement based on the given type of node and /* Build a generic statement based on the given type of node and
arguments. Similar to `build_nt', except that we set 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 /* ??? This should be obsolete with the lineno_stmt productions
in the grammar. */ in the grammar. */
...@@ -166,7 +166,7 @@ build_stmt (enum tree_code code, ...) ...@@ -166,7 +166,7 @@ build_stmt (enum tree_code code, ...)
ret = make_node (code); ret = make_node (code);
TREE_TYPE (ret) = void_type_node; TREE_TYPE (ret) = void_type_node;
length = TREE_CODE_LENGTH (code); 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, /* Most statements have implicit side effects all on their own,
such as control transfer. For those that do, we'll compute such as control transfer. For those that do, we'll compute
......
...@@ -6540,7 +6540,7 @@ c_finish_if_stmt (location_t if_locus, tree cond, tree then_block, ...@@ -6540,7 +6540,7 @@ c_finish_if_stmt (location_t if_locus, tree cond, tree then_block,
} }
stmt = build3 (COND_EXPR, NULL_TREE, cond, then_block, else_block); 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); add_stmt (stmt);
} }
...@@ -6584,7 +6584,7 @@ c_finish_loop (location_t start_locus, tree cond, tree incr, tree body, ...@@ -6584,7 +6584,7 @@ c_finish_loop (location_t start_locus, tree cond, tree incr, tree body,
} }
else else
t = build1 (GOTO_EXPR, void_type_node, clab); t = build1 (GOTO_EXPR, void_type_node, clab);
annotate_with_locus (t, start_locus); SET_EXPR_LOCATION (t, start_locus);
add_stmt (t); add_stmt (t);
} }
...@@ -6592,9 +6592,9 @@ c_finish_loop (location_t start_locus, tree cond, tree incr, tree body, ...@@ -6592,9 +6592,9 @@ c_finish_loop (location_t start_locus, tree cond, tree incr, tree body,
exit = build (COND_EXPR, void_type_node, cond, exit, t); exit = build (COND_EXPR, void_type_node, cond, exit, t);
exit = fold (exit); exit = fold (exit);
if (cond_is_first) if (cond_is_first)
annotate_with_locus (exit, start_locus); SET_EXPR_LOCATION (exit, start_locus);
else else
annotate_with_locus (exit, input_location); SET_EXPR_LOCATION (exit, input_location);
} }
add_stmt (top); add_stmt (top);
...@@ -6687,7 +6687,7 @@ c_process_expr_stmt (tree expr) ...@@ -6687,7 +6687,7 @@ c_process_expr_stmt (tree expr)
expr = build1 (NOP_EXPR, TREE_TYPE (expr), expr); expr = build1 (NOP_EXPR, TREE_TYPE (expr), expr);
if (EXPR_P (expr)) if (EXPR_P (expr))
annotate_with_locus (expr, input_location); SET_EXPR_LOCATION (expr, input_location);
return expr; return expr;
} }
......
...@@ -500,10 +500,11 @@ coverage_checksum_string (unsigned chksum, const char *string) ...@@ -500,10 +500,11 @@ coverage_checksum_string (unsigned chksum, const char *string)
static unsigned static unsigned
compute_checksum (void) 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, chksum = coverage_checksum_string (chksum, xloc.file);
DECL_SOURCE_FILE (current_function_decl));
chksum = coverage_checksum_string chksum = coverage_checksum_string
(chksum, IDENTIFIER_POINTER (DECL_ASSEMBLER_NAME (current_function_decl))); (chksum, IDENTIFIER_POINTER (DECL_ASSEMBLER_NAME (current_function_decl)));
...@@ -523,8 +524,8 @@ coverage_begin_output (void) ...@@ -523,8 +524,8 @@ coverage_begin_output (void)
if (!bbg_function_announced) if (!bbg_function_announced)
{ {
const char *file = DECL_SOURCE_FILE (current_function_decl); expanded_location xloc
unsigned line = DECL_SOURCE_LINE (current_function_decl); = expand_location (DECL_SOURCE_LOCATION (current_function_decl));
unsigned long offset; unsigned long offset;
if (!bbg_file_opened) if (!bbg_file_opened)
...@@ -546,8 +547,8 @@ coverage_begin_output (void) ...@@ -546,8 +547,8 @@ coverage_begin_output (void)
gcov_write_unsigned (compute_checksum ()); gcov_write_unsigned (compute_checksum ());
gcov_write_string (IDENTIFIER_POINTER gcov_write_string (IDENTIFIER_POINTER
(DECL_ASSEMBLER_NAME (current_function_decl))); (DECL_ASSEMBLER_NAME (current_function_decl)));
gcov_write_string (file); gcov_write_string (xloc.file);
gcov_write_unsigned (line); gcov_write_unsigned (xloc.line);
gcov_write_length (offset); gcov_write_length (offset);
bbg_function_announced = 1; bbg_function_announced = 1;
......
...@@ -94,7 +94,7 @@ lower_function_body (void) ...@@ -94,7 +94,7 @@ lower_function_body (void)
|| TREE_OPERAND (TREE_VALUE (data.return_statements), 0) != NULL)) || TREE_OPERAND (TREE_VALUE (data.return_statements), 0) != NULL))
{ {
x = build (RETURN_EXPR, void_type_node, 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); tsi_link_after (&i, x, TSI_CONTINUE_LINKING);
} }
...@@ -109,7 +109,11 @@ lower_function_body (void) ...@@ -109,7 +109,11 @@ lower_function_body (void)
It now fills in for many such returns. Failure to remove this It now fills in for many such returns. Failure to remove this
will result in incorrect results for coverage analysis. */ will result in incorrect results for coverage analysis. */
x = TREE_VALUE (t); x = TREE_VALUE (t);
#ifdef USE_MAPPED_LOCATION
SET_EXPR_LOCATION (x, UNKNOWN_LOCATION);
#else
SET_EXPR_LOCUS (x, NULL); SET_EXPR_LOCUS (x, NULL);
#endif
tsi_link_after (&i, x, TSI_CONTINUE_LINKING); tsi_link_after (&i, x, TSI_CONTINUE_LINKING);
} }
......
...@@ -453,10 +453,10 @@ internal_get_tmp_var (tree val, tree *pre_p, tree *post_p, bool is_formal) ...@@ -453,10 +453,10 @@ internal_get_tmp_var (tree val, tree *pre_p, tree *post_p, bool is_formal)
mod = build (MODIFY_EXPR, TREE_TYPE (t), t, val); mod = build (MODIFY_EXPR, TREE_TYPE (t), t, val);
class = TREE_CODE_CLASS (TREE_CODE (val)); class = TREE_CODE_CLASS (TREE_CODE (val));
if (EXPR_LOCUS (val)) if (EXPR_HAS_LOCATION (val))
SET_EXPR_LOCUS (mod, EXPR_LOCUS (val)); SET_EXPR_LOCUS (mod, EXPR_LOCUS (val));
else else
annotate_with_locus (mod, input_location); SET_EXPR_LOCATION (mod, input_location);
/* gimplify_modify_expr might want to reduce this further. */ /* gimplify_modify_expr might want to reduce this further. */
gimplify_and_add (mod, pre_p); gimplify_and_add (mod, pre_p);
...@@ -559,7 +559,7 @@ annotate_one_with_locus (tree t, location_t locus) ...@@ -559,7 +559,7 @@ annotate_one_with_locus (tree t, location_t locus)
if (IS_EXPR_CODE_CLASS (TREE_CODE_CLASS (TREE_CODE (t))) if (IS_EXPR_CODE_CLASS (TREE_CODE_CLASS (TREE_CODE (t)))
&& ! EXPR_HAS_LOCATION (t) && ! EXPR_HAS_LOCATION (t)
&& should_carry_locus_p (t)) && should_carry_locus_p (t))
annotate_with_locus (t, locus); SET_EXPR_LOCATION (t, locus);
} }
void void
...@@ -1832,8 +1832,8 @@ gimplify_call_expr (tree *expr_p, tree *pre_p, bool (*gimple_test_f) (tree)) ...@@ -1832,8 +1832,8 @@ gimplify_call_expr (tree *expr_p, tree *pre_p, bool (*gimple_test_f) (tree))
/* For reliable diagnostics during inlining, it is necessary that /* For reliable diagnostics during inlining, it is necessary that
every call_expr be annotated with file and line. */ every call_expr be annotated with file and line. */
if (!EXPR_LOCUS (*expr_p)) if (! EXPR_HAS_LOCATION (*expr_p))
annotate_with_locus (*expr_p, input_location); SET_EXPR_LOCATION (*expr_p, input_location);
/* This may be a call to a builtin function. /* This may be a call to a builtin function.
...@@ -3435,7 +3435,6 @@ gimplify_expr (tree *expr_p, tree *pre_p, tree *post_p, ...@@ -3435,7 +3435,6 @@ gimplify_expr (tree *expr_p, tree *pre_p, tree *post_p,
tree internal_post = NULL_TREE; tree internal_post = NULL_TREE;
tree save_expr; tree save_expr;
int is_statement = (pre_p == NULL); int is_statement = (pre_p == NULL);
location_t *locus;
location_t saved_location; location_t saved_location;
enum gimplify_status ret; enum gimplify_status ret;
...@@ -3455,12 +3454,9 @@ gimplify_expr (tree *expr_p, tree *pre_p, tree *post_p, ...@@ -3455,12 +3454,9 @@ gimplify_expr (tree *expr_p, tree *pre_p, tree *post_p,
post_p = &internal_post; post_p = &internal_post;
saved_location = input_location; saved_location = input_location;
if (save_expr == error_mark_node) if (save_expr != error_mark_node
locus = NULL; && EXPR_HAS_LOCATION (*expr_p))
else input_location = EXPR_LOCATION (*expr_p);
locus = EXPR_LOCUS (save_expr);
if (locus)
input_location = *locus;
/* Loop over the specific gimplifiers until the toplevel node /* Loop over the specific gimplifiers until the toplevel node
remains the same. */ remains the same. */
......
...@@ -160,6 +160,7 @@ print_node (FILE *file, const char *prefix, tree node, int indent) ...@@ -160,6 +160,7 @@ print_node (FILE *file, const char *prefix, tree node, int indent)
int len; int len;
int first_rtl; int first_rtl;
int i; int i;
expanded_location xloc;
if (node == 0) if (node == 0)
return; return;
...@@ -372,8 +373,8 @@ print_node (FILE *file, const char *prefix, tree node, int indent) ...@@ -372,8 +373,8 @@ print_node (FILE *file, const char *prefix, tree node, int indent)
fputs (" decl_7", file); fputs (" decl_7", file);
fprintf (file, " %s", GET_MODE_NAME (mode)); fprintf (file, " %s", GET_MODE_NAME (mode));
fprintf (file, " file %s line %d", xloc = expand_location (DECL_SOURCE_LOCATION (node));
DECL_SOURCE_FILE (node), DECL_SOURCE_LINE (node)); fprintf (file, " file %s line %d", xloc.file, xloc.line);
print_node (file, "size", DECL_SIZE (node), indent + 4); print_node (file, "size", DECL_SIZE (node), indent + 4);
print_node (file, "unit size", DECL_SIZE_UNIT (node), indent + 4); print_node (file, "unit size", DECL_SIZE_UNIT (node), indent + 4);
...@@ -745,10 +746,9 @@ print_node (FILE *file, const char *prefix, tree node, int indent) ...@@ -745,10 +746,9 @@ print_node (FILE *file, const char *prefix, tree node, int indent)
if (EXPR_HAS_LOCATION (node)) if (EXPR_HAS_LOCATION (node))
{ {
expanded_location xloc = expand_location (EXPR_LOCATION (node));
indent_to (file, indent+4); indent_to (file, indent+4);
fprintf (file, "%s:%d", fprintf (file, "%s:%d", xloc.file, xloc.line);
EXPR_FILENAME (node),
EXPR_LINENO (node));
} }
fprintf (file, ">"); fprintf (file, ">");
......
...@@ -315,6 +315,7 @@ dequeue_and_dump (dump_info_p di) ...@@ -315,6 +315,7 @@ dequeue_and_dump (dump_info_p di)
} }
else if (DECL_P (t)) else if (DECL_P (t))
{ {
expanded_location xloc;
/* All declarations have names. */ /* All declarations have names. */
if (DECL_NAME (t)) if (DECL_NAME (t))
dump_child ("name", DECL_NAME (t)); dump_child ("name", DECL_NAME (t));
...@@ -325,18 +326,19 @@ dequeue_and_dump (dump_info_p di) ...@@ -325,18 +326,19 @@ dequeue_and_dump (dump_info_p di)
queue_and_dump_type (di, t); queue_and_dump_type (di, t);
dump_child ("scpe", DECL_CONTEXT (t)); dump_child ("scpe", DECL_CONTEXT (t));
/* And a source position. */ /* 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) if (!filename)
filename = DECL_SOURCE_FILE (t); filename = xloc.file;
else else
/* Skip the slash. */ /* Skip the slash. */
++filename; ++filename;
dump_maybe_newline (di); dump_maybe_newline (di);
fprintf (di->stream, "srcp: %s:%-6d ", filename, fprintf (di->stream, "srcp: %s:%-6d ", filename,
DECL_SOURCE_LINE (t)); xloc.line);
di->column += 6 + strlen (filename) + 8; di->column += 6 + strlen (filename) + 8;
} }
/* And any declaration can be compiler-generated. */ /* And any declaration can be compiler-generated. */
......
...@@ -50,7 +50,7 @@ Software Foundation, 59 Temple Place - Suite 330, Boston, MA ...@@ -50,7 +50,7 @@ Software Foundation, 59 Temple Place - Suite 330, Boston, MA
/* Helpers. */ /* Helpers. */
static tree mf_build_string (const char *string); static tree mf_build_string (const char *string);
static tree mf_varname_tree (tree); 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. */ /* Initialization of all the mf-runtime.h extern decls. */
static void mf_init_extern_trees (void); static void mf_init_extern_trees (void);
...@@ -117,10 +117,11 @@ mf_varname_tree (tree decl) ...@@ -117,10 +117,11 @@ mf_varname_tree (tree decl)
/* Add FILENAME[:LINENUMBER]. */ /* Add FILENAME[:LINENUMBER]. */
{ {
expanded_location xloc = expand_location (DECL_SOURCE_LOCATION (decl));
const char *sourcefile; 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) if (sourcefile == NULL && current_function_decl != NULL_TREE)
sourcefile = DECL_SOURCE_FILE (current_function_decl); sourcefile = DECL_SOURCE_FILE (current_function_decl);
if (sourcefile == NULL) if (sourcefile == NULL)
...@@ -128,7 +129,6 @@ mf_varname_tree (tree decl) ...@@ -128,7 +129,6 @@ mf_varname_tree (tree decl)
pp_string (buf, sourcefile); pp_string (buf, sourcefile);
sourceline = DECL_SOURCE_LINE (decl);
if (sourceline != 0) if (sourceline != 0)
{ {
pp_string (buf, ":"); pp_string (buf, ":");
...@@ -188,25 +188,23 @@ mf_varname_tree (tree decl) ...@@ -188,25 +188,23 @@ mf_varname_tree (tree decl)
/* And another friend, for producing a simpler message. */ /* And another friend, for producing a simpler message. */
static tree 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; const char *file = NULL, *colon, *line, *op, *name, *cp;
char linebuf[18]; char linebuf[18];
char *string; char *string;
tree result; tree result;
/* Add FILENAME. */ /* Add FILENAME[:LINENUMBER]. */
if (locus != NULL) if (xloc.file == NULL && current_function_decl != NULL_TREE)
file = locus->file; xloc.file = DECL_SOURCE_FILE (current_function_decl);
if (file == NULL && current_function_decl != NULL_TREE) if (xloc.file == NULL)
file = DECL_SOURCE_FILE (current_function_decl); xloc.file = "<unknown file>";
if (file == NULL)
file = "<unknown file>";
/* Add :LINENUMBER. */ if (xloc.line > 0)
if (locus != NULL && locus->line > 0)
{ {
sprintf (linebuf, "%d", locus->line); sprintf (linebuf, "%d", xloc.line);
colon = ":"; colon = ":";
line = linebuf; line = linebuf;
} }
...@@ -348,13 +346,13 @@ mf_decl_cache_locals (void) ...@@ -348,13 +346,13 @@ mf_decl_cache_locals (void)
globals into the cache variables. */ globals into the cache variables. */
t = build (MODIFY_EXPR, TREE_TYPE (mf_cache_shift_decl_l), t = build (MODIFY_EXPR, TREE_TYPE (mf_cache_shift_decl_l),
mf_cache_shift_decl_l, mf_cache_shift_decl); 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); gimplify_to_stmt_list (&t);
shift_init_stmts = t; shift_init_stmts = t;
t = build (MODIFY_EXPR, TREE_TYPE (mf_cache_mask_decl_l), t = build (MODIFY_EXPR, TREE_TYPE (mf_cache_mask_decl_l),
mf_cache_mask_decl_l, mf_cache_mask_decl); 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); gimplify_to_stmt_list (&t);
mask_init_stmts = t; mask_init_stmts = t;
...@@ -548,7 +546,10 @@ mf_build_check_statement_for (tree addr, tree size, ...@@ -548,7 +546,10 @@ mf_build_check_statement_for (tree addr, tree size,
This is the body of the conditional. */ 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, dirflag, u);
u = tree_cons (NULL_TREE, size, u); u = tree_cons (NULL_TREE, size, u);
u = tree_cons (NULL_TREE, mf_value, u); u = tree_cons (NULL_TREE, mf_value, u);
...@@ -920,7 +921,7 @@ mx_register_decls (tree decl, tree *stmt_list) ...@@ -920,7 +921,7 @@ mx_register_decls (tree decl, tree *stmt_list)
register_fncall_params); register_fncall_params);
/* Accumulate the two calls. */ /* Accumulate the two calls. */
/* ??? Set EXPR_LOCUS. */ /* ??? Set EXPR_LOCATION. */
gimplify_stmt (&register_fncall); gimplify_stmt (&register_fncall);
gimplify_stmt (&unregister_fncall); gimplify_stmt (&unregister_fncall);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment