aboutsummaryrefslogtreecommitdiff
path: root/gcc/fortran/trans-io.c
diff options
context:
space:
mode:
authorJanne Blomqvist <jblomqvi@cc.hut.fi>2005-08-08 01:56:19 +0300
committerSteven G. Kargl <kargl@gcc.gnu.org>2005-08-07 22:56:19 +0000
commit6403ec5ff6aa7436ed28d1cdbfaedd30dec78fbe (patch)
tree776ab9ca4e6e1d2bbc7e4ac4d9e56a25dc86106e /gcc/fortran/trans-io.c
parentf18faab7c47ea68f493465631d146e2f4a1ecd29 (diff)
downloadgcc-6403ec5ff6aa7436ed28d1cdbfaedd30dec78fbe.zip
gcc-6403ec5ff6aa7436ed28d1cdbfaedd30dec78fbe.tar.gz
gcc-6403ec5ff6aa7436ed28d1cdbfaedd30dec78fbe.tar.bz2
[multiple changes]
2005-08-07 Janne Blomqvist <jblomqvi@cc.hut.fi> PR fortran/22390 * dump-parse-tree.c (gfc_show_code_node): Add case for FLUSH. * gfortran.h: Add enums for FLUSH. * io.c (gfc_free_filepos,match_file_element,match_filepos): Modify comment appropriately. (gfc_match_flush): New function. * match.c (gfc_match_if): Add match for flush. * match.h: Add prototype. * parse.c (decode_statement): Add flush to 'f' case. (next_statement): Add case for flush. (gfc_ascii_statement): Likewise. * resolve.c (resolve_code): Add flush case. * st.c (gfc_free_statement): Add flush case. * trans-io.c: Add prototype for flush. (gfc_build_io_library_fndecls): Build fndecl for flush. (gfc_trans_flush): New function. * trans-stmt.h: Add prototype. * trans.c (gfc_trans_code): Add case for flush. 2005-08-07 Janne Blomqvist <jblomqvi@cc.hut.fi> PR fortran/22390 * io/backspace.c: File removed, contents moved to ... * io/endfile.c: Ditto. * io/rewind.c: Ditto. * io/file_pos.c: New file, ... here. * Makefile.am: Add file_pos.c to list, remove obsolete files. * Makefile.in: Regenerated. 2005-08-07 Janne Blomqvist <jblomqvi@cc.hut.fi> Steven G. Kargl <kargls@comcast.net> PR fortran/22390 * gfortran.dg/flush_1.f90: New test. Co-Authored-By: Steven G. Kargl <kargls@comcast.net> From-SVN: r102835
Diffstat (limited to 'gcc/fortran/trans-io.c')
-rw-r--r--gcc/fortran/trans-io.c20
1 files changed, 20 insertions, 0 deletions
diff --git a/gcc/fortran/trans-io.c b/gcc/fortran/trans-io.c
index 2af6eb3..b25e80a 100644
--- a/gcc/fortran/trans-io.c
+++ b/gcc/fortran/trans-io.c
@@ -125,6 +125,7 @@ static GTY(()) tree iocall_iolength_done;
static GTY(()) tree iocall_rewind;
static GTY(()) tree iocall_backspace;
static GTY(()) tree iocall_endfile;
+static GTY(()) tree iocall_flush;
static GTY(()) tree iocall_set_nml_val;
static GTY(()) tree iocall_set_nml_val_dim;
@@ -297,6 +298,11 @@ gfc_build_io_library_fndecls (void)
iocall_endfile =
gfc_build_library_function_decl (get_identifier (PREFIX("st_endfile")),
gfc_int4_type_node, 0);
+
+ iocall_flush =
+ gfc_build_library_function_decl (get_identifier (PREFIX("st_flush")),
+ gfc_int4_type_node, 0);
+
/* Library helpers */
iocall_read_done =
@@ -755,6 +761,16 @@ gfc_trans_rewind (gfc_code * code)
}
+/* Translate a FLUSH statement. */
+
+tree
+gfc_trans_flush (gfc_code * code)
+{
+
+ return build_filepos (iocall_flush, code);
+}
+
+
/* Translate the non-IOLENGTH form of an INQUIRE statement. */
tree
@@ -770,6 +786,10 @@ gfc_trans_inquire (gfc_code * code)
set_error_locus (&block, &code->loc);
p = code->ext.inquire;
+ /* Sanity check. */
+ if (p->unit && p->file)
+ gfc_error ("INQUIRE statement at %L cannot contain both FILE and UNIT specifiers.", &code->loc);
+
if (p->unit)
set_parameter_value (&block, ioparm_unit, p->unit);