* 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.
From-SVN: r83919
(lang_dependent_init): Save, set input_location to <built-in>.
(warn_deprecated_use): Use expand_location.
+ * 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.
+
2004-06-30 Richard Sandiford <rsandifo@redhat.com>
Eric Christopher <echristo@redhat.com>
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 */
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);
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);
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.
/* 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));
}
}
}
}
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
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
{
/* 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
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;
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;
/* 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);
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. */
*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);
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
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)
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 ();
-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;
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);
}
}
#define TARGET_OPTF(ARG)
#endif
-static int saved_lineno;
-
/* CPP's options. */
static cpp_options *cpp_opts;
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);
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. */
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);
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.
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));