diff options
author | Per Bothner <per@bothner.com> | 2004-09-07 07:43:37 -0700 |
---|---|---|
committer | Paul Brook <pbrook@gcc.gnu.org> | 2004-09-07 14:43:37 +0000 |
commit | c8cc8542fa03e78ff3a39734f5dad49b233be54f (patch) | |
tree | 52dd9f205592562d8c793717e022109001b07465 /gcc/fortran/trans.c | |
parent | 5212068fdf32944f8a35909cd5e9eb8d420fbc76 (diff) | |
download | gcc-c8cc8542fa03e78ff3a39734f5dad49b233be54f.zip gcc-c8cc8542fa03e78ff3a39734f5dad49b233be54f.tar.gz gcc-c8cc8542fa03e78ff3a39734f5dad49b233be54f.tar.bz2 |
error.c (show_locus): Handle mapped locations.
2004-09-07 Per Bothner <per@bothner.com>
Paul Brook <paul@codesourcery.com>
* error.c (show_locus): Handle mapped locations.
* f95-lang.c (gfc_be_parse_file): Initialize mapped locations.
* gfortran.h: Include input.h.
(struct gfc_linebuf): Use source_location.
* scanner.c (get_file): Initialize linemap.
(preprocessor_line): Pass extra argument to get_file.
(load_file): Ditto. Setup linemap.
(gfc_new_file): Handle mapped locations.
* trans-common.c (build_field, build_equiv_decl, build_common_decl):
Set decl source locations.
(gfc_trans_common): Set blank common block location.
* trans-decl.c (gfc_set_decl_location): New function.
(gfc_get_label_decl, gfc_get_symbol_decl): Use it.
(trans_function_start): Move call to gfc_set_backend_locus..
(build_function_decl): ... to here.
(build_entry_thunks): Set and restore the backend locus.
(gfc_generate_constructors): Remove excess arguments to
init_function_start.
(gfc_generate_block_data): Add comments. Set the decl locus.
* trans-io.c (set_error_locus): Handle mapped locations.
* trans.c (gfc_get_backend_locus, gfc_get_backend_locus): Ditto.
(gfc_trans_code): Use SET_EXPR_LOCATION.
(gfc_generate_code): Override the location of the new symbol.
* trans.h (gfc_set_decl_location): Add prototype.
Co-Authored-By: Paul Brook <paul@codesourcery.com>
From-SVN: r87142
Diffstat (limited to 'gcc/fortran/trans.c')
-rw-r--r-- | gcc/fortran/trans.c | 15 |
1 files changed, 13 insertions, 2 deletions
diff --git a/gcc/fortran/trans.c b/gcc/fortran/trans.c index 727a7d7..59decfe 100644 --- a/gcc/fortran/trans.c +++ b/gcc/fortran/trans.c @@ -442,7 +442,11 @@ void gfc_get_backend_locus (locus * loc) { loc->lb = gfc_getmem (sizeof (gfc_linebuf)); +#ifdef USE_MAPPED_LOCATION + loc->lb->location = input_location; // FIXME adjust?? +#else loc->lb->linenum = input_line - 1; +#endif loc->lb->file = gfc_current_backend_file; } @@ -452,9 +456,13 @@ gfc_get_backend_locus (locus * loc) void gfc_set_backend_locus (locus * loc) { - input_line = loc->lb->linenum; gfc_current_backend_file = loc->lb->file; +#ifdef USE_MAPPED_LOCATION + input_location = loc->lb->location; +#else + input_line = loc->lb->linenum; input_filename = loc->lb->file->filename; +#endif } @@ -626,7 +634,7 @@ gfc_trans_code (gfc_code * code) if (TREE_CODE (res) == STATEMENT_LIST) annotate_all_with_locus (&res, input_location); else - annotate_with_locus (res, input_location); + SET_EXPR_LOCATION (res, input_location); /* Add the new statemment to the block. */ gfc_add_expr_to_block (&block, res); @@ -665,6 +673,9 @@ gfc_generate_code (gfc_namespace * ns) attr.subroutine = 1; attr.access = ACCESS_PUBLIC; main_program->attr = attr; + /* Set the location to the first line of code. */ + if (ns->code) + main_program->declared_at = ns->code->loc; ns->proc_name = main_program; gfc_commit_symbols (); } |