Commit e513a086 by Tobias Burnus Committed by Tobias Burnus

re PR fortran/36342 (Missing file name in compilation diagnostics of preprocessed fortran source)

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.

From-SVN: r137985
parent 95331614
2008-07-19 Tobias Burnus <burnus@net-b.de> 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.
2008-07-19 Tobias Burnus <burnus@net-b.de>
* check.c (gfc_check_cshift,gfc_check_eoshift,gfc_check_unpack): Add rank * check.c (gfc_check_cshift,gfc_check_eoshift,gfc_check_unpack): Add rank
checks for cshift's shift and eoshift's shift and boundary args. checks for cshift's shift and eoshift's shift and boundary args.
(gfc_check_unpack): Add rank and shape tests for unpack. (gfc_check_unpack): Add rank and shape tests for unpack.
......
...@@ -1672,7 +1672,7 @@ preprocessor_line (gfc_char_t *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 /* 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 line. If so, we call load_file() recursively to load the included
...@@ -1743,7 +1743,7 @@ include_line (gfc_char_t *line) ...@@ -1743,7 +1743,7 @@ include_line (gfc_char_t *line)
read by anything else. */ read by anything else. */
filename = gfc_widechar_to_char (begin, -1); filename = gfc_widechar_to_char (begin, -1);
load_file (filename, false); load_file (filename, NULL, false);
gfc_free (filename); gfc_free (filename);
return true; return true;
} }
...@@ -1752,7 +1752,7 @@ include_line (gfc_char_t *line) ...@@ -1752,7 +1752,7 @@ include_line (gfc_char_t *line)
/* Load a file into memory by calling load_line until the file ends. */ /* Load a file into memory by calling load_line until the file ends. */
static try static try
load_file (const char *filename, bool initial) load_file (const char *realfilename, const char *displayedname, bool initial)
{ {
gfc_char_t *line; gfc_char_t *line;
gfc_linebuf *b; gfc_linebuf *b;
...@@ -1760,6 +1760,9 @@ load_file (const char *filename, bool initial) ...@@ -1760,6 +1760,9 @@ load_file (const char *filename, bool initial)
FILE *input; FILE *input;
int len, line_len; int len, line_len;
bool first_line; bool first_line;
const char *filename;
filename = displayedname ? displayedname : realfilename;
for (f = current_file; f; f = f->up) for (f = current_file; f; f = f->up)
if (strcmp (filename, f->filename) == 0) if (strcmp (filename, f->filename) == 0)
...@@ -1776,7 +1779,7 @@ load_file (const char *filename, bool initial) ...@@ -1776,7 +1779,7 @@ load_file (const char *filename, bool initial)
gfc_src_file = NULL; gfc_src_file = NULL;
} }
else else
input = gfc_open_file (filename); input = gfc_open_file (realfilename);
if (input == NULL) if (input == NULL)
{ {
gfc_error_now ("Can't open file '%s'", filename); gfc_error_now ("Can't open file '%s'", filename);
...@@ -1785,7 +1788,7 @@ load_file (const char *filename, bool initial) ...@@ -1785,7 +1788,7 @@ load_file (const char *filename, bool initial)
} }
else else
{ {
input = gfc_open_included_file (filename, false, false); input = gfc_open_included_file (realfilename, false, false);
if (input == NULL) if (input == NULL)
{ {
gfc_error_now ("Can't open included file '%s'", filename); gfc_error_now ("Can't open included file '%s'", filename);
...@@ -1927,10 +1930,10 @@ gfc_new_file (void) ...@@ -1927,10 +1930,10 @@ gfc_new_file (void)
{ {
result = gfc_cpp_preprocess (gfc_source_file); result = gfc_cpp_preprocess (gfc_source_file);
if (!gfc_cpp_preprocess_only ()) 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 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.lb = line_head;
gfc_current_locus.nextc = (line_head == NULL) ? NULL : line_head->line; gfc_current_locus.nextc = (line_head == NULL) ? NULL : line_head->line;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment