summaryrefslogtreecommitdiff
path: root/gcc/fortran/trans-io.c
diff options
context:
space:
mode:
authortkoenig <tkoenig@138bc75d-0d04-0410-961f-82ee72b054a4>2005-09-09 18:21:45 +0000
committertkoenig <tkoenig@138bc75d-0d04-0410-961f-82ee72b054a4>2005-09-09 18:21:45 +0000
commit65f9e5fc730d0ed1763b00efb53144ab9d5b0b1d (patch)
tree56c7562709009df08fd688c5642a73bd009d5144 /gcc/fortran/trans-io.c
parentd14b4c1584e4c22fd175c0932bd93f222403072d (diff)
downloadgcc-65f9e5fc730d0ed1763b00efb53144ab9d5b0b1d.tar.gz
2005-09-09 Thomas Koenig <Thomas.Koenig@online.de>
* gfortran.h: Add iomsg to gfc_open, gfc_close, gfc_filepos, gfc_inquire and gfc_dt. * dump-parse-tree.c (gfc_show_code_node): Add iomsg for open, close, file positioning, inquire and namelist. * io.c (io_tag): Add tag_iomsg. (resolve_tag): Add standards warning for iomsg. (match_open_element): Add iomsg. (gfc_free_open): Add iomsg. (gfc_resolve_open): Add iomsg. (gfc_free_close): Add iomsg. (match_close_element): Add iomsg. (gfc_resolve_close): Add iomsg. (gfc_free_filepos): Add iomsg. (match_file_element): Add iomsg. (gfc_resolve_filepos): Add iostat and iomsg. (match-dt_element): Add iomsg. (gfc_free_dt): Add iomsg. (gfc_resolve_dt): Add iomsg. (gfc_free_inquire): Add iomsg. (match_inquire_element): Add iomsg. (gfc_resolve_inquire): Add iomsg. * trans_io.c: Add ioparm_iomsg and ioparm_iomsg_len. (gfc_build_io_library_fndecls): Add iomsg as last field. (gfc_trans_open): Add iomsg. (gfc_trans_close): Add iomsg. (build_fileos): Call set_string for iomsg. (gfc_trans_inquire): Add iomsg. (build_dt): Add iomsg. 2005-09-09 Thomas Koenig <Thomas.Koenig@online.de> * io/io.h: Add iomsg as last field of st_parameter. * runtime/error.c (generate_error): If iomsg is present, copy the message there. 2005-09-09 Thomas Koenig <Thomas.Koenig@online.de> * gfortran.dg/iomsg_1.f90: New test case. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@104102 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/fortran/trans-io.c')
-rw-r--r--gcc/fortran/trans-io.c28
1 files changed, 27 insertions, 1 deletions
diff --git a/gcc/fortran/trans-io.c b/gcc/fortran/trans-io.c
index b25e80a98f5..e9a9c600f0a 100644
--- a/gcc/fortran/trans-io.c
+++ b/gcc/fortran/trans-io.c
@@ -98,6 +98,8 @@ static GTY(()) tree ioparm_readwrite_len;
static GTY(()) tree ioparm_namelist_name;
static GTY(()) tree ioparm_namelist_name_len;
static GTY(()) tree ioparm_namelist_read_mode;
+static GTY(()) tree ioparm_iomsg;
+static GTY(()) tree ioparm_iomsg_len;
/* The global I/O variables */
@@ -213,6 +215,7 @@ gfc_build_io_library_fndecls (void)
ADD_STRING (namelist_name);
ADD_FIELD (namelist_read_mode, gfc_int4_type_node);
+ ADD_STRING (iomsg);
gfc_finish_type (ioparm_type);
@@ -642,6 +645,10 @@ gfc_trans_open (gfc_code * code)
if (p->pad)
set_string (&block, &post_block, ioparm_pad, ioparm_pad_len, p->pad);
+ if (p->iomsg)
+ set_string (&block, &post_block, ioparm_iomsg, ioparm_iomsg_len,
+ p->iomsg);
+
if (p->iostat)
set_parameter_ref (&block, ioparm_iostat, p->iostat);
@@ -681,6 +688,10 @@ gfc_trans_close (gfc_code * code)
set_string (&block, &post_block, ioparm_status,
ioparm_status_len, p->status);
+ if (p->iomsg)
+ set_string (&block, &post_block, ioparm_iomsg, ioparm_iomsg_len,
+ p->iomsg);
+
if (p->iostat)
set_parameter_ref (&block, ioparm_iostat, p->iostat);
@@ -703,19 +714,24 @@ gfc_trans_close (gfc_code * code)
static tree
build_filepos (tree function, gfc_code * code)
{
- stmtblock_t block;
+ stmtblock_t block, post_block;
gfc_filepos *p;
tree tmp;
p = code->ext.filepos;
gfc_init_block (&block);
+ gfc_init_block (&post_block);
set_error_locus (&block, &code->loc);
if (p->unit)
set_parameter_value (&block, ioparm_unit, p->unit);
+ if (p->iomsg)
+ set_string (&block, &post_block, ioparm_iomsg, ioparm_iomsg_len,
+ p->iomsg);
+
if (p->iostat)
set_parameter_ref (&block, ioparm_iostat, p->iostat);
@@ -725,6 +741,8 @@ build_filepos (tree function, gfc_code * code)
tmp = gfc_build_function_call (function, NULL);
gfc_add_expr_to_block (&block, tmp);
+ gfc_add_block_to_block (&block, &post_block);
+
io_result (&block, p->err, NULL, NULL);
return gfc_finish_block (&block);
@@ -796,6 +814,10 @@ gfc_trans_inquire (gfc_code * code)
if (p->file)
set_string (&block, &post_block, ioparm_file, ioparm_file_len, p->file);
+ if (p->iomsg)
+ set_string (&block, &post_block, ioparm_iomsg, ioparm_iomsg_len,
+ p->iomsg);
+
if (p->iostat)
set_parameter_ref (&block, ioparm_iostat, p->iostat);
@@ -1179,6 +1201,10 @@ build_dt (tree * function, gfc_code * code)
ioparm_format_len, dt->format_label->format);
}
+ if (dt->iomsg)
+ set_string (&block, &post_block, ioparm_iomsg, ioparm_iomsg_len,
+ dt->iomsg);
+
if (dt->iostat)
set_parameter_ref (&block, ioparm_iostat, dt->iostat);