aboutsummaryrefslogtreecommitdiff
path: root/libgfortran/runtime
diff options
context:
space:
mode:
authorJerry DeLisle <jvdelisle@gcc.gnu.org>2007-06-24 22:56:21 +0000
committerJerry DeLisle <jvdelisle@gcc.gnu.org>2007-06-24 22:56:21 +0000
commit87557722c87bd2ef0905ff061e7b0f990626ec5e (patch)
tree02b1685a81931b1ab370a868e2b201861e6a069c /libgfortran/runtime
parenta49c5793d5df1c90f00aa0419b1f218bb4983fd9 (diff)
downloadgcc-87557722c87bd2ef0905ff061e7b0f990626ec5e.zip
gcc-87557722c87bd2ef0905ff061e7b0f990626ec5e.tar.gz
gcc-87557722c87bd2ef0905ff061e7b0f990626ec5e.tar.bz2
re PR libfortran/32456 (IO error message should show Unit/Filename)
2007-06-24 Jerry DeLisle <jvdelisle@gcc.gnu.org> PR libgfortran/32456 * runtime/error.c (show_locus): Update to emit the unit number and file name involved with the error. Use new function filename_from_unit. * libgfortran.h (filename_from_unit): Declare new function. * io/unit.c (init_units): Set the unit file name for stdin, stdout, and stderr for use later in error reporting. (filename_from_unit): Add this new function. From-SVN: r125989
Diffstat (limited to 'libgfortran/runtime')
-rw-r--r--libgfortran/runtime/error.c14
1 files changed, 14 insertions, 0 deletions
diff --git a/libgfortran/runtime/error.c b/libgfortran/runtime/error.c
index bd3c306..959a44b 100644
--- a/libgfortran/runtime/error.c
+++ b/libgfortran/runtime/error.c
@@ -248,8 +248,22 @@ st_sprintf (char *buffer, const char *format, ...)
void
show_locus (st_parameter_common *cmp)
{
+ static char *filename;
+
if (!options.locus || cmp == NULL || cmp->filename == NULL)
return;
+
+ if (cmp->unit > 0)
+ {
+ filename = filename_from_unit (cmp->unit);
+ if (filename != NULL)
+ {
+ st_printf ("At line %d of file %s (unit = %d, file = '%s')\n",
+ (int) cmp->line, cmp->filename, cmp->unit, filename);
+ free_mem (filename);
+ }
+ return;
+ }
st_printf ("At line %d of file %s\n", (int) cmp->line, cmp->filename);
}