Eliminate source_location in favor of location_t
Historically GCC used location_t, while libcpp used source_location. This inconsistency has been annoying me for a while, so this patch removes source_location in favor of location_t throughout (as the latter is shorter). gcc/ChangeLog: * builtins.c: Replace "source_location" with "location_t". * diagnostic-show-locus.c: Likewise. * diagnostic.c: Likewise. * dumpfile.c: Likewise. * gcc-rich-location.h: Likewise. * genmatch.c: Likewise. * gimple.h: Likewise. * gimplify.c: Likewise. * input.c: Likewise. * input.h: Likewise. Eliminate the typedef. * omp-expand.c: Likewise. * selftest.h: Likewise. * substring-locations.h (get_source_location_for_substring): Rename to.. (get_location_within_string): ...this. * tree-cfg.c: Replace "source_location" with "location_t". * tree-cfgcleanup.c: Likewise. * tree-diagnostic.c: Likewise. * tree-into-ssa.c: Likewise. * tree-outof-ssa.c: Likewise. * tree-parloops.c: Likewise. * tree-phinodes.c: Likewise. * tree-phinodes.h: Likewise. * tree-ssa-loop-ivopts.c: Likewise. * tree-ssa-loop-manip.c: Likewise. * tree-ssa-phiopt.c: Likewise. * tree-ssa-phiprop.c: Likewise. * tree-ssa-threadupdate.c: Likewise. * tree-ssa.c: Likewise. * tree-ssa.h: Likewise. * tree-vect-loop-manip.c: Likewise. gcc/c-family/ChangeLog: * c-common.c (c_get_substring_location): Update for renaming of get_source_location_for_substring to get_location_within_string. * c-lex.c: Replace "source_location" with "location_t". * c-opts.c: Likewise. * c-ppoutput.c: Likewise. gcc/c/ChangeLog: * c-decl.c: Replace "source_location" with "location_t". * c-tree.h: Likewise. * c-typeck.c: Likewise. * gimple-parser.c: Likewise. gcc/cp/ChangeLog: * call.c: Replace "source_location" with "location_t". * cp-tree.h: Likewise. * cvt.c: Likewise. * name-lookup.c: Likewise. * parser.c: Likewise. * typeck.c: Likewise. gcc/fortran/ChangeLog: * cpp.c: Replace "source_location" with "location_t". * gfortran.h: Likewise. gcc/go/ChangeLog: * go-gcc-diagnostics.cc: Replace "source_location" with "location_t". * go-gcc.cc: Likewise. * go-linemap.cc: Likewise. * go-location.h: Likewise. * gofrontend/README: Likewise. gcc/jit/ChangeLog: * jit-playback.c: Replace "source_location" with "location_t". gcc/testsuite/ChangeLog: * g++.dg/plugin/comment_plugin.c: Replace "source_location" with "location_t". * gcc.dg/plugin/diagnostic_plugin_test_show_locus.c: Likewise. libcc1/ChangeLog: * libcc1plugin.cc: Replace "source_location" with "location_t". (plugin_context::get_source_location): Rename to... (plugin_context::get_location_t): ...this. * libcp1plugin.cc: Likewise. libcpp/ChangeLog: * charset.c: Replace "source_location" with "location_t". * directives-only.c: Likewise. * directives.c: Likewise. * errors.c: Likewise. * expr.c: Likewise. * files.c: Likewise. * include/cpplib.h: Likewise. Rename MAX_SOURCE_LOCATION to MAX_LOCATION_T. * include/line-map.h: Likewise. * init.c: Likewise. * internal.h: Likewise. * lex.c: Likewise. * line-map.c: Likewise. * location-example.txt: Likewise. * macro.c: Likewise. * pch.c: Likewise. * traditional.c: Likewise. From-SVN: r266085
This commit is contained in:
parent
f9731de3db
commit
620e594be5
83 changed files with 840 additions and 734 deletions
|
@ -1,3 +1,37 @@
|
|||
2018-11-13 David Malcolm <dmalcolm@redhat.com>
|
||||
|
||||
* builtins.c: Replace "source_location" with "location_t".
|
||||
* diagnostic-show-locus.c: Likewise.
|
||||
* diagnostic.c: Likewise.
|
||||
* dumpfile.c: Likewise.
|
||||
* gcc-rich-location.h: Likewise.
|
||||
* genmatch.c: Likewise.
|
||||
* gimple.h: Likewise.
|
||||
* gimplify.c: Likewise.
|
||||
* input.c: Likewise.
|
||||
* input.h: Likewise. Eliminate the typedef.
|
||||
* omp-expand.c: Likewise.
|
||||
* selftest.h: Likewise.
|
||||
* substring-locations.h (get_source_location_for_substring):
|
||||
Rename to..
|
||||
(get_location_within_string): ...this.
|
||||
* tree-cfg.c: Replace "source_location" with "location_t".
|
||||
* tree-cfgcleanup.c: Likewise.
|
||||
* tree-diagnostic.c: Likewise.
|
||||
* tree-into-ssa.c: Likewise.
|
||||
* tree-outof-ssa.c: Likewise.
|
||||
* tree-parloops.c: Likewise.
|
||||
* tree-phinodes.c: Likewise.
|
||||
* tree-phinodes.h: Likewise.
|
||||
* tree-ssa-loop-ivopts.c: Likewise.
|
||||
* tree-ssa-loop-manip.c: Likewise.
|
||||
* tree-ssa-phiopt.c: Likewise.
|
||||
* tree-ssa-phiprop.c: Likewise.
|
||||
* tree-ssa-threadupdate.c: Likewise.
|
||||
* tree-ssa.c: Likewise.
|
||||
* tree-ssa.h: Likewise.
|
||||
* tree-vect-loop-manip.c: Likewise.
|
||||
|
||||
2018-11-13 Michael Ploujnikov <michael.ploujnikov@oracle.com>
|
||||
|
||||
* doc/extend.texi: Fix typo in the weakref description.
|
||||
|
|
|
@ -6151,7 +6151,7 @@ get_memmodel (tree exp)
|
|||
{
|
||||
rtx op;
|
||||
unsigned HOST_WIDE_INT val;
|
||||
source_location loc
|
||||
location_t loc
|
||||
= expansion_point_location_if_in_system_header (input_location);
|
||||
|
||||
/* If the parameter is not a constant, it's a run time value so we'll just
|
||||
|
@ -6227,7 +6227,7 @@ expand_builtin_atomic_compare_exchange (machine_mode mode, tree exp,
|
|||
enum memmodel success, failure;
|
||||
tree weak;
|
||||
bool is_weak;
|
||||
source_location loc
|
||||
location_t loc
|
||||
= expansion_point_location_if_in_system_header (input_location);
|
||||
|
||||
success = get_memmodel (CALL_EXPR_ARG (exp, 4));
|
||||
|
@ -6354,7 +6354,7 @@ expand_ifn_atomic_compare_exchange (gcall *call)
|
|||
enum memmodel success, failure;
|
||||
tree lhs;
|
||||
bool is_weak;
|
||||
source_location loc
|
||||
location_t loc
|
||||
= expansion_point_location_if_in_system_header (gimple_location (call));
|
||||
|
||||
success = get_memmodel (gimple_call_arg (call, 4));
|
||||
|
@ -6426,7 +6426,7 @@ expand_builtin_atomic_load (machine_mode mode, tree exp, rtx target)
|
|||
model = get_memmodel (CALL_EXPR_ARG (exp, 1));
|
||||
if (is_mm_release (model) || is_mm_acq_rel (model))
|
||||
{
|
||||
source_location loc
|
||||
location_t loc
|
||||
= expansion_point_location_if_in_system_header (input_location);
|
||||
warning_at (loc, OPT_Winvalid_memory_model,
|
||||
"invalid memory model for %<__atomic_load%>");
|
||||
|
@ -6458,7 +6458,7 @@ expand_builtin_atomic_store (machine_mode mode, tree exp)
|
|||
if (!(is_mm_relaxed (model) || is_mm_seq_cst (model)
|
||||
|| is_mm_release (model)))
|
||||
{
|
||||
source_location loc
|
||||
location_t loc
|
||||
= expansion_point_location_if_in_system_header (input_location);
|
||||
warning_at (loc, OPT_Winvalid_memory_model,
|
||||
"invalid memory model for %<__atomic_store%>");
|
||||
|
@ -6651,7 +6651,7 @@ expand_builtin_atomic_clear (tree exp)
|
|||
|
||||
if (is_mm_consume (model) || is_mm_acquire (model) || is_mm_acq_rel (model))
|
||||
{
|
||||
source_location loc
|
||||
location_t loc
|
||||
= expansion_point_location_if_in_system_header (input_location);
|
||||
warning_at (loc, OPT_Winvalid_memory_model,
|
||||
"invalid memory model for %<__atomic_store%>");
|
||||
|
@ -10200,7 +10200,7 @@ fold_builtin_next_arg (tree exp, bool va_start_p)
|
|||
definition of the va_start macro (perhaps on the token for
|
||||
builtin) in a system header, so warnings will not be emitted.
|
||||
Use the location in real source code. */
|
||||
source_location current_location =
|
||||
location_t current_location =
|
||||
linemap_unwind_to_first_non_reserved_loc (line_table, input_location,
|
||||
NULL);
|
||||
|
||||
|
|
|
@ -1,3 +1,11 @@
|
|||
2018-11-13 David Malcolm <dmalcolm@redhat.com>
|
||||
|
||||
* c-common.c (c_get_substring_location): Update for renaming of
|
||||
get_source_location_for_substring to get_location_within_string.
|
||||
* c-lex.c: Replace "source_location" with "location_t".
|
||||
* c-opts.c: Likewise.
|
||||
* c-ppoutput.c: Likewise.
|
||||
|
||||
2018-11-13 Martin Sebor <msebor@redhat.com>
|
||||
|
||||
PR middle-end/81824
|
||||
|
|
|
@ -862,13 +862,13 @@ c_get_substring_location (const substring_loc &substr_loc,
|
|||
if (tok_type == CPP_OTHER)
|
||||
return "unrecognized string type";
|
||||
|
||||
return get_source_location_for_substring (parse_in, g_string_concat_db,
|
||||
substr_loc.get_fmt_string_loc (),
|
||||
tok_type,
|
||||
substr_loc.get_caret_idx (),
|
||||
substr_loc.get_start_idx (),
|
||||
substr_loc.get_end_idx (),
|
||||
out_loc);
|
||||
return get_location_within_string (parse_in, g_string_concat_db,
|
||||
substr_loc.get_fmt_string_loc (),
|
||||
tok_type,
|
||||
substr_loc.get_caret_idx (),
|
||||
substr_loc.get_start_idx (),
|
||||
substr_loc.get_end_idx (),
|
||||
out_loc);
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -237,7 +237,7 @@ fe_file_change (const line_map_ordinary *new_map)
|
|||
}
|
||||
|
||||
static void
|
||||
cb_def_pragma (cpp_reader *pfile, source_location loc)
|
||||
cb_def_pragma (cpp_reader *pfile, location_t loc)
|
||||
{
|
||||
/* Issue a warning message if we have been asked to do so. Ignore
|
||||
unknown pragmas in system headers unless an explicit
|
||||
|
@ -265,7 +265,7 @@ cb_def_pragma (cpp_reader *pfile, source_location loc)
|
|||
|
||||
/* #define callback for DWARF and DWARF2 debug info. */
|
||||
static void
|
||||
cb_define (cpp_reader *pfile, source_location loc, cpp_hashnode *node)
|
||||
cb_define (cpp_reader *pfile, location_t loc, cpp_hashnode *node)
|
||||
{
|
||||
const struct line_map *map = linemap_lookup (line_table, loc);
|
||||
(*debug_hooks->define) (SOURCE_LINE (linemap_check_ordinary (map), loc),
|
||||
|
@ -274,7 +274,7 @@ cb_define (cpp_reader *pfile, source_location loc, cpp_hashnode *node)
|
|||
|
||||
/* #undef callback for DWARF and DWARF2 debug info. */
|
||||
static void
|
||||
cb_undef (cpp_reader * ARG_UNUSED (pfile), source_location loc,
|
||||
cb_undef (cpp_reader * ARG_UNUSED (pfile), location_t loc,
|
||||
cpp_hashnode *node)
|
||||
{
|
||||
const struct line_map *map = linemap_lookup (line_table, loc);
|
||||
|
|
|
@ -1393,7 +1393,7 @@ c_finish_options (void)
|
|||
cb_file_change (parse_in, bltin_map);
|
||||
|
||||
/* Make sure all of the builtins about to be declared have
|
||||
BUILTINS_LOCATION has their source_location. */
|
||||
BUILTINS_LOCATION has their location_t. */
|
||||
cpp_force_token_locations (parse_in, BUILTINS_LOCATION);
|
||||
|
||||
cpp_init_builtins (parse_in, flag_hosted);
|
||||
|
|
|
@ -59,24 +59,24 @@ static void account_for_newlines (const unsigned char *, size_t);
|
|||
static int dump_macro (cpp_reader *, cpp_hashnode *, void *);
|
||||
static void dump_queued_macros (cpp_reader *);
|
||||
|
||||
static bool print_line_1 (source_location, const char*, FILE *);
|
||||
static bool print_line (source_location, const char *);
|
||||
static bool maybe_print_line_1 (source_location, FILE *);
|
||||
static bool maybe_print_line (source_location);
|
||||
static bool print_line_1 (location_t, const char*, FILE *);
|
||||
static bool print_line (location_t, const char *);
|
||||
static bool maybe_print_line_1 (location_t, FILE *);
|
||||
static bool maybe_print_line (location_t);
|
||||
static bool do_line_change (cpp_reader *, const cpp_token *,
|
||||
source_location, int);
|
||||
location_t, int);
|
||||
|
||||
/* 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 *, source_location, cpp_hashnode *);
|
||||
static void cb_undef (cpp_reader *, source_location, cpp_hashnode *);
|
||||
static void cb_used_define (cpp_reader *, source_location, cpp_hashnode *);
|
||||
static void cb_used_undef (cpp_reader *, source_location, cpp_hashnode *);
|
||||
static void cb_include (cpp_reader *, source_location, const unsigned char *,
|
||||
static void cb_define (cpp_reader *, location_t, cpp_hashnode *);
|
||||
static void cb_undef (cpp_reader *, location_t, cpp_hashnode *);
|
||||
static void cb_used_define (cpp_reader *, location_t, cpp_hashnode *);
|
||||
static void cb_used_undef (cpp_reader *, location_t, cpp_hashnode *);
|
||||
static void cb_include (cpp_reader *, location_t, const unsigned char *,
|
||||
const char *, int, const cpp_token **);
|
||||
static void cb_ident (cpp_reader *, source_location, const cpp_string *);
|
||||
static void cb_def_pragma (cpp_reader *, source_location);
|
||||
static void cb_ident (cpp_reader *, location_t, const cpp_string *);
|
||||
static void cb_def_pragma (cpp_reader *, location_t);
|
||||
static void cb_read_pch (cpp_reader *pfile, const char *name,
|
||||
int fd, const char *orig_name);
|
||||
|
||||
|
@ -179,7 +179,7 @@ scan_translation_unit (cpp_reader *pfile)
|
|||
print.source = NULL;
|
||||
for (;;)
|
||||
{
|
||||
source_location loc;
|
||||
location_t loc;
|
||||
const cpp_token *token = cpp_get_token_with_location (pfile, &loc);
|
||||
|
||||
if (token->type == CPP_PADDING)
|
||||
|
@ -336,7 +336,7 @@ scan_translation_unit_trad (cpp_reader *pfile)
|
|||
return FALSE. */
|
||||
|
||||
static bool
|
||||
maybe_print_line_1 (source_location src_loc, FILE *stream)
|
||||
maybe_print_line_1 (location_t src_loc, FILE *stream)
|
||||
{
|
||||
bool emitted_line_marker = false;
|
||||
int src_line = LOCATION_LINE (src_loc);
|
||||
|
@ -373,7 +373,7 @@ maybe_print_line_1 (source_location src_loc, FILE *stream)
|
|||
return FALSE. */
|
||||
|
||||
static bool
|
||||
maybe_print_line (source_location src_loc)
|
||||
maybe_print_line (location_t src_loc)
|
||||
{
|
||||
if (cpp_get_options (parse_in)->debug)
|
||||
linemap_dump_location (line_table, src_loc,
|
||||
|
@ -386,7 +386,7 @@ maybe_print_line (source_location src_loc)
|
|||
was effectively emitted, return TRUE otherwise return FALSE. */
|
||||
|
||||
static bool
|
||||
print_line_1 (source_location src_loc, const char *special_flags, FILE *stream)
|
||||
print_line_1 (location_t src_loc, const char *special_flags, FILE *stream)
|
||||
{
|
||||
bool emitted_line_marker = false;
|
||||
|
||||
|
@ -435,7 +435,7 @@ print_line_1 (source_location src_loc, const char *special_flags, FILE *stream)
|
|||
line marker was effectively emitted, FALSE otherwise. */
|
||||
|
||||
static bool
|
||||
print_line (source_location src_loc, const char *special_flags)
|
||||
print_line (location_t src_loc, const char *special_flags)
|
||||
{
|
||||
if (cpp_get_options (parse_in)->debug)
|
||||
linemap_dump_location (line_table, src_loc,
|
||||
|
@ -447,7 +447,7 @@ print_line (source_location src_loc, const char *special_flags)
|
|||
Return TRUE if a line marker is emitted, FALSE otherwise. */
|
||||
static bool
|
||||
do_line_change (cpp_reader *pfile, const cpp_token *token,
|
||||
source_location src_loc, int parsing_args)
|
||||
location_t src_loc, int parsing_args)
|
||||
{
|
||||
bool emitted_line_marker = false;
|
||||
if (define_queue || undef_queue)
|
||||
|
@ -487,7 +487,7 @@ cb_line_change (cpp_reader *pfile, const cpp_token *token,
|
|||
}
|
||||
|
||||
static void
|
||||
cb_ident (cpp_reader *pfile ATTRIBUTE_UNUSED, source_location line,
|
||||
cb_ident (cpp_reader *pfile ATTRIBUTE_UNUSED, location_t line,
|
||||
const cpp_string *str)
|
||||
{
|
||||
maybe_print_line (line);
|
||||
|
@ -496,7 +496,7 @@ cb_ident (cpp_reader *pfile ATTRIBUTE_UNUSED, source_location line,
|
|||
}
|
||||
|
||||
static void
|
||||
cb_define (cpp_reader *pfile, source_location line, cpp_hashnode *node)
|
||||
cb_define (cpp_reader *pfile, location_t line, cpp_hashnode *node)
|
||||
{
|
||||
const line_map_ordinary *map;
|
||||
|
||||
|
@ -520,7 +520,7 @@ cb_define (cpp_reader *pfile, source_location line, cpp_hashnode *node)
|
|||
}
|
||||
|
||||
static void
|
||||
cb_undef (cpp_reader *pfile ATTRIBUTE_UNUSED, source_location line,
|
||||
cb_undef (cpp_reader *pfile ATTRIBUTE_UNUSED, location_t line,
|
||||
cpp_hashnode *node)
|
||||
{
|
||||
maybe_print_line (line);
|
||||
|
@ -529,7 +529,7 @@ cb_undef (cpp_reader *pfile ATTRIBUTE_UNUSED, source_location line,
|
|||
}
|
||||
|
||||
static void
|
||||
cb_used_define (cpp_reader *pfile, source_location line ATTRIBUTE_UNUSED,
|
||||
cb_used_define (cpp_reader *pfile, location_t line ATTRIBUTE_UNUSED,
|
||||
cpp_hashnode *node)
|
||||
{
|
||||
if (cpp_user_macro_p (node))
|
||||
|
@ -544,7 +544,7 @@ cb_used_define (cpp_reader *pfile, source_location line ATTRIBUTE_UNUSED,
|
|||
|
||||
static void
|
||||
cb_used_undef (cpp_reader *pfile ATTRIBUTE_UNUSED,
|
||||
source_location line ATTRIBUTE_UNUSED,
|
||||
location_t line ATTRIBUTE_UNUSED,
|
||||
cpp_hashnode *node)
|
||||
{
|
||||
macro_queue *q;
|
||||
|
@ -595,7 +595,7 @@ dump_queued_macros (cpp_reader *pfile ATTRIBUTE_UNUSED)
|
|||
}
|
||||
|
||||
static void
|
||||
cb_include (cpp_reader *pfile ATTRIBUTE_UNUSED, source_location line,
|
||||
cb_include (cpp_reader *pfile ATTRIBUTE_UNUSED, location_t line,
|
||||
const unsigned char *dir, const char *header, int angle_brackets,
|
||||
const cpp_token **comments)
|
||||
{
|
||||
|
@ -676,7 +676,7 @@ pp_file_change (const line_map_ordinary *map)
|
|||
|
||||
/* Copy a #pragma directive to the preprocessed output. */
|
||||
static void
|
||||
cb_def_pragma (cpp_reader *pfile, source_location line)
|
||||
cb_def_pragma (cpp_reader *pfile, location_t line)
|
||||
{
|
||||
maybe_print_line (line);
|
||||
fputs ("#pragma ", print.outf);
|
||||
|
|
|
@ -1,3 +1,10 @@
|
|||
2018-11-13 David Malcolm <dmalcolm@redhat.com>
|
||||
|
||||
* c-decl.c: Replace "source_location" with "location_t".
|
||||
* c-tree.h: Likewise.
|
||||
* c-typeck.c: Likewise.
|
||||
* gimple-parser.c: Likewise.
|
||||
|
||||
2018-11-09 Jakub Jelinek <jakub@redhat.com>
|
||||
|
||||
* c-parser.c (c_parser_omp_clause_final): Use
|
||||
|
|
|
@ -9955,7 +9955,7 @@ build_null_declspecs (void)
|
|||
SPECS, returning SPECS. */
|
||||
|
||||
struct c_declspecs *
|
||||
declspecs_add_addrspace (source_location location,
|
||||
declspecs_add_addrspace (location_t location,
|
||||
struct c_declspecs *specs, addr_space_t as)
|
||||
{
|
||||
specs->non_sc_seen_p = true;
|
||||
|
@ -9978,7 +9978,7 @@ declspecs_add_addrspace (source_location location,
|
|||
returning SPECS. */
|
||||
|
||||
struct c_declspecs *
|
||||
declspecs_add_qual (source_location loc,
|
||||
declspecs_add_qual (location_t loc,
|
||||
struct c_declspecs *specs, tree qual)
|
||||
{
|
||||
enum rid i;
|
||||
|
@ -10895,7 +10895,7 @@ declspecs_add_type (location_t loc, struct c_declspecs *specs,
|
|||
declaration specifiers SPECS, returning SPECS. */
|
||||
|
||||
struct c_declspecs *
|
||||
declspecs_add_scspec (source_location loc,
|
||||
declspecs_add_scspec (location_t loc,
|
||||
struct c_declspecs *specs,
|
||||
tree scspec)
|
||||
{
|
||||
|
@ -11014,7 +11014,7 @@ declspecs_add_scspec (source_location loc,
|
|||
returning SPECS. */
|
||||
|
||||
struct c_declspecs *
|
||||
declspecs_add_attrs (source_location loc, struct c_declspecs *specs, tree attrs)
|
||||
declspecs_add_attrs (location_t loc, struct c_declspecs *specs, tree attrs)
|
||||
{
|
||||
specs->attrs = chainon (attrs, specs->attrs);
|
||||
specs->locations[cdw_attributes] = loc;
|
||||
|
@ -11026,7 +11026,7 @@ declspecs_add_attrs (source_location loc, struct c_declspecs *specs, tree attrs)
|
|||
alignment is ALIGN) to the declaration specifiers SPECS, returning
|
||||
SPECS. */
|
||||
struct c_declspecs *
|
||||
declspecs_add_alignas (source_location loc,
|
||||
declspecs_add_alignas (location_t loc,
|
||||
struct c_declspecs *specs, tree align)
|
||||
{
|
||||
int align_log;
|
||||
|
|
|
@ -288,7 +288,7 @@ enum c_declspec_word {
|
|||
specifier is added, please update the enum c_declspec_word above
|
||||
accordingly. */
|
||||
struct c_declspecs {
|
||||
source_location locations[cdw_number_of_elements];
|
||||
location_t locations[cdw_number_of_elements];
|
||||
/* The type specified, if a single type specifier such as a struct,
|
||||
union or enum specifier, typedef name or typeof specifies the
|
||||
whole type, or NULL_TREE if none or a keyword such as "void" or
|
||||
|
@ -592,19 +592,19 @@ extern struct c_declarator *build_id_declarator (tree);
|
|||
extern struct c_declarator *make_pointer_declarator (struct c_declspecs *,
|
||||
struct c_declarator *);
|
||||
extern struct c_declspecs *build_null_declspecs (void);
|
||||
extern struct c_declspecs *declspecs_add_qual (source_location,
|
||||
extern struct c_declspecs *declspecs_add_qual (location_t,
|
||||
struct c_declspecs *, tree);
|
||||
extern struct c_declspecs *declspecs_add_type (location_t,
|
||||
struct c_declspecs *,
|
||||
struct c_typespec);
|
||||
extern struct c_declspecs *declspecs_add_scspec (source_location,
|
||||
extern struct c_declspecs *declspecs_add_scspec (location_t,
|
||||
struct c_declspecs *, tree);
|
||||
extern struct c_declspecs *declspecs_add_attrs (source_location,
|
||||
extern struct c_declspecs *declspecs_add_attrs (location_t,
|
||||
struct c_declspecs *, tree);
|
||||
extern struct c_declspecs *declspecs_add_addrspace (source_location,
|
||||
extern struct c_declspecs *declspecs_add_addrspace (location_t,
|
||||
struct c_declspecs *,
|
||||
addr_space_t);
|
||||
extern struct c_declspecs *declspecs_add_alignas (source_location,
|
||||
extern struct c_declspecs *declspecs_add_alignas (location_t,
|
||||
struct c_declspecs *, tree);
|
||||
extern struct c_declspecs *finish_declspecs (struct c_declspecs *);
|
||||
|
||||
|
|
|
@ -6226,7 +6226,7 @@ pedwarn_init (location_t loc, int opt, const char *gmsgid, ...)
|
|||
/* Use the location where a macro was expanded rather than where
|
||||
it was defined to make sure macros defined in system headers
|
||||
but used incorrectly elsewhere are diagnosed. */
|
||||
source_location exploc = expansion_point_location_if_in_system_header (loc);
|
||||
location_t exploc = expansion_point_location_if_in_system_header (loc);
|
||||
auto_diagnostic_group d;
|
||||
va_list ap;
|
||||
va_start (ap, gmsgid);
|
||||
|
@ -6254,7 +6254,7 @@ warning_init (location_t loc, int opt, const char *gmsgid)
|
|||
/* Use the location where a macro was expanded rather than where
|
||||
it was defined to make sure macros defined in system headers
|
||||
but used incorrectly elsewhere are diagnosed. */
|
||||
source_location exploc = expansion_point_location_if_in_system_header (loc);
|
||||
location_t exploc = expansion_point_location_if_in_system_header (loc);
|
||||
|
||||
/* The gmsgid may be a format string with %< and %>. */
|
||||
warned = warning_at (exploc, opt, gmsgid);
|
||||
|
@ -10234,7 +10234,7 @@ c_finish_return (location_t loc, tree retval, tree origtype)
|
|||
|
||||
/* Use the expansion point to handle cases such as returning NULL
|
||||
in a function returning void. */
|
||||
source_location xloc = expansion_point_location_if_in_system_header (loc);
|
||||
location_t xloc = expansion_point_location_if_in_system_header (loc);
|
||||
|
||||
if (TREE_THIS_VOLATILE (current_function_decl))
|
||||
warning_at (xloc, 0,
|
||||
|
|
|
@ -1643,7 +1643,7 @@ c_finish_gimple_return (location_t loc, tree retval)
|
|||
|
||||
/* Use the expansion point to handle cases such as returning NULL
|
||||
in a function returning void. */
|
||||
source_location xloc = expansion_point_location_if_in_system_header (loc);
|
||||
location_t xloc = expansion_point_location_if_in_system_header (loc);
|
||||
|
||||
if (TREE_THIS_VOLATILE (current_function_decl))
|
||||
warning_at (xloc, 0,
|
||||
|
|
|
@ -1,3 +1,12 @@
|
|||
2018-11-13 David Malcolm <dmalcolm@redhat.com>
|
||||
|
||||
* call.c: Replace "source_location" with "location_t".
|
||||
* cp-tree.h: Likewise.
|
||||
* cvt.c: Likewise.
|
||||
* name-lookup.c: Likewise.
|
||||
* parser.c: Likewise.
|
||||
* typeck.c: Likewise.
|
||||
|
||||
2018-11-12 Jason Merrill <jason@redhat.com>
|
||||
|
||||
Implement P0315R4, Lambdas in unevaluated contexts.
|
||||
|
|
|
@ -6681,7 +6681,7 @@ conversion_null_warnings (tree totype, tree expr, tree fn, int argnum)
|
|||
if (null_node_p (expr) && TREE_CODE (totype) != BOOLEAN_TYPE
|
||||
&& ARITHMETIC_TYPE_P (totype))
|
||||
{
|
||||
source_location loc =
|
||||
location_t loc =
|
||||
expansion_point_location_if_in_system_header (input_location);
|
||||
|
||||
if (fn)
|
||||
|
@ -6710,7 +6710,7 @@ conversion_null_warnings (tree totype, tree expr, tree fn, int argnum)
|
|||
else if (null_ptr_cst_p (expr) &&
|
||||
(TYPE_PTR_OR_PTRMEM_P (totype) || NULLPTR_TYPE_P (totype)))
|
||||
{
|
||||
source_location loc =
|
||||
location_t loc =
|
||||
expansion_point_location_if_in_system_header (input_location);
|
||||
maybe_warn_zero_as_null_pointer_constant (expr, loc);
|
||||
}
|
||||
|
@ -7386,7 +7386,7 @@ convert_arg_to_ellipsis (tree arg, tsubst_flags_t complain)
|
|||
/* va_arg (EXPR, TYPE) is a builtin. Make sure it is not abused. */
|
||||
|
||||
tree
|
||||
build_x_va_arg (source_location loc, tree expr, tree type)
|
||||
build_x_va_arg (location_t loc, tree expr, tree type)
|
||||
{
|
||||
if (processing_template_decl)
|
||||
{
|
||||
|
|
|
@ -5783,7 +5783,7 @@ enum cp_decl_spec {
|
|||
struct cp_decl_specifier_seq {
|
||||
/* An array of locations for the declaration sepecifiers, indexed by
|
||||
enum cp_decl_spec_word. */
|
||||
source_location locations[ds_last];
|
||||
location_t locations[ds_last];
|
||||
/* The primary type, if any, given by the decl-specifier-seq.
|
||||
Modifiers, like "short", "const", and "unsigned" are not
|
||||
reflected here. This field will be a TYPE, unless a typedef-name
|
||||
|
@ -6183,7 +6183,7 @@ extern void pop_defarg_context (void);
|
|||
extern tree convert_default_arg (tree, tree, tree, int,
|
||||
tsubst_flags_t);
|
||||
extern tree convert_arg_to_ellipsis (tree, tsubst_flags_t);
|
||||
extern tree build_x_va_arg (source_location, tree, tree);
|
||||
extern tree build_x_va_arg (location_t, tree, tree);
|
||||
extern tree cxx_type_promotes_to (tree);
|
||||
extern tree type_passed_as (tree);
|
||||
extern tree convert_for_arg_passing (tree, tree, tsubst_flags_t);
|
||||
|
@ -6351,7 +6351,7 @@ extern tree build_cp_library_fn_ptr (const char *, tree, int);
|
|||
extern tree push_library_fn (tree, tree, tree, int);
|
||||
extern tree push_void_library_fn (tree, tree, int);
|
||||
extern tree push_throw_library_fn (tree, tree);
|
||||
extern void warn_misplaced_attr_for_class_type (source_location location,
|
||||
extern void warn_misplaced_attr_for_class_type (location_t location,
|
||||
tree class_type);
|
||||
extern tree check_tag_decl (cp_decl_specifier_seq *, bool);
|
||||
extern tree shadow_tag (cp_decl_specifier_seq *);
|
||||
|
|
|
@ -1687,7 +1687,7 @@ build_expr_type_conversion (int desires, tree expr, bool complain)
|
|||
&& (desires & WANT_INT)
|
||||
&& !(desires & WANT_NULL))
|
||||
{
|
||||
source_location loc =
|
||||
location_t loc =
|
||||
expansion_point_location_if_in_system_header (input_location);
|
||||
|
||||
warning_at (loc, OPT_Wconversion_null,
|
||||
|
|
|
@ -4752,7 +4752,7 @@ fixup_anonymous_aggr (tree t)
|
|||
class-key, in it class-specifier. */
|
||||
|
||||
void
|
||||
warn_misplaced_attr_for_class_type (source_location location,
|
||||
warn_misplaced_attr_for_class_type (location_t location,
|
||||
tree class_type)
|
||||
{
|
||||
gcc_assert (OVERLOAD_TYPE_P (class_type));
|
||||
|
@ -10257,7 +10257,7 @@ grokdeclarator (const cp_declarator *declarator,
|
|||
bool constexpr_p = decl_spec_seq_has_spec_p (declspecs, ds_constexpr);
|
||||
bool late_return_type_p = false;
|
||||
bool array_parameter_p = false;
|
||||
source_location saved_loc = input_location;
|
||||
location_t saved_loc = input_location;
|
||||
tree reqs = NULL_TREE;
|
||||
|
||||
signed_p = decl_spec_seq_has_spec_p (declspecs, ds_signed);
|
||||
|
|
|
@ -6049,7 +6049,7 @@ class macro_use_before_def : public deferred_diagnostic
|
|||
static macro_use_before_def *
|
||||
maybe_make (location_t use_loc, cpp_hashnode *macro)
|
||||
{
|
||||
source_location def_loc = cpp_macro_definition_location (macro);
|
||||
location_t def_loc = cpp_macro_definition_location (macro);
|
||||
if (def_loc == UNKNOWN_LOCATION)
|
||||
return NULL;
|
||||
|
||||
|
|
|
@ -5441,7 +5441,7 @@ cp_parser_primary_expression (cp_parser *parser,
|
|||
{
|
||||
tree expression;
|
||||
tree type;
|
||||
source_location type_location;
|
||||
location_t type_location;
|
||||
location_t start_loc
|
||||
= cp_lexer_peek_token (parser->lexer)->location;
|
||||
/* The `__builtin_va_arg' construct is used to handle
|
||||
|
@ -28525,7 +28525,7 @@ set_and_check_decl_spec_loc (cp_decl_specifier_seq *decl_specs,
|
|||
if (decl_specs == NULL)
|
||||
return;
|
||||
|
||||
source_location location = token->location;
|
||||
location_t location = token->location;
|
||||
|
||||
if (decl_specs->locations[ds] == 0)
|
||||
{
|
||||
|
|
|
@ -4433,7 +4433,7 @@ cp_build_binary_op (location_t location,
|
|||
&& !TYPE_PTR_OR_PTRMEM_P (type1)))
|
||||
&& (complain & tf_warning))
|
||||
{
|
||||
source_location loc =
|
||||
location_t loc =
|
||||
expansion_point_location_if_in_system_header (input_location);
|
||||
|
||||
warning_at (loc, OPT_Wpointer_arith, "NULL used in arithmetic");
|
||||
|
|
|
@ -777,11 +777,11 @@ compatible_locations_p (location_t loc_a, location_t loc_b)
|
|||
/* Expand each location towards the spelling location, and
|
||||
recurse. */
|
||||
const line_map_macro *macro_map = linemap_check_macro (map_a);
|
||||
source_location loc_a_toward_spelling
|
||||
location_t loc_a_toward_spelling
|
||||
= linemap_macro_map_loc_unwind_toward_spelling (line_table,
|
||||
macro_map,
|
||||
loc_a);
|
||||
source_location loc_b_toward_spelling
|
||||
location_t loc_b_toward_spelling
|
||||
= linemap_macro_map_loc_unwind_toward_spelling (line_table,
|
||||
macro_map,
|
||||
loc_b);
|
||||
|
|
|
@ -794,12 +794,12 @@ print_parseable_fixits (pretty_printer *pp, rich_location *richloc)
|
|||
for (unsigned i = 0; i < richloc->get_num_fixit_hints (); i++)
|
||||
{
|
||||
const fixit_hint *hint = richloc->get_fixit_hint (i);
|
||||
source_location start_loc = hint->get_start_loc ();
|
||||
location_t start_loc = hint->get_start_loc ();
|
||||
expanded_location start_exploc = expand_location (start_loc);
|
||||
pp_string (pp, "fix-it:");
|
||||
print_escaped_string (pp, start_exploc.file);
|
||||
/* For compatibility with clang, print as a half-open range. */
|
||||
source_location next_loc = hint->get_next_loc ();
|
||||
location_t next_loc = hint->get_next_loc ();
|
||||
expanded_location next_exploc = expand_location (next_loc);
|
||||
pp_printf (pp, ":{%i:%i-%i:%i}:",
|
||||
start_exploc.line, start_exploc.column,
|
||||
|
|
|
@ -47,7 +47,7 @@ along with GCC; see the file COPYING3. If not see
|
|||
|
||||
static dump_flags_t pflags; /* current dump_flags */
|
||||
|
||||
static void dump_loc (dump_flags_t, FILE *, source_location);
|
||||
static void dump_loc (dump_flags_t, FILE *, location_t);
|
||||
|
||||
/* Current -fopt-info output stream, if any, and flags. */
|
||||
static FILE *alt_dump_file = NULL;
|
||||
|
@ -466,7 +466,7 @@ kind_as_string (dump_flags_t dump_kind)
|
|||
/* Print source location on DFILE if enabled. */
|
||||
|
||||
static void
|
||||
dump_loc (dump_flags_t dump_kind, FILE *dfile, source_location loc)
|
||||
dump_loc (dump_flags_t dump_kind, FILE *dfile, location_t loc)
|
||||
{
|
||||
if (dump_kind)
|
||||
{
|
||||
|
@ -487,7 +487,7 @@ dump_loc (dump_flags_t dump_kind, FILE *dfile, source_location loc)
|
|||
/* Print source location to PP if enabled. */
|
||||
|
||||
static void
|
||||
dump_loc (dump_flags_t dump_kind, pretty_printer *pp, source_location loc)
|
||||
dump_loc (dump_flags_t dump_kind, pretty_printer *pp, location_t loc)
|
||||
{
|
||||
if (dump_kind)
|
||||
{
|
||||
|
|
|
@ -1,3 +1,8 @@
|
|||
2018-11-13 David Malcolm <dmalcolm@redhat.com>
|
||||
|
||||
* cpp.c: Replace "source_location" with "location_t".
|
||||
* gfortran.h: Likewise.
|
||||
|
||||
2018-11-08 Jakub Jelinek <jakub@redhat.com>
|
||||
|
||||
* trans-openmp.c (gfc_trans_omp_clauses): Use
|
||||
|
|
|
@ -134,14 +134,14 @@ static void scan_translation_unit_trad (cpp_reader *);
|
|||
in specific modes. */
|
||||
static void cb_file_change (cpp_reader *, const line_map_ordinary *);
|
||||
static void cb_line_change (cpp_reader *, const cpp_token *, int);
|
||||
static void cb_define (cpp_reader *, source_location, cpp_hashnode *);
|
||||
static void cb_undef (cpp_reader *, source_location, cpp_hashnode *);
|
||||
static void cb_def_pragma (cpp_reader *, source_location);
|
||||
static void cb_include (cpp_reader *, source_location, const unsigned char *,
|
||||
static void cb_define (cpp_reader *, location_t, cpp_hashnode *);
|
||||
static void cb_undef (cpp_reader *, location_t, cpp_hashnode *);
|
||||
static void cb_def_pragma (cpp_reader *, location_t);
|
||||
static void cb_include (cpp_reader *, location_t, const unsigned char *,
|
||||
const char *, int, const cpp_token **);
|
||||
static void cb_ident (cpp_reader *, source_location, const cpp_string *);
|
||||
static void cb_used_define (cpp_reader *, source_location, cpp_hashnode *);
|
||||
static void cb_used_undef (cpp_reader *, source_location, cpp_hashnode *);
|
||||
static void cb_ident (cpp_reader *, location_t, const cpp_string *);
|
||||
static void cb_used_define (cpp_reader *, location_t, cpp_hashnode *);
|
||||
static void cb_used_undef (cpp_reader *, location_t, cpp_hashnode *);
|
||||
static bool cb_cpp_diagnostic (cpp_reader *, enum cpp_diagnostic_level,
|
||||
enum cpp_warning_reason, rich_location *,
|
||||
const char *, va_list *)
|
||||
|
@ -578,7 +578,7 @@ gfc_cpp_init (void)
|
|||
if (!gfc_cpp_option.no_predefined)
|
||||
{
|
||||
/* Make sure all of the builtins about to be declared have
|
||||
BUILTINS_LOCATION has their source_location. */
|
||||
BUILTINS_LOCATION has their location_t. */
|
||||
cpp_force_token_locations (cpp_in, BUILTINS_LOCATION);
|
||||
|
||||
cpp_define_builtins (cpp_in);
|
||||
|
@ -709,8 +709,8 @@ static void scan_translation_unit_trad (cpp_reader *);
|
|||
static void account_for_newlines (const unsigned char *, size_t);
|
||||
static int dump_macro (cpp_reader *, cpp_hashnode *, void *);
|
||||
|
||||
static void print_line (source_location, const char *);
|
||||
static void maybe_print_line (source_location);
|
||||
static void print_line (location_t, const char *);
|
||||
static void maybe_print_line (location_t);
|
||||
|
||||
|
||||
/* Writes out the preprocessed file, handling spacing and paste
|
||||
|
@ -790,7 +790,7 @@ scan_translation_unit_trad (cpp_reader *pfile)
|
|||
different line to the current one, output the required newlines or
|
||||
a line marker. */
|
||||
static void
|
||||
maybe_print_line (source_location src_loc)
|
||||
maybe_print_line (location_t src_loc)
|
||||
{
|
||||
const line_map_ordinary *map
|
||||
= linemap_check_ordinary (linemap_lookup (line_table, src_loc));
|
||||
|
@ -819,7 +819,7 @@ maybe_print_line (source_location src_loc)
|
|||
/* Output a line marker for logical line LINE. Special flags are "1"
|
||||
or "2" indicating entering or leaving a file. */
|
||||
static void
|
||||
print_line (source_location src_loc, const char *special_flags)
|
||||
print_line (location_t src_loc, const char *special_flags)
|
||||
{
|
||||
/* End any previous line of text. */
|
||||
if (print.printed)
|
||||
|
@ -897,7 +897,7 @@ static void
|
|||
cb_line_change (cpp_reader *pfile, const cpp_token *token,
|
||||
int parsing_args)
|
||||
{
|
||||
source_location src_loc = token->src_loc;
|
||||
location_t src_loc = token->src_loc;
|
||||
|
||||
if (token->type == CPP_EOF || parsing_args)
|
||||
return;
|
||||
|
@ -924,7 +924,7 @@ cb_line_change (cpp_reader *pfile, const cpp_token *token,
|
|||
}
|
||||
|
||||
static void
|
||||
cb_ident (cpp_reader *pfile ATTRIBUTE_UNUSED, source_location line,
|
||||
cb_ident (cpp_reader *pfile ATTRIBUTE_UNUSED, location_t line,
|
||||
const cpp_string *str)
|
||||
{
|
||||
maybe_print_line (line);
|
||||
|
@ -933,7 +933,7 @@ cb_ident (cpp_reader *pfile ATTRIBUTE_UNUSED, source_location line,
|
|||
}
|
||||
|
||||
static void
|
||||
cb_define (cpp_reader *pfile ATTRIBUTE_UNUSED, source_location line,
|
||||
cb_define (cpp_reader *pfile ATTRIBUTE_UNUSED, location_t line,
|
||||
cpp_hashnode *node ATTRIBUTE_UNUSED)
|
||||
{
|
||||
maybe_print_line (line);
|
||||
|
@ -952,7 +952,7 @@ cb_define (cpp_reader *pfile ATTRIBUTE_UNUSED, source_location line,
|
|||
}
|
||||
|
||||
static void
|
||||
cb_undef (cpp_reader *pfile ATTRIBUTE_UNUSED, source_location line,
|
||||
cb_undef (cpp_reader *pfile ATTRIBUTE_UNUSED, location_t line,
|
||||
cpp_hashnode *node)
|
||||
{
|
||||
maybe_print_line (line);
|
||||
|
@ -961,7 +961,7 @@ cb_undef (cpp_reader *pfile ATTRIBUTE_UNUSED, source_location line,
|
|||
}
|
||||
|
||||
static void
|
||||
cb_include (cpp_reader *pfile ATTRIBUTE_UNUSED, source_location line,
|
||||
cb_include (cpp_reader *pfile ATTRIBUTE_UNUSED, location_t line,
|
||||
const unsigned char *dir, const char *header, int angle_brackets,
|
||||
const cpp_token **comments)
|
||||
{
|
||||
|
@ -1003,7 +1003,7 @@ dump_macro (cpp_reader *pfile, cpp_hashnode *node, void *v ATTRIBUTE_UNUSED)
|
|||
}
|
||||
|
||||
static void
|
||||
cb_used_define (cpp_reader *pfile, source_location line ATTRIBUTE_UNUSED,
|
||||
cb_used_define (cpp_reader *pfile, location_t line ATTRIBUTE_UNUSED,
|
||||
cpp_hashnode *node)
|
||||
{
|
||||
gfc_cpp_macro_queue *q;
|
||||
|
@ -1086,7 +1086,7 @@ pp_dir_change (cpp_reader *pfile ATTRIBUTE_UNUSED, const char *dir)
|
|||
|
||||
/* Copy a #pragma directive to the preprocessed output. */
|
||||
static void
|
||||
cb_def_pragma (cpp_reader *pfile, source_location line)
|
||||
cb_def_pragma (cpp_reader *pfile, location_t line)
|
||||
{
|
||||
maybe_print_line (line);
|
||||
fputs ("#pragma ", print.outf);
|
||||
|
@ -1096,7 +1096,7 @@ cb_def_pragma (cpp_reader *pfile, source_location line)
|
|||
|
||||
static void
|
||||
cb_used_undef (cpp_reader *pfile ATTRIBUTE_UNUSED,
|
||||
source_location line ATTRIBUTE_UNUSED,
|
||||
location_t line ATTRIBUTE_UNUSED,
|
||||
cpp_hashnode *node)
|
||||
{
|
||||
gfc_cpp_macro_queue *q;
|
||||
|
|
|
@ -952,7 +952,7 @@ typedef struct gfc_file
|
|||
|
||||
typedef struct gfc_linebuf
|
||||
{
|
||||
source_location location;
|
||||
location_t location;
|
||||
struct gfc_file *file;
|
||||
struct gfc_linebuf *next;
|
||||
|
||||
|
|
|
@ -28,7 +28,7 @@ class gcc_rich_location : public rich_location
|
|||
/* Constructors. */
|
||||
|
||||
/* Constructing from a location. */
|
||||
gcc_rich_location (source_location loc, const range_label *label = NULL)
|
||||
gcc_rich_location (location_t loc, const range_label *label = NULL)
|
||||
: rich_location (line_table, loc, label)
|
||||
{
|
||||
}
|
||||
|
|
|
@ -53,7 +53,7 @@ unsigned verbose;
|
|||
static struct line_maps *line_table;
|
||||
|
||||
/* The rich_location class within libcpp requires a way to expand
|
||||
source_location instances, and relies on the client code
|
||||
location_t instances, and relies on the client code
|
||||
providing a symbol named
|
||||
linemap_client_expand_location_to_spelling_point
|
||||
to do this.
|
||||
|
@ -61,7 +61,7 @@ static struct line_maps *line_table;
|
|||
This is the implementation for genmatch. */
|
||||
|
||||
expanded_location
|
||||
linemap_client_expand_location_to_spelling_point (source_location loc,
|
||||
linemap_client_expand_location_to_spelling_point (location_t loc,
|
||||
enum location_aspect)
|
||||
{
|
||||
const struct line_map_ordinary *map;
|
||||
|
@ -78,7 +78,7 @@ diagnostic_cb (cpp_reader *, enum cpp_diagnostic_level errtype,
|
|||
const char *msg, va_list *ap)
|
||||
{
|
||||
const line_map_ordinary *map;
|
||||
source_location location = richloc->get_loc ();
|
||||
location_t location = richloc->get_loc ();
|
||||
linemap_resolve_location (line_table, location, LRK_SPELLING_LOCATION, &map);
|
||||
expanded_location loc = linemap_expand_location (line_table, map, location);
|
||||
fprintf (stderr, "%s:%d:%d %s: ", loc.file, loc.line, loc.column,
|
||||
|
@ -131,7 +131,7 @@ static void
|
|||
#if GCC_VERSION >= 4001
|
||||
__attribute__((format (printf, 2, 3)))
|
||||
#endif
|
||||
fatal_at (source_location loc, const char *msg, ...)
|
||||
fatal_at (location_t loc, const char *msg, ...)
|
||||
{
|
||||
rich_location richloc (line_table, loc);
|
||||
va_list ap;
|
||||
|
@ -157,7 +157,7 @@ static void
|
|||
#if GCC_VERSION >= 4001
|
||||
__attribute__((format (printf, 2, 3)))
|
||||
#endif
|
||||
warning_at (source_location loc, const char *msg, ...)
|
||||
warning_at (location_t loc, const char *msg, ...)
|
||||
{
|
||||
rich_location richloc (line_table, loc);
|
||||
va_list ap;
|
||||
|
@ -184,7 +184,7 @@ fprintf_indent (FILE *f, unsigned int indent, const char *format, ...)
|
|||
}
|
||||
|
||||
static void
|
||||
output_line_directive (FILE *f, source_location location,
|
||||
output_line_directive (FILE *f, location_t location,
|
||||
bool dumpfile = false, bool fnargs = false)
|
||||
{
|
||||
const line_map_ordinary *map;
|
||||
|
@ -667,10 +667,10 @@ struct capture_info;
|
|||
|
||||
struct operand {
|
||||
enum op_type { OP_PREDICATE, OP_EXPR, OP_CAPTURE, OP_C_EXPR, OP_IF, OP_WITH };
|
||||
operand (enum op_type type_, source_location loc_)
|
||||
operand (enum op_type type_, location_t loc_)
|
||||
: type (type_), location (loc_) {}
|
||||
enum op_type type;
|
||||
source_location location;
|
||||
location_t location;
|
||||
virtual void gen_transform (FILE *, int, const char *, bool, int,
|
||||
const char *, capture_info *,
|
||||
dt_operand ** = 0,
|
||||
|
@ -682,7 +682,7 @@ struct operand {
|
|||
|
||||
struct predicate : public operand
|
||||
{
|
||||
predicate (predicate_id *p_, source_location loc)
|
||||
predicate (predicate_id *p_, location_t loc)
|
||||
: operand (OP_PREDICATE, loc), p (p_) {}
|
||||
predicate_id *p;
|
||||
};
|
||||
|
@ -692,7 +692,7 @@ struct predicate : public operand
|
|||
|
||||
struct expr : public operand
|
||||
{
|
||||
expr (id_base *operation_, source_location loc, bool is_commutative_ = false)
|
||||
expr (id_base *operation_, location_t loc, bool is_commutative_ = false)
|
||||
: operand (OP_EXPR, loc), operation (operation_),
|
||||
ops (vNULL), expr_type (NULL), is_commutative (is_commutative_),
|
||||
is_generic (false), force_single_use (false) {}
|
||||
|
@ -733,7 +733,7 @@ struct c_expr : public operand
|
|||
id_tab (const char *id_, const char *oper_): id (id_), oper (oper_) {}
|
||||
};
|
||||
|
||||
c_expr (cpp_reader *r_, source_location loc,
|
||||
c_expr (cpp_reader *r_, location_t loc,
|
||||
vec<cpp_token> code_, unsigned nr_stmts_,
|
||||
vec<id_tab> ids_, cid_map_t *capture_ids_)
|
||||
: operand (OP_C_EXPR, loc), r (r_), code (code_),
|
||||
|
@ -755,7 +755,7 @@ struct c_expr : public operand
|
|||
|
||||
struct capture : public operand
|
||||
{
|
||||
capture (source_location loc, unsigned where_, operand *what_, bool value_)
|
||||
capture (location_t loc, unsigned where_, operand *what_, bool value_)
|
||||
: operand (OP_CAPTURE, loc), where (where_), value_match (value_),
|
||||
what (what_) {}
|
||||
/* Identifier index for the value. */
|
||||
|
@ -775,7 +775,7 @@ struct capture : public operand
|
|||
|
||||
struct if_expr : public operand
|
||||
{
|
||||
if_expr (source_location loc)
|
||||
if_expr (location_t loc)
|
||||
: operand (OP_IF, loc), cond (NULL), trueexpr (NULL), falseexpr (NULL) {}
|
||||
c_expr *cond;
|
||||
operand *trueexpr;
|
||||
|
@ -786,7 +786,7 @@ struct if_expr : public operand
|
|||
|
||||
struct with_expr : public operand
|
||||
{
|
||||
with_expr (source_location loc)
|
||||
with_expr (location_t loc)
|
||||
: operand (OP_WITH, loc), with (NULL), subexpr (NULL) {}
|
||||
c_expr *with;
|
||||
operand *subexpr;
|
||||
|
@ -1797,13 +1797,13 @@ decision_tree::find_node (vec<dt_node *>& ops, dt_node *p)
|
|||
{
|
||||
if (verbose >= 1)
|
||||
{
|
||||
source_location p_loc = 0;
|
||||
location_t p_loc = 0;
|
||||
if (p->type == dt_node::DT_OPERAND)
|
||||
p_loc = as_a <dt_operand *> (p)->op->location;
|
||||
source_location op_loc = 0;
|
||||
location_t op_loc = 0;
|
||||
if (ops[i]->type == dt_node::DT_OPERAND)
|
||||
op_loc = as_a <dt_operand *> (ops[i])->op->location;
|
||||
source_location true_loc = 0;
|
||||
location_t true_loc = 0;
|
||||
true_loc = true_node->op->location;
|
||||
warning_at (p_loc,
|
||||
"failed to merge decision tree node");
|
||||
|
@ -3925,7 +3925,7 @@ private:
|
|||
c_expr *parse_c_expr (cpp_ttype);
|
||||
operand *parse_op ();
|
||||
|
||||
void record_operlist (source_location, user_id *);
|
||||
void record_operlist (location_t, user_id *);
|
||||
|
||||
void parse_pattern ();
|
||||
operand *parse_result (operand *, predicate_id *);
|
||||
|
@ -3933,10 +3933,10 @@ private:
|
|||
vec<simplify *>&, operand *, operand *);
|
||||
void parse_simplify (simplify::simplify_kind,
|
||||
vec<simplify *>&, predicate_id *, operand *);
|
||||
void parse_for (source_location);
|
||||
void parse_if (source_location);
|
||||
void parse_predicates (source_location);
|
||||
void parse_operator_list (source_location);
|
||||
void parse_for (location_t);
|
||||
void parse_if (location_t);
|
||||
void parse_predicates (location_t);
|
||||
void parse_operator_list (location_t);
|
||||
|
||||
void finish_match_operand (operand *);
|
||||
|
||||
|
@ -4094,7 +4094,7 @@ parser::get_internal_capture_id ()
|
|||
/* Record an operator-list use for transparent for handling. */
|
||||
|
||||
void
|
||||
parser::record_operlist (source_location loc, user_id *p)
|
||||
parser::record_operlist (location_t loc, user_id *p)
|
||||
{
|
||||
if (!oper_lists_set->add (p))
|
||||
{
|
||||
|
@ -4168,7 +4168,7 @@ parser::parse_operation ()
|
|||
struct operand *
|
||||
parser::parse_capture (operand *op, bool require_existing)
|
||||
{
|
||||
source_location src_loc = eat_token (CPP_ATSIGN)->src_loc;
|
||||
location_t src_loc = eat_token (CPP_ATSIGN)->src_loc;
|
||||
const cpp_token *token = peek ();
|
||||
const char *id = NULL;
|
||||
bool value_match = false;
|
||||
|
@ -4324,7 +4324,7 @@ parser::parse_c_expr (cpp_ttype start)
|
|||
unsigned opencnt;
|
||||
vec<cpp_token> code = vNULL;
|
||||
unsigned nr_stmts = 0;
|
||||
source_location loc = eat_token (start)->src_loc;
|
||||
location_t loc = eat_token (start)->src_loc;
|
||||
if (start == CPP_OPEN_PAREN)
|
||||
end = CPP_CLOSE_PAREN;
|
||||
else if (start == CPP_OPEN_BRACE)
|
||||
|
@ -4513,7 +4513,7 @@ parser::parse_result (operand *result, predicate_id *matcher)
|
|||
else if (peek_ident ("switch"))
|
||||
{
|
||||
token = eat_ident ("switch");
|
||||
source_location ifloc = eat_token (CPP_OPEN_PAREN)->src_loc;
|
||||
location_t ifloc = eat_token (CPP_OPEN_PAREN)->src_loc;
|
||||
eat_ident ("if");
|
||||
if_expr *ife = new if_expr (ifloc);
|
||||
operand *res = ife;
|
||||
|
@ -4652,7 +4652,7 @@ parser::parse_simplify (simplify::simplify_kind kind,
|
|||
subst = <ident> '(' <ident>... ')' */
|
||||
|
||||
void
|
||||
parser::parse_for (source_location)
|
||||
parser::parse_for (location_t)
|
||||
{
|
||||
auto_vec<const cpp_token *> user_id_tokens;
|
||||
vec<user_id *> user_ids = vNULL;
|
||||
|
@ -4766,7 +4766,7 @@ parser::parse_for (source_location)
|
|||
oprs = '(' 'define_operator_list' <ident> <ident>... ')' */
|
||||
|
||||
void
|
||||
parser::parse_operator_list (source_location)
|
||||
parser::parse_operator_list (location_t)
|
||||
{
|
||||
const cpp_token *token = peek ();
|
||||
const char *id = get_ident ();
|
||||
|
@ -4818,7 +4818,7 @@ parser::parse_operator_list (source_location)
|
|||
if = '(' 'if' '(' <c-expr> ')' <pattern> ')' */
|
||||
|
||||
void
|
||||
parser::parse_if (source_location)
|
||||
parser::parse_if (location_t)
|
||||
{
|
||||
c_expr *ifexpr = parse_c_expr (CPP_OPEN_PAREN);
|
||||
|
||||
|
@ -4842,7 +4842,7 @@ parser::parse_if (source_location)
|
|||
preds = '(' 'define_predicates' <ident>... ')' */
|
||||
|
||||
void
|
||||
parser::parse_predicates (source_location)
|
||||
parser::parse_predicates (location_t)
|
||||
{
|
||||
do
|
||||
{
|
||||
|
@ -4873,7 +4873,7 @@ parser::parse_pattern ()
|
|||
else if (strcmp (id, "match") == 0)
|
||||
{
|
||||
bool with_args = false;
|
||||
source_location e_loc = peek ()->src_loc;
|
||||
location_t e_loc = peek ()->src_loc;
|
||||
if (peek ()->type == CPP_OPEN_PAREN)
|
||||
{
|
||||
eat_token (CPP_OPEN_PAREN);
|
||||
|
|
|
@ -4426,7 +4426,7 @@ gimple_phi_arg_edge (gphi *phi, size_t i)
|
|||
|
||||
/* Return the source location of gimple argument I of phi node PHI. */
|
||||
|
||||
static inline source_location
|
||||
static inline location_t
|
||||
gimple_phi_arg_location (gphi *phi, size_t i)
|
||||
{
|
||||
return gimple_phi_arg (phi, i)->locus;
|
||||
|
@ -4434,7 +4434,7 @@ gimple_phi_arg_location (gphi *phi, size_t i)
|
|||
|
||||
/* Return the source location of the argument on edge E of phi node PHI. */
|
||||
|
||||
static inline source_location
|
||||
static inline location_t
|
||||
gimple_phi_arg_location_from_edge (gphi *phi, edge e)
|
||||
{
|
||||
return gimple_phi_arg (phi, e->dest_idx)->locus;
|
||||
|
@ -4443,7 +4443,7 @@ gimple_phi_arg_location_from_edge (gphi *phi, edge e)
|
|||
/* Set the source location of gimple argument I of phi node PHI to LOC. */
|
||||
|
||||
static inline void
|
||||
gimple_phi_arg_set_location (gphi *phi, size_t i, source_location loc)
|
||||
gimple_phi_arg_set_location (gphi *phi, size_t i, location_t loc)
|
||||
{
|
||||
gimple_phi_arg (phi, i)->locus = loc;
|
||||
}
|
||||
|
|
|
@ -13840,7 +13840,7 @@ gimplify_va_arg_expr (tree *expr_p, gimple_seq *pre_p,
|
|||
bool warned;
|
||||
/* Use the expansion point to handle cases such as passing bool (defined
|
||||
in a system header) through `...'. */
|
||||
source_location xloc
|
||||
location_t xloc
|
||||
= expansion_point_location_if_in_system_header (loc);
|
||||
|
||||
/* Unfortunately, this is merely undefined, rather than a constraint
|
||||
|
|
|
@ -1,3 +1,11 @@
|
|||
2018-11-13 David Malcolm <dmalcolm@redhat.com>
|
||||
|
||||
* go-gcc-diagnostics.cc: Replace "source_location" with "location_t".
|
||||
* go-gcc.cc: Likewise.
|
||||
* go-linemap.cc: Likewise.
|
||||
* go-location.h: Likewise.
|
||||
* gofrontend/README: Likewise.
|
||||
|
||||
2018-10-31 Ian Lance Taylor <iant@golang.org>
|
||||
|
||||
* go-gcc.cc (Gcc_backend::write_global_definitions): Don't call
|
||||
|
|
|
@ -24,7 +24,7 @@
|
|||
void
|
||||
go_be_error_at(const Location location, const std::string& errmsg)
|
||||
{
|
||||
source_location gcc_loc = location.gcc_location();
|
||||
location_t gcc_loc = location.gcc_location();
|
||||
error_at(gcc_loc, "%s", errmsg.c_str());
|
||||
}
|
||||
|
||||
|
@ -33,7 +33,7 @@ void
|
|||
go_be_warning_at(const Location location,
|
||||
int opt, const std::string& warningmsg)
|
||||
{
|
||||
source_location gcc_loc = location.gcc_location();
|
||||
location_t gcc_loc = location.gcc_location();
|
||||
warning_at(gcc_loc, opt, "%s", warningmsg.c_str());
|
||||
}
|
||||
|
||||
|
@ -41,7 +41,7 @@ void
|
|||
go_be_fatal_error(const Location location,
|
||||
const std::string& fatalmsg)
|
||||
{
|
||||
source_location gcc_loc = location.gcc_location();
|
||||
location_t gcc_loc = location.gcc_location();
|
||||
fatal_error(gcc_loc, "%s", fatalmsg.c_str());
|
||||
}
|
||||
|
||||
|
@ -49,7 +49,7 @@ void
|
|||
go_be_inform(const Location location,
|
||||
const std::string& infomsg)
|
||||
{
|
||||
source_location gcc_loc = location.gcc_location();
|
||||
location_t gcc_loc = location.gcc_location();
|
||||
inform(gcc_loc, "%s", infomsg.c_str());
|
||||
}
|
||||
|
||||
|
|
|
@ -2243,9 +2243,9 @@ Gcc_backend::switch_statement(
|
|||
{
|
||||
if (pc->empty())
|
||||
{
|
||||
source_location loc = (*ps != NULL
|
||||
? EXPR_LOCATION((*ps)->get_tree())
|
||||
: UNKNOWN_LOCATION);
|
||||
location_t loc = (*ps != NULL
|
||||
? EXPR_LOCATION((*ps)->get_tree())
|
||||
: UNKNOWN_LOCATION);
|
||||
tree label = create_artificial_label(loc);
|
||||
tree c = build_case_label(NULL_TREE, NULL_TREE, label);
|
||||
append_to_statement_list(c, &stmt_list);
|
||||
|
@ -2259,7 +2259,7 @@ Gcc_backend::switch_statement(
|
|||
tree t = (*pcv)->get_tree();
|
||||
if (t == error_mark_node)
|
||||
return this->error_statement();
|
||||
source_location loc = EXPR_LOCATION(t);
|
||||
location_t loc = EXPR_LOCATION(t);
|
||||
tree label = create_artificial_label(loc);
|
||||
tree c = build_case_label((*pcv)->get_tree(), NULL_TREE, label);
|
||||
append_to_statement_list(c, &stmt_list);
|
||||
|
|
|
@ -77,7 +77,7 @@ std::string
|
|||
Gcc_linemap::to_string(Location location)
|
||||
{
|
||||
const line_map_ordinary *lmo;
|
||||
source_location resolved_location;
|
||||
location_t resolved_location;
|
||||
|
||||
// Screen out unknown and predeclared locations; produce output
|
||||
// only for simple file:line locations.
|
||||
|
|
|
@ -18,16 +18,16 @@ class Location
|
|||
: gcc_loc_(UNKNOWN_LOCATION)
|
||||
{ }
|
||||
|
||||
explicit Location(source_location loc)
|
||||
explicit Location(location_t loc)
|
||||
: gcc_loc_(loc)
|
||||
{ }
|
||||
|
||||
source_location
|
||||
location_t
|
||||
gcc_location() const
|
||||
{ return this->gcc_loc_; }
|
||||
|
||||
private:
|
||||
source_location gcc_loc_;
|
||||
location_t gcc_loc_;
|
||||
};
|
||||
|
||||
// The Go frontend requires the ability to compare Locations.
|
||||
|
|
|
@ -14,7 +14,7 @@ header files.
|
|||
Issues to be faced in this transition:
|
||||
|
||||
* Representation of source locations.
|
||||
+ Currently the frontend uses gcc's source_location codes, using the
|
||||
+ Currently the frontend uses gcc's location_t codes, using the
|
||||
interface in libcpp/line-map.h.
|
||||
|
||||
* Handling of error messages.
|
||||
|
|
84
gcc/input.c
84
gcc/input.c
|
@ -152,7 +152,7 @@ static const size_t fcache_line_record_size = 100;
|
|||
ASPECT controls which part of the location to use. */
|
||||
|
||||
static expanded_location
|
||||
expand_location_1 (source_location loc,
|
||||
expand_location_1 (location_t loc,
|
||||
bool expansion_point_p,
|
||||
enum location_aspect aspect)
|
||||
{
|
||||
|
@ -201,14 +201,14 @@ expand_location_1 (source_location loc,
|
|||
break;
|
||||
case LOCATION_ASPECT_START:
|
||||
{
|
||||
source_location start = get_start (loc);
|
||||
location_t start = get_start (loc);
|
||||
if (start != loc)
|
||||
return expand_location_1 (start, expansion_point_p, aspect);
|
||||
}
|
||||
break;
|
||||
case LOCATION_ASPECT_FINISH:
|
||||
{
|
||||
source_location finish = get_finish (loc);
|
||||
location_t finish = get_finish (loc);
|
||||
if (finish != loc)
|
||||
return expand_location_1 (finish, expansion_point_p, aspect);
|
||||
}
|
||||
|
@ -256,7 +256,7 @@ static size_t
|
|||
total_lines_num (const char *file_path)
|
||||
{
|
||||
size_t r = 0;
|
||||
source_location l = 0;
|
||||
location_t l = 0;
|
||||
if (linemap_get_file_highest_location (line_table, file_path, &l))
|
||||
{
|
||||
gcc_assert (l >= RESERVED_LOCATION_COUNT);
|
||||
|
@ -786,7 +786,7 @@ location_missing_trailing_newline (const char *file_path)
|
|||
function would return true if passed a token "4" that is the result
|
||||
of the expansion of the built-in __LINE__ macro. */
|
||||
bool
|
||||
is_location_from_builtin_token (source_location loc)
|
||||
is_location_from_builtin_token (location_t loc)
|
||||
{
|
||||
const line_map_ordinary *map = NULL;
|
||||
loc = linemap_resolve_location (line_table, loc,
|
||||
|
@ -800,7 +800,7 @@ is_location_from_builtin_token (source_location loc)
|
|||
readable location is set to the string "<built-in>". */
|
||||
|
||||
expanded_location
|
||||
expand_location (source_location loc)
|
||||
expand_location (location_t loc)
|
||||
{
|
||||
return expand_location_1 (loc, /*expansion_point_p=*/true,
|
||||
LOCATION_ASPECT_CARET);
|
||||
|
@ -813,14 +813,14 @@ expand_location (source_location loc)
|
|||
"<built-in>". */
|
||||
|
||||
expanded_location
|
||||
expand_location_to_spelling_point (source_location loc,
|
||||
expand_location_to_spelling_point (location_t loc,
|
||||
enum location_aspect aspect)
|
||||
{
|
||||
return expand_location_1 (loc, /*expansion_point_p=*/false, aspect);
|
||||
}
|
||||
|
||||
/* The rich_location class within libcpp requires a way to expand
|
||||
source_location instances, and relies on the client code
|
||||
location_t instances, and relies on the client code
|
||||
providing a symbol named
|
||||
linemap_client_expand_location_to_spelling_point
|
||||
to do this.
|
||||
|
@ -829,7 +829,7 @@ expand_location_to_spelling_point (source_location loc,
|
|||
which simply calls into expand_location_1. */
|
||||
|
||||
expanded_location
|
||||
linemap_client_expand_location_to_spelling_point (source_location loc,
|
||||
linemap_client_expand_location_to_spelling_point (location_t loc,
|
||||
enum location_aspect aspect)
|
||||
{
|
||||
return expand_location_1 (loc, /*expansion_point_p=*/false, aspect);
|
||||
|
@ -848,8 +848,8 @@ linemap_client_expand_location_to_spelling_point (source_location loc,
|
|||
warning_at, the diagnostic would be suppressed (unless
|
||||
-Wsystem-headers). */
|
||||
|
||||
source_location
|
||||
expansion_point_location_if_in_system_header (source_location location)
|
||||
location_t
|
||||
expansion_point_location_if_in_system_header (location_t location)
|
||||
{
|
||||
if (in_system_header_at (location))
|
||||
location = linemap_resolve_location (line_table, location,
|
||||
|
@ -861,8 +861,8 @@ expansion_point_location_if_in_system_header (source_location location)
|
|||
/* If LOCATION is a virtual location for a token coming from the expansion
|
||||
of a macro, unwind to the location of the expansion point of the macro. */
|
||||
|
||||
source_location
|
||||
expansion_point_location (source_location location)
|
||||
location_t
|
||||
expansion_point_location (location_t location)
|
||||
{
|
||||
return linemap_resolve_location (line_table, location,
|
||||
LRK_MACRO_EXPANSION_POINT, NULL);
|
||||
|
@ -976,7 +976,7 @@ dump_line_table_statistics (void)
|
|||
|
||||
/* Get location one beyond the final location in ordinary map IDX. */
|
||||
|
||||
static source_location
|
||||
static location_t
|
||||
get_end_location (struct line_maps *set, unsigned int idx)
|
||||
{
|
||||
if (idx == LINEMAPS_ORDINARY_USED (set) - 1)
|
||||
|
@ -1001,37 +1001,37 @@ write_digit (FILE *stream, int digit)
|
|||
static void
|
||||
write_digit_row (FILE *stream, int indent,
|
||||
const line_map_ordinary *map,
|
||||
source_location loc, int max_col, int divisor)
|
||||
location_t loc, int max_col, int divisor)
|
||||
{
|
||||
fprintf (stream, "%*c", indent, ' ');
|
||||
fprintf (stream, "|");
|
||||
for (int column = 1; column < max_col; column++)
|
||||
{
|
||||
source_location column_loc = loc + (column << map->m_range_bits);
|
||||
location_t column_loc = loc + (column << map->m_range_bits);
|
||||
write_digit (stream, column_loc / divisor);
|
||||
}
|
||||
fprintf (stream, "\n");
|
||||
}
|
||||
|
||||
/* Write a half-closed (START) / half-open (END) interval of
|
||||
source_location to STREAM. */
|
||||
location_t to STREAM. */
|
||||
|
||||
static void
|
||||
dump_location_range (FILE *stream,
|
||||
source_location start, source_location end)
|
||||
location_t start, location_t end)
|
||||
{
|
||||
fprintf (stream,
|
||||
" source_location interval: %u <= loc < %u\n",
|
||||
" location_t interval: %u <= loc < %u\n",
|
||||
start, end);
|
||||
}
|
||||
|
||||
/* Write a labelled description of a half-closed (START) / half-open (END)
|
||||
interval of source_location to STREAM. */
|
||||
interval of location_t to STREAM. */
|
||||
|
||||
static void
|
||||
dump_labelled_location_range (FILE *stream,
|
||||
const char *name,
|
||||
source_location start, source_location end)
|
||||
location_t start, location_t end)
|
||||
{
|
||||
fprintf (stream, "%s\n", name);
|
||||
dump_location_range (stream, start, end);
|
||||
|
@ -1050,7 +1050,7 @@ dump_location_info (FILE *stream)
|
|||
/* Visualize the ordinary line_map instances, rendering the sources. */
|
||||
for (unsigned int idx = 0; idx < LINEMAPS_ORDINARY_USED (line_table); idx++)
|
||||
{
|
||||
source_location end_location = get_end_location (line_table, idx);
|
||||
location_t end_location = get_end_location (line_table, idx);
|
||||
/* half-closed: doesn't include this one. */
|
||||
|
||||
const line_map_ordinary *map
|
||||
|
@ -1069,7 +1069,7 @@ dump_location_info (FILE *stream)
|
|||
map->m_range_bits);
|
||||
|
||||
/* Render the span of source lines that this "map" covers. */
|
||||
for (source_location loc = MAP_START_LOCATION (map);
|
||||
for (location_t loc = MAP_START_LOCATION (map);
|
||||
loc < end_location;
|
||||
loc += (1 << map->m_range_bits) )
|
||||
{
|
||||
|
@ -1094,7 +1094,7 @@ dump_location_info (FILE *stream)
|
|||
|
||||
/* "loc" is at column 0, which means "the whole line".
|
||||
Render the locations *within* the line, by underlining
|
||||
it, showing the source_location numeric values
|
||||
it, showing the location_t numeric values
|
||||
at each column. */
|
||||
size_t max_col = (1 << map->m_column_and_range_bits) - 1;
|
||||
if (max_col > line_text.length ())
|
||||
|
@ -1128,12 +1128,12 @@ dump_location_info (FILE *stream)
|
|||
/* Visualize the macro line_map instances, rendering the sources. */
|
||||
for (unsigned int i = 0; i < LINEMAPS_MACRO_USED (line_table); i++)
|
||||
{
|
||||
/* Each macro map that is allocated owns source_location values
|
||||
/* Each macro map that is allocated owns location_t values
|
||||
that are *lower* that the one before them.
|
||||
Hence it's meaningful to view them either in order of ascending
|
||||
source locations, or in order of ascending macro map index. */
|
||||
const bool ascending_source_locations = true;
|
||||
unsigned int idx = (ascending_source_locations
|
||||
const bool ascending_location_ts = true;
|
||||
unsigned int idx = (ascending_location_ts
|
||||
? (LINEMAPS_MACRO_USED (line_table) - (i + 1))
|
||||
: i);
|
||||
const line_map_macro *map = LINEMAPS_MACRO_MAP_AT (line_table, idx);
|
||||
|
@ -1154,8 +1154,8 @@ dump_location_info (FILE *stream)
|
|||
fprintf (stream, " macro_locations:\n");
|
||||
for (unsigned int i = 0; i < MACRO_MAP_NUM_MACRO_TOKENS (map); i++)
|
||||
{
|
||||
source_location x = MACRO_MAP_LOCATIONS (map)[2 * i];
|
||||
source_location y = MACRO_MAP_LOCATIONS (map)[(2 * i) + 1];
|
||||
location_t x = MACRO_MAP_LOCATIONS (map)[2 * i];
|
||||
location_t y = MACRO_MAP_LOCATIONS (map)[(2 * i) + 1];
|
||||
|
||||
/* linemap_add_macro_token encodes token numbers in an expansion
|
||||
by putting them after MAP_START_LOCATION. */
|
||||
|
@ -1166,7 +1166,7 @@ dump_location_info (FILE *stream)
|
|||
adding 2 extra args for padding tokens; presumably there may
|
||||
be a leading and/or trailing padding token injected,
|
||||
each for 2 more location slots.
|
||||
This would explain there being up to 4 source_locations slots
|
||||
This would explain there being up to 4 location_ts slots
|
||||
that may be uninitialized. */
|
||||
|
||||
fprintf (stream, " %u: %u, %u\n",
|
||||
|
@ -1191,17 +1191,17 @@ dump_location_info (FILE *stream)
|
|||
fprintf (stream, "\n");
|
||||
}
|
||||
|
||||
/* It appears that MAX_SOURCE_LOCATION itself is never assigned to a
|
||||
/* It appears that MAX_LOCATION_T itself is never assigned to a
|
||||
macro map, presumably due to an off-by-one error somewhere
|
||||
between the logic in linemap_enter_macro and
|
||||
LINEMAPS_MACRO_LOWEST_LOCATION. */
|
||||
dump_labelled_location_range (stream, "MAX_SOURCE_LOCATION",
|
||||
MAX_SOURCE_LOCATION,
|
||||
MAX_SOURCE_LOCATION + 1);
|
||||
dump_labelled_location_range (stream, "MAX_LOCATION_T",
|
||||
MAX_LOCATION_T,
|
||||
MAX_LOCATION_T + 1);
|
||||
|
||||
/* Visualize ad-hoc values. */
|
||||
dump_labelled_location_range (stream, "AD-HOC LOCATIONS",
|
||||
MAX_SOURCE_LOCATION + 1, UINT_MAX);
|
||||
MAX_LOCATION_T + 1, UINT_MAX);
|
||||
}
|
||||
|
||||
/* string_concat's constructor. */
|
||||
|
@ -1473,12 +1473,12 @@ get_substring_ranges_for_loc (cpp_reader *pfile,
|
|||
than for end-users. */
|
||||
|
||||
const char *
|
||||
get_source_location_for_substring (cpp_reader *pfile,
|
||||
string_concat_db *concats,
|
||||
location_t strloc,
|
||||
enum cpp_ttype type,
|
||||
int caret_idx, int start_idx, int end_idx,
|
||||
source_location *out_loc)
|
||||
get_location_within_string (cpp_reader *pfile,
|
||||
string_concat_db *concats,
|
||||
location_t strloc,
|
||||
enum cpp_ttype type,
|
||||
int caret_idx, int start_idx, int end_idx,
|
||||
location_t *out_loc)
|
||||
{
|
||||
gcc_checking_assert (caret_idx >= 0);
|
||||
gcc_checking_assert (start_idx >= 0);
|
||||
|
@ -1638,7 +1638,7 @@ assert_loceq (const char *exp_filename, int exp_linenum, int exp_colnum,
|
|||
- line_table->default_range_bits: some frontends use a non-zero value
|
||||
and others use zero
|
||||
- the fallback modes within line-map.c: there are various threshold
|
||||
values for source_location/location_t beyond line-map.c changes
|
||||
values for location_t beyond line-map.c changes
|
||||
behavior (disabling of the range-packing optimization, disabling
|
||||
of column-tracking). We can exercise these by starting the line_table
|
||||
at interesting values at or near these thresholds.
|
||||
|
|
18
gcc/input.h
18
gcc/input.h
|
@ -27,17 +27,17 @@ extern GTY(()) struct line_maps *line_table;
|
|||
extern GTY(()) struct line_maps *saved_line_table;
|
||||
|
||||
/* A value which will never be used to represent a real location. */
|
||||
#define UNKNOWN_LOCATION ((source_location) 0)
|
||||
#define UNKNOWN_LOCATION ((location_t) 0)
|
||||
|
||||
/* The location for declarations in "<built-in>" */
|
||||
#define BUILTINS_LOCATION ((source_location) 1)
|
||||
#define BUILTINS_LOCATION ((location_t) 1)
|
||||
|
||||
/* line-map.c reserves RESERVED_LOCATION_COUNT to the user. Ensure
|
||||
both UNKNOWN_LOCATION and BUILTINS_LOCATION fit into that. */
|
||||
STATIC_ASSERT (BUILTINS_LOCATION < RESERVED_LOCATION_COUNT);
|
||||
|
||||
extern bool is_location_from_builtin_token (source_location);
|
||||
extern expanded_location expand_location (source_location);
|
||||
extern bool is_location_from_builtin_token (location_t);
|
||||
extern expanded_location expand_location (location_t);
|
||||
|
||||
/* A class capturing the bounds of a buffer, to allow for run-time
|
||||
bounds-checking in a checked build. */
|
||||
|
@ -86,15 +86,11 @@ extern char_span location_get_source_line (const char *file_path, int line);
|
|||
|
||||
extern bool location_missing_trailing_newline (const char *file_path);
|
||||
extern expanded_location
|
||||
expand_location_to_spelling_point (source_location,
|
||||
expand_location_to_spelling_point (location_t,
|
||||
enum location_aspect aspect
|
||||
= LOCATION_ASPECT_CARET);
|
||||
extern source_location expansion_point_location_if_in_system_header (source_location);
|
||||
extern source_location expansion_point_location (source_location);
|
||||
|
||||
/* Historically GCC used location_t, while cpp used source_location.
|
||||
This could be removed but it hardly seems worth the effort. */
|
||||
typedef source_location location_t;
|
||||
extern location_t expansion_point_location_if_in_system_header (location_t);
|
||||
extern location_t expansion_point_location (location_t);
|
||||
|
||||
extern location_t input_location;
|
||||
|
||||
|
|
|
@ -1,3 +1,7 @@
|
|||
2018-11-13 David Malcolm <dmalcolm@redhat.com>
|
||||
|
||||
* jit-playback.c: Replace "source_location" with "location_t".
|
||||
|
||||
2018-10-17 David Malcolm <dmalcolm@redhat.com>
|
||||
|
||||
* Make-lang.in (selftest-jit): New.
|
||||
|
|
|
@ -2827,7 +2827,7 @@ handle_locations ()
|
|||
FOR_EACH_VEC_ELT (m_cached_locations, i, cached_location)
|
||||
{
|
||||
tree t = cached_location->first;
|
||||
source_location srcloc = cached_location->second->m_srcloc;
|
||||
location_t srcloc = cached_location->second->m_srcloc;
|
||||
|
||||
/* This covers expressions: */
|
||||
if (CAN_HAVE_LOCATION_P (t))
|
||||
|
@ -2927,7 +2927,7 @@ new_location (recording::location *rloc,
|
|||
/* Deferred setting of the location for a given tree, by adding the
|
||||
(tree, playback::location) pair to a list of deferred associations.
|
||||
We will actually set the location on the tree later on once
|
||||
the source_location for the playback::location exists. */
|
||||
the location_t for the playback::location exists. */
|
||||
|
||||
void
|
||||
playback::context::
|
||||
|
|
|
@ -686,7 +686,7 @@ public:
|
|||
|
||||
recording::location *get_recording_loc () const { return m_recording_loc; }
|
||||
|
||||
source_location m_srcloc;
|
||||
location_t m_srcloc;
|
||||
|
||||
private:
|
||||
recording::location *m_recording_loc;
|
||||
|
|
|
@ -3333,7 +3333,7 @@ expand_omp_for_generic (struct omp_region *region,
|
|||
gphi_iterator psi;
|
||||
for (psi = gsi_start_phis (l3_bb); !gsi_end_p (psi); gsi_next (&psi))
|
||||
{
|
||||
source_location locus;
|
||||
location_t locus;
|
||||
gphi *nphi;
|
||||
gphi *exit_phi = psi.phi ();
|
||||
|
||||
|
@ -4476,7 +4476,7 @@ expand_omp_for_static_chunk (struct omp_region *region,
|
|||
gsi_next (&psi), ++i)
|
||||
{
|
||||
gphi *nphi;
|
||||
source_location locus;
|
||||
location_t locus;
|
||||
|
||||
phi = psi.phi ();
|
||||
if (operand_equal_p (gimple_phi_arg_def (phi, 0),
|
||||
|
|
|
@ -141,7 +141,7 @@ class auto_fix_quotes
|
|||
- line_table->default_range_bits: some frontends use a non-zero value
|
||||
and others use zero
|
||||
- the fallback modes within line-map.c: there are various threshold
|
||||
values for source_location/location_t beyond line-map.c changes
|
||||
values for location_t beyond line-map.c changes
|
||||
behavior (disabling of the range-packing optimization, disabling
|
||||
of column-tracking). We can exercise these by starting the line_table
|
||||
at interesting values at or near these thresholds.
|
||||
|
|
|
@ -115,12 +115,12 @@ class format_string_diagnostic_t
|
|||
/* Implementation detail, for use when implementing
|
||||
LANG_HOOKS_GET_SUBSTRING_LOCATION. */
|
||||
|
||||
extern const char *get_source_location_for_substring (cpp_reader *pfile,
|
||||
string_concat_db *concats,
|
||||
location_t strloc,
|
||||
enum cpp_ttype type,
|
||||
int caret_idx,
|
||||
int start_idx, int end_idx,
|
||||
location_t *out_loc);
|
||||
extern const char *get_location_within_string (cpp_reader *pfile,
|
||||
string_concat_db *concats,
|
||||
location_t strloc,
|
||||
enum cpp_ttype type,
|
||||
int caret_idx,
|
||||
int start_idx, int end_idx,
|
||||
location_t *out_loc);
|
||||
|
||||
#endif /* ! GCC_SUBSTRING_LOCATIONS_H */
|
||||
|
|
|
@ -1,3 +1,9 @@
|
|||
2018-11-13 David Malcolm <dmalcolm@redhat.com>
|
||||
|
||||
* g++.dg/plugin/comment_plugin.c: Replace "source_location" with
|
||||
"location_t".
|
||||
* gcc.dg/plugin/diagnostic_plugin_test_show_locus.c: Likewise.
|
||||
|
||||
2018-11-13 Martin Sebor <msebor@redhat.com>
|
||||
|
||||
PR middle-end/81824
|
||||
|
|
|
@ -13,7 +13,7 @@ int plugin_is_GPL_compatible;
|
|||
/* Test callback for cpp_callbacks::comments. */
|
||||
|
||||
void
|
||||
my_comment_cb (cpp_reader *, source_location loc,
|
||||
my_comment_cb (cpp_reader *, location_t loc,
|
||||
const unsigned char *content, size_t len)
|
||||
{
|
||||
if (in_system_header_at (loc))
|
||||
|
|
|
@ -22,7 +22,7 @@
|
|||
hard-coded locations relative to the top of each function.
|
||||
|
||||
The plugin uses a function "get_loc" below to map from line/column
|
||||
numbers to source_location, and this relies on input_location being in
|
||||
numbers to location_t, and this relies on input_location being in
|
||||
the same ordinary line_map as the locations in question. The plugin
|
||||
runs after parsing, so input_location will be at the end of the file.
|
||||
|
||||
|
@ -90,7 +90,7 @@ public:
|
|||
|
||||
}; // class pass_test_show_locus
|
||||
|
||||
/* Given LINE_NUM and COL_NUM, generate a source_location in the
|
||||
/* Given LINE_NUM and COL_NUM, generate a location_t in the
|
||||
current file, relative to input_location. This relies on the
|
||||
location being expressible in the same ordinary line_map as
|
||||
input_location (which is typically at the end of the source file
|
||||
|
@ -100,7 +100,7 @@ public:
|
|||
|
||||
COL_NUM uses the Emacs convention of 0-based column numbers. */
|
||||
|
||||
static source_location
|
||||
static location_t
|
||||
get_loc (unsigned int line_num, unsigned int col_num)
|
||||
{
|
||||
/* Use input_location to get the relevant line_map */
|
||||
|
@ -109,7 +109,7 @@ get_loc (unsigned int line_num, unsigned int col_num)
|
|||
input_location));
|
||||
|
||||
/* Convert from 0-based column numbers to 1-based column numbers. */
|
||||
source_location loc
|
||||
location_t loc
|
||||
= linemap_position_for_line_and_column (line_table,
|
||||
line_map,
|
||||
line_num, col_num + 1);
|
||||
|
|
|
@ -9212,7 +9212,7 @@ public:
|
|||
unsigned int
|
||||
pass_warn_function_return::execute (function *fun)
|
||||
{
|
||||
source_location location;
|
||||
location_t location;
|
||||
gimple *last;
|
||||
edge e;
|
||||
edge_iterator ei;
|
||||
|
|
|
@ -529,7 +529,7 @@ remove_forwarder_block (basic_block bb)
|
|||
gsi_next (&psi))
|
||||
{
|
||||
gphi *phi = psi.phi ();
|
||||
source_location l = gimple_phi_arg_location_from_edge (phi, succ);
|
||||
location_t l = gimple_phi_arg_location_from_edge (phi, succ);
|
||||
tree def = gimple_phi_arg_def (phi, succ->dest_idx);
|
||||
add_phi_arg (phi, unshare_expr (def), s, l);
|
||||
}
|
||||
|
@ -1082,7 +1082,7 @@ remove_forwarder_block_with_phi (basic_block bb)
|
|||
{
|
||||
gphi *phi = gsi.phi ();
|
||||
tree def = gimple_phi_arg_def (phi, succ->dest_idx);
|
||||
source_location locus = gimple_phi_arg_location_from_edge (phi, succ);
|
||||
location_t locus = gimple_phi_arg_location_from_edge (phi, succ);
|
||||
|
||||
if (TREE_CODE (def) == SSA_NAME)
|
||||
{
|
||||
|
|
|
@ -56,7 +56,7 @@ default_tree_diagnostic_starter (diagnostic_context *context,
|
|||
struct loc_map_pair
|
||||
{
|
||||
const line_map_macro *map;
|
||||
source_location where;
|
||||
location_t where;
|
||||
};
|
||||
|
||||
|
||||
|
@ -99,7 +99,7 @@ struct loc_map_pair
|
|||
static void
|
||||
maybe_unwind_expanded_macro_loc (diagnostic_context *context,
|
||||
const diagnostic_info *diagnostic,
|
||||
source_location where)
|
||||
location_t where)
|
||||
{
|
||||
const struct line_map *map;
|
||||
auto_vec<loc_map_pair> loc_vec;
|
||||
|
@ -178,14 +178,14 @@ maybe_unwind_expanded_macro_loc (diagnostic_context *context,
|
|||
|
||||
/* Resolve the location iter->where into the locus 1/ of the
|
||||
comment above. */
|
||||
source_location resolved_def_loc =
|
||||
location_t resolved_def_loc =
|
||||
linemap_resolve_location (line_table, iter->where,
|
||||
LRK_MACRO_DEFINITION_LOCATION, NULL);
|
||||
|
||||
/* Don't print trace for locations that are reserved or from
|
||||
within a system header. */
|
||||
const line_map_ordinary *m = NULL;
|
||||
source_location l =
|
||||
location_t l =
|
||||
linemap_resolve_location (line_table, resolved_def_loc,
|
||||
LRK_SPELLING_LOCATION, &m);
|
||||
if (l < RESERVED_LOCATION_COUNT || LINEMAP_SYSP (m))
|
||||
|
@ -210,7 +210,7 @@ maybe_unwind_expanded_macro_loc (diagnostic_context *context,
|
|||
/* Resolve the location of the expansion point of the macro
|
||||
which expansion gave the token represented by def_loc.
|
||||
This is the locus 2/ of the earlier comment. */
|
||||
source_location resolved_exp_loc =
|
||||
location_t resolved_exp_loc =
|
||||
linemap_resolve_location (line_table,
|
||||
MACRO_MAP_EXPANSION_POINT_LOCATION (iter->map),
|
||||
LRK_MACRO_DEFINITION_LOCATION, NULL);
|
||||
|
|
|
@ -2119,7 +2119,7 @@ rewrite_update_phi_arguments (basic_block bb)
|
|||
/* Update the argument if there is a reaching def. */
|
||||
if (reaching_def)
|
||||
{
|
||||
source_location locus;
|
||||
location_t locus;
|
||||
int arg_i = PHI_ARG_INDEX_FROM_USE (arg_p);
|
||||
|
||||
SET_USE (arg_p, reaching_def);
|
||||
|
|
|
@ -143,7 +143,7 @@ struct elim_graph
|
|||
auto_vec<int> edge_list;
|
||||
|
||||
/* Source locus on each edge */
|
||||
auto_vec<source_location> edge_locus;
|
||||
auto_vec<location_t> edge_locus;
|
||||
|
||||
/* Visited vector. */
|
||||
auto_sbitmap visited;
|
||||
|
@ -162,7 +162,7 @@ struct elim_graph
|
|||
auto_vec<tree> const_copies;
|
||||
|
||||
/* Source locations for any constant copies. */
|
||||
auto_vec<source_location> copy_locus;
|
||||
auto_vec<location_t> copy_locus;
|
||||
};
|
||||
|
||||
|
||||
|
@ -238,7 +238,7 @@ emit_partition_copy (rtx dest, rtx src, int unsignedsrcp, tree sizeexp)
|
|||
/* Insert a copy instruction from partition SRC to DEST onto edge E. */
|
||||
|
||||
static void
|
||||
insert_partition_copy_on_edge (edge e, int dest, int src, source_location locus)
|
||||
insert_partition_copy_on_edge (edge e, int dest, int src, location_t locus)
|
||||
{
|
||||
tree var;
|
||||
if (dump_file && (dump_flags & TDF_DETAILS))
|
||||
|
@ -272,7 +272,7 @@ insert_partition_copy_on_edge (edge e, int dest, int src, source_location locus)
|
|||
onto edge E. */
|
||||
|
||||
static void
|
||||
insert_value_copy_on_edge (edge e, int dest, tree src, source_location locus)
|
||||
insert_value_copy_on_edge (edge e, int dest, tree src, location_t locus)
|
||||
{
|
||||
rtx dest_rtx, seq, x;
|
||||
machine_mode dest_mode, src_mode;
|
||||
|
@ -333,7 +333,7 @@ insert_value_copy_on_edge (edge e, int dest, tree src, source_location locus)
|
|||
|
||||
static void
|
||||
insert_rtx_to_part_on_edge (edge e, int dest, rtx src, int unsignedsrcp,
|
||||
source_location locus)
|
||||
location_t locus)
|
||||
{
|
||||
if (dump_file && (dump_flags & TDF_DETAILS))
|
||||
{
|
||||
|
@ -367,7 +367,7 @@ insert_rtx_to_part_on_edge (edge e, int dest, rtx src, int unsignedsrcp,
|
|||
onto edge E. */
|
||||
|
||||
static void
|
||||
insert_part_to_rtx_on_edge (edge e, rtx dest, int src, source_location locus)
|
||||
insert_part_to_rtx_on_edge (edge e, rtx dest, int src, location_t locus)
|
||||
{
|
||||
tree var;
|
||||
if (dump_file && (dump_flags & TDF_DETAILS))
|
||||
|
@ -444,7 +444,7 @@ elim_graph_add_node (elim_graph *g, int node)
|
|||
/* Add the edge PRED->SUCC to graph G. */
|
||||
|
||||
static inline void
|
||||
elim_graph_add_edge (elim_graph *g, int pred, int succ, source_location locus)
|
||||
elim_graph_add_edge (elim_graph *g, int pred, int succ, location_t locus)
|
||||
{
|
||||
g->edge_list.safe_push (pred);
|
||||
g->edge_list.safe_push (succ);
|
||||
|
@ -456,7 +456,7 @@ elim_graph_add_edge (elim_graph *g, int pred, int succ, source_location locus)
|
|||
return the successor node. -1 is returned if there is no such edge. */
|
||||
|
||||
static inline int
|
||||
elim_graph_remove_succ_edge (elim_graph *g, int node, source_location *locus)
|
||||
elim_graph_remove_succ_edge (elim_graph *g, int node, location_t *locus)
|
||||
{
|
||||
int y;
|
||||
unsigned x;
|
||||
|
@ -556,7 +556,7 @@ eliminate_build (elim_graph *g)
|
|||
for (gsi = gsi_start_phis (g->e->dest); !gsi_end_p (gsi); gsi_next (&gsi))
|
||||
{
|
||||
gphi *phi = gsi.phi ();
|
||||
source_location locus;
|
||||
location_t locus;
|
||||
|
||||
p0 = var_to_partition (g->map, gimple_phi_result (phi));
|
||||
/* Ignore results which are not in partitions. */
|
||||
|
@ -597,7 +597,7 @@ static void
|
|||
elim_forward (elim_graph *g, int T)
|
||||
{
|
||||
int S;
|
||||
source_location locus;
|
||||
location_t locus;
|
||||
|
||||
bitmap_set_bit (g->visited, T);
|
||||
FOR_EACH_ELIM_GRAPH_SUCC (g, T, S, locus,
|
||||
|
@ -615,7 +615,7 @@ static int
|
|||
elim_unvisited_predecessor (elim_graph *g, int T)
|
||||
{
|
||||
int P;
|
||||
source_location locus;
|
||||
location_t locus;
|
||||
|
||||
FOR_EACH_ELIM_GRAPH_PRED (g, T, P, locus,
|
||||
{
|
||||
|
@ -631,7 +631,7 @@ static void
|
|||
elim_backward (elim_graph *g, int T)
|
||||
{
|
||||
int P;
|
||||
source_location locus;
|
||||
location_t locus;
|
||||
|
||||
bitmap_set_bit (g->visited, T);
|
||||
FOR_EACH_ELIM_GRAPH_PRED (g, T, P, locus,
|
||||
|
@ -666,7 +666,7 @@ static void
|
|||
elim_create (elim_graph *g, int T)
|
||||
{
|
||||
int P, S;
|
||||
source_location locus;
|
||||
location_t locus;
|
||||
|
||||
if (elim_unvisited_predecessor (g, T))
|
||||
{
|
||||
|
@ -741,7 +741,7 @@ eliminate_phi (edge e, elim_graph *g)
|
|||
{
|
||||
int dest;
|
||||
tree src;
|
||||
source_location locus;
|
||||
location_t locus;
|
||||
|
||||
src = g->const_copies.pop ();
|
||||
dest = g->const_dests.pop ();
|
||||
|
|
|
@ -1041,7 +1041,7 @@ create_phi_for_local_result (reduction_info **slot, struct loop *loop)
|
|||
gphi *new_phi;
|
||||
basic_block store_bb, continue_bb;
|
||||
tree local_res;
|
||||
source_location locus;
|
||||
location_t locus;
|
||||
|
||||
/* STORE_BB is the block where the phi
|
||||
should be stored. It is the destination of the loop exit.
|
||||
|
@ -2131,7 +2131,7 @@ create_parallel_loop (struct loop *loop, tree loop_fn, tree data,
|
|||
for (gphi_iterator gpi = gsi_start_phis (ex_bb);
|
||||
!gsi_end_p (gpi); gsi_next (&gpi))
|
||||
{
|
||||
source_location locus;
|
||||
location_t locus;
|
||||
gphi *phi = gpi.phi ();
|
||||
tree def = PHI_ARG_DEF_FROM_EDGE (phi, exit);
|
||||
gimple *def_stmt = SSA_NAME_DEF_STMT (def);
|
||||
|
|
|
@ -351,7 +351,7 @@ create_phi_node (tree var, basic_block bb)
|
|||
PHI points to the reallocated phi node when we return. */
|
||||
|
||||
void
|
||||
add_phi_arg (gphi *phi, tree def, edge e, source_location locus)
|
||||
add_phi_arg (gphi *phi, tree def, edge e, location_t locus)
|
||||
{
|
||||
basic_block bb = e->dest;
|
||||
|
||||
|
|
|
@ -24,7 +24,7 @@ extern void phinodes_print_statistics (void);
|
|||
extern void reserve_phi_args_for_new_edge (basic_block);
|
||||
extern void add_phi_node_to_bb (gphi *phi, basic_block bb);
|
||||
extern gphi *create_phi_node (tree, basic_block);
|
||||
extern void add_phi_arg (gphi *, tree, edge, source_location);
|
||||
extern void add_phi_arg (gphi *, tree, edge, location_t);
|
||||
extern void remove_phi_args (edge);
|
||||
extern void remove_phi_node (gimple_stmt_iterator *, bool);
|
||||
extern void remove_phi_nodes (basic_block);
|
||||
|
|
|
@ -543,7 +543,7 @@ struct ivopts_data
|
|||
{
|
||||
/* The currently optimized loop. */
|
||||
struct loop *current_loop;
|
||||
source_location loop_loc;
|
||||
location_t loop_loc;
|
||||
|
||||
/* Numbers of iterations for all exits of the current loop. */
|
||||
hash_map<edge, tree_niter_desc *> *niters;
|
||||
|
|
|
@ -786,7 +786,7 @@ split_loop_exit_edge (edge exit, bool copy_constants_p)
|
|||
tree new_name, name;
|
||||
use_operand_p op_p;
|
||||
gphi_iterator psi;
|
||||
source_location locus;
|
||||
location_t locus;
|
||||
|
||||
for (psi = gsi_start_phis (dest); !gsi_end_p (psi); gsi_next (&psi))
|
||||
{
|
||||
|
|
|
@ -423,7 +423,7 @@ factor_out_conditional_conversion (edge e0, edge e1, gphi *phi,
|
|||
tree temp, result;
|
||||
gphi *newphi;
|
||||
gimple_stmt_iterator gsi, gsi_for_def;
|
||||
source_location locus = gimple_location (phi);
|
||||
location_t locus = gimple_location (phi);
|
||||
enum tree_code convert_code;
|
||||
|
||||
/* Handle only PHI statements with two arguments. TODO: If all
|
||||
|
@ -669,7 +669,7 @@ conditional_replacement (basic_block cond_bb, basic_block middle_bb,
|
|||
|
||||
if (!useless_type_conversion_p (TREE_TYPE (result), TREE_TYPE (new_var)))
|
||||
{
|
||||
source_location locus_0, locus_1;
|
||||
location_t locus_0, locus_1;
|
||||
|
||||
new_var2 = make_ssa_name (TREE_TYPE (result));
|
||||
new_stmt = gimple_build_assign (new_var2, CONVERT_EXPR, new_var);
|
||||
|
@ -2049,7 +2049,7 @@ cond_store_replacement (basic_block middle_bb, basic_block join_bb,
|
|||
gphi *newphi;
|
||||
gassign *new_stmt;
|
||||
gimple_stmt_iterator gsi;
|
||||
source_location locus;
|
||||
location_t locus;
|
||||
|
||||
/* Check if middle_bb contains of only one store. */
|
||||
if (!assign
|
||||
|
@ -2133,7 +2133,7 @@ cond_if_else_store_replacement_1 (basic_block then_bb, basic_block else_bb,
|
|||
gimple *else_assign)
|
||||
{
|
||||
tree lhs_base, lhs, then_rhs, else_rhs, name;
|
||||
source_location then_locus, else_locus;
|
||||
location_t then_locus, else_locus;
|
||||
gimple_stmt_iterator gsi;
|
||||
gphi *newphi;
|
||||
gassign *new_stmt;
|
||||
|
|
|
@ -159,7 +159,7 @@ phiprop_insert_phi (basic_block bb, gphi *phi, gimple *use_stmt,
|
|||
{
|
||||
tree old_arg, new_var;
|
||||
gassign *tmp;
|
||||
source_location locus;
|
||||
location_t locus;
|
||||
|
||||
old_arg = PHI_ARG_DEF_FROM_EDGE (phi, e);
|
||||
locus = gimple_phi_arg_location_from_edge (phi, e);
|
||||
|
|
|
@ -431,7 +431,7 @@ copy_phi_arg_into_existing_phi (edge src_e, edge tgt_e)
|
|||
gphi *src_phi = gsi.phi ();
|
||||
gphi *dest_phi = gsi2.phi ();
|
||||
tree val = gimple_phi_arg_def (src_phi, src_idx);
|
||||
source_location locus = gimple_phi_arg_location (src_phi, src_idx);
|
||||
location_t locus = gimple_phi_arg_location (src_phi, src_idx);
|
||||
|
||||
SET_PHI_ARG_DEF (dest_phi, tgt_idx, val);
|
||||
gimple_phi_arg_set_location (dest_phi, tgt_idx, locus);
|
||||
|
@ -445,7 +445,7 @@ copy_phi_arg_into_existing_phi (edge src_e, edge tgt_e)
|
|||
|
||||
static tree
|
||||
get_value_locus_in_path (tree def, vec<jump_thread_edge *> *path,
|
||||
basic_block bb, int idx, source_location *locus)
|
||||
basic_block bb, int idx, location_t *locus)
|
||||
{
|
||||
tree arg;
|
||||
gphi *def_phi;
|
||||
|
@ -499,7 +499,7 @@ copy_phi_args (basic_block bb, edge src_e, edge tgt_e,
|
|||
{
|
||||
gphi *phi = gsi.phi ();
|
||||
tree def = gimple_phi_arg_def (phi, src_indx);
|
||||
source_location locus = gimple_phi_arg_location (phi, src_indx);
|
||||
location_t locus = gimple_phi_arg_location (phi, src_indx);
|
||||
|
||||
if (TREE_CODE (def) == SSA_NAME
|
||||
&& !virtual_operand_p (gimple_phi_result (phi)))
|
||||
|
|
|
@ -52,7 +52,7 @@ static hash_map<edge, auto_vec<edge_var_map> > *edge_var_maps;
|
|||
/* Add a mapping with PHI RESULT and PHI DEF associated with edge E. */
|
||||
|
||||
void
|
||||
redirect_edge_var_map_add (edge e, tree result, tree def, source_location locus)
|
||||
redirect_edge_var_map_add (edge e, tree result, tree def, location_t locus)
|
||||
{
|
||||
edge_var_map new_node;
|
||||
|
||||
|
@ -151,7 +151,7 @@ ssa_redirect_edge (edge e, basic_block dest)
|
|||
for (gsi = gsi_start_phis (e->dest); !gsi_end_p (gsi); gsi_next (&gsi))
|
||||
{
|
||||
tree def;
|
||||
source_location locus ;
|
||||
location_t locus;
|
||||
|
||||
phi = gsi.phi ();
|
||||
def = gimple_phi_arg_def (phi, e->dest_idx);
|
||||
|
|
|
@ -24,14 +24,14 @@ along with GCC; see the file COPYING3. If not see
|
|||
struct edge_var_map {
|
||||
tree result; /* PHI result. */
|
||||
tree def; /* PHI arg definition. */
|
||||
source_location locus; /* PHI arg location. */
|
||||
location_t locus; /* PHI arg location. */
|
||||
};
|
||||
|
||||
/* A vector of var maps. */
|
||||
typedef vec<edge_var_map, va_heap, vl_embed> edge_var_map_vector;
|
||||
|
||||
|
||||
extern void redirect_edge_var_map_add (edge, tree, tree, source_location);
|
||||
extern void redirect_edge_var_map_add (edge, tree, tree, location_t);
|
||||
extern void redirect_edge_var_map_clear (edge);
|
||||
extern void redirect_edge_var_map_dup (edge, edge);
|
||||
extern vec<edge_var_map> *redirect_edge_var_map_vector (edge);
|
||||
|
@ -74,7 +74,7 @@ redirect_edge_var_map_result (edge_var_map *v)
|
|||
|
||||
/* Given an edge_var_map V, return the PHI arg location. */
|
||||
|
||||
static inline source_location
|
||||
static inline location_t
|
||||
redirect_edge_var_map_location (edge_var_map *v)
|
||||
{
|
||||
return v->locus;
|
||||
|
|
|
@ -2172,7 +2172,7 @@ slpeel_update_phi_nodes_for_guard1 (struct loop *skip_loop,
|
|||
struct loop *update_loop,
|
||||
edge guard_edge, edge merge_edge)
|
||||
{
|
||||
source_location merge_loc, guard_loc;
|
||||
location_t merge_loc, guard_loc;
|
||||
edge orig_e = loop_preheader_edge (skip_loop);
|
||||
edge update_e = loop_preheader_edge (update_loop);
|
||||
gphi_iterator gsi_orig, gsi_update;
|
||||
|
|
|
@ -1,3 +1,10 @@
|
|||
2018-11-13 David Malcolm <dmalcolm@redhat.com>
|
||||
|
||||
* libcc1plugin.cc: Replace "source_location" with "location_t".
|
||||
(plugin_context::get_source_location): Rename to...
|
||||
(plugin_context::get_location_t): ...this.
|
||||
* libcp1plugin.cc: Likewise.
|
||||
|
||||
2018-10-31 Joseph Myers <joseph@codesourcery.com>
|
||||
|
||||
PR bootstrap/82856
|
||||
|
|
|
@ -187,15 +187,15 @@ struct plugin_context : public cc1_plugin::connection
|
|||
return t;
|
||||
}
|
||||
|
||||
source_location get_source_location (const char *filename,
|
||||
unsigned int line_number)
|
||||
location_t get_location_t (const char *filename,
|
||||
unsigned int line_number)
|
||||
{
|
||||
if (filename == NULL)
|
||||
return UNKNOWN_LOCATION;
|
||||
|
||||
filename = intern_filename (filename);
|
||||
linemap_add (line_table, LC_ENTER, false, filename, line_number);
|
||||
source_location loc = linemap_line_start (line_table, line_number, 0);
|
||||
location_t loc = linemap_line_start (line_table, line_number, 0);
|
||||
linemap_add (line_table, LC_LEAVE, false, NULL, 0);
|
||||
return loc;
|
||||
}
|
||||
|
@ -397,7 +397,7 @@ plugin_build_decl (cc1_plugin::connection *self,
|
|||
abort ();
|
||||
}
|
||||
|
||||
source_location loc = ctx->get_source_location (filename, line_number);
|
||||
location_t loc = ctx->get_location_t (filename, line_number);
|
||||
|
||||
decl = build_decl (loc, code, identifier, sym_type);
|
||||
TREE_USED (decl) = 1;
|
||||
|
@ -448,7 +448,7 @@ plugin_tagbind (cc1_plugin::connection *self,
|
|||
{
|
||||
plugin_context *ctx = static_cast<plugin_context *> (self);
|
||||
tree t = convert_in (tagged_type), x;
|
||||
c_pushtag (ctx->get_source_location (filename, line_number),
|
||||
c_pushtag (ctx->get_location_t (filename, line_number),
|
||||
get_identifier (name), t);
|
||||
|
||||
/* Propagate the newly-added type name so that previously-created
|
||||
|
@ -884,7 +884,7 @@ plugin_build_constant (cc1_plugin::connection *self, gcc_type type_in,
|
|||
tree type = convert_in (type_in);
|
||||
|
||||
cst = build_int_cst (type, value);
|
||||
decl = build_decl (ctx->get_source_location (filename, line_number),
|
||||
decl = build_decl (ctx->get_location_t (filename, line_number),
|
||||
CONST_DECL, get_identifier (name), type);
|
||||
DECL_INITIAL (decl) = cst;
|
||||
pushdecl_safe (decl);
|
||||
|
|
|
@ -178,15 +178,15 @@ struct plugin_context : public cc1_plugin::connection
|
|||
return t;
|
||||
}
|
||||
|
||||
source_location get_source_location (const char *filename,
|
||||
unsigned int line_number)
|
||||
location_t get_location_t (const char *filename,
|
||||
unsigned int line_number)
|
||||
{
|
||||
if (filename == NULL)
|
||||
return UNKNOWN_LOCATION;
|
||||
|
||||
filename = intern_filename (filename);
|
||||
linemap_add (line_table, LC_ENTER, false, filename, line_number);
|
||||
source_location loc = linemap_line_start (line_table, line_number, 0);
|
||||
location_t loc = linemap_line_start (line_table, line_number, 0);
|
||||
linemap_add (line_table, LC_LEAVE, false, NULL, 0);
|
||||
return loc;
|
||||
}
|
||||
|
@ -1028,7 +1028,7 @@ plugin_add_using_decl (cc1_plugin::connection *,
|
|||
static tree
|
||||
build_named_class_type (enum tree_code code,
|
||||
tree id,
|
||||
source_location loc)
|
||||
location_t loc)
|
||||
{
|
||||
/* See at_fake_function_scope_p. */
|
||||
gcc_assert (!at_function_scope_p ());
|
||||
|
@ -1114,7 +1114,7 @@ plugin_build_decl (cc1_plugin::connection *self,
|
|||
gcc_assert (!substitution_name);
|
||||
}
|
||||
|
||||
source_location loc = ctx->get_source_location (filename, line_number);
|
||||
location_t loc = ctx->get_location_t (filename, line_number);
|
||||
bool class_member_p = at_class_scope_p ();
|
||||
bool ctor = false, dtor = false, assop = false;
|
||||
tree_code opcode = ERROR_MARK;
|
||||
|
@ -1742,7 +1742,7 @@ plugin_start_class_type (cc1_plugin::connection *self,
|
|||
unsigned int line_number)
|
||||
{
|
||||
plugin_context *ctx = static_cast<plugin_context *> (self);
|
||||
source_location loc = ctx->get_source_location (filename, line_number);
|
||||
location_t loc = ctx->get_location_t (filename, line_number);
|
||||
tree typedecl = convert_in (typedecl_in);
|
||||
tree type = TREE_TYPE (typedecl);
|
||||
|
||||
|
@ -1802,8 +1802,8 @@ plugin_start_closure_class_type (cc1_plugin::connection *self,
|
|||
|
||||
tree lambda_expr = build_lambda_expr ();
|
||||
|
||||
LAMBDA_EXPR_LOCATION (lambda_expr) = ctx->get_source_location (filename,
|
||||
line_number);
|
||||
LAMBDA_EXPR_LOCATION (lambda_expr) = ctx->get_location_t (filename,
|
||||
line_number);
|
||||
|
||||
tree type = begin_lambda_type (lambda_expr);
|
||||
|
||||
|
@ -1936,7 +1936,7 @@ plugin_start_enum_type (cc1_plugin::connection *self,
|
|||
|
||||
gcc_assert (is_new_type);
|
||||
|
||||
source_location loc = ctx->get_source_location (filename, line_number);
|
||||
location_t loc = ctx->get_location_t (filename, line_number);
|
||||
tree type_decl = TYPE_NAME (type);
|
||||
DECL_SOURCE_LOCATION (type_decl) = loc;
|
||||
SET_OPAQUE_ENUM_P (type, false);
|
||||
|
@ -2244,7 +2244,7 @@ plugin_build_type_template_parameter (cc1_plugin::connection *self,
|
|||
unsigned int line_number)
|
||||
{
|
||||
plugin_context *ctx = static_cast<plugin_context *> (self);
|
||||
source_location loc = ctx->get_source_location (filename, line_number);
|
||||
location_t loc = ctx->get_location_t (filename, line_number);
|
||||
|
||||
gcc_assert (template_parm_scope_p ());
|
||||
|
||||
|
@ -2274,7 +2274,7 @@ plugin_build_template_template_parameter (cc1_plugin::connection *self,
|
|||
unsigned int line_number)
|
||||
{
|
||||
plugin_context *ctx = static_cast<plugin_context *> (self);
|
||||
source_location loc = ctx->get_source_location (filename, line_number);
|
||||
location_t loc = ctx->get_location_t (filename, line_number);
|
||||
|
||||
gcc_assert (template_parm_scope_p ());
|
||||
|
||||
|
@ -2309,7 +2309,7 @@ plugin_build_value_template_parameter (cc1_plugin::connection *self,
|
|||
unsigned int line_number)
|
||||
{
|
||||
plugin_context *ctx = static_cast<plugin_context *> (self);
|
||||
source_location loc = ctx->get_source_location (filename, line_number);
|
||||
location_t loc = ctx->get_location_t (filename, line_number);
|
||||
|
||||
gcc_assert (template_parm_scope_p ());
|
||||
|
||||
|
@ -3354,7 +3354,7 @@ plugin_build_function_template_specialization (cc1_plugin::connection *self,
|
|||
unsigned int line_number)
|
||||
{
|
||||
plugin_context *ctx = static_cast<plugin_context *> (self);
|
||||
source_location loc = ctx->get_source_location (filename, line_number);
|
||||
location_t loc = ctx->get_location_t (filename, line_number);
|
||||
tree name = convert_in (template_decl);
|
||||
tree targsl = targlist (targs);
|
||||
|
||||
|
@ -3374,7 +3374,7 @@ plugin_build_class_template_specialization (cc1_plugin::connection *self,
|
|||
unsigned int line_number)
|
||||
{
|
||||
plugin_context *ctx = static_cast<plugin_context *> (self);
|
||||
source_location loc = ctx->get_source_location (filename, line_number);
|
||||
location_t loc = ctx->get_location_t (filename, line_number);
|
||||
tree name = convert_in (template_decl);
|
||||
|
||||
tree tdecl = finish_template_type (name, targlist (args), false);;
|
||||
|
@ -3601,7 +3601,7 @@ plugin_build_constant (cc1_plugin::connection *self, gcc_type type_in,
|
|||
cst = build_int_cst (type, value);
|
||||
if (!TYPE_READONLY (type))
|
||||
type = build_qualified_type (type, TYPE_QUAL_CONST);
|
||||
decl = build_decl (ctx->get_source_location (filename, line_number),
|
||||
decl = build_decl (ctx->get_location_t (filename, line_number),
|
||||
VAR_DECL, get_identifier (name), type);
|
||||
TREE_STATIC (decl) = 1;
|
||||
TREE_READONLY (decl) = 1;
|
||||
|
@ -3637,7 +3637,7 @@ plugin_add_static_assert (cc1_plugin::connection *self,
|
|||
TREE_TYPE (message) = char_array_type_node;
|
||||
fix_string_type (message);
|
||||
|
||||
source_location loc = ctx->get_source_location (filename, line_number);
|
||||
location_t loc = ctx->get_location_t (filename, line_number);
|
||||
|
||||
bool member_p = at_class_scope_p ();
|
||||
|
||||
|
|
|
@ -1,3 +1,23 @@
|
|||
2018-11-13 David Malcolm <dmalcolm@redhat.com>
|
||||
|
||||
* charset.c: Replace "source_location" with "location_t".
|
||||
* directives-only.c: Likewise.
|
||||
* directives.c: Likewise.
|
||||
* errors.c: Likewise.
|
||||
* expr.c: Likewise.
|
||||
* files.c: Likewise.
|
||||
* include/cpplib.h: Likewise. Rename MAX_SOURCE_LOCATION to
|
||||
MAX_LOCATION_T.
|
||||
* include/line-map.h: Likewise.
|
||||
* init.c: Likewise.
|
||||
* internal.h: Likewise.
|
||||
* lex.c: Likewise.
|
||||
* line-map.c: Likewise.
|
||||
* location-example.txt: Likewise.
|
||||
* macro.c: Likewise.
|
||||
* pch.c: Likewise.
|
||||
* traditional.c: Likewise.
|
||||
|
||||
2018-11-07 Hafiz Abid Qadeer <abidh@codesourcery.com>
|
||||
|
||||
* configure: Regenerated.
|
||||
|
|
|
@ -2135,7 +2135,7 @@ _cpp_default_encoding (void)
|
|||
/* Constructor for cpp_string_location_reader. */
|
||||
|
||||
cpp_string_location_reader::
|
||||
cpp_string_location_reader (source_location src_loc,
|
||||
cpp_string_location_reader (location_t src_loc,
|
||||
line_maps *line_table)
|
||||
: m_line_table (line_table)
|
||||
{
|
||||
|
|
|
@ -43,7 +43,7 @@ _cpp_preprocess_dir_only (cpp_reader *pfile,
|
|||
unsigned flags;
|
||||
linenum_type lines;
|
||||
int col;
|
||||
source_location loc;
|
||||
location_t loc;
|
||||
|
||||
restart:
|
||||
/* Buffer initialization ala _cpp_clean_line(). */
|
||||
|
|
|
@ -30,7 +30,7 @@ along with this program; see the file COPYING3. If not see
|
|||
struct if_stack
|
||||
{
|
||||
struct if_stack *next;
|
||||
source_location line; /* Line where condition started. */
|
||||
location_t line; /* Line where condition started. */
|
||||
const cpp_hashnode *mi_cmacro;/* macro name for #ifndef around entire file */
|
||||
bool skip_elses; /* Can future #else / #elif be skipped? */
|
||||
bool was_skipping; /* If were skipping on entry. */
|
||||
|
@ -98,7 +98,7 @@ static void directive_diagnostics (cpp_reader *, const directive *, int);
|
|||
static void run_directive (cpp_reader *, int, const char *, size_t);
|
||||
static char *glue_header_name (cpp_reader *);
|
||||
static const char *parse_include (cpp_reader *, int *, const cpp_token ***,
|
||||
source_location *);
|
||||
location_t *);
|
||||
static void push_conditional (cpp_reader *, int, int, const cpp_hashnode *);
|
||||
static unsigned int read_flag (cpp_reader *, unsigned int);
|
||||
static bool strtolinenum (const uchar *, size_t, linenum_type *, bool *);
|
||||
|
@ -124,8 +124,8 @@ static void do_linemarker (cpp_reader *);
|
|||
static const cpp_token *get_token_no_padding (cpp_reader *);
|
||||
static const cpp_token *get__Pragma_string (cpp_reader *);
|
||||
static void destringize_and_run (cpp_reader *, const cpp_string *,
|
||||
source_location);
|
||||
static bool parse_answer (cpp_reader *, int, source_location, cpp_macro **);
|
||||
location_t);
|
||||
static bool parse_answer (cpp_reader *, int, location_t, cpp_macro **);
|
||||
static cpp_hashnode *parse_assertion (cpp_reader *, int, cpp_macro **);
|
||||
static cpp_macro **find_answer (cpp_hashnode *, const cpp_macro *);
|
||||
static void handle_assertion (cpp_reader *, const char *, int);
|
||||
|
@ -756,7 +756,7 @@ glue_header_name (cpp_reader *pfile)
|
|||
|
||||
static const char *
|
||||
parse_include (cpp_reader *pfile, int *pangle_brackets,
|
||||
const cpp_token ***buf, source_location *location)
|
||||
const cpp_token ***buf, location_t *location)
|
||||
{
|
||||
char *fname;
|
||||
const cpp_token *header;
|
||||
|
@ -814,7 +814,7 @@ do_include_common (cpp_reader *pfile, enum include_type type)
|
|||
const char *fname;
|
||||
int angle_brackets;
|
||||
const cpp_token **buf = NULL;
|
||||
source_location location;
|
||||
location_t location;
|
||||
|
||||
/* Re-enable saving of comments if requested, so that the include
|
||||
callback can dump comments which follow #include. */
|
||||
|
@ -1093,7 +1093,7 @@ do_linemarker (cpp_reader *pfile)
|
|||
}
|
||||
/* Compensate for the increment in linemap_add that occurs in
|
||||
_cpp_do_file_change. We're currently at the start of the line
|
||||
*following* the #line directive. A separate source_location for this
|
||||
*following* the #line directive. A separate location_t for this
|
||||
location makes no sense (until we do the LC_LEAVE), and
|
||||
complicates LAST_SOURCE_LINE_LOCATION. */
|
||||
pfile->line_table->highest_location--;
|
||||
|
@ -1135,7 +1135,7 @@ do_diagnostic (cpp_reader *pfile, enum cpp_diagnostic_level code,
|
|||
{
|
||||
const unsigned char *dir_name;
|
||||
unsigned char *line;
|
||||
source_location src_loc = pfile->cur_token[-1].src_loc;
|
||||
location_t src_loc = pfile->cur_token[-1].src_loc;
|
||||
|
||||
if (print_dir)
|
||||
dir_name = pfile->directive->name;
|
||||
|
@ -1432,7 +1432,7 @@ do_pragma (cpp_reader *pfile)
|
|||
{
|
||||
const struct pragma_entry *p = NULL;
|
||||
const cpp_token *token, *pragma_token;
|
||||
source_location pragma_token_virt_loc = 0;
|
||||
location_t pragma_token_virt_loc = 0;
|
||||
cpp_token ns_token;
|
||||
unsigned int count = 1;
|
||||
|
||||
|
@ -1538,7 +1538,7 @@ do_pragma_push_macro (cpp_reader *pfile)
|
|||
txt = get__Pragma_string (pfile);
|
||||
if (!txt)
|
||||
{
|
||||
source_location src_loc = pfile->cur_token[-1].src_loc;
|
||||
location_t src_loc = pfile->cur_token[-1].src_loc;
|
||||
cpp_error_with_line (pfile, CPP_DL_ERROR, src_loc, 0,
|
||||
"invalid #pragma push_macro directive");
|
||||
check_eol (pfile, false);
|
||||
|
@ -1593,7 +1593,7 @@ do_pragma_pop_macro (cpp_reader *pfile)
|
|||
txt = get__Pragma_string (pfile);
|
||||
if (!txt)
|
||||
{
|
||||
source_location src_loc = pfile->cur_token[-1].src_loc;
|
||||
location_t src_loc = pfile->cur_token[-1].src_loc;
|
||||
cpp_error_with_line (pfile, CPP_DL_ERROR, src_loc, 0,
|
||||
"invalid #pragma pop_macro directive");
|
||||
check_eol (pfile, false);
|
||||
|
@ -1695,7 +1695,7 @@ do_pragma_dependency (cpp_reader *pfile)
|
|||
{
|
||||
const char *fname;
|
||||
int angle_brackets, ordering;
|
||||
source_location location;
|
||||
location_t location;
|
||||
|
||||
fname = parse_include (pfile, &angle_brackets, NULL, &location);
|
||||
if (!fname)
|
||||
|
@ -1801,7 +1801,7 @@ get__Pragma_string (cpp_reader *pfile)
|
|||
\" and \\ sequences, and process the result as a #pragma directive. */
|
||||
static void
|
||||
destringize_and_run (cpp_reader *pfile, const cpp_string *in,
|
||||
source_location expansion_loc)
|
||||
location_t expansion_loc)
|
||||
{
|
||||
const unsigned char *src, *limit;
|
||||
char *dest, *result;
|
||||
|
@ -1921,7 +1921,7 @@ destringize_and_run (cpp_reader *pfile, const cpp_string *in,
|
|||
|
||||
/* Handle the _Pragma operator. Return 0 on error, 1 if ok. */
|
||||
int
|
||||
_cpp_do__Pragma (cpp_reader *pfile, source_location expansion_loc)
|
||||
_cpp_do__Pragma (cpp_reader *pfile, location_t expansion_loc)
|
||||
{
|
||||
const cpp_token *string = get__Pragma_string (pfile);
|
||||
pfile->directive_result.type = CPP_PADDING;
|
||||
|
@ -2142,7 +2142,7 @@ push_conditional (cpp_reader *pfile, int skip, int type,
|
|||
ANSWERP to point to the answer. PRED_LOC is the location of the
|
||||
predicate. */
|
||||
static bool
|
||||
parse_answer (cpp_reader *pfile, int type, source_location pred_loc,
|
||||
parse_answer (cpp_reader *pfile, int type, location_t pred_loc,
|
||||
cpp_macro **answer_ptr)
|
||||
{
|
||||
/* In a conditional, it is legal to not have an open paren. We
|
||||
|
|
|
@ -52,7 +52,7 @@ cpp_diagnostic (cpp_reader * pfile, enum cpp_diagnostic_level level,
|
|||
enum cpp_warning_reason reason,
|
||||
const char *msgid, va_list *ap)
|
||||
{
|
||||
source_location src_loc;
|
||||
location_t src_loc;
|
||||
|
||||
if (CPP_OPTION (pfile, traditional))
|
||||
{
|
||||
|
@ -150,7 +150,7 @@ ATTRIBUTE_FPTR_PRINTF(6,0)
|
|||
static bool
|
||||
cpp_diagnostic_with_line (cpp_reader * pfile, enum cpp_diagnostic_level level,
|
||||
enum cpp_warning_reason reason,
|
||||
source_location src_loc, unsigned int column,
|
||||
location_t src_loc, unsigned int column,
|
||||
const char *msgid, va_list *ap)
|
||||
{
|
||||
bool ret;
|
||||
|
@ -169,7 +169,7 @@ cpp_diagnostic_with_line (cpp_reader * pfile, enum cpp_diagnostic_level level,
|
|||
|
||||
bool
|
||||
cpp_error_with_line (cpp_reader *pfile, enum cpp_diagnostic_level level,
|
||||
source_location src_loc, unsigned int column,
|
||||
location_t src_loc, unsigned int column,
|
||||
const char *msgid, ...)
|
||||
{
|
||||
va_list ap;
|
||||
|
@ -188,7 +188,7 @@ cpp_error_with_line (cpp_reader *pfile, enum cpp_diagnostic_level level,
|
|||
|
||||
bool
|
||||
cpp_warning_with_line (cpp_reader *pfile, enum cpp_warning_reason reason,
|
||||
source_location src_loc, unsigned int column,
|
||||
location_t src_loc, unsigned int column,
|
||||
const char *msgid, ...)
|
||||
{
|
||||
va_list ap;
|
||||
|
@ -207,7 +207,7 @@ cpp_warning_with_line (cpp_reader *pfile, enum cpp_warning_reason reason,
|
|||
|
||||
bool
|
||||
cpp_pedwarning_with_line (cpp_reader *pfile, enum cpp_warning_reason reason,
|
||||
source_location src_loc, unsigned int column,
|
||||
location_t src_loc, unsigned int column,
|
||||
const char *msgid, ...)
|
||||
{
|
||||
va_list ap;
|
||||
|
@ -227,7 +227,7 @@ cpp_pedwarning_with_line (cpp_reader *pfile, enum cpp_warning_reason reason,
|
|||
|
||||
bool
|
||||
cpp_warning_with_line_syshdr (cpp_reader *pfile, enum cpp_warning_reason reason,
|
||||
source_location src_loc, unsigned int column,
|
||||
location_t src_loc, unsigned int column,
|
||||
const char *msgid, ...)
|
||||
{
|
||||
va_list ap;
|
||||
|
@ -247,7 +247,7 @@ cpp_warning_with_line_syshdr (cpp_reader *pfile, enum cpp_warning_reason reason,
|
|||
|
||||
bool
|
||||
cpp_error_at (cpp_reader * pfile, enum cpp_diagnostic_level level,
|
||||
source_location src_loc, const char *msgid, ...)
|
||||
location_t src_loc, const char *msgid, ...)
|
||||
{
|
||||
va_list ap;
|
||||
bool ret;
|
||||
|
@ -298,7 +298,7 @@ cpp_errno (cpp_reader *pfile, enum cpp_diagnostic_level level,
|
|||
bool
|
||||
cpp_errno_filename (cpp_reader *pfile, enum cpp_diagnostic_level level,
|
||||
const char *filename,
|
||||
source_location loc)
|
||||
location_t loc)
|
||||
{
|
||||
if (filename[0] == '\0')
|
||||
filename = _("stdout");
|
||||
|
|
|
@ -30,7 +30,7 @@ struct op
|
|||
{
|
||||
const cpp_token *token; /* The token forming op (for diagnostics). */
|
||||
cpp_num value; /* The value logically "right" of op. */
|
||||
source_location loc; /* The location of this value. */
|
||||
location_t loc; /* The location of this value. */
|
||||
enum cpp_ttype op;
|
||||
};
|
||||
|
||||
|
@ -52,13 +52,13 @@ static cpp_num num_equality_op (cpp_reader *, cpp_num, cpp_num,
|
|||
enum cpp_ttype);
|
||||
static cpp_num num_mul (cpp_reader *, cpp_num, cpp_num);
|
||||
static cpp_num num_div_op (cpp_reader *, cpp_num, cpp_num, enum cpp_ttype,
|
||||
source_location);
|
||||
location_t);
|
||||
static cpp_num num_lshift (cpp_num, size_t, size_t);
|
||||
static cpp_num num_rshift (cpp_num, size_t, size_t);
|
||||
|
||||
static cpp_num append_digit (cpp_num, int, int, size_t);
|
||||
static cpp_num parse_defined (cpp_reader *);
|
||||
static cpp_num eval_token (cpp_reader *, const cpp_token *, source_location);
|
||||
static cpp_num eval_token (cpp_reader *, const cpp_token *, location_t);
|
||||
static struct op *reduce (cpp_reader *, struct op *, enum cpp_ttype);
|
||||
static unsigned int interpret_float_suffix (cpp_reader *, const uchar *, size_t);
|
||||
static unsigned int interpret_int_suffix (cpp_reader *, const uchar *, size_t);
|
||||
|
@ -505,7 +505,7 @@ cpp_get_userdef_suffix (const cpp_token *tok)
|
|||
VIRTUAL_LOCATION is the virtual location for TOKEN. */
|
||||
unsigned int
|
||||
cpp_classify_number (cpp_reader *pfile, const cpp_token *token,
|
||||
const char **ud_suffix, source_location virtual_location)
|
||||
const char **ud_suffix, location_t virtual_location)
|
||||
{
|
||||
const uchar *str = token->val.str.text;
|
||||
const uchar *limit;
|
||||
|
@ -1091,7 +1091,7 @@ parse_defined (cpp_reader *pfile)
|
|||
operators). */
|
||||
static cpp_num
|
||||
eval_token (cpp_reader *pfile, const cpp_token *token,
|
||||
source_location virtual_location)
|
||||
location_t virtual_location)
|
||||
{
|
||||
cpp_num result;
|
||||
unsigned int temp;
|
||||
|
@ -1288,7 +1288,7 @@ _cpp_parse_expr (cpp_reader *pfile, bool is_if)
|
|||
struct op *top = pfile->op_stack;
|
||||
unsigned int lex_count;
|
||||
bool saw_leading_not, want_value = true;
|
||||
source_location virtual_location = 0;
|
||||
location_t virtual_location = 0;
|
||||
|
||||
pfile->state.skip_eval = 0;
|
||||
|
||||
|
@ -2086,7 +2086,7 @@ num_mul (cpp_reader *pfile, cpp_num lhs, cpp_num rhs)
|
|||
|
||||
static cpp_num
|
||||
num_div_op (cpp_reader *pfile, cpp_num lhs, cpp_num rhs, enum cpp_ttype op,
|
||||
source_location location)
|
||||
location_t location)
|
||||
{
|
||||
cpp_num result, sub;
|
||||
cpp_num_part mask;
|
||||
|
|
|
@ -144,7 +144,7 @@ struct cpp_file_hash_entry
|
|||
{
|
||||
struct cpp_file_hash_entry *next;
|
||||
cpp_dir *start_dir;
|
||||
source_location location;
|
||||
location_t location;
|
||||
union
|
||||
{
|
||||
_cpp_file *file;
|
||||
|
@ -171,18 +171,18 @@ static bool open_file (_cpp_file *file);
|
|||
static bool pch_open_file (cpp_reader *pfile, _cpp_file *file,
|
||||
bool *invalid_pch);
|
||||
static bool find_file_in_dir (cpp_reader *pfile, _cpp_file *file,
|
||||
bool *invalid_pch, source_location loc);
|
||||
bool *invalid_pch, location_t loc);
|
||||
static bool read_file_guts (cpp_reader *pfile, _cpp_file *file,
|
||||
source_location loc);
|
||||
location_t loc);
|
||||
static bool read_file (cpp_reader *pfile, _cpp_file *file,
|
||||
source_location loc);
|
||||
location_t loc);
|
||||
static bool should_stack_file (cpp_reader *, _cpp_file *file, bool import,
|
||||
source_location loc);
|
||||
location_t loc);
|
||||
static struct cpp_dir *search_path_head (cpp_reader *, const char *fname,
|
||||
int angle_brackets, enum include_type);
|
||||
static const char *dir_name_of_file (_cpp_file *file);
|
||||
static void open_file_failed (cpp_reader *pfile, _cpp_file *file, int,
|
||||
source_location);
|
||||
location_t);
|
||||
static struct cpp_file_hash_entry *search_cache (struct cpp_file_hash_entry *head,
|
||||
const cpp_dir *start_dir);
|
||||
static _cpp_file *make_cpp_file (cpp_reader *, cpp_dir *, const char *fname);
|
||||
|
@ -377,7 +377,7 @@ maybe_shorter_path (const char * file)
|
|||
|
||||
static bool
|
||||
find_file_in_dir (cpp_reader *pfile, _cpp_file *file, bool *invalid_pch,
|
||||
source_location loc)
|
||||
location_t loc)
|
||||
{
|
||||
char *path;
|
||||
|
||||
|
@ -507,7 +507,7 @@ _cpp_find_failed (_cpp_file *file)
|
|||
_cpp_file *
|
||||
_cpp_find_file (cpp_reader *pfile, const char *fname, cpp_dir *start_dir,
|
||||
bool fake, int angle_brackets, bool implicit_preinclude,
|
||||
source_location loc)
|
||||
location_t loc)
|
||||
{
|
||||
struct cpp_file_hash_entry *entry;
|
||||
void **hash_slot;
|
||||
|
@ -671,7 +671,7 @@ _cpp_find_file (cpp_reader *pfile, const char *fname, cpp_dir *start_dir,
|
|||
|
||||
FIXME: Flush file cache and try again if we run out of memory. */
|
||||
static bool
|
||||
read_file_guts (cpp_reader *pfile, _cpp_file *file, source_location loc)
|
||||
read_file_guts (cpp_reader *pfile, _cpp_file *file, location_t loc)
|
||||
{
|
||||
ssize_t size, total, count;
|
||||
uchar *buf;
|
||||
|
@ -755,7 +755,7 @@ read_file_guts (cpp_reader *pfile, _cpp_file *file, source_location loc)
|
|||
have been passed through find_file() at some stage. Use LOC for
|
||||
any diagnostics. */
|
||||
static bool
|
||||
read_file (cpp_reader *pfile, _cpp_file *file, source_location loc)
|
||||
read_file (cpp_reader *pfile, _cpp_file *file, location_t loc)
|
||||
{
|
||||
/* If we already have its contents in memory, succeed immediately. */
|
||||
if (file->buffer_valid)
|
||||
|
@ -783,7 +783,7 @@ read_file (cpp_reader *pfile, _cpp_file *file, source_location loc)
|
|||
Use LOC for any diagnostics. */
|
||||
static bool
|
||||
should_stack_file (cpp_reader *pfile, _cpp_file *file, bool import,
|
||||
source_location loc)
|
||||
location_t loc)
|
||||
{
|
||||
_cpp_file *f;
|
||||
|
||||
|
@ -892,7 +892,7 @@ should_stack_file (cpp_reader *pfile, _cpp_file *file, bool import,
|
|||
stacked. Use LOC for any diagnostics. */
|
||||
bool
|
||||
_cpp_stack_file (cpp_reader *pfile, _cpp_file *file, bool import,
|
||||
source_location loc)
|
||||
location_t loc)
|
||||
{
|
||||
cpp_buffer *buffer;
|
||||
int sysp;
|
||||
|
@ -1007,7 +1007,7 @@ dir_name_of_file (_cpp_file *file)
|
|||
Returns true if a buffer was stacked. */
|
||||
bool
|
||||
_cpp_stack_include (cpp_reader *pfile, const char *fname, int angle_brackets,
|
||||
enum include_type type, source_location loc)
|
||||
enum include_type type, location_t loc)
|
||||
{
|
||||
struct cpp_dir *dir;
|
||||
_cpp_file *file;
|
||||
|
@ -1037,7 +1037,7 @@ _cpp_stack_include (cpp_reader *pfile, const char *fname, int angle_brackets,
|
|||
/* Compensate for the increment in linemap_add that occurs if
|
||||
_cpp_stack_file actually stacks the file. In the case of a
|
||||
normal #include, we're currently at the start of the line
|
||||
*following* the #include. A separate source_location for this
|
||||
*following* the #include. A separate location_t for this
|
||||
location makes no sense (until we do the LC_LEAVE), and
|
||||
complicates LAST_SOURCE_LINE_LOCATION. This does not apply if we
|
||||
found a PCH file (in which case linemap_add is not called) or we
|
||||
|
@ -1059,7 +1059,7 @@ _cpp_stack_include (cpp_reader *pfile, const char *fname, int angle_brackets,
|
|||
/* Could not open FILE. The complication is dependency output. */
|
||||
static void
|
||||
open_file_failed (cpp_reader *pfile, _cpp_file *file, int angle_brackets,
|
||||
source_location loc)
|
||||
location_t loc)
|
||||
{
|
||||
int sysp = pfile->line_table->highest_line > 1 && pfile->buffer ? pfile->buffer->sysp : 0;
|
||||
bool print_dep = CPP_OPTION (pfile, deps.style) > (angle_brackets || !!sysp);
|
||||
|
@ -1247,7 +1247,7 @@ cpp_included (cpp_reader *pfile, const char *fname)
|
|||
filenames aliased by links or redundant . or .. traversals etc. */
|
||||
bool
|
||||
cpp_included_before (cpp_reader *pfile, const char *fname,
|
||||
source_location location)
|
||||
location_t location)
|
||||
{
|
||||
struct cpp_file_hash_entry *entry
|
||||
= (struct cpp_file_hash_entry *)
|
||||
|
|
|
@ -240,8 +240,10 @@ struct GTY(()) cpp_identifier {
|
|||
/* A preprocessing token. This has been carefully packed and should
|
||||
occupy 16 bytes on 32-bit hosts and 24 bytes on 64-bit hosts. */
|
||||
struct GTY(()) cpp_token {
|
||||
source_location src_loc; /* Location of first char of token,
|
||||
together with range of full token. */
|
||||
|
||||
/* Location of first char of token, together with range of full token. */
|
||||
location_t src_loc;
|
||||
|
||||
ENUM_BITFIELD(cpp_ttype) type : CHAR_BIT; /* token type */
|
||||
unsigned short flags; /* flags - see above */
|
||||
|
||||
|
@ -624,12 +626,12 @@ struct cpp_callbacks
|
|||
void (*file_change) (cpp_reader *, const line_map_ordinary *);
|
||||
|
||||
void (*dir_change) (cpp_reader *, const char *);
|
||||
void (*include) (cpp_reader *, source_location, const unsigned char *,
|
||||
void (*include) (cpp_reader *, location_t, const unsigned char *,
|
||||
const char *, int, const cpp_token **);
|
||||
void (*define) (cpp_reader *, source_location, cpp_hashnode *);
|
||||
void (*undef) (cpp_reader *, source_location, cpp_hashnode *);
|
||||
void (*ident) (cpp_reader *, source_location, const cpp_string *);
|
||||
void (*def_pragma) (cpp_reader *, source_location);
|
||||
void (*define) (cpp_reader *, location_t, cpp_hashnode *);
|
||||
void (*undef) (cpp_reader *, location_t, cpp_hashnode *);
|
||||
void (*ident) (cpp_reader *, location_t, const cpp_string *);
|
||||
void (*def_pragma) (cpp_reader *, location_t);
|
||||
int (*valid_pch) (cpp_reader *, const char *, int);
|
||||
void (*read_pch) (cpp_reader *, const char *, int, const char *);
|
||||
missing_header_cb missing_header;
|
||||
|
@ -649,14 +651,14 @@ struct cpp_callbacks
|
|||
|
||||
/* Callbacks for when a macro is expanded, or tested (whether
|
||||
defined or not at the time) in #ifdef, #ifndef or "defined". */
|
||||
void (*used_define) (cpp_reader *, source_location, cpp_hashnode *);
|
||||
void (*used_undef) (cpp_reader *, source_location, cpp_hashnode *);
|
||||
void (*used_define) (cpp_reader *, location_t, cpp_hashnode *);
|
||||
void (*used_undef) (cpp_reader *, location_t, cpp_hashnode *);
|
||||
/* Called before #define and #undef or other macro definition
|
||||
changes are processed. */
|
||||
void (*before_define) (cpp_reader *);
|
||||
/* Called whenever a macro is expanded or tested.
|
||||
Second argument is the location of the start of the current expansion. */
|
||||
void (*used) (cpp_reader *, source_location, cpp_hashnode *);
|
||||
void (*used) (cpp_reader *, location_t, cpp_hashnode *);
|
||||
|
||||
/* Callback to identify whether an attribute exists. */
|
||||
int (*has_attribute) (cpp_reader *);
|
||||
|
@ -676,7 +678,7 @@ struct cpp_callbacks
|
|||
The content contains the opening slash-star (or slash-slash),
|
||||
and for C-style comments contains the closing star-slash. For
|
||||
C++-style comments it does not include the terminating newline. */
|
||||
void (*comment) (cpp_reader *, source_location, const unsigned char *,
|
||||
void (*comment) (cpp_reader *, location_t, const unsigned char *,
|
||||
size_t);
|
||||
|
||||
/* Callback for filename remapping in __FILE__ and __BASE_FILE__ macro
|
||||
|
@ -753,7 +755,7 @@ struct GTY(()) cpp_macro {
|
|||
} GTY ((desc ("%1.kind == cmk_assert"))) parm;
|
||||
|
||||
/* Definition line number. */
|
||||
source_location line;
|
||||
location_t line;
|
||||
|
||||
/* Number of tokens in body, or bytes for traditional macros. */
|
||||
/* Do we really need 2^32-1 range here? */
|
||||
|
@ -884,13 +886,13 @@ struct GTY(()) cpp_hashnode {
|
|||
|
||||
class cpp_string_location_reader {
|
||||
public:
|
||||
cpp_string_location_reader (source_location src_loc,
|
||||
cpp_string_location_reader (location_t src_loc,
|
||||
line_maps *line_table);
|
||||
|
||||
source_range get_next ();
|
||||
|
||||
private:
|
||||
source_location m_loc;
|
||||
location_t m_loc;
|
||||
int m_offset_per_column;
|
||||
line_maps *m_line_table;
|
||||
};
|
||||
|
@ -995,7 +997,7 @@ extern int cpp_avoid_paste (cpp_reader *, const cpp_token *,
|
|||
const cpp_token *);
|
||||
extern const cpp_token *cpp_get_token (cpp_reader *);
|
||||
extern const cpp_token *cpp_get_token_with_location (cpp_reader *,
|
||||
source_location *);
|
||||
location_t *);
|
||||
inline bool cpp_user_macro_p (const cpp_hashnode *node)
|
||||
{
|
||||
return node->type == NT_USER_MACRO;
|
||||
|
@ -1017,7 +1019,7 @@ inline bool cpp_fun_like_macro_p (cpp_hashnode *node)
|
|||
|
||||
extern const unsigned char *cpp_macro_definition (cpp_reader *,
|
||||
cpp_hashnode *);
|
||||
inline source_location cpp_macro_definition_location (cpp_hashnode *node)
|
||||
inline location_t cpp_macro_definition_location (cpp_hashnode *node)
|
||||
{
|
||||
return node->value.macro->line;
|
||||
}
|
||||
|
@ -1126,7 +1128,7 @@ struct cpp_num
|
|||
/* Classify a CPP_NUMBER token. The return value is a combination of
|
||||
the flags from the above sets. */
|
||||
extern unsigned cpp_classify_number (cpp_reader *, const cpp_token *,
|
||||
const char **, source_location);
|
||||
const char **, location_t);
|
||||
|
||||
/* Return the classification flags for a float suffix. */
|
||||
extern unsigned int cpp_interpret_float_suffix (cpp_reader *, const char *,
|
||||
|
@ -1165,30 +1167,30 @@ extern bool cpp_errno (cpp_reader *, enum cpp_diagnostic_level,
|
|||
/* Similarly, but with "FILENAME: " instead of "MSGID: ", where
|
||||
the filename is not localized. */
|
||||
extern bool cpp_errno_filename (cpp_reader *, enum cpp_diagnostic_level,
|
||||
const char *filename, source_location loc);
|
||||
const char *filename, location_t loc);
|
||||
|
||||
/* Same as cpp_error, except additionally specifies a position as a
|
||||
(translation unit) physical line and physical column. If the line is
|
||||
zero, then no location is printed. */
|
||||
extern bool cpp_error_with_line (cpp_reader *, enum cpp_diagnostic_level,
|
||||
source_location, unsigned,
|
||||
location_t, unsigned,
|
||||
const char *msgid, ...)
|
||||
ATTRIBUTE_PRINTF_5;
|
||||
extern bool cpp_warning_with_line (cpp_reader *, enum cpp_warning_reason,
|
||||
source_location, unsigned,
|
||||
location_t, unsigned,
|
||||
const char *msgid, ...)
|
||||
ATTRIBUTE_PRINTF_5;
|
||||
extern bool cpp_pedwarning_with_line (cpp_reader *, enum cpp_warning_reason,
|
||||
source_location, unsigned,
|
||||
location_t, unsigned,
|
||||
const char *msgid, ...)
|
||||
ATTRIBUTE_PRINTF_5;
|
||||
extern bool cpp_warning_with_line_syshdr (cpp_reader *, enum cpp_warning_reason,
|
||||
source_location, unsigned,
|
||||
location_t, unsigned,
|
||||
const char *msgid, ...)
|
||||
ATTRIBUTE_PRINTF_5;
|
||||
|
||||
extern bool cpp_error_at (cpp_reader * pfile, enum cpp_diagnostic_level,
|
||||
source_location src_loc, const char *msgid, ...)
|
||||
location_t src_loc, const char *msgid, ...)
|
||||
ATTRIBUTE_PRINTF_4;
|
||||
|
||||
extern bool cpp_error_at (cpp_reader * pfile, enum cpp_diagnostic_level,
|
||||
|
@ -1219,7 +1221,7 @@ typedef struct
|
|||
char *comment;
|
||||
|
||||
/* source location for the given comment. */
|
||||
source_location sloc;
|
||||
location_t sloc;
|
||||
} cpp_comment;
|
||||
|
||||
/* Structure holding all comments for a given cpp_reader. */
|
||||
|
@ -1258,7 +1260,7 @@ extern unsigned char *cpp_quote_string (unsigned char *, const unsigned char *,
|
|||
|
||||
/* In files.c */
|
||||
extern bool cpp_included (cpp_reader *, const char *);
|
||||
extern bool cpp_included_before (cpp_reader *, const char *, source_location);
|
||||
extern bool cpp_included_before (cpp_reader *, const char *, location_t);
|
||||
extern void cpp_make_system_header (cpp_reader *, int, int);
|
||||
extern bool cpp_push_include (cpp_reader *, const char *);
|
||||
extern bool cpp_push_default_include (cpp_reader *, const char *);
|
||||
|
@ -1281,7 +1283,7 @@ extern int cpp_read_state (cpp_reader *, const char *, FILE *,
|
|||
struct save_macro_data *);
|
||||
|
||||
/* In lex.c */
|
||||
extern void cpp_force_token_locations (cpp_reader *, source_location);
|
||||
extern void cpp_force_token_locations (cpp_reader *, location_t);
|
||||
extern void cpp_stop_forcing_token_locations (cpp_reader *);
|
||||
|
||||
/* In expr.c */
|
||||
|
|
|
@ -73,7 +73,7 @@ enum lc_reason
|
|||
LC_HWM /* High Water Mark. */
|
||||
};
|
||||
|
||||
/* The typedef "source_location" is a key within the location database,
|
||||
/* The typedef "location_t" is a key within the location database,
|
||||
identifying a source location or macro expansion, along with range
|
||||
information, and (optionally) a pointer for use by gcc.
|
||||
|
||||
|
@ -182,7 +182,7 @@ enum lc_reason
|
|||
| macromap[1]->start_location | Start of macro map 1
|
||||
-----------+-------------------------------+-------------------------------
|
||||
| macromap[0]->start_location | Start of macro map 0
|
||||
0x7fffffff | MAX_SOURCE_LOCATION | Also used as a mask for
|
||||
0x7fffffff | MAX_LOCATION_T | Also used as a mask for
|
||||
| | accessing the ad-hoc data table
|
||||
-----------+-------------------------------+-------------------------------
|
||||
0x80000000 | Start of ad-hoc values; the lower 31 bits are used as an index
|
||||
|
@ -283,9 +283,9 @@ enum lc_reason
|
|||
finish == ordmap->start + (23 << 12) + (19 << 5)
|
||||
== ordmap->start + 0x17260
|
||||
|
||||
To further see how source_location works in practice, see the
|
||||
To further see how location_t works in practice, see the
|
||||
worked example in libcpp/location-example.txt. */
|
||||
typedef unsigned int source_location;
|
||||
typedef unsigned int location_t;
|
||||
|
||||
/* Do not track column numbers higher than this one. As a result, the
|
||||
range of column_bits is [12, 18] (or 0 if column numbers are
|
||||
|
@ -295,15 +295,15 @@ const unsigned int LINE_MAP_MAX_COLUMN_NUMBER = (1U << 12);
|
|||
/* Do not pack ranges if locations get higher than this.
|
||||
If you change this, update:
|
||||
gcc.dg/plugin/location-overflow-test-*.c. */
|
||||
const source_location LINE_MAP_MAX_LOCATION_WITH_PACKED_RANGES = 0x50000000;
|
||||
const location_t LINE_MAP_MAX_LOCATION_WITH_PACKED_RANGES = 0x50000000;
|
||||
|
||||
/* Do not track column numbers if locations get higher than this.
|
||||
If you change this, update:
|
||||
gcc.dg/plugin/location-overflow-test-*.c. */
|
||||
const source_location LINE_MAP_MAX_LOCATION_WITH_COLS = 0x60000000;
|
||||
const location_t LINE_MAP_MAX_LOCATION_WITH_COLS = 0x60000000;
|
||||
|
||||
/* Highest possible source location encoded within an ordinary map. */
|
||||
const source_location LINE_MAP_MAX_LOCATION = 0x70000000;
|
||||
const location_t LINE_MAP_MAX_LOCATION = 0x70000000;
|
||||
|
||||
/* A range of source locations.
|
||||
|
||||
|
@ -315,15 +315,15 @@ const source_location LINE_MAP_MAX_LOCATION = 0x70000000;
|
|||
let's do it the simple way, as a pair. */
|
||||
struct GTY(()) source_range
|
||||
{
|
||||
source_location m_start;
|
||||
source_location m_finish;
|
||||
location_t m_start;
|
||||
location_t m_finish;
|
||||
|
||||
/* We avoid using constructors, since various structs that
|
||||
don't yet have constructors will embed instances of
|
||||
source_range. */
|
||||
|
||||
/* Make a source_range from a source_location. */
|
||||
static source_range from_location (source_location loc)
|
||||
/* Make a source_range from a location_t. */
|
||||
static source_range from_location (location_t loc)
|
||||
{
|
||||
source_range result;
|
||||
result.m_start = loc;
|
||||
|
@ -331,9 +331,9 @@ struct GTY(()) source_range
|
|||
return result;
|
||||
}
|
||||
|
||||
/* Make a source_range from a pair of source_location. */
|
||||
static source_range from_locations (source_location start,
|
||||
source_location finish)
|
||||
/* Make a source_range from a pair of location_t. */
|
||||
static source_range from_locations (location_t start,
|
||||
location_t finish)
|
||||
{
|
||||
source_range result;
|
||||
result.m_start = start;
|
||||
|
@ -379,7 +379,7 @@ typedef size_t (*line_map_round_alloc_size_func) (size_t);
|
|||
/* This contains GTY mark-up to support precompiled headers.
|
||||
line_map is an abstract class, only derived objects exist. */
|
||||
struct GTY((tag ("0"), desc ("MAP_ORDINARY_P (&%h) ? 1 : 2"))) line_map {
|
||||
source_location start_location;
|
||||
location_t start_location;
|
||||
|
||||
/* Size and alignment is (usually) 4 bytes. */
|
||||
};
|
||||
|
@ -395,7 +395,7 @@ struct GTY((tag ("0"), desc ("MAP_ORDINARY_P (&%h) ? 1 : 2"))) line_map {
|
|||
(The top line is line 1 and the leftmost column is column 1; line/column 0
|
||||
means "entire file/line" or "unknown line/column" or "not applicable".)
|
||||
|
||||
The highest possible source location is MAX_SOURCE_LOCATION. */
|
||||
The highest possible source location is MAX_LOCATION_T. */
|
||||
struct GTY((tag ("1"))) line_map_ordinary : public line_map {
|
||||
/* Base class is 4 bytes. */
|
||||
|
||||
|
@ -410,7 +410,7 @@ struct GTY((tag ("1"))) line_map_ordinary : public line_map {
|
|||
cpp_buffer. */
|
||||
unsigned char sysp;
|
||||
|
||||
/* Number of the low-order source_location bits used for column numbers
|
||||
/* Number of the low-order location_t bits used for column numbers
|
||||
and ranges. */
|
||||
unsigned int m_column_and_range_bits : 8;
|
||||
|
||||
|
@ -437,14 +437,14 @@ struct GTY((tag ("1"))) line_map_ordinary : public line_map {
|
|||
/* Location from whence this line map was included. For regular
|
||||
#includes, this location will be the last location of a map. For
|
||||
outermost file, this is 0. */
|
||||
source_location included_from;
|
||||
location_t included_from;
|
||||
|
||||
/* Size is 20 or 24 bytes, no padding */
|
||||
};
|
||||
|
||||
/* This is the highest possible source location encoded within an
|
||||
ordinary or macro map. */
|
||||
const source_location MAX_SOURCE_LOCATION = 0x7FFFFFFF;
|
||||
const location_t MAX_LOCATION_T = 0x7FFFFFFF;
|
||||
|
||||
struct cpp_hashnode;
|
||||
|
||||
|
@ -521,14 +521,14 @@ struct GTY((tag ("2"))) line_map_macro : public line_map {
|
|||
In the example above x1 (for token "+") is going to be the same
|
||||
as y1. x0 is the spelling location for the argument token "1",
|
||||
and x2 is the spelling location for the argument token "2". */
|
||||
source_location * GTY((atomic)) macro_locations;
|
||||
location_t * GTY((atomic)) macro_locations;
|
||||
|
||||
/* This is the location of the expansion point of the current macro
|
||||
map. It's the location of the macro name. That location is held
|
||||
by the map that was current right before the current one. It
|
||||
could have been either a macro or an ordinary map, depending on
|
||||
if we are in a nested expansion context not. */
|
||||
source_location expansion;
|
||||
location_t expansion;
|
||||
|
||||
/* Size is 20 or 32 (4 bytes padding on 64-bit). */
|
||||
};
|
||||
|
@ -561,19 +561,19 @@ struct GTY((tag ("2"))) line_map_macro : public line_map {
|
|||
/* Get whether location LOC is an ad-hoc, ordinary or macro location. */
|
||||
|
||||
inline bool
|
||||
IS_ORDINARY_LOC (source_location loc)
|
||||
IS_ORDINARY_LOC (location_t loc)
|
||||
{
|
||||
return loc < LINE_MAP_MAX_LOCATION;
|
||||
}
|
||||
|
||||
inline bool
|
||||
IS_ADHOC_LOC (source_location loc)
|
||||
IS_ADHOC_LOC (location_t loc)
|
||||
{
|
||||
return loc > MAX_SOURCE_LOCATION;
|
||||
return loc > MAX_LOCATION_T;
|
||||
}
|
||||
|
||||
inline bool
|
||||
IS_MACRO_LOC (source_location loc)
|
||||
IS_MACRO_LOC (location_t loc)
|
||||
{
|
||||
return !IS_ORDINARY_LOC (loc) && !IS_ADHOC_LOC (loc);
|
||||
}
|
||||
|
@ -634,7 +634,7 @@ linemap_check_macro (const line_map *map)
|
|||
|
||||
/* Read the start location of MAP. */
|
||||
|
||||
inline source_location
|
||||
inline location_t
|
||||
MAP_START_LOCATION (const line_map *map)
|
||||
{
|
||||
return map->start_location;
|
||||
|
@ -687,7 +687,7 @@ MACRO_MAP_NUM_MACRO_TOKENS (const line_map_macro *macro_map)
|
|||
/* Get the array of pairs of locations within macro map MAP.
|
||||
See the declaration of line_map_macro for more information. */
|
||||
|
||||
inline source_location *
|
||||
inline location_t *
|
||||
MACRO_MAP_LOCATIONS (const line_map_macro *macro_map)
|
||||
{
|
||||
return macro_map->macro_locations;
|
||||
|
@ -695,7 +695,7 @@ MACRO_MAP_LOCATIONS (const line_map_macro *macro_map)
|
|||
|
||||
/* Get the location of the expansion point of the macro map MAP. */
|
||||
|
||||
inline source_location
|
||||
inline location_t
|
||||
MACRO_MAP_EXPANSION_POINT_LOCATION (const line_map_macro *macro_map)
|
||||
{
|
||||
return macro_map->expansion;
|
||||
|
@ -742,7 +742,7 @@ struct GTY(()) maps_info_macro {
|
|||
/* Data structure to associate a source_range together with an arbitrary
|
||||
data pointer with a source location. */
|
||||
struct GTY(()) location_adhoc_data {
|
||||
source_location locus;
|
||||
location_t locus;
|
||||
source_range src_range;
|
||||
void * GTY((skip)) data;
|
||||
};
|
||||
|
@ -761,7 +761,7 @@ struct htab;
|
|||
|
||||
struct GTY(()) location_adhoc_data_map {
|
||||
struct htab * GTY((skip)) htab;
|
||||
source_location curr_loc;
|
||||
location_t curr_loc;
|
||||
unsigned int allocated;
|
||||
struct location_adhoc_data GTY((length ("%h.allocated"))) *data;
|
||||
};
|
||||
|
@ -781,11 +781,11 @@ struct GTY(()) line_maps {
|
|||
/* If true, prints an include trace a la -H. */
|
||||
bool trace_includes;
|
||||
|
||||
/* Highest source_location "given out". */
|
||||
source_location highest_location;
|
||||
/* Highest location_t "given out". */
|
||||
location_t highest_location;
|
||||
|
||||
/* Start of line of highest source_location "given out". */
|
||||
source_location highest_line;
|
||||
/* Start of line of highest location_t "given out". */
|
||||
location_t highest_line;
|
||||
|
||||
/* The maximum column number we can quickly allocate. Higher numbers
|
||||
may require allocating a new line_map. */
|
||||
|
@ -802,7 +802,7 @@ struct GTY(()) line_maps {
|
|||
|
||||
/* The special location value that is used as spelling location for
|
||||
built-in tokens. */
|
||||
source_location builtin_location;
|
||||
location_t builtin_location;
|
||||
|
||||
/* True if we've seen a #line or # 44 "file" directive. */
|
||||
bool seen_line_directive;
|
||||
|
@ -1032,12 +1032,12 @@ LINEMAPS_LAST_MACRO_MAP (const line_maps *set)
|
|||
|
||||
/* Returns the lowest location [of a token resulting from macro
|
||||
expansion] encoded in this line table. */
|
||||
inline source_location
|
||||
inline location_t
|
||||
LINEMAPS_MACRO_LOWEST_LOCATION (const line_maps *set)
|
||||
{
|
||||
return LINEMAPS_MACRO_USED (set)
|
||||
? MAP_START_LOCATION (LINEMAPS_LAST_MACRO_MAP (set))
|
||||
: MAX_SOURCE_LOCATION + 1;
|
||||
: MAX_LOCATION_T + 1;
|
||||
}
|
||||
|
||||
/* Returns the last macro map allocated in the line table SET. */
|
||||
|
@ -1047,33 +1047,33 @@ LINEMAPS_LAST_ALLOCATED_MACRO_MAP (const line_maps *set)
|
|||
return (line_map_macro *)LINEMAPS_LAST_ALLOCATED_MAP (set, true);
|
||||
}
|
||||
|
||||
extern source_location get_combined_adhoc_loc (struct line_maps *,
|
||||
source_location,
|
||||
extern location_t get_combined_adhoc_loc (struct line_maps *,
|
||||
location_t,
|
||||
source_range,
|
||||
void *);
|
||||
extern void *get_data_from_adhoc_loc (struct line_maps *, source_location);
|
||||
extern source_location get_location_from_adhoc_loc (struct line_maps *,
|
||||
source_location);
|
||||
extern void *get_data_from_adhoc_loc (struct line_maps *, location_t);
|
||||
extern location_t get_location_from_adhoc_loc (struct line_maps *,
|
||||
location_t);
|
||||
|
||||
extern source_range get_range_from_loc (line_maps *set, source_location loc);
|
||||
extern source_range get_range_from_loc (line_maps *set, location_t loc);
|
||||
|
||||
/* Get whether location LOC is a "pure" location, or
|
||||
whether it is an ad-hoc location, or embeds range information. */
|
||||
|
||||
bool
|
||||
pure_location_p (line_maps *set, source_location loc);
|
||||
pure_location_p (line_maps *set, location_t loc);
|
||||
|
||||
/* Given location LOC within SET, strip away any packed range information
|
||||
or ad-hoc information. */
|
||||
|
||||
extern source_location get_pure_location (line_maps *set,
|
||||
source_location loc);
|
||||
extern location_t get_pure_location (line_maps *set,
|
||||
location_t loc);
|
||||
|
||||
/* Combine LOC and BLOCK, giving a combined adhoc location. */
|
||||
|
||||
inline source_location
|
||||
inline location_t
|
||||
COMBINE_LOCATION_DATA (struct line_maps *set,
|
||||
source_location loc,
|
||||
location_t loc,
|
||||
source_range src_range,
|
||||
void *block)
|
||||
{
|
||||
|
@ -1087,19 +1087,19 @@ extern void rebuild_location_adhoc_htab (struct line_maps *);
|
|||
spelling location for built-in tokens. This BUILTIN_LOCATION has
|
||||
to be strictly less than RESERVED_LOCATION_COUNT. */
|
||||
extern void linemap_init (struct line_maps *set,
|
||||
source_location builtin_location);
|
||||
location_t builtin_location);
|
||||
|
||||
/* Check for and warn about line_maps entered but not exited. */
|
||||
|
||||
extern void linemap_check_files_exited (struct line_maps *);
|
||||
|
||||
/* Return a source_location for the start (i.e. column==0) of
|
||||
/* Return a location_t for the start (i.e. column==0) of
|
||||
(physical) line TO_LINE in the current source file (as in the
|
||||
most recent linemap_add). MAX_COLUMN_HINT is the highest column
|
||||
number we expect to use in this line (but it does not change
|
||||
the highest_location). */
|
||||
|
||||
extern source_location linemap_line_start
|
||||
extern location_t linemap_line_start
|
||||
(struct line_maps *set, linenum_type to_line, unsigned int max_column_hint);
|
||||
|
||||
/* Add a mapping of logical source line to physical source file and
|
||||
|
@ -1126,7 +1126,7 @@ extern const struct line_map *linemap_add
|
|||
binary search. If no line map have been allocated yet, this
|
||||
function returns NULL. */
|
||||
extern const struct line_map *linemap_lookup
|
||||
(struct line_maps *, source_location);
|
||||
(struct line_maps *, location_t);
|
||||
|
||||
/* Returns TRUE if the line table set tracks token locations across
|
||||
macro expansion, FALSE otherwise. */
|
||||
|
@ -1145,49 +1145,49 @@ const char* linemap_map_get_macro_name (const line_map_macro *);
|
|||
that is part of a macro replacement-list defined in a system
|
||||
header, but expanded in a non-system file. */
|
||||
int linemap_location_in_system_header_p (struct line_maps *,
|
||||
source_location);
|
||||
location_t);
|
||||
|
||||
/* Return TRUE if LOCATION is a source code location of a token that is part of
|
||||
a macro expansion, FALSE otherwise. */
|
||||
bool linemap_location_from_macro_expansion_p (const struct line_maps *,
|
||||
source_location);
|
||||
location_t);
|
||||
|
||||
/* TRUE if LOCATION is a source code location of a token that is part of the
|
||||
definition of a macro, FALSE otherwise. */
|
||||
bool linemap_location_from_macro_definition_p (struct line_maps *,
|
||||
source_location);
|
||||
location_t);
|
||||
|
||||
/* With the precondition that LOCATION is the locus of a token that is
|
||||
an argument of a function-like macro MACRO_MAP and appears in the
|
||||
expansion of MACRO_MAP, return the locus of that argument in the
|
||||
context of the caller of MACRO_MAP. */
|
||||
|
||||
extern source_location linemap_macro_map_loc_unwind_toward_spelling
|
||||
(line_maps *set, const line_map_macro *macro_map, source_location location);
|
||||
extern location_t linemap_macro_map_loc_unwind_toward_spelling
|
||||
(line_maps *set, const line_map_macro *macro_map, location_t location);
|
||||
|
||||
/* source_location values from 0 to RESERVED_LOCATION_COUNT-1 will
|
||||
/* location_t values from 0 to RESERVED_LOCATION_COUNT-1 will
|
||||
be reserved for libcpp user as special values, no token from libcpp
|
||||
will contain any of those locations. */
|
||||
const source_location RESERVED_LOCATION_COUNT = 2;
|
||||
const location_t RESERVED_LOCATION_COUNT = 2;
|
||||
|
||||
/* Converts a map and a source_location to source line. */
|
||||
/* Converts a map and a location_t to source line. */
|
||||
inline linenum_type
|
||||
SOURCE_LINE (const line_map_ordinary *ord_map, source_location loc)
|
||||
SOURCE_LINE (const line_map_ordinary *ord_map, location_t loc)
|
||||
{
|
||||
return ((loc - ord_map->start_location)
|
||||
>> ord_map->m_column_and_range_bits) + ord_map->to_line;
|
||||
}
|
||||
|
||||
/* Convert a map and source_location to source column number. */
|
||||
/* Convert a map and location_t to source column number. */
|
||||
inline linenum_type
|
||||
SOURCE_COLUMN (const line_map_ordinary *ord_map, source_location loc)
|
||||
SOURCE_COLUMN (const line_map_ordinary *ord_map, location_t loc)
|
||||
{
|
||||
return ((loc - ord_map->start_location)
|
||||
& ((1 << ord_map->m_column_and_range_bits) - 1)) >> ord_map->m_range_bits;
|
||||
}
|
||||
|
||||
|
||||
inline source_location
|
||||
inline location_t
|
||||
linemap_included_from (const line_map_ordinary *ord_map)
|
||||
{
|
||||
return ord_map->included_from;
|
||||
|
@ -1205,26 +1205,26 @@ MAIN_FILE_P (const line_map_ordinary *ord_map)
|
|||
return ord_map->included_from == 0;
|
||||
}
|
||||
|
||||
/* Encode and return a source_location from a column number. The
|
||||
/* Encode and return a location_t from a column number. The
|
||||
source line considered is the last source line used to call
|
||||
linemap_line_start, i.e, the last source line which a location was
|
||||
encoded from. */
|
||||
extern source_location
|
||||
extern location_t
|
||||
linemap_position_for_column (struct line_maps *, unsigned int);
|
||||
|
||||
/* Encode and return a source location from a given line and
|
||||
column. */
|
||||
source_location
|
||||
location_t
|
||||
linemap_position_for_line_and_column (line_maps *set,
|
||||
const line_map_ordinary *,
|
||||
linenum_type, unsigned int);
|
||||
|
||||
/* Encode and return a source_location starting from location LOC and
|
||||
/* Encode and return a location_t starting from location LOC and
|
||||
shifting it by OFFSET columns. This function does not support
|
||||
virtual locations. */
|
||||
source_location
|
||||
location_t
|
||||
linemap_position_for_loc_and_offset (struct line_maps *set,
|
||||
source_location loc,
|
||||
location_t loc,
|
||||
unsigned int offset);
|
||||
|
||||
/* Return the file this map is for. */
|
||||
|
@ -1256,16 +1256,16 @@ LINEMAP_SYSP (const line_map_ordinary *ord_map)
|
|||
the same token as the token for POST, and a negative value
|
||||
otherwise. */
|
||||
int linemap_compare_locations (struct line_maps *set,
|
||||
source_location pre,
|
||||
source_location post);
|
||||
location_t pre,
|
||||
location_t post);
|
||||
|
||||
/* Return TRUE if LOC_A denotes the location a token that comes
|
||||
topogically before the token denoted by location LOC_B, or if they
|
||||
are equal. */
|
||||
inline bool
|
||||
linemap_location_before_p (struct line_maps *set,
|
||||
source_location loc_a,
|
||||
source_location loc_b)
|
||||
location_t loc_a,
|
||||
location_t loc_b)
|
||||
{
|
||||
return linemap_compare_locations (set, loc_a, loc_b) >= 0;
|
||||
}
|
||||
|
@ -1324,7 +1324,7 @@ enum range_display_kind
|
|||
|
||||
struct location_range
|
||||
{
|
||||
source_location m_loc;
|
||||
location_t m_loc;
|
||||
|
||||
enum range_display_kind m_range_display_kind;
|
||||
|
||||
|
@ -1607,7 +1607,7 @@ class fixit_hint;
|
|||
|
||||
Adding a fix-it hint can fail: for example, attempts to insert content
|
||||
at the transition between two line maps may fail due to there being no
|
||||
source_location (aka location_t) value to express the new location.
|
||||
location_t value to express the new location.
|
||||
|
||||
Attempts to add a fix-it hint within a macro expansion will fail.
|
||||
|
||||
|
@ -1637,24 +1637,24 @@ class rich_location
|
|||
/* Constructors. */
|
||||
|
||||
/* Constructing from a location. */
|
||||
rich_location (line_maps *set, source_location loc,
|
||||
rich_location (line_maps *set, location_t loc,
|
||||
const range_label *label = NULL);
|
||||
|
||||
/* Destructor. */
|
||||
~rich_location ();
|
||||
|
||||
/* Accessors. */
|
||||
source_location get_loc () const { return get_loc (0); }
|
||||
source_location get_loc (unsigned int idx) const;
|
||||
location_t get_loc () const { return get_loc (0); }
|
||||
location_t get_loc (unsigned int idx) const;
|
||||
|
||||
void
|
||||
add_range (source_location loc,
|
||||
add_range (location_t loc,
|
||||
enum range_display_kind range_display_kind
|
||||
= SHOW_RANGE_WITHOUT_CARET,
|
||||
const range_label *label = NULL);
|
||||
|
||||
void
|
||||
set_range (unsigned int idx, source_location loc,
|
||||
set_range (unsigned int idx, location_t loc,
|
||||
enum range_display_kind range_display_kind);
|
||||
|
||||
unsigned int get_num_locations () const { return m_ranges.count (); }
|
||||
|
@ -1678,7 +1678,7 @@ class rich_location
|
|||
|
||||
/* Suggest inserting NEW_CONTENT immediately before the start of WHERE. */
|
||||
void
|
||||
add_fixit_insert_before (source_location where,
|
||||
add_fixit_insert_before (location_t where,
|
||||
const char *new_content);
|
||||
|
||||
/* Suggest inserting NEW_CONTENT immediately after the end of the primary
|
||||
|
@ -1688,7 +1688,7 @@ class rich_location
|
|||
|
||||
/* Suggest inserting NEW_CONTENT immediately after the end of WHERE. */
|
||||
void
|
||||
add_fixit_insert_after (source_location where,
|
||||
add_fixit_insert_after (location_t where,
|
||||
const char *new_content);
|
||||
|
||||
/* Methods for adding removal fix-it hints. */
|
||||
|
@ -1700,7 +1700,7 @@ class rich_location
|
|||
/* Suggest removing the content covered between the start and finish
|
||||
of WHERE. */
|
||||
void
|
||||
add_fixit_remove (source_location where);
|
||||
add_fixit_remove (location_t where);
|
||||
|
||||
/* Suggest removing the content covered by SRC_RANGE. */
|
||||
void
|
||||
|
@ -1715,7 +1715,7 @@ class rich_location
|
|||
/* Suggest replacing the content between the start and finish of
|
||||
WHERE with NEW_CONTENT. */
|
||||
void
|
||||
add_fixit_replace (source_location where,
|
||||
add_fixit_replace (location_t where,
|
||||
const char *new_content);
|
||||
|
||||
/* Suggest replacing the content covered by SRC_RANGE with
|
||||
|
@ -1751,10 +1751,10 @@ class rich_location
|
|||
}
|
||||
|
||||
private:
|
||||
bool reject_impossible_fixit (source_location where);
|
||||
bool reject_impossible_fixit (location_t where);
|
||||
void stop_supporting_fixits ();
|
||||
void maybe_add_fixit (source_location start,
|
||||
source_location next_loc,
|
||||
void maybe_add_fixit (location_t start,
|
||||
location_t next_loc,
|
||||
const char *new_content);
|
||||
|
||||
public:
|
||||
|
@ -1843,16 +1843,16 @@ class range_label
|
|||
class fixit_hint
|
||||
{
|
||||
public:
|
||||
fixit_hint (source_location start,
|
||||
source_location next_loc,
|
||||
fixit_hint (location_t start,
|
||||
location_t next_loc,
|
||||
const char *new_content);
|
||||
~fixit_hint () { free (m_bytes); }
|
||||
|
||||
bool affects_line_p (const char *file, int line) const;
|
||||
source_location get_start_loc () const { return m_start; }
|
||||
source_location get_next_loc () const { return m_next_loc; }
|
||||
bool maybe_append (source_location start,
|
||||
source_location next_loc,
|
||||
location_t get_start_loc () const { return m_start; }
|
||||
location_t get_next_loc () const { return m_next_loc; }
|
||||
bool maybe_append (location_t start,
|
||||
location_t next_loc,
|
||||
const char *new_content);
|
||||
|
||||
const char *get_string () const { return m_bytes; }
|
||||
|
@ -1867,8 +1867,8 @@ class fixit_hint
|
|||
this is a half-open/half-closed range:
|
||||
[start, next_loc)
|
||||
so that we can support insertion via start == next_loc. */
|
||||
source_location m_start;
|
||||
source_location m_next_loc;
|
||||
location_t m_start;
|
||||
location_t m_next_loc;
|
||||
char *m_bytes;
|
||||
size_t m_len;
|
||||
};
|
||||
|
@ -1932,10 +1932,10 @@ enum location_resolution_kind
|
|||
resolves to a location reserved for the client code, like
|
||||
UNKNOWN_LOCATION or BUILTINS_LOCATION in GCC. */
|
||||
|
||||
source_location linemap_resolve_location (struct line_maps *,
|
||||
source_location loc,
|
||||
enum location_resolution_kind lrk,
|
||||
const line_map_ordinary **loc_map);
|
||||
location_t linemap_resolve_location (struct line_maps *,
|
||||
location_t loc,
|
||||
enum location_resolution_kind lrk,
|
||||
const line_map_ordinary **loc_map);
|
||||
|
||||
/* Suppose that LOC is the virtual location of a token coming from the
|
||||
expansion of a macro M. This function then steps up to get the
|
||||
|
@ -1944,9 +1944,9 @@ source_location linemap_resolve_location (struct line_maps *,
|
|||
the point where M' was expanded. LOC_MAP is an output parameter.
|
||||
When non-NULL, *LOC_MAP is set to the map of the returned
|
||||
location. */
|
||||
source_location linemap_unwind_toward_expansion (struct line_maps *,
|
||||
source_location loc,
|
||||
const struct line_map **loc_map);
|
||||
location_t linemap_unwind_toward_expansion (struct line_maps *,
|
||||
location_t loc,
|
||||
const struct line_map **loc_map);
|
||||
|
||||
/* If LOC is the virtual location of a token coming from the expansion
|
||||
of a macro M and if its spelling location is reserved (e.g, a
|
||||
|
@ -1962,9 +1962,9 @@ source_location linemap_unwind_toward_expansion (struct line_maps *,
|
|||
|
||||
*MAP is set to the map of the returned location if the later is
|
||||
different from LOC. */
|
||||
source_location linemap_unwind_to_first_non_reserved_loc (struct line_maps *,
|
||||
source_location loc,
|
||||
const struct line_map **map);
|
||||
location_t linemap_unwind_to_first_non_reserved_loc (struct line_maps *,
|
||||
location_t loc,
|
||||
const struct line_map **map);
|
||||
|
||||
/* Expand source code location LOC and return a user readable source
|
||||
code location. LOC must be a spelling (non-virtual) location. If
|
||||
|
@ -1972,7 +1972,7 @@ source_location linemap_unwind_to_first_non_reserved_loc (struct line_maps *,
|
|||
location is returned. */
|
||||
expanded_location linemap_expand_location (struct line_maps *,
|
||||
const struct line_map *,
|
||||
source_location loc);
|
||||
location_t loc);
|
||||
|
||||
/* Statistics about maps allocation and usage as returned by
|
||||
linemap_get_statistics. */
|
||||
|
@ -1999,7 +1999,7 @@ struct linemap_stats
|
|||
location emitted for that file. */
|
||||
bool linemap_get_file_highest_location (struct line_maps * set,
|
||||
const char *file_name,
|
||||
source_location *loc);
|
||||
location_t *loc);
|
||||
|
||||
/* Compute and return statistics about the memory consumption of some
|
||||
parts of the line table SET. */
|
||||
|
@ -2007,7 +2007,7 @@ void linemap_get_statistics (struct line_maps *, struct linemap_stats *);
|
|||
|
||||
/* Dump debugging information about source location LOC into the file
|
||||
stream STREAM. SET is the line map set LOC comes from. */
|
||||
void linemap_dump_location (struct line_maps *, source_location, FILE *);
|
||||
void linemap_dump_location (struct line_maps *, location_t, FILE *);
|
||||
|
||||
/* Dump line map at index IX in line table SET to STREAM. If STREAM
|
||||
is NULL, use stderr. IS_MACRO is true if the caller wants to
|
||||
|
@ -2019,7 +2019,7 @@ void linemap_dump (FILE *, struct line_maps *, unsigned, bool);
|
|||
specifies how many macro maps to dump. */
|
||||
void line_table_dump (FILE *, struct line_maps *, unsigned int, unsigned int);
|
||||
|
||||
/* An enum for distinguishing the various parts within a source_location. */
|
||||
/* An enum for distinguishing the various parts within a location_t. */
|
||||
|
||||
enum location_aspect
|
||||
{
|
||||
|
@ -2028,14 +2028,14 @@ enum location_aspect
|
|||
LOCATION_ASPECT_FINISH
|
||||
};
|
||||
|
||||
/* The rich_location class requires a way to expand source_location instances.
|
||||
/* The rich_location class requires a way to expand location_t instances.
|
||||
We would directly use expand_location_to_spelling_point, which is
|
||||
implemented in gcc/input.c, but we also need to use it for rich_location
|
||||
within genmatch.c.
|
||||
Hence we require client code of libcpp to implement the following
|
||||
symbol. */
|
||||
extern expanded_location
|
||||
linemap_client_expand_location_to_spelling_point (source_location,
|
||||
linemap_client_expand_location_to_spelling_point (location_t,
|
||||
enum location_aspect);
|
||||
|
||||
#endif /* !LIBCPP_LINE_MAP_H */
|
||||
|
|
|
@ -633,7 +633,7 @@ cpp_post_options (cpp_reader *pfile)
|
|||
const char *
|
||||
cpp_read_main_file (cpp_reader *pfile, const char *fname)
|
||||
{
|
||||
const source_location loc = 0;
|
||||
const location_t loc = 0;
|
||||
|
||||
if (CPP_OPTION (pfile, deps.style) != DEPS_NONE)
|
||||
{
|
||||
|
|
|
@ -150,11 +150,11 @@ typedef struct
|
|||
location at index 0 is the virtual location of the token at index
|
||||
0 in the current instance of cpp_context; similarly for all the
|
||||
other virtual locations. */
|
||||
source_location *virt_locs;
|
||||
location_t *virt_locs;
|
||||
/* This is a pointer to the current virtual location. This is used
|
||||
to iterate over the virtual locations while we iterate over the
|
||||
tokens they belong to. */
|
||||
source_location *cur_virt_loc;
|
||||
location_t *cur_virt_loc;
|
||||
} macro_context;
|
||||
|
||||
/* The kind of tokens carried by a cpp_context. */
|
||||
|
@ -372,7 +372,7 @@ struct def_pragma_macro {
|
|||
unsigned char *definition;
|
||||
|
||||
/* Definition line number. */
|
||||
source_location line;
|
||||
location_t line;
|
||||
/* If macro defined in system header. */
|
||||
unsigned int syshdr : 1;
|
||||
/* Nonzero if it has been expanded or had its existence tested. */
|
||||
|
@ -400,7 +400,7 @@ struct cpp_reader
|
|||
struct line_maps *line_table;
|
||||
|
||||
/* The line of the '#' of the current directive. */
|
||||
source_location directive_line;
|
||||
location_t directive_line;
|
||||
|
||||
/* Memory buffers. */
|
||||
_cpp_buff *a_buff; /* Aligned permanent storage. */
|
||||
|
@ -419,7 +419,7 @@ struct cpp_reader
|
|||
|
||||
/* When expanding a macro at top-level, this is the location of the
|
||||
macro invocation. */
|
||||
source_location invocation_location;
|
||||
location_t invocation_location;
|
||||
|
||||
/* This is the node representing the macro being expanded at
|
||||
top-level. The value of this data member is valid iff
|
||||
|
@ -551,7 +551,7 @@ struct cpp_reader
|
|||
unsigned char *base;
|
||||
unsigned char *limit;
|
||||
unsigned char *cur;
|
||||
source_location first_line;
|
||||
location_t first_line;
|
||||
} out;
|
||||
|
||||
/* Used for buffer overlays by traditional.c. */
|
||||
|
@ -572,7 +572,7 @@ struct cpp_reader
|
|||
|
||||
/* If non-zero, the lexer will use this location for the next token
|
||||
instead of getting a location from the linemap. */
|
||||
source_location forced_token_location;
|
||||
location_t forced_token_location;
|
||||
};
|
||||
|
||||
/* Character classes. Based on the more primitive macros in safe-ctype.h.
|
||||
|
@ -646,7 +646,7 @@ extern bool _cpp_arguments_ok (cpp_reader *, cpp_macro *, const cpp_hashnode *,
|
|||
unsigned int);
|
||||
extern const unsigned char *_cpp_builtin_macro_text (cpp_reader *,
|
||||
cpp_hashnode *,
|
||||
source_location = 0);
|
||||
location_t = 0);
|
||||
extern int _cpp_warn_if_unused_macro (cpp_reader *, cpp_hashnode *, void *);
|
||||
extern void _cpp_push_token_context (cpp_reader *, cpp_hashnode *,
|
||||
const cpp_token *, unsigned int);
|
||||
|
@ -659,14 +659,14 @@ extern void _cpp_destroy_hashtable (cpp_reader *);
|
|||
/* In files.c */
|
||||
typedef struct _cpp_file _cpp_file;
|
||||
extern _cpp_file *_cpp_find_file (cpp_reader *, const char *, cpp_dir *,
|
||||
bool, int, bool, source_location);
|
||||
bool, int, bool, location_t);
|
||||
extern bool _cpp_find_failed (_cpp_file *);
|
||||
extern void _cpp_mark_file_once_only (cpp_reader *, struct _cpp_file *);
|
||||
extern void _cpp_fake_include (cpp_reader *, const char *);
|
||||
extern bool _cpp_stack_file (cpp_reader *, _cpp_file*, bool,
|
||||
source_location);
|
||||
location_t);
|
||||
extern bool _cpp_stack_include (cpp_reader *, const char *, int,
|
||||
enum include_type, source_location);
|
||||
enum include_type, location_t);
|
||||
extern int _cpp_compare_file_date (cpp_reader *, const char *, int);
|
||||
extern void _cpp_report_missing_guards (cpp_reader *);
|
||||
extern void _cpp_init_files (cpp_reader *);
|
||||
|
@ -717,7 +717,7 @@ extern int _cpp_handle_directive (cpp_reader *, int);
|
|||
extern void _cpp_define_builtin (cpp_reader *, const char *);
|
||||
extern char ** _cpp_save_pragma_names (cpp_reader *);
|
||||
extern void _cpp_restore_pragma_names (cpp_reader *, char **);
|
||||
extern int _cpp_do__Pragma (cpp_reader *, source_location);
|
||||
extern int _cpp_do__Pragma (cpp_reader *, location_t);
|
||||
extern void _cpp_init_directives (cpp_reader *);
|
||||
extern void _cpp_init_internal_pragmas (cpp_reader *);
|
||||
extern void _cpp_do_file_change (cpp_reader *, enum lc_reason, const char *,
|
||||
|
@ -730,7 +730,7 @@ struct _cpp_dir_only_callbacks
|
|||
{
|
||||
/* Called to print a block of lines. */
|
||||
void (*print_lines) (int, const void *, size_t);
|
||||
bool (*maybe_print_line) (source_location);
|
||||
bool (*maybe_print_line) (location_t);
|
||||
};
|
||||
|
||||
extern void _cpp_preprocess_dir_only (cpp_reader *,
|
||||
|
@ -867,7 +867,7 @@ ufputs (const unsigned char *s, FILE *f)
|
|||
the replacement-list of MACRO. */
|
||||
const line_map_macro *linemap_enter_macro (struct line_maps *,
|
||||
struct cpp_hashnode*,
|
||||
source_location,
|
||||
location_t,
|
||||
unsigned int);
|
||||
|
||||
/* Create and return a virtual location for a token that is part of a
|
||||
|
@ -892,10 +892,10 @@ const line_map_macro *linemap_enter_macro (struct line_maps *,
|
|||
MACRO_DEFINITION_LOC is the location in the macro definition,
|
||||
either of the token itself or of a macro parameter that it
|
||||
replaces. */
|
||||
source_location linemap_add_macro_token (const line_map_macro *,
|
||||
unsigned int,
|
||||
source_location,
|
||||
source_location);
|
||||
location_t linemap_add_macro_token (const line_map_macro *,
|
||||
unsigned int,
|
||||
location_t,
|
||||
location_t);
|
||||
|
||||
/* Return the source line number corresponding to source location
|
||||
LOCATION. SET is the line map set LOCATION comes from. If
|
||||
|
@ -903,7 +903,7 @@ source_location linemap_add_macro_token (const line_map_macro *,
|
|||
expansion-list of a macro expansion return the line number of the
|
||||
macro expansion point. */
|
||||
int linemap_get_expansion_line (struct line_maps *,
|
||||
source_location);
|
||||
location_t);
|
||||
|
||||
/* Return the path of the file corresponding to source code location
|
||||
LOCATION.
|
||||
|
@ -914,7 +914,7 @@ int linemap_get_expansion_line (struct line_maps *,
|
|||
|
||||
SET is the line map set LOCATION comes from. */
|
||||
const char* linemap_get_expansion_filename (struct line_maps *,
|
||||
source_location);
|
||||
location_t);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
|
|
|
@ -1232,7 +1232,7 @@ static int
|
|||
skip_line_comment (cpp_reader *pfile)
|
||||
{
|
||||
cpp_buffer *buffer = pfile->buffer;
|
||||
source_location orig_line = pfile->line_table->highest_line;
|
||||
location_t orig_line = pfile->line_table->highest_line;
|
||||
|
||||
while (*buffer->cur != '\n')
|
||||
buffer->cur++;
|
||||
|
@ -1894,7 +1894,7 @@ lex_raw_string (cpp_reader *pfile, cpp_token *token, const uchar *base,
|
|||
_cpp_process_line_notes (pfile, false);
|
||||
if (!_cpp_get_fresh_line (pfile))
|
||||
{
|
||||
source_location src_loc = token->src_loc;
|
||||
location_t src_loc = token->src_loc;
|
||||
token->type = CPP_EOF;
|
||||
/* Tell the compiler the line number of the EOF token. */
|
||||
token->src_loc = pfile->line_table->highest_line;
|
||||
|
@ -3774,11 +3774,11 @@ cpp_token_val_index (const cpp_token *tok)
|
|||
}
|
||||
|
||||
/* All tokens lexed in R after calling this function will be forced to
|
||||
have their source_location to be P, until
|
||||
have their location_t to be P, until
|
||||
cpp_stop_forcing_token_locations is called for R. */
|
||||
|
||||
void
|
||||
cpp_force_token_locations (cpp_reader *r, source_location loc)
|
||||
cpp_force_token_locations (cpp_reader *r, location_t loc)
|
||||
{
|
||||
r->forced_token_location = loc;
|
||||
}
|
||||
|
|
|
@ -28,21 +28,21 @@ along with this program; see the file COPYING3. If not see
|
|||
|
||||
static void trace_include (const struct line_maps *, const line_map_ordinary *);
|
||||
static const line_map_ordinary * linemap_ordinary_map_lookup (struct line_maps *,
|
||||
source_location);
|
||||
location_t);
|
||||
static const line_map_macro* linemap_macro_map_lookup (struct line_maps *,
|
||||
source_location);
|
||||
static source_location linemap_macro_map_loc_to_def_point
|
||||
(const line_map_macro *, source_location);
|
||||
static source_location linemap_macro_map_loc_to_exp_point
|
||||
(const line_map_macro *, source_location);
|
||||
static source_location linemap_macro_loc_to_spelling_point
|
||||
(struct line_maps *, source_location, const line_map_ordinary **);
|
||||
static source_location linemap_macro_loc_to_def_point (struct line_maps *,
|
||||
source_location,
|
||||
const line_map_ordinary **);
|
||||
static source_location linemap_macro_loc_to_exp_point (struct line_maps *,
|
||||
source_location,
|
||||
const line_map_ordinary **);
|
||||
location_t);
|
||||
static location_t linemap_macro_map_loc_to_def_point
|
||||
(const line_map_macro *, location_t);
|
||||
static location_t linemap_macro_map_loc_to_exp_point
|
||||
(const line_map_macro *, location_t);
|
||||
static location_t linemap_macro_loc_to_spelling_point
|
||||
(struct line_maps *, location_t, const line_map_ordinary **);
|
||||
static location_t linemap_macro_loc_to_def_point (line_maps *,
|
||||
location_t,
|
||||
const line_map_ordinary **);
|
||||
static location_t linemap_macro_loc_to_exp_point (line_maps *,
|
||||
location_t,
|
||||
const line_map_ordinary **);
|
||||
|
||||
/* Counters defined in macro.c. */
|
||||
extern unsigned num_expanded_macros_counter;
|
||||
|
@ -110,16 +110,16 @@ rebuild_location_adhoc_htab (struct line_maps *set)
|
|||
|
||||
/* Helper function for get_combined_adhoc_loc.
|
||||
Can the given LOCUS + SRC_RANGE and DATA pointer be stored compactly
|
||||
within a source_location, without needing to use an ad-hoc location. */
|
||||
within a location_t, without needing to use an ad-hoc location. */
|
||||
|
||||
static bool
|
||||
can_be_stored_compactly_p (struct line_maps *set,
|
||||
source_location locus,
|
||||
location_t locus,
|
||||
source_range src_range,
|
||||
void *data)
|
||||
{
|
||||
/* If there's an ad-hoc pointer, we can't store it directly in the
|
||||
source_location, we need the lookaside. */
|
||||
location_t, we need the lookaside. */
|
||||
if (data)
|
||||
return false;
|
||||
|
||||
|
@ -139,7 +139,7 @@ can_be_stored_compactly_p (struct line_maps *set,
|
|||
|
||||
/* All 3 locations must be within ordinary maps, typically, the same
|
||||
ordinary map. */
|
||||
source_location lowest_macro_loc = LINEMAPS_MACRO_LOWEST_LOCATION (set);
|
||||
location_t lowest_macro_loc = LINEMAPS_MACRO_LOWEST_LOCATION (set);
|
||||
if (locus >= lowest_macro_loc)
|
||||
return false;
|
||||
if (src_range.m_start >= lowest_macro_loc)
|
||||
|
@ -153,9 +153,9 @@ can_be_stored_compactly_p (struct line_maps *set,
|
|||
|
||||
/* Combine LOCUS and DATA to a combined adhoc loc. */
|
||||
|
||||
source_location
|
||||
location_t
|
||||
get_combined_adhoc_loc (struct line_maps *set,
|
||||
source_location locus,
|
||||
location_t locus,
|
||||
source_range src_range,
|
||||
void *data)
|
||||
{
|
||||
|
@ -164,7 +164,7 @@ get_combined_adhoc_loc (struct line_maps *set,
|
|||
|
||||
if (IS_ADHOC_LOC (locus))
|
||||
locus
|
||||
= set->location_adhoc_data_map.data[locus & MAX_SOURCE_LOCATION].locus;
|
||||
= set->location_adhoc_data_map.data[locus & MAX_LOCATION_T].locus;
|
||||
if (locus == 0 && data == NULL)
|
||||
return 0;
|
||||
|
||||
|
@ -186,7 +186,7 @@ get_combined_adhoc_loc (struct line_maps *set,
|
|||
unsigned int col_diff = (int_diff >> ordmap->m_range_bits);
|
||||
if (col_diff < (1U << ordmap->m_range_bits))
|
||||
{
|
||||
source_location packed = locus | col_diff;
|
||||
location_t packed = locus | col_diff;
|
||||
set->num_optimized_ranges++;
|
||||
return packed;
|
||||
}
|
||||
|
@ -243,28 +243,28 @@ get_combined_adhoc_loc (struct line_maps *set,
|
|||
/* Return the data for the adhoc loc. */
|
||||
|
||||
void *
|
||||
get_data_from_adhoc_loc (struct line_maps *set, source_location loc)
|
||||
get_data_from_adhoc_loc (struct line_maps *set, location_t loc)
|
||||
{
|
||||
linemap_assert (IS_ADHOC_LOC (loc));
|
||||
return set->location_adhoc_data_map.data[loc & MAX_SOURCE_LOCATION].data;
|
||||
return set->location_adhoc_data_map.data[loc & MAX_LOCATION_T].data;
|
||||
}
|
||||
|
||||
/* Return the location for the adhoc loc. */
|
||||
|
||||
source_location
|
||||
get_location_from_adhoc_loc (struct line_maps *set, source_location loc)
|
||||
location_t
|
||||
get_location_from_adhoc_loc (struct line_maps *set, location_t loc)
|
||||
{
|
||||
linemap_assert (IS_ADHOC_LOC (loc));
|
||||
return set->location_adhoc_data_map.data[loc & MAX_SOURCE_LOCATION].locus;
|
||||
return set->location_adhoc_data_map.data[loc & MAX_LOCATION_T].locus;
|
||||
}
|
||||
|
||||
/* Return the source_range for adhoc location LOC. */
|
||||
|
||||
static source_range
|
||||
get_range_from_adhoc_loc (struct line_maps *set, source_location loc)
|
||||
get_range_from_adhoc_loc (struct line_maps *set, location_t loc)
|
||||
{
|
||||
linemap_assert (IS_ADHOC_LOC (loc));
|
||||
return set->location_adhoc_data_map.data[loc & MAX_SOURCE_LOCATION].src_range;
|
||||
return set->location_adhoc_data_map.data[loc & MAX_LOCATION_T].src_range;
|
||||
}
|
||||
|
||||
/* Get the source_range of location LOC, either from the ad-hoc
|
||||
|
@ -272,7 +272,7 @@ get_range_from_adhoc_loc (struct line_maps *set, source_location loc)
|
|||
|
||||
source_range
|
||||
get_range_from_loc (struct line_maps *set,
|
||||
source_location loc)
|
||||
location_t loc)
|
||||
{
|
||||
if (IS_ADHOC_LOC (loc))
|
||||
return get_range_from_adhoc_loc (set, loc);
|
||||
|
@ -298,7 +298,7 @@ get_range_from_loc (struct line_maps *set,
|
|||
whether it is an ad-hoc location, or embeds range information. */
|
||||
|
||||
bool
|
||||
pure_location_p (line_maps *set, source_location loc)
|
||||
pure_location_p (line_maps *set, location_t loc)
|
||||
{
|
||||
if (IS_ADHOC_LOC (loc))
|
||||
return false;
|
||||
|
@ -317,12 +317,12 @@ pure_location_p (line_maps *set, source_location loc)
|
|||
/* Given location LOC within SET, strip away any packed range information
|
||||
or ad-hoc information. */
|
||||
|
||||
source_location
|
||||
get_pure_location (line_maps *set, source_location loc)
|
||||
location_t
|
||||
get_pure_location (line_maps *set, location_t loc)
|
||||
{
|
||||
if (IS_ADHOC_LOC (loc))
|
||||
loc
|
||||
= set->location_adhoc_data_map.data[loc & MAX_SOURCE_LOCATION].locus;
|
||||
= set->location_adhoc_data_map.data[loc & MAX_LOCATION_T].locus;
|
||||
|
||||
if (loc >= LINEMAPS_MACRO_LOWEST_LOCATION (set))
|
||||
return loc;
|
||||
|
@ -340,7 +340,7 @@ get_pure_location (line_maps *set, source_location loc)
|
|||
|
||||
void
|
||||
linemap_init (struct line_maps *set,
|
||||
source_location builtin_location)
|
||||
location_t builtin_location)
|
||||
{
|
||||
#if __GNUC__ == 4 && __GNUC_MINOR__ == 2 && !defined (__clang__)
|
||||
/* PR33916, needed to fix PR82939. */
|
||||
|
@ -386,7 +386,7 @@ linemap_check_files_exited (struct line_maps *set)
|
|||
macro maps are allocated in different memory location. */
|
||||
|
||||
static struct line_map *
|
||||
new_linemap (struct line_maps *set, source_location start_location)
|
||||
new_linemap (struct line_maps *set, location_t start_location)
|
||||
{
|
||||
bool macro_p = start_location >= LINE_MAP_MAX_LOCATION;
|
||||
unsigned num_maps_allocated = LINEMAPS_ALLOCATED (set, macro_p);
|
||||
|
@ -464,7 +464,7 @@ linemap_add (struct line_maps *set, enum lc_reason reason,
|
|||
{
|
||||
/* Generate a start_location above the current highest_location.
|
||||
If possible, make the low range bits be zero. */
|
||||
source_location start_location;
|
||||
location_t start_location;
|
||||
if (set->highest_location < LINE_MAP_MAX_LOCATION_WITH_COLS)
|
||||
{
|
||||
start_location = set->highest_location + (1 << set->default_range_bits);
|
||||
|
@ -610,9 +610,9 @@ linemap_tracks_macro_expansion_locs_p (struct line_maps *set)
|
|||
|
||||
const line_map_macro *
|
||||
linemap_enter_macro (struct line_maps *set, struct cpp_hashnode *macro_node,
|
||||
source_location expansion, unsigned int num_tokens)
|
||||
location_t expansion, unsigned int num_tokens)
|
||||
{
|
||||
source_location start_location
|
||||
location_t start_location
|
||||
= LINEMAPS_MACRO_LOWEST_LOCATION (set) - num_tokens;
|
||||
|
||||
if (start_location < LINE_MAP_MAX_LOCATION)
|
||||
|
@ -624,12 +624,12 @@ linemap_enter_macro (struct line_maps *set, struct cpp_hashnode *macro_node,
|
|||
map->macro = macro_node;
|
||||
map->n_tokens = num_tokens;
|
||||
map->macro_locations
|
||||
= (source_location*) set->reallocator (NULL,
|
||||
= (location_t*) set->reallocator (NULL,
|
||||
2 * num_tokens
|
||||
* sizeof (source_location));
|
||||
* sizeof (location_t));
|
||||
map->expansion = expansion;
|
||||
memset (MACRO_MAP_LOCATIONS (map), 0,
|
||||
2 * num_tokens * sizeof (source_location));
|
||||
2 * num_tokens * sizeof (location_t));
|
||||
|
||||
LINEMAPS_MACRO_CACHE (set) = LINEMAPS_MACRO_USED (set) - 1;
|
||||
|
||||
|
@ -659,13 +659,13 @@ linemap_enter_macro (struct line_maps *set, struct cpp_hashnode *macro_node,
|
|||
either of the token itself or of a macro parameter that it
|
||||
replaces. */
|
||||
|
||||
source_location
|
||||
location_t
|
||||
linemap_add_macro_token (const line_map_macro *map,
|
||||
unsigned int token_no,
|
||||
source_location orig_loc,
|
||||
source_location orig_parm_replacement_loc)
|
||||
location_t orig_loc,
|
||||
location_t orig_parm_replacement_loc)
|
||||
{
|
||||
source_location result;
|
||||
location_t result;
|
||||
|
||||
linemap_assert (linemap_macro_expansion_map_p (map));
|
||||
linemap_assert (token_no < MACRO_MAP_NUM_MACRO_TOKENS (map));
|
||||
|
@ -677,19 +677,19 @@ linemap_add_macro_token (const line_map_macro *map,
|
|||
return result;
|
||||
}
|
||||
|
||||
/* Return a source_location for the start (i.e. column==0) of
|
||||
/* Return a location_t for the start (i.e. column==0) of
|
||||
(physical) line TO_LINE in the current source file (as in the
|
||||
most recent linemap_add). MAX_COLUMN_HINT is the highest column
|
||||
number we expect to use in this line (but it does not change
|
||||
the highest_location). */
|
||||
|
||||
source_location
|
||||
location_t
|
||||
linemap_line_start (struct line_maps *set, linenum_type to_line,
|
||||
unsigned int max_column_hint)
|
||||
{
|
||||
line_map_ordinary *map = LINEMAPS_LAST_ORDINARY_MAP (set);
|
||||
source_location highest = set->highest_location;
|
||||
source_location r;
|
||||
location_t highest = set->highest_location;
|
||||
location_t r;
|
||||
linenum_type last_line =
|
||||
SOURCE_LINE (map, set->highest_line);
|
||||
int line_delta = to_line - last_line;
|
||||
|
@ -717,7 +717,7 @@ linemap_line_start (struct line_maps *set, linenum_type to_line,
|
|||
|| highest > LINE_MAP_MAX_LOCATION_WITH_COLS)
|
||||
{
|
||||
/* If the column number is ridiculous or we've allocated a huge
|
||||
number of source_locations, give up on column numbers
|
||||
number of location_ts, give up on column numbers
|
||||
(and on packed ranges). */
|
||||
max_column_hint = 0;
|
||||
column_bits = 0;
|
||||
|
@ -782,15 +782,15 @@ linemap_line_start (struct line_maps *set, linenum_type to_line,
|
|||
return r;
|
||||
}
|
||||
|
||||
/* Encode and return a source_location from a column number. The
|
||||
/* Encode and return a location_t from a column number. The
|
||||
source line considered is the last source line used to call
|
||||
linemap_line_start, i.e, the last source line which a location was
|
||||
encoded from. */
|
||||
|
||||
source_location
|
||||
location_t
|
||||
linemap_position_for_column (struct line_maps *set, unsigned int to_column)
|
||||
{
|
||||
source_location r = set->highest_line;
|
||||
location_t r = set->highest_line;
|
||||
|
||||
linemap_assert
|
||||
(!linemap_macro_expansion_map_p (LINEMAPS_LAST_ORDINARY_MAP (set)));
|
||||
|
@ -800,7 +800,7 @@ linemap_position_for_column (struct line_maps *set, unsigned int to_column)
|
|||
if (r > LINE_MAP_MAX_LOCATION_WITH_COLS
|
||||
|| to_column > LINE_MAP_MAX_COLUMN_NUMBER)
|
||||
{
|
||||
/* Running low on source_locations - disable column numbers. */
|
||||
/* Running low on location_ts - disable column numbers. */
|
||||
return r;
|
||||
}
|
||||
else
|
||||
|
@ -833,7 +833,7 @@ linemap_position_for_column (struct line_maps *set, unsigned int to_column)
|
|||
/* Encode and return a source location from a given line and
|
||||
column. */
|
||||
|
||||
source_location
|
||||
location_t
|
||||
linemap_position_for_line_and_column (line_maps *set,
|
||||
const line_map_ordinary *ord_map,
|
||||
linenum_type line,
|
||||
|
@ -841,13 +841,13 @@ linemap_position_for_line_and_column (line_maps *set,
|
|||
{
|
||||
linemap_assert (ORDINARY_MAP_STARTING_LINE_NUMBER (ord_map) <= line);
|
||||
|
||||
source_location r = MAP_START_LOCATION (ord_map);
|
||||
location_t r = MAP_START_LOCATION (ord_map);
|
||||
r += ((line - ORDINARY_MAP_STARTING_LINE_NUMBER (ord_map))
|
||||
<< ord_map->m_column_and_range_bits);
|
||||
if (r <= LINE_MAP_MAX_LOCATION_WITH_COLS)
|
||||
r += ((column & ((1 << ord_map->m_column_and_range_bits) - 1))
|
||||
<< ord_map->m_range_bits);
|
||||
source_location upper_limit = LINEMAPS_MACRO_LOWEST_LOCATION (set);
|
||||
location_t upper_limit = LINEMAPS_MACRO_LOWEST_LOCATION (set);
|
||||
if (r >= upper_limit)
|
||||
r = upper_limit - 1;
|
||||
if (r > set->highest_location)
|
||||
|
@ -855,19 +855,19 @@ linemap_position_for_line_and_column (line_maps *set,
|
|||
return r;
|
||||
}
|
||||
|
||||
/* Encode and return a source_location starting from location LOC and
|
||||
/* Encode and return a location_t starting from location LOC and
|
||||
shifting it by COLUMN_OFFSET columns. This function does not support
|
||||
virtual locations. */
|
||||
|
||||
source_location
|
||||
location_t
|
||||
linemap_position_for_loc_and_offset (struct line_maps *set,
|
||||
source_location loc,
|
||||
location_t loc,
|
||||
unsigned int column_offset)
|
||||
{
|
||||
const line_map_ordinary * map = NULL;
|
||||
|
||||
if (IS_ADHOC_LOC (loc))
|
||||
loc = set->location_adhoc_data_map.data[loc & MAX_SOURCE_LOCATION].locus;
|
||||
loc = set->location_adhoc_data_map.data[loc & MAX_LOCATION_T].locus;
|
||||
|
||||
/* This function does not support virtual locations yet. */
|
||||
if (linemap_location_from_macro_expansion_p (set, loc))
|
||||
|
@ -913,7 +913,7 @@ linemap_position_for_loc_and_offset (struct line_maps *set,
|
|||
if (column >= (1u << (map->m_column_and_range_bits - map->m_range_bits)))
|
||||
return loc;
|
||||
|
||||
source_location r =
|
||||
location_t r =
|
||||
linemap_position_for_line_and_column (set, map, line, column);
|
||||
if (linemap_assert_fails (r <= set->highest_location)
|
||||
|| linemap_assert_fails (map == linemap_lookup (set, r)))
|
||||
|
@ -926,10 +926,10 @@ linemap_position_for_loc_and_offset (struct line_maps *set,
|
|||
ordinary or a macro map), returns that map. */
|
||||
|
||||
const struct line_map*
|
||||
linemap_lookup (struct line_maps *set, source_location line)
|
||||
linemap_lookup (struct line_maps *set, location_t line)
|
||||
{
|
||||
if (IS_ADHOC_LOC (line))
|
||||
line = set->location_adhoc_data_map.data[line & MAX_SOURCE_LOCATION].locus;
|
||||
line = set->location_adhoc_data_map.data[line & MAX_LOCATION_T].locus;
|
||||
if (linemap_location_from_macro_expansion_p (set, line))
|
||||
return linemap_macro_map_lookup (set, line);
|
||||
return linemap_ordinary_map_lookup (set, line);
|
||||
|
@ -941,13 +941,13 @@ linemap_lookup (struct line_maps *set, source_location line)
|
|||
binary search. */
|
||||
|
||||
static const line_map_ordinary *
|
||||
linemap_ordinary_map_lookup (struct line_maps *set, source_location line)
|
||||
linemap_ordinary_map_lookup (struct line_maps *set, location_t line)
|
||||
{
|
||||
unsigned int md, mn, mx;
|
||||
const line_map_ordinary *cached, *result;
|
||||
|
||||
if (IS_ADHOC_LOC (line))
|
||||
line = set->location_adhoc_data_map.data[line & MAX_SOURCE_LOCATION].locus;
|
||||
line = set->location_adhoc_data_map.data[line & MAX_LOCATION_T].locus;
|
||||
|
||||
if (set == NULL || line < RESERVED_LOCATION_COUNT)
|
||||
return NULL;
|
||||
|
@ -989,13 +989,13 @@ linemap_ordinary_map_lookup (struct line_maps *set, source_location line)
|
|||
binary search. */
|
||||
|
||||
static const line_map_macro *
|
||||
linemap_macro_map_lookup (struct line_maps *set, source_location line)
|
||||
linemap_macro_map_lookup (struct line_maps *set, location_t line)
|
||||
{
|
||||
unsigned int md, mn, mx;
|
||||
const struct line_map_macro *cached, *result;
|
||||
|
||||
if (IS_ADHOC_LOC (line))
|
||||
line = set->location_adhoc_data_map.data[line & MAX_SOURCE_LOCATION].locus;
|
||||
line = set->location_adhoc_data_map.data[line & MAX_LOCATION_T].locus;
|
||||
|
||||
linemap_assert (line >= LINEMAPS_MACRO_LOWEST_LOCATION (set));
|
||||
|
||||
|
@ -1045,9 +1045,9 @@ linemap_macro_expansion_map_p (const struct line_map *map)
|
|||
Read the comments of struct line_map and struct line_map_macro in
|
||||
line-map.h to understand what a macro expansion point is. */
|
||||
|
||||
static source_location
|
||||
static location_t
|
||||
linemap_macro_map_loc_to_exp_point (const line_map_macro *map,
|
||||
source_location location ATTRIBUTE_UNUSED)
|
||||
location_t location ATTRIBUTE_UNUSED)
|
||||
{
|
||||
linemap_assert (linemap_macro_expansion_map_p (map)
|
||||
&& location >= MAP_START_LOCATION (map));
|
||||
|
@ -1065,9 +1065,9 @@ linemap_macro_map_loc_to_exp_point (const line_map_macro *map,
|
|||
Return the location of the token at the definition point of the
|
||||
macro. */
|
||||
|
||||
static source_location
|
||||
static location_t
|
||||
linemap_macro_map_loc_to_def_point (const line_map_macro *map,
|
||||
source_location location)
|
||||
location_t location)
|
||||
{
|
||||
unsigned token_no;
|
||||
|
||||
|
@ -1089,10 +1089,10 @@ linemap_macro_map_loc_to_def_point (const line_map_macro *map,
|
|||
|
||||
In other words, this returns the xI location presented in the
|
||||
comments of line_map_macro above. */
|
||||
source_location
|
||||
location_t
|
||||
linemap_macro_map_loc_unwind_toward_spelling (line_maps *set,
|
||||
const line_map_macro* map,
|
||||
source_location location)
|
||||
location_t location)
|
||||
{
|
||||
unsigned token_no;
|
||||
|
||||
|
@ -1120,13 +1120,13 @@ linemap_macro_map_loc_unwind_toward_spelling (line_maps *set,
|
|||
|
||||
int
|
||||
linemap_get_expansion_line (struct line_maps *set,
|
||||
source_location location)
|
||||
location_t location)
|
||||
{
|
||||
const line_map_ordinary *map = NULL;
|
||||
|
||||
if (IS_ADHOC_LOC (location))
|
||||
location = set->location_adhoc_data_map.data[location
|
||||
& MAX_SOURCE_LOCATION].locus;
|
||||
& MAX_LOCATION_T].locus;
|
||||
|
||||
if (location < RESERVED_LOCATION_COUNT)
|
||||
return 0;
|
||||
|
@ -1148,13 +1148,13 @@ linemap_get_expansion_line (struct line_maps *set,
|
|||
|
||||
const char*
|
||||
linemap_get_expansion_filename (struct line_maps *set,
|
||||
source_location location)
|
||||
location_t location)
|
||||
{
|
||||
const struct line_map_ordinary *map = NULL;
|
||||
|
||||
if (IS_ADHOC_LOC (location))
|
||||
location = set->location_adhoc_data_map.data[location
|
||||
& MAX_SOURCE_LOCATION].locus;
|
||||
& MAX_LOCATION_T].locus;
|
||||
|
||||
if (location < RESERVED_LOCATION_COUNT)
|
||||
return NULL;
|
||||
|
@ -1186,13 +1186,13 @@ linemap_map_get_macro_name (const line_map_macro *macro_map)
|
|||
|
||||
int
|
||||
linemap_location_in_system_header_p (struct line_maps *set,
|
||||
source_location location)
|
||||
location_t location)
|
||||
{
|
||||
const struct line_map *map = NULL;
|
||||
|
||||
if (IS_ADHOC_LOC (location))
|
||||
location = set->location_adhoc_data_map.data[location
|
||||
& MAX_SOURCE_LOCATION].locus;
|
||||
& MAX_LOCATION_T].locus;
|
||||
|
||||
if (location < RESERVED_LOCATION_COUNT)
|
||||
return false;
|
||||
|
@ -1211,7 +1211,7 @@ linemap_location_in_system_header_p (struct line_maps *set,
|
|||
const line_map_macro *macro_map = linemap_check_macro (map);
|
||||
|
||||
/* It's a token resulting from a macro expansion. */
|
||||
source_location loc =
|
||||
location_t loc =
|
||||
linemap_macro_map_loc_unwind_toward_spelling (set, macro_map, location);
|
||||
if (loc < RESERVED_LOCATION_COUNT)
|
||||
/* This token might come from a built-in macro. Let's
|
||||
|
@ -1232,11 +1232,11 @@ linemap_location_in_system_header_p (struct line_maps *set,
|
|||
|
||||
bool
|
||||
linemap_location_from_macro_expansion_p (const struct line_maps *set,
|
||||
source_location location)
|
||||
location_t location)
|
||||
{
|
||||
if (IS_ADHOC_LOC (location))
|
||||
location = set->location_adhoc_data_map.data[location
|
||||
& MAX_SOURCE_LOCATION].locus;
|
||||
& MAX_LOCATION_T].locus;
|
||||
|
||||
return IS_MACRO_LOC (location);
|
||||
}
|
||||
|
@ -1248,10 +1248,10 @@ linemap_location_from_macro_expansion_p (const struct line_maps *set,
|
|||
|
||||
static const struct line_map*
|
||||
first_map_in_common_1 (struct line_maps *set,
|
||||
source_location *loc0,
|
||||
source_location *loc1)
|
||||
location_t *loc0,
|
||||
location_t *loc1)
|
||||
{
|
||||
source_location l0 = *loc0, l1 = *loc1;
|
||||
location_t l0 = *loc0, l1 = *loc1;
|
||||
const struct line_map *map0 = linemap_lookup (set, l0),
|
||||
*map1 = linemap_lookup (set, l1);
|
||||
|
||||
|
@ -1290,10 +1290,10 @@ first_map_in_common_1 (struct line_maps *set,
|
|||
|
||||
static const struct line_map*
|
||||
first_map_in_common (struct line_maps *set,
|
||||
source_location loc0,
|
||||
source_location loc1,
|
||||
source_location *res_loc0,
|
||||
source_location *res_loc1)
|
||||
location_t loc0,
|
||||
location_t loc1,
|
||||
location_t *res_loc0,
|
||||
location_t *res_loc1)
|
||||
{
|
||||
*res_loc0 = loc0;
|
||||
*res_loc1 = loc1;
|
||||
|
@ -1308,11 +1308,11 @@ first_map_in_common (struct line_maps *set,
|
|||
|
||||
int
|
||||
linemap_compare_locations (struct line_maps *set,
|
||||
source_location pre,
|
||||
source_location post)
|
||||
location_t pre,
|
||||
location_t post)
|
||||
{
|
||||
bool pre_virtual_p, post_virtual_p;
|
||||
source_location l0 = pre, l1 = post;
|
||||
location_t l0 = pre, l1 = post;
|
||||
|
||||
if (IS_ADHOC_LOC (l0))
|
||||
l0 = get_location_from_adhoc_loc (set, l0);
|
||||
|
@ -1378,9 +1378,9 @@ trace_include (const struct line_maps *set, const line_map_ordinary *map)
|
|||
|
||||
This is a subroutine for linemap_resolve_location. */
|
||||
|
||||
static source_location
|
||||
static location_t
|
||||
linemap_macro_loc_to_spelling_point (struct line_maps *set,
|
||||
source_location location,
|
||||
location_t location,
|
||||
const line_map_ordinary **original_map)
|
||||
{
|
||||
linemap_assert (set && location >= RESERVED_LOCATION_COUNT);
|
||||
|
@ -1412,16 +1412,16 @@ linemap_macro_loc_to_spelling_point (struct line_maps *set,
|
|||
|
||||
This is a subroutine of linemap_resolve_location. */
|
||||
|
||||
static source_location
|
||||
static location_t
|
||||
linemap_macro_loc_to_def_point (struct line_maps *set,
|
||||
source_location location,
|
||||
location_t location,
|
||||
const line_map_ordinary **original_map)
|
||||
{
|
||||
linemap_assert (set && location >= RESERVED_LOCATION_COUNT);
|
||||
|
||||
for (;;)
|
||||
{
|
||||
source_location caret_loc = location;
|
||||
location_t caret_loc = location;
|
||||
if (IS_ADHOC_LOC (caret_loc))
|
||||
caret_loc = get_location_from_adhoc_loc (set, caret_loc);
|
||||
|
||||
|
@ -1454,16 +1454,16 @@ linemap_macro_loc_to_def_point (struct line_maps *set,
|
|||
|
||||
This is a subroutine of linemap_resolve_location. */
|
||||
|
||||
static source_location
|
||||
static location_t
|
||||
linemap_macro_loc_to_exp_point (struct line_maps *set,
|
||||
source_location location,
|
||||
location_t location,
|
||||
const line_map_ordinary **original_map)
|
||||
{
|
||||
struct line_map *map;
|
||||
|
||||
if (IS_ADHOC_LOC (location))
|
||||
location = set->location_adhoc_data_map.data[location
|
||||
& MAX_SOURCE_LOCATION].locus;
|
||||
& MAX_LOCATION_T].locus;
|
||||
|
||||
linemap_assert (set && location >= RESERVED_LOCATION_COUNT);
|
||||
|
||||
|
@ -1529,15 +1529,15 @@ linemap_macro_loc_to_exp_point (struct line_maps *set,
|
|||
resolves to a location reserved for the client code, like
|
||||
UNKNOWN_LOCATION or BUILTINS_LOCATION in GCC. */
|
||||
|
||||
source_location
|
||||
location_t
|
||||
linemap_resolve_location (struct line_maps *set,
|
||||
source_location loc,
|
||||
location_t loc,
|
||||
enum location_resolution_kind lrk,
|
||||
const line_map_ordinary **map)
|
||||
{
|
||||
source_location locus = loc;
|
||||
location_t locus = loc;
|
||||
if (IS_ADHOC_LOC (loc))
|
||||
locus = set->location_adhoc_data_map.data[loc & MAX_SOURCE_LOCATION].locus;
|
||||
locus = set->location_adhoc_data_map.data[loc & MAX_LOCATION_T].locus;
|
||||
|
||||
if (locus < RESERVED_LOCATION_COUNT)
|
||||
{
|
||||
|
@ -1571,7 +1571,7 @@ linemap_resolve_location (struct line_maps *set,
|
|||
|
||||
bool
|
||||
linemap_location_from_macro_definition_p (struct line_maps *set,
|
||||
source_location loc)
|
||||
location_t loc)
|
||||
{
|
||||
if (IS_ADHOC_LOC (loc))
|
||||
loc = get_location_from_adhoc_loc (set, loc);
|
||||
|
@ -1584,13 +1584,13 @@ linemap_location_from_macro_definition_p (struct line_maps *set,
|
|||
const struct line_map_macro *map
|
||||
= linemap_check_macro (linemap_lookup (set, loc));
|
||||
|
||||
source_location s_loc
|
||||
location_t s_loc
|
||||
= linemap_macro_map_loc_unwind_toward_spelling (set, map, loc);
|
||||
if (linemap_location_from_macro_expansion_p (set, s_loc))
|
||||
loc = s_loc;
|
||||
else
|
||||
{
|
||||
source_location def_loc
|
||||
location_t def_loc
|
||||
= linemap_macro_map_loc_to_def_point (map, loc);
|
||||
return s_loc == def_loc;
|
||||
}
|
||||
|
@ -1609,17 +1609,17 @@ linemap_location_from_macro_definition_p (struct line_maps *set,
|
|||
*LOC_MAP must be set to the map of LOC. This function then sets it
|
||||
to the map of the returned location. */
|
||||
|
||||
source_location
|
||||
location_t
|
||||
linemap_unwind_toward_expansion (struct line_maps *set,
|
||||
source_location loc,
|
||||
location_t loc,
|
||||
const struct line_map **map)
|
||||
{
|
||||
source_location resolved_location;
|
||||
location_t resolved_location;
|
||||
const line_map_macro *macro_map = linemap_check_macro (*map);
|
||||
const struct line_map *resolved_map;
|
||||
|
||||
if (IS_ADHOC_LOC (loc))
|
||||
loc = set->location_adhoc_data_map.data[loc & MAX_SOURCE_LOCATION].locus;
|
||||
loc = set->location_adhoc_data_map.data[loc & MAX_LOCATION_T].locus;
|
||||
|
||||
resolved_location =
|
||||
linemap_macro_map_loc_unwind_toward_spelling (set, macro_map, loc);
|
||||
|
@ -1649,17 +1649,17 @@ linemap_unwind_toward_expansion (struct line_maps *set,
|
|||
|
||||
*MAP is set to the map of the returned location if the later is
|
||||
different from LOC. */
|
||||
source_location
|
||||
location_t
|
||||
linemap_unwind_to_first_non_reserved_loc (struct line_maps *set,
|
||||
source_location loc,
|
||||
location_t loc,
|
||||
const struct line_map **map)
|
||||
{
|
||||
source_location resolved_loc;
|
||||
location_t resolved_loc;
|
||||
const struct line_map *map0 = NULL;
|
||||
const line_map_ordinary *map1 = NULL;
|
||||
|
||||
if (IS_ADHOC_LOC (loc))
|
||||
loc = set->location_adhoc_data_map.data[loc & MAX_SOURCE_LOCATION].locus;
|
||||
loc = set->location_adhoc_data_map.data[loc & MAX_LOCATION_T].locus;
|
||||
|
||||
map0 = linemap_lookup (set, loc);
|
||||
if (!linemap_macro_expansion_map_p (map0))
|
||||
|
@ -1696,7 +1696,7 @@ linemap_unwind_to_first_non_reserved_loc (struct line_maps *set,
|
|||
expanded_location
|
||||
linemap_expand_location (struct line_maps *set,
|
||||
const struct line_map *map,
|
||||
source_location loc)
|
||||
location_t loc)
|
||||
|
||||
{
|
||||
expanded_location xloc;
|
||||
|
@ -1705,8 +1705,8 @@ linemap_expand_location (struct line_maps *set,
|
|||
if (IS_ADHOC_LOC (loc))
|
||||
{
|
||||
xloc.data
|
||||
= set->location_adhoc_data_map.data[loc & MAX_SOURCE_LOCATION].data;
|
||||
loc = set->location_adhoc_data_map.data[loc & MAX_SOURCE_LOCATION].locus;
|
||||
= set->location_adhoc_data_map.data[loc & MAX_LOCATION_T].data;
|
||||
loc = set->location_adhoc_data_map.data[loc & MAX_LOCATION_T].locus;
|
||||
}
|
||||
|
||||
if (loc < RESERVED_LOCATION_COUNT)
|
||||
|
@ -1801,16 +1801,16 @@ linemap_dump (FILE *stream, struct line_maps *set, unsigned ix, bool is_macro)
|
|||
|
||||
void
|
||||
linemap_dump_location (struct line_maps *set,
|
||||
source_location loc,
|
||||
location_t loc,
|
||||
FILE *stream)
|
||||
{
|
||||
const line_map_ordinary *map;
|
||||
source_location location;
|
||||
location_t location;
|
||||
const char *path = "", *from = "";
|
||||
int l = -1, c = -1, s = -1, e = -1;
|
||||
|
||||
if (IS_ADHOC_LOC (loc))
|
||||
loc = set->location_adhoc_data_map.data[loc & MAX_SOURCE_LOCATION].locus;
|
||||
loc = set->location_adhoc_data_map.data[loc & MAX_LOCATION_T].locus;
|
||||
|
||||
if (loc == 0)
|
||||
return;
|
||||
|
@ -1852,7 +1852,7 @@ linemap_dump_location (struct line_maps *set,
|
|||
bool
|
||||
linemap_get_file_highest_location (struct line_maps *set,
|
||||
const char *file_name,
|
||||
source_location *loc)
|
||||
location_t *loc)
|
||||
{
|
||||
/* If the set is empty or no ordinary map has been created then
|
||||
there is no file to look for ... */
|
||||
|
@ -1874,7 +1874,7 @@ linemap_get_file_highest_location (struct line_maps *set,
|
|||
/* The highest location for a given map is either the starting
|
||||
location of the next map minus one, or -- if the map is the
|
||||
latest one -- the highest location of the set. */
|
||||
source_location result;
|
||||
location_t result;
|
||||
if (i == (int) set->info_ordinary.used - 1)
|
||||
result = set->highest_location;
|
||||
else
|
||||
|
@ -1915,14 +1915,14 @@ linemap_get_statistics (struct line_maps *set,
|
|||
linemap_assert (linemap_macro_expansion_map_p (cur_map));
|
||||
|
||||
macro_maps_locations_size +=
|
||||
2 * MACRO_MAP_NUM_MACRO_TOKENS (cur_map) * sizeof (source_location);
|
||||
2 * MACRO_MAP_NUM_MACRO_TOKENS (cur_map) * sizeof (location_t);
|
||||
|
||||
for (i = 0; i < 2 * MACRO_MAP_NUM_MACRO_TOKENS (cur_map); i += 2)
|
||||
{
|
||||
if (MACRO_MAP_LOCATIONS (cur_map)[i] ==
|
||||
MACRO_MAP_LOCATIONS (cur_map)[i + 1])
|
||||
duplicated_macro_maps_locations_size +=
|
||||
sizeof (source_location);
|
||||
sizeof (location_t);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1989,7 +1989,7 @@ line_table_dump (FILE *stream, struct line_maps *set, unsigned int num_ordinary,
|
|||
|
||||
/* Construct a rich_location with location LOC as its initial range. */
|
||||
|
||||
rich_location::rich_location (line_maps *set, source_location loc,
|
||||
rich_location::rich_location (line_maps *set, location_t loc,
|
||||
const range_label *label) :
|
||||
m_line_table (set),
|
||||
m_ranges (),
|
||||
|
@ -2012,7 +2012,7 @@ rich_location::~rich_location ()
|
|||
|
||||
/* Get location IDX within this rich_location. */
|
||||
|
||||
source_location
|
||||
location_t
|
||||
rich_location::get_loc (unsigned int idx) const
|
||||
{
|
||||
const location_range *locrange = get_range (idx);
|
||||
|
@ -2075,7 +2075,7 @@ rich_location::override_column (int column)
|
|||
/* Add the given range. */
|
||||
|
||||
void
|
||||
rich_location::add_range (source_location loc,
|
||||
rich_location::add_range (location_t loc,
|
||||
enum range_display_kind range_display_kind,
|
||||
const range_label *label)
|
||||
{
|
||||
|
@ -2100,7 +2100,7 @@ rich_location::add_range (source_location loc,
|
|||
- the "%C" and "%L" format codes in the Fortran frontend. */
|
||||
|
||||
void
|
||||
rich_location::set_range (unsigned int idx, source_location loc,
|
||||
rich_location::set_range (unsigned int idx, location_t loc,
|
||||
enum range_display_kind range_display_kind)
|
||||
{
|
||||
/* We can either overwrite an existing range, or add one exactly
|
||||
|
@ -2136,10 +2136,10 @@ rich_location::add_fixit_insert_before (const char *new_content)
|
|||
immediately before the start of WHERE. */
|
||||
|
||||
void
|
||||
rich_location::add_fixit_insert_before (source_location where,
|
||||
rich_location::add_fixit_insert_before (location_t where,
|
||||
const char *new_content)
|
||||
{
|
||||
source_location start = get_range_from_loc (m_line_table, where).m_start;
|
||||
location_t start = get_range_from_loc (m_line_table, where).m_start;
|
||||
maybe_add_fixit (start, start, new_content);
|
||||
}
|
||||
|
||||
|
@ -2156,11 +2156,11 @@ rich_location::add_fixit_insert_after (const char *new_content)
|
|||
immediately after the end-point of WHERE. */
|
||||
|
||||
void
|
||||
rich_location::add_fixit_insert_after (source_location where,
|
||||
rich_location::add_fixit_insert_after (location_t where,
|
||||
const char *new_content)
|
||||
{
|
||||
source_location finish = get_range_from_loc (m_line_table, where).m_finish;
|
||||
source_location next_loc
|
||||
location_t finish = get_range_from_loc (m_line_table, where).m_finish;
|
||||
location_t next_loc
|
||||
= linemap_position_for_loc_and_offset (m_line_table, finish, 1);
|
||||
|
||||
/* linemap_position_for_loc_and_offset can fail, if so, it returns
|
||||
|
@ -2189,7 +2189,7 @@ rich_location::add_fixit_remove ()
|
|||
the start and finish of WHERE. */
|
||||
|
||||
void
|
||||
rich_location::add_fixit_remove (source_location where)
|
||||
rich_location::add_fixit_remove (location_t where)
|
||||
{
|
||||
source_range range = get_range_from_loc (m_line_table, where);
|
||||
add_fixit_remove (range);
|
||||
|
@ -2219,7 +2219,7 @@ rich_location::add_fixit_replace (const char *new_content)
|
|||
the start and finish of WHERE with NEW_CONTENT. */
|
||||
|
||||
void
|
||||
rich_location::add_fixit_replace (source_location where,
|
||||
rich_location::add_fixit_replace (location_t where,
|
||||
const char *new_content)
|
||||
{
|
||||
source_range range = get_range_from_loc (m_line_table, where);
|
||||
|
@ -2233,11 +2233,11 @@ void
|
|||
rich_location::add_fixit_replace (source_range src_range,
|
||||
const char *new_content)
|
||||
{
|
||||
source_location start = get_pure_location (m_line_table, src_range.m_start);
|
||||
source_location finish = get_pure_location (m_line_table, src_range.m_finish);
|
||||
location_t start = get_pure_location (m_line_table, src_range.m_start);
|
||||
location_t finish = get_pure_location (m_line_table, src_range.m_finish);
|
||||
|
||||
/* Fix-it hints use half-closed ranges, so attempt to offset the endpoint. */
|
||||
source_location next_loc
|
||||
location_t next_loc
|
||||
= linemap_position_for_loc_and_offset (m_line_table, finish, 1);
|
||||
/* linemap_position_for_loc_and_offset can fail, if so, it returns
|
||||
its input value. */
|
||||
|
@ -2268,7 +2268,7 @@ rich_location::get_last_fixit_hint () const
|
|||
Otherwise (the common case), return false. */
|
||||
|
||||
bool
|
||||
rich_location::reject_impossible_fixit (source_location where)
|
||||
rich_location::reject_impossible_fixit (location_t where)
|
||||
{
|
||||
/* Fix-its within a rich_location should either all be suggested, or
|
||||
none of them should be suggested.
|
||||
|
@ -2306,8 +2306,8 @@ rich_location::stop_supporting_fixits ()
|
|||
consolidating into the prior fixit if possible. */
|
||||
|
||||
void
|
||||
rich_location::maybe_add_fixit (source_location start,
|
||||
source_location next_loc,
|
||||
rich_location::maybe_add_fixit (location_t start,
|
||||
location_t next_loc,
|
||||
const char *new_content)
|
||||
{
|
||||
if (reject_impossible_fixit (start))
|
||||
|
@ -2388,8 +2388,8 @@ rich_location::maybe_add_fixit (source_location start,
|
|||
|
||||
/* class fixit_hint. */
|
||||
|
||||
fixit_hint::fixit_hint (source_location start,
|
||||
source_location next_loc,
|
||||
fixit_hint::fixit_hint (location_t start,
|
||||
location_t next_loc,
|
||||
const char *new_content)
|
||||
: m_start (start),
|
||||
m_next_loc (next_loc),
|
||||
|
@ -2427,8 +2427,8 @@ fixit_hint::affects_line_p (const char *file, int line) const
|
|||
Otherwise return false. */
|
||||
|
||||
bool
|
||||
fixit_hint::maybe_append (source_location start,
|
||||
source_location next_loc,
|
||||
fixit_hint::maybe_append (location_t start,
|
||||
location_t next_loc,
|
||||
const char *new_content)
|
||||
{
|
||||
/* For consolidation to be possible, START must be at this hint's
|
||||
|
|
|
@ -20,17 +20,17 @@ extern int foo ();
|
|||
|
||||
|
||||
The undocumented -fdump-internal-locations option outputs this information
|
||||
to stderr, showing what each source_location value means. Source code
|
||||
lines are quoted, showing both per-line source_location values and
|
||||
per-line&column source_location values (written vertically under the
|
||||
to stderr, showing what each location_t value means. Source code
|
||||
lines are quoted, showing both per-line location_t values and
|
||||
per-line&column location_t values (written vertically under the
|
||||
corresponding character of source code).
|
||||
|
||||
VVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVV
|
||||
RESERVED LOCATIONS
|
||||
source_location interval: 0 <= loc < 2
|
||||
location_t interval: 0 <= loc < 2
|
||||
|
||||
ORDINARY MAP: 0
|
||||
source_location interval: 32 <= loc < 64
|
||||
location_t interval: 32 <= loc < 64
|
||||
file: test.c
|
||||
starting at line: 1
|
||||
column bits: 12
|
||||
|
@ -40,21 +40,21 @@ test.c: 1|loc: 32|#include "test.h"
|
|||
|46802468024680246
|
||||
|
||||
ORDINARY MAP: 1
|
||||
source_location interval: 64 <= loc < 96
|
||||
location_t interval: 64 <= loc < 96
|
||||
file: <built-in>
|
||||
starting at line: 0
|
||||
column bits: 0
|
||||
range bits: 0
|
||||
|
||||
ORDINARY MAP: 2
|
||||
source_location interval: 96 <= loc < 128
|
||||
location_t interval: 96 <= loc < 128
|
||||
file: <command-line>
|
||||
starting at line: 0
|
||||
column bits: 0
|
||||
range bits: 0
|
||||
|
||||
ORDINARY MAP: 3
|
||||
source_location interval: 128 <= loc < 160128
|
||||
location_t interval: 128 <= loc < 160128
|
||||
file: /usr/include/stdc-predef.h
|
||||
starting at line: 1
|
||||
column bits: 12
|
||||
|
@ -62,14 +62,14 @@ ORDINARY MAP: 3
|
|||
(contents of /usr/include/stdc-predef.h snipped for brevity)
|
||||
|
||||
ORDINARY MAP: 4
|
||||
source_location interval: 160128 <= loc < 160160
|
||||
location_t interval: 160128 <= loc < 160160
|
||||
file: <command-line>
|
||||
starting at line: 32
|
||||
column bits: 12
|
||||
range bits: 5
|
||||
|
||||
ORDINARY MAP: 5
|
||||
source_location interval: 160160 <= loc < 164256
|
||||
location_t interval: 160160 <= loc < 164256
|
||||
file: test.c
|
||||
starting at line: 1
|
||||
column bits: 12
|
||||
|
@ -81,7 +81,7 @@ test.c: 1|loc:160160|#include "test.h"
|
|||
|24680246802468024
|
||||
|
||||
ORDINARY MAP: 6
|
||||
source_location interval: 164256 <= loc < 173280
|
||||
location_t interval: 164256 <= loc < 173280
|
||||
file: test.h
|
||||
starting at line: 1
|
||||
column bits: 12
|
||||
|
@ -103,7 +103,7 @@ test.h: 3|loc:172448|#define PLUS(A, B) A + B
|
|||
|024680246802468024680246
|
||||
|
||||
ORDINARY MAP: 7
|
||||
source_location interval: 173280 <= loc < 202016
|
||||
location_t interval: 173280 <= loc < 202016
|
||||
file: test.c
|
||||
starting at line: 2
|
||||
column bits: 12
|
||||
|
@ -150,10 +150,10 @@ test.c: 9|loc:201952|}
|
|||
|4
|
||||
|
||||
UNALLOCATED LOCATIONS
|
||||
source_location interval: 202016 <= loc < 2147483633
|
||||
location_t interval: 202016 <= loc < 2147483633
|
||||
|
||||
MACRO 1: PLUS (7 tokens)
|
||||
source_location interval: 2147483633 <= loc < 2147483640
|
||||
location_t interval: 2147483633 <= loc < 2147483640
|
||||
test.c:7:11: note: expansion point is location 194115
|
||||
int b = PLUS (3,4);
|
||||
^~~~
|
||||
|
@ -189,7 +189,7 @@ x-location == y-location == 2947526575 encodes token # 800042942
|
|||
x-location == y-location == 2947526575 encodes token # 800042942
|
||||
|
||||
MACRO 0: PLUS (7 tokens)
|
||||
source_location interval: 2147483640 <= loc < 2147483647
|
||||
location_t interval: 2147483640 <= loc < 2147483647
|
||||
test.c:6:11: note: expansion point is location 190019
|
||||
int a = PLUS (1,2);
|
||||
^~~~
|
||||
|
@ -224,9 +224,9 @@ x-location == y-location == 2947526575 encodes token # 800042935
|
|||
6: 2947526575, 2947526575
|
||||
x-location == y-location == 2947526575 encodes token # 800042935
|
||||
|
||||
MAX_SOURCE_LOCATION
|
||||
source_location interval: 2147483647 <= loc < 2147483648
|
||||
MAX_LOCATION_T
|
||||
location_t interval: 2147483647 <= loc < 2147483648
|
||||
|
||||
AD-HOC LOCATIONS
|
||||
source_location interval: 2147483648 <= loc < 4294967295
|
||||
location_t interval: 2147483648 <= loc < 4294967295
|
||||
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
|
|
138
libcpp/macro.c
138
libcpp/macro.c
|
@ -39,9 +39,9 @@ struct macro_arg
|
|||
const cpp_token *stringified; /* Stringified argument. */
|
||||
unsigned int count; /* # of tokens in argument. */
|
||||
unsigned int expanded_count; /* # of tokens in expanded argument. */
|
||||
source_location *virt_locs; /* Where virtual locations for
|
||||
location_t *virt_locs; /* Where virtual locations for
|
||||
unexpanded tokens are stored. */
|
||||
source_location *expanded_virt_locs; /* Where virtual locations for
|
||||
location_t *expanded_virt_locs; /* Where virtual locations for
|
||||
expanded tokens are
|
||||
stored. */
|
||||
};
|
||||
|
@ -72,7 +72,7 @@ struct macro_arg_token_iter
|
|||
/* A pointer to the "full" location of the current token. If
|
||||
-ftrack-macro-expansion is used this location tracks loci across
|
||||
macro expansion. */
|
||||
const source_location *location_ptr;
|
||||
const location_t *location_ptr;
|
||||
#if CHECKING_P
|
||||
/* The number of times the iterator went forward. This useful only
|
||||
when checking is enabled. */
|
||||
|
@ -235,22 +235,22 @@ class vaopt_state {
|
|||
int m_state;
|
||||
|
||||
/* The location of the paste token. */
|
||||
source_location m_paste_location;
|
||||
location_t m_paste_location;
|
||||
|
||||
/* Location of the __VA_OPT__ token. */
|
||||
source_location m_location;
|
||||
location_t m_location;
|
||||
};
|
||||
|
||||
/* Macro expansion. */
|
||||
|
||||
static int enter_macro_context (cpp_reader *, cpp_hashnode *,
|
||||
const cpp_token *, source_location);
|
||||
const cpp_token *, location_t);
|
||||
static int builtin_macro (cpp_reader *, cpp_hashnode *,
|
||||
source_location, source_location);
|
||||
location_t, location_t);
|
||||
static void push_ptoken_context (cpp_reader *, cpp_hashnode *, _cpp_buff *,
|
||||
const cpp_token **, unsigned int);
|
||||
static void push_extended_tokens_context (cpp_reader *, cpp_hashnode *,
|
||||
_cpp_buff *, source_location *,
|
||||
_cpp_buff *, location_t *,
|
||||
const cpp_token **, unsigned int);
|
||||
static _cpp_buff *collect_args (cpp_reader *, const cpp_hashnode *,
|
||||
_cpp_buff **, unsigned *);
|
||||
|
@ -260,21 +260,21 @@ static void expand_arg (cpp_reader *, macro_arg *);
|
|||
static const cpp_token *new_string_token (cpp_reader *, uchar *, unsigned int);
|
||||
static const cpp_token *stringify_arg (cpp_reader *, macro_arg *);
|
||||
static void paste_all_tokens (cpp_reader *, const cpp_token *);
|
||||
static bool paste_tokens (cpp_reader *, source_location,
|
||||
static bool paste_tokens (cpp_reader *, location_t,
|
||||
const cpp_token **, const cpp_token *);
|
||||
static void alloc_expanded_arg_mem (cpp_reader *, macro_arg *, size_t);
|
||||
static void ensure_expanded_arg_room (cpp_reader *, macro_arg *, size_t, size_t *);
|
||||
static void delete_macro_args (_cpp_buff*, unsigned num_args);
|
||||
static void set_arg_token (macro_arg *, const cpp_token *,
|
||||
source_location, size_t,
|
||||
location_t, size_t,
|
||||
enum macro_arg_token_kind,
|
||||
bool);
|
||||
static const source_location *get_arg_token_location (const macro_arg *,
|
||||
static const location_t *get_arg_token_location (const macro_arg *,
|
||||
enum macro_arg_token_kind);
|
||||
static const cpp_token **arg_token_ptr_at (const macro_arg *,
|
||||
size_t,
|
||||
enum macro_arg_token_kind,
|
||||
source_location **virt_location);
|
||||
location_t **virt_location);
|
||||
|
||||
static void macro_arg_token_iter_init (macro_arg_token_iter *, bool,
|
||||
enum macro_arg_token_kind,
|
||||
|
@ -282,31 +282,31 @@ static void macro_arg_token_iter_init (macro_arg_token_iter *, bool,
|
|||
const cpp_token **);
|
||||
static const cpp_token *macro_arg_token_iter_get_token
|
||||
(const macro_arg_token_iter *it);
|
||||
static source_location macro_arg_token_iter_get_location
|
||||
static location_t macro_arg_token_iter_get_location
|
||||
(const macro_arg_token_iter *);
|
||||
static void macro_arg_token_iter_forward (macro_arg_token_iter *);
|
||||
static _cpp_buff *tokens_buff_new (cpp_reader *, size_t,
|
||||
source_location **);
|
||||
location_t **);
|
||||
static size_t tokens_buff_count (_cpp_buff *);
|
||||
static const cpp_token **tokens_buff_last_token_ptr (_cpp_buff *);
|
||||
static inline const cpp_token **tokens_buff_put_token_to (const cpp_token **,
|
||||
source_location *,
|
||||
location_t *,
|
||||
const cpp_token *,
|
||||
source_location,
|
||||
source_location,
|
||||
location_t,
|
||||
location_t,
|
||||
const line_map_macro *,
|
||||
unsigned int);
|
||||
|
||||
static const cpp_token **tokens_buff_add_token (_cpp_buff *,
|
||||
source_location *,
|
||||
location_t *,
|
||||
const cpp_token *,
|
||||
source_location,
|
||||
source_location,
|
||||
location_t,
|
||||
location_t,
|
||||
const line_map_macro *,
|
||||
unsigned int);
|
||||
static inline void tokens_buff_remove_last_token (_cpp_buff *);
|
||||
static void replace_args (cpp_reader *, cpp_hashnode *, cpp_macro *,
|
||||
macro_arg *, source_location);
|
||||
macro_arg *, location_t);
|
||||
static _cpp_buff *funlike_invocation_p (cpp_reader *, cpp_hashnode *,
|
||||
_cpp_buff **, unsigned *);
|
||||
static cpp_macro *create_iso_definition (cpp_reader *);
|
||||
|
@ -322,8 +322,8 @@ static void check_trad_stringification (cpp_reader *, const cpp_macro *,
|
|||
static bool reached_end_of_context (cpp_context *);
|
||||
static void consume_next_token_from_context (cpp_reader *pfile,
|
||||
const cpp_token **,
|
||||
source_location *);
|
||||
static const cpp_token* cpp_get_token_1 (cpp_reader *, source_location *);
|
||||
location_t *);
|
||||
static const cpp_token* cpp_get_token_1 (cpp_reader *, location_t *);
|
||||
|
||||
static cpp_hashnode* macro_of_context (cpp_context *context);
|
||||
|
||||
|
@ -382,7 +382,7 @@ static const char * const monthnames[] =
|
|||
a builtin macro. */
|
||||
const uchar *
|
||||
_cpp_builtin_macro_text (cpp_reader *pfile, cpp_hashnode *node,
|
||||
source_location loc)
|
||||
location_t loc)
|
||||
{
|
||||
const uchar *result = NULL;
|
||||
linenum_type number = 1;
|
||||
|
@ -587,7 +587,7 @@ _cpp_builtin_macro_text (cpp_reader *pfile, cpp_hashnode *node,
|
|||
point of the macro. */
|
||||
static int
|
||||
builtin_macro (cpp_reader *pfile, cpp_hashnode *node,
|
||||
source_location loc, source_location expand_loc)
|
||||
location_t loc, location_t expand_loc)
|
||||
{
|
||||
const uchar *buf;
|
||||
size_t len;
|
||||
|
@ -623,7 +623,7 @@ builtin_macro (cpp_reader *pfile, cpp_hashnode *node,
|
|||
Create a macro line map and generate a virtual location for
|
||||
the token resulting from the expansion of the built-in
|
||||
macro. */
|
||||
source_location *virt_locs = NULL;
|
||||
location_t *virt_locs = NULL;
|
||||
_cpp_buff *token_buf = tokens_buff_new (pfile, 1, &virt_locs);
|
||||
const line_map_macro * map =
|
||||
linemap_enter_macro (pfile->line_table, node, loc, 1);
|
||||
|
@ -773,7 +773,7 @@ stringify_arg (cpp_reader *pfile, macro_arg *arg)
|
|||
guaranteed to not have the PASTE_LEFT flag set. LOCATION is
|
||||
the virtual location used for error reporting. */
|
||||
static bool
|
||||
paste_tokens (cpp_reader *pfile, source_location location,
|
||||
paste_tokens (cpp_reader *pfile, location_t location,
|
||||
const cpp_token **plhs, const cpp_token *rhs)
|
||||
{
|
||||
unsigned char *buf, *end, *lhsend;
|
||||
|
@ -803,7 +803,7 @@ paste_tokens (cpp_reader *pfile, source_location location,
|
|||
lhs = _cpp_lex_direct (pfile);
|
||||
if (pfile->buffer->cur != pfile->buffer->rlimit)
|
||||
{
|
||||
source_location saved_loc = lhs->src_loc;
|
||||
location_t saved_loc = lhs->src_loc;
|
||||
|
||||
_cpp_pop_buffer (pfile);
|
||||
_cpp_backup_tokens (pfile, 1);
|
||||
|
@ -841,7 +841,7 @@ paste_all_tokens (cpp_reader *pfile, const cpp_token *lhs)
|
|||
{
|
||||
const cpp_token *rhs = NULL;
|
||||
cpp_context *context = pfile->context;
|
||||
source_location virt_loc = 0;
|
||||
location_t virt_loc = 0;
|
||||
|
||||
/* We are expanding a macro and we must have been called on a token
|
||||
that appears at the left hand side of a ## operator. */
|
||||
|
@ -903,7 +903,7 @@ paste_all_tokens (cpp_reader *pfile, const cpp_token *lhs)
|
|||
/* Put the resulting token in its own context. */
|
||||
if (context->tokens_kind == TOKENS_KIND_EXTENDED)
|
||||
{
|
||||
source_location *virt_locs = NULL;
|
||||
location_t *virt_locs = NULL;
|
||||
_cpp_buff *token_buf = tokens_buff_new (pfile, 1, &virt_locs);
|
||||
tokens_buff_add_token (token_buf, virt_locs, lhs,
|
||||
virt_loc, 0, NULL, 0);
|
||||
|
@ -993,7 +993,7 @@ collect_args (cpp_reader *pfile, const cpp_hashnode *node,
|
|||
macro_arg *args, *arg;
|
||||
const cpp_token *token;
|
||||
unsigned int argc;
|
||||
source_location virt_loc;
|
||||
location_t virt_loc;
|
||||
bool track_macro_expansion_p = CPP_OPTION (pfile, track_macro_expansion);
|
||||
unsigned num_args_alloced = 0;
|
||||
|
||||
|
@ -1030,7 +1030,7 @@ collect_args (cpp_reader *pfile, const cpp_hashnode *node,
|
|||
if (track_macro_expansion_p)
|
||||
{
|
||||
virt_locs_capacity = DEFAULT_NUM_TOKENS_PER_MACRO_ARG;
|
||||
arg->virt_locs = XNEWVEC (source_location,
|
||||
arg->virt_locs = XNEWVEC (location_t,
|
||||
virt_locs_capacity);
|
||||
}
|
||||
|
||||
|
@ -1048,7 +1048,7 @@ collect_args (cpp_reader *pfile, const cpp_hashnode *node,
|
|||
&& (ntokens + 2 > virt_locs_capacity))
|
||||
{
|
||||
virt_locs_capacity += ARG_TOKENS_EXTENT;
|
||||
arg->virt_locs = XRESIZEVEC (source_location,
|
||||
arg->virt_locs = XRESIZEVEC (location_t,
|
||||
arg->virt_locs,
|
||||
virt_locs_capacity);
|
||||
}
|
||||
|
@ -1260,7 +1260,7 @@ macro_real_token_count (const cpp_macro *macro)
|
|||
macro. */
|
||||
static int
|
||||
enter_macro_context (cpp_reader *pfile, cpp_hashnode *node,
|
||||
const cpp_token *result, source_location location)
|
||||
const cpp_token *result, location_t location)
|
||||
{
|
||||
/* The presence of a macro invalidates a file's controlling macro. */
|
||||
pfile->mi_valid = false;
|
||||
|
@ -1340,7 +1340,7 @@ enter_macro_context (cpp_reader *pfile, cpp_hashnode *node,
|
|||
unsigned int i;
|
||||
const cpp_token *src = macro->exp.tokens;
|
||||
const line_map_macro *map;
|
||||
source_location *virt_locs = NULL;
|
||||
location_t *virt_locs = NULL;
|
||||
_cpp_buff *macro_tokens
|
||||
= tokens_buff_new (pfile, tokens_count, &virt_locs);
|
||||
|
||||
|
@ -1401,7 +1401,7 @@ enter_macro_context (cpp_reader *pfile, cpp_hashnode *node,
|
|||
pfile->about_to_expand_macro_p = false;
|
||||
/* Handle built-in macros and the _Pragma operator. */
|
||||
{
|
||||
source_location expand_loc;
|
||||
location_t expand_loc;
|
||||
|
||||
if (/* The top-level macro invocation that triggered the expansion
|
||||
we are looking at is with a function-like user macro ... */
|
||||
|
@ -1467,12 +1467,12 @@ delete_macro_args (_cpp_buff *buff, unsigned num_args)
|
|||
tokens, at least. */
|
||||
static void
|
||||
set_arg_token (macro_arg *arg, const cpp_token *token,
|
||||
source_location location, size_t index,
|
||||
location_t location, size_t index,
|
||||
enum macro_arg_token_kind kind,
|
||||
bool track_macro_exp_p)
|
||||
{
|
||||
const cpp_token **token_ptr;
|
||||
source_location *loc = NULL;
|
||||
location_t *loc = NULL;
|
||||
|
||||
token_ptr =
|
||||
arg_token_ptr_at (arg, index, kind,
|
||||
|
@ -1493,13 +1493,13 @@ set_arg_token (macro_arg *arg, const cpp_token *token,
|
|||
/* Get the pointer to the location of the argument token of the
|
||||
function-like macro argument ARG. This function must be called
|
||||
only when we -ftrack-macro-expansion is on. */
|
||||
static const source_location *
|
||||
static const location_t *
|
||||
get_arg_token_location (const macro_arg *arg,
|
||||
enum macro_arg_token_kind kind)
|
||||
{
|
||||
const source_location *loc = NULL;
|
||||
const location_t *loc = NULL;
|
||||
const cpp_token **token_ptr =
|
||||
arg_token_ptr_at (arg, 0, kind, (source_location **) &loc);
|
||||
arg_token_ptr_at (arg, 0, kind, (location_t **) &loc);
|
||||
|
||||
if (token_ptr == NULL)
|
||||
return NULL;
|
||||
|
@ -1516,7 +1516,7 @@ get_arg_token_location (const macro_arg *arg,
|
|||
static const cpp_token **
|
||||
arg_token_ptr_at (const macro_arg *arg, size_t index,
|
||||
enum macro_arg_token_kind kind,
|
||||
source_location **virt_location)
|
||||
location_t **virt_location)
|
||||
{
|
||||
const cpp_token **tokens_ptr = NULL;
|
||||
|
||||
|
@ -1546,7 +1546,7 @@ arg_token_ptr_at (const macro_arg *arg, size_t index,
|
|||
*virt_location = &arg->expanded_virt_locs[index];
|
||||
else if (kind == MACRO_ARG_TOKEN_STRINGIFIED)
|
||||
*virt_location =
|
||||
(source_location *) &tokens_ptr[index]->src_loc;
|
||||
(location_t *) &tokens_ptr[index]->src_loc;
|
||||
}
|
||||
return &tokens_ptr[index];
|
||||
}
|
||||
|
@ -1623,7 +1623,7 @@ macro_arg_token_iter_get_token (const macro_arg_token_iter *it)
|
|||
}
|
||||
|
||||
/* Return the location of the token pointed to by the iterator.*/
|
||||
static source_location
|
||||
static location_t
|
||||
macro_arg_token_iter_get_location (const macro_arg_token_iter *it)
|
||||
{
|
||||
#if CHECKING_P
|
||||
|
@ -1720,14 +1720,14 @@ last_token_is (_cpp_buff *buff, const cpp_token **ptr)
|
|||
function-like macro invocation. */
|
||||
static void
|
||||
replace_args (cpp_reader *pfile, cpp_hashnode *node, cpp_macro *macro,
|
||||
macro_arg *args, source_location expansion_point_loc)
|
||||
macro_arg *args, location_t expansion_point_loc)
|
||||
{
|
||||
unsigned int i, total;
|
||||
const cpp_token *src, *limit;
|
||||
const cpp_token **first = NULL;
|
||||
macro_arg *arg;
|
||||
_cpp_buff *buff = NULL;
|
||||
source_location *virt_locs = NULL;
|
||||
location_t *virt_locs = NULL;
|
||||
unsigned int exp_count;
|
||||
const line_map_macro *map = NULL;
|
||||
int track_macro_exp;
|
||||
|
@ -1797,7 +1797,7 @@ replace_args (cpp_reader *pfile, cpp_hashnode *node, cpp_macro *macro,
|
|||
|
||||
As far as tokens are concerned, the memory overhead of
|
||||
-ftrack-macro-expansion is proportional to the number of
|
||||
macros that get expanded multiplied by sizeof (source_location).
|
||||
macros that get expanded multiplied by sizeof (location_t).
|
||||
The good news is that extra memory gets freed when the macro
|
||||
context is freed, i.e shortly after the macro got expanded. */
|
||||
|
||||
|
@ -2216,7 +2216,7 @@ static void
|
|||
push_extended_tokens_context (cpp_reader *pfile,
|
||||
cpp_hashnode *macro,
|
||||
_cpp_buff *token_buff,
|
||||
source_location *virt_locs,
|
||||
location_t *virt_locs,
|
||||
const cpp_token **first,
|
||||
unsigned int count)
|
||||
{
|
||||
|
@ -2262,13 +2262,13 @@ _cpp_push_text_context (cpp_reader *pfile, cpp_hashnode *macro,
|
|||
expansion. */
|
||||
static _cpp_buff*
|
||||
tokens_buff_new (cpp_reader *pfile, size_t len,
|
||||
source_location **virt_locs)
|
||||
location_t **virt_locs)
|
||||
{
|
||||
size_t tokens_size = len * sizeof (cpp_token *);
|
||||
size_t locs_size = len * sizeof (source_location);
|
||||
size_t locs_size = len * sizeof (location_t);
|
||||
|
||||
if (virt_locs != NULL)
|
||||
*virt_locs = XNEWVEC (source_location, locs_size);
|
||||
*virt_locs = XNEWVEC (location_t, locs_size);
|
||||
return _cpp_get_buff (pfile, tokens_size);
|
||||
}
|
||||
|
||||
|
@ -2325,14 +2325,14 @@ tokens_buff_remove_last_token (_cpp_buff *tokens_buff)
|
|||
point. */
|
||||
static inline const cpp_token **
|
||||
tokens_buff_put_token_to (const cpp_token **dest,
|
||||
source_location *virt_loc_dest,
|
||||
location_t *virt_loc_dest,
|
||||
const cpp_token *token,
|
||||
source_location virt_loc,
|
||||
source_location parm_def_loc,
|
||||
location_t virt_loc,
|
||||
location_t parm_def_loc,
|
||||
const line_map_macro *map,
|
||||
unsigned int macro_token_index)
|
||||
{
|
||||
source_location macro_loc = virt_loc;
|
||||
location_t macro_loc = virt_loc;
|
||||
const cpp_token **result;
|
||||
|
||||
if (virt_loc_dest)
|
||||
|
@ -2370,15 +2370,15 @@ tokens_buff_put_token_to (const cpp_token **dest,
|
|||
position of the token coming right after the insertion point. */
|
||||
static const cpp_token **
|
||||
tokens_buff_add_token (_cpp_buff *buffer,
|
||||
source_location *virt_locs,
|
||||
location_t *virt_locs,
|
||||
const cpp_token *token,
|
||||
source_location virt_loc,
|
||||
source_location parm_def_loc,
|
||||
location_t virt_loc,
|
||||
location_t parm_def_loc,
|
||||
const line_map_macro *map,
|
||||
unsigned int macro_token_index)
|
||||
{
|
||||
const cpp_token **result;
|
||||
source_location *virt_loc_dest = NULL;
|
||||
location_t *virt_loc_dest = NULL;
|
||||
unsigned token_index =
|
||||
(BUFF_FRONT (buffer) - buffer->base) / sizeof (cpp_token *);
|
||||
|
||||
|
@ -2410,7 +2410,7 @@ alloc_expanded_arg_mem (cpp_reader *pfile, macro_arg *arg, size_t capacity)
|
|||
|
||||
arg->expanded = XNEWVEC (const cpp_token *, capacity);
|
||||
if (CPP_OPTION (pfile, track_macro_expansion))
|
||||
arg->expanded_virt_locs = XNEWVEC (source_location, capacity);
|
||||
arg->expanded_virt_locs = XNEWVEC (location_t, capacity);
|
||||
|
||||
}
|
||||
|
||||
|
@ -2432,9 +2432,9 @@ ensure_expanded_arg_room (cpp_reader *pfile, macro_arg *arg,
|
|||
if (CPP_OPTION (pfile, track_macro_expansion))
|
||||
{
|
||||
if (arg->expanded_virt_locs == NULL)
|
||||
arg->expanded_virt_locs = XNEWVEC (source_location, size);
|
||||
arg->expanded_virt_locs = XNEWVEC (location_t, size);
|
||||
else
|
||||
arg->expanded_virt_locs = XRESIZEVEC (source_location,
|
||||
arg->expanded_virt_locs = XRESIZEVEC (location_t,
|
||||
arg->expanded_virt_locs,
|
||||
size);
|
||||
}
|
||||
|
@ -2477,7 +2477,7 @@ expand_arg (cpp_reader *pfile, macro_arg *arg)
|
|||
for (;;)
|
||||
{
|
||||
const cpp_token *token;
|
||||
source_location location;
|
||||
location_t location;
|
||||
|
||||
ensure_expanded_arg_room (pfile, arg, arg->expanded_count + 1,
|
||||
&capacity);
|
||||
|
@ -2616,7 +2616,7 @@ reached_end_of_context (cpp_context *context)
|
|||
static inline void
|
||||
consume_next_token_from_context (cpp_reader *pfile,
|
||||
const cpp_token ** token,
|
||||
source_location *location)
|
||||
location_t *location)
|
||||
{
|
||||
cpp_context *c = pfile->context;
|
||||
|
||||
|
@ -2655,8 +2655,8 @@ consume_next_token_from_context (cpp_reader *pfile,
|
|||
location if we are in the traditional mode, and just returns
|
||||
LOCATION otherwise. */
|
||||
|
||||
static inline source_location
|
||||
maybe_adjust_loc_for_trad_cpp (cpp_reader *pfile, source_location location)
|
||||
static inline location_t
|
||||
maybe_adjust_loc_for_trad_cpp (cpp_reader *pfile, location_t location)
|
||||
{
|
||||
if (CPP_OPTION (pfile, traditional))
|
||||
{
|
||||
|
@ -2681,12 +2681,12 @@ maybe_adjust_loc_for_trad_cpp (cpp_reader *pfile, source_location location)
|
|||
cpp_get_token_with_location to learn more about the meaning of this
|
||||
location. */
|
||||
static const cpp_token*
|
||||
cpp_get_token_1 (cpp_reader *pfile, source_location *location)
|
||||
cpp_get_token_1 (cpp_reader *pfile, location_t *location)
|
||||
{
|
||||
const cpp_token *result;
|
||||
/* This token is a virtual token that either encodes a location
|
||||
related to macro expansion or a spelling location. */
|
||||
source_location virt_loc = 0;
|
||||
location_t virt_loc = 0;
|
||||
/* pfile->about_to_expand_macro_p can be overriden by indirect calls
|
||||
to functions that push macro contexts. So let's save it so that
|
||||
we can restore it when we are about to leave this routine. */
|
||||
|
@ -2884,7 +2884,7 @@ cpp_get_token (cpp_reader *pfile)
|
|||
location is just the same thing as its spelling location. */
|
||||
|
||||
const cpp_token *
|
||||
cpp_get_token_with_location (cpp_reader *pfile, source_location *loc)
|
||||
cpp_get_token_with_location (cpp_reader *pfile, location_t *loc)
|
||||
{
|
||||
return cpp_get_token_1 (pfile, loc);
|
||||
}
|
||||
|
|
|
@ -437,7 +437,7 @@ _cpp_restore_pushed_macros (cpp_reader *r, FILE *f)
|
|||
return 0;
|
||||
|
||||
p->definition = defn;
|
||||
if (fread (&(p->line), sizeof (source_location), 1, f) != 1)
|
||||
if (fread (&(p->line), sizeof (location_t), 1, f) != 1)
|
||||
return 0;
|
||||
defnlen = 0;
|
||||
if (fread (&defnlen, sizeof (defnlen), 1, f) != 1)
|
||||
|
@ -501,7 +501,7 @@ _cpp_save_pushed_macros (cpp_reader *r, FILE *f)
|
|||
if (fwrite (&defnlen, sizeof (size_t), 1, f) != 1
|
||||
|| fwrite (pp[i]->definition, defnlen, 1, f) != 1)
|
||||
return 0;
|
||||
if (fwrite (&(pp[i]->line), sizeof (source_location), 1, f) != 1)
|
||||
if (fwrite (&(pp[i]->line), sizeof (location_t), 1, f) != 1)
|
||||
return 0;
|
||||
defnlen = 0;
|
||||
defnlen |= (pp[i]->syshdr != 0 ? 1 : 0);
|
||||
|
|
|
@ -60,7 +60,7 @@ struct fun_macro
|
|||
size_t offset;
|
||||
|
||||
/* The line the macro name appeared on. */
|
||||
source_location line;
|
||||
location_t line;
|
||||
|
||||
/* Number of parameters. */
|
||||
unsigned int paramc;
|
||||
|
@ -161,7 +161,7 @@ static const uchar *
|
|||
copy_comment (cpp_reader *pfile, const uchar *cur, int in_define)
|
||||
{
|
||||
bool unterminated, copy = false;
|
||||
source_location src_loc = pfile->line_table->highest_line;
|
||||
location_t src_loc = pfile->line_table->highest_line;
|
||||
cpp_buffer *buffer = pfile->buffer;
|
||||
|
||||
buffer->cur = cur;
|
||||
|
|
Loading…
Add table
Reference in a new issue