summaryrefslogtreecommitdiff
path: root/gcc/fortran/scanner.c
diff options
context:
space:
mode:
authorburnus <burnus@138bc75d-0d04-0410-961f-82ee72b054a4>2008-07-19 18:27:00 +0000
committerburnus <burnus@138bc75d-0d04-0410-961f-82ee72b054a4>2008-07-19 18:27:00 +0000
commit85cf1e19389c8522be31c520b7f06c408e40a880 (patch)
treea24c5d579b633edb0a84159e588ab12be43092d5 /gcc/fortran/scanner.c
parent65c05dfdcfbd74e48f5432af9d7561bd4cba5ce9 (diff)
downloadgcc-85cf1e19389c8522be31c520b7f06c408e40a880.tar.gz
2008-07-19 Tobias Burnus <burnus@net-b.de>
PR fortran/36342 * scanner.c (load_file): Add argument to destinguish between true filename and displayed filename. (include_line,gfc_new_file): Adapt accordingly. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@137985 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/fortran/scanner.c')
-rw-r--r--gcc/fortran/scanner.c17
1 files changed, 10 insertions, 7 deletions
diff --git a/gcc/fortran/scanner.c b/gcc/fortran/scanner.c
index 6e6017a9004..3087c62e41b 100644
--- a/gcc/fortran/scanner.c
+++ b/gcc/fortran/scanner.c
@@ -1672,7 +1672,7 @@ preprocessor_line (gfc_char_t *c)
}
-static try load_file (const char *, bool);
+static try load_file (const char *, const char *, bool);
/* include_line()-- Checks a line buffer to see if it is an include
line. If so, we call load_file() recursively to load the included
@@ -1743,7 +1743,7 @@ include_line (gfc_char_t *line)
read by anything else. */
filename = gfc_widechar_to_char (begin, -1);
- load_file (filename, false);
+ load_file (filename, NULL, false);
gfc_free (filename);
return true;
}
@@ -1752,7 +1752,7 @@ include_line (gfc_char_t *line)
/* Load a file into memory by calling load_line until the file ends. */
static try
-load_file (const char *filename, bool initial)
+load_file (const char *realfilename, const char *displayedname, bool initial)
{
gfc_char_t *line;
gfc_linebuf *b;
@@ -1760,6 +1760,9 @@ load_file (const char *filename, bool initial)
FILE *input;
int len, line_len;
bool first_line;
+ const char *filename;
+
+ filename = displayedname ? displayedname : realfilename;
for (f = current_file; f; f = f->up)
if (strcmp (filename, f->filename) == 0)
@@ -1776,7 +1779,7 @@ load_file (const char *filename, bool initial)
gfc_src_file = NULL;
}
else
- input = gfc_open_file (filename);
+ input = gfc_open_file (realfilename);
if (input == NULL)
{
gfc_error_now ("Can't open file '%s'", filename);
@@ -1785,7 +1788,7 @@ load_file (const char *filename, bool initial)
}
else
{
- input = gfc_open_included_file (filename, false, false);
+ input = gfc_open_included_file (realfilename, false, false);
if (input == NULL)
{
gfc_error_now ("Can't open included file '%s'", filename);
@@ -1927,10 +1930,10 @@ gfc_new_file (void)
{
result = gfc_cpp_preprocess (gfc_source_file);
if (!gfc_cpp_preprocess_only ())
- result = load_file (gfc_cpp_temporary_file (), true);
+ result = load_file (gfc_cpp_temporary_file (), gfc_source_file, true);
}
else
- result = load_file (gfc_source_file, true);
+ result = load_file (gfc_source_file, NULL, true);
gfc_current_locus.lb = line_head;
gfc_current_locus.nextc = (line_head == NULL) ? NULL : line_head->line;