* 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.
* tree-cfg.c: Use new macros and typedefs.
* tree-flow-inline.h: Likewise.
From-SVN: r83922
* 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.
+ * tree-cfg.c: Use new macros and typedefs.
+ * tree-flow-inline.h: Likewise.
2004-06-30 Richard Sandiford <rsandifo@redhat.com>
Eric Christopher <echristo@redhat.com>
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);
}
/* 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",
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);
}
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)
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)
{
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)
{
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
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)));
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)));
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;
}
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;
}
remove_bb (basic_block bb)
{
block_stmt_iterator i;
- location_t *loc = NULL;
+ source_locus loc = 0;
if (dump_file)
{
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
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);
}
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;
}
static void
execute_warn_function_return (void)
{
+#ifdef USE_MAPPED_LOCATION
+ source_location location;
+#else
location_t *locus;
+#endif
tree last;
edge e;
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
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;
}
}
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);
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 "???";
}