diff options
author | Thomas Koenig <Thomas.Koenig@online.de> | 2005-09-09 18:21:45 +0000 |
---|---|---|
committer | Thomas Koenig <tkoenig@gcc.gnu.org> | 2005-09-09 18:21:45 +0000 |
commit | 7aba8abebf67491594a3b6274d441bcbf47d894b (patch) | |
tree | 56c7562709009df08fd688c5642a73bd009d5144 /libgfortran | |
parent | 2360a4c1a67232511351afd4986ef9e1e2a73c36 (diff) | |
download | gcc-7aba8abebf67491594a3b6274d441bcbf47d894b.zip gcc-7aba8abebf67491594a3b6274d441bcbf47d894b.tar.gz gcc-7aba8abebf67491594a3b6274d441bcbf47d894b.tar.bz2 |
gfortran.h: Add iomsg to gfc_open, gfc_close, gfc_filepos, gfc_inquire and gfc_dt.
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.
From-SVN: r104102
Diffstat (limited to 'libgfortran')
-rw-r--r-- | libgfortran/ChangeLog | 6 | ||||
-rw-r--r-- | libgfortran/io/io.h | 3 | ||||
-rw-r--r-- | libgfortran/runtime/error.c | 19 |
3 files changed, 20 insertions, 8 deletions
diff --git a/libgfortran/ChangeLog b/libgfortran/ChangeLog index 5edab98..6e45ee0 100644 --- a/libgfortran/ChangeLog +++ b/libgfortran/ChangeLog @@ -1,3 +1,9 @@ +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 Richard Sandiford <richard@codesourcery.com> PR fortran/12840 diff --git a/libgfortran/io/io.h b/libgfortran/io/io.h index 06825df..6f4023b 100644 --- a/libgfortran/io/io.h +++ b/libgfortran/io/io.h @@ -263,6 +263,9 @@ typedef struct CHARACTER (namelist_name); GFC_INTEGER_4 namelist_read_mode; + /* iomsg */ + CHARACTER (iomsg); + #undef CHARACTER } st_parameter; diff --git a/libgfortran/runtime/error.c b/libgfortran/runtime/error.c index 2a84edf..3c1686d 100644 --- a/libgfortran/runtime/error.c +++ b/libgfortran/runtime/error.c @@ -441,10 +441,10 @@ translate_error (int code) /* generate_error()-- Come here when an error happens. This - * subroutine is called if it is possible to continue on after the - * error. If an IOSTAT variable exists, we set it. If the IOSTAT or - * ERR label is present, we return, otherwise we terminate the program - * after print a message. The error code is always required but the + * subroutine is called if it is possible to continue on after the error. + * If an IOSTAT or IOMSG variable exists, we set it. If IOSTAT or + * ERR labels are present, we return, otherwise we terminate the program + * after printing a message. The error code is always required but the * message parameter can be NULL, in which case a string describing * the most recent operating system error is used. */ @@ -455,6 +455,13 @@ generate_error (int family, const char *message) if (ioparm.iostat != NULL) *ioparm.iostat = family; + if (message == NULL) + message = + (family == ERROR_OS) ? get_oserror () : translate_error (family); + + if (ioparm.iomsg) + cf_strcpy (ioparm.iomsg, ioparm.iomsg_len, message); + /* Report status back to the compiler. */ switch (family) { @@ -483,10 +490,6 @@ generate_error (int family, const char *message) /* Terminate the program */ - if (message == NULL) - message = - (family == ERROR_OS) ? get_oserror () : translate_error (family); - runtime_error (message); } |