Commit c86af7f3 by Janne Blomqvist

PR 45629 Remove usage of setjmp/longjmp

From-SVN: r166180
parent 6f1abb06
2010-11-02 Janne Blomqvist <jb@gcc.gnu.org>
PR libfortran/45629
* io/io.h: Remove setjmp.h include.
(st_parameter_dt): Change last_char to int, remove eof_jump.
* io/list_read.c (next_char): Return EOF instead of jumping.
(unget_char): Use int to be able to handle EOF.
(eat_spaces): Handle EOF return from next_char.
(eat_line): Likewise.
(eat_separator): Handle EOF return from next_char, eat_spaces,
eat_line.
(finish_separator): Likewise.
(convert_integer): Likewise.
(read_logical): Likewise.
(read_integer): Likewise.
(read_character): Likewise.
(parse_real): Likewise.
(read_complex): Likewise.
(read_real): Likewise.
(list_formatted_read_scalar): Likewise.
(list_formatted_read): Likewise.
(finish_list_read): Likewise.
(nml_parse_qualifier): Likewise.
(nml_match_name): Likewise.
(nml_get_obj_data): Likewise.
(namelist_read): Likewise.
* io/transfer.c (data_transfer_init): Initialize last_char.
(finalize_transfer): Remove jmp_buf setup.
2010-10-26 Jerry DeLisle <jvdelisle@gcc.gnu.org>
PR libgfortran/46010
......
......@@ -31,7 +31,6 @@ see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
#include "libgfortran.h"
#include <setjmp.h>
#include <gthr.h>
/* Forward declarations. */
......@@ -427,7 +426,10 @@ typedef struct st_parameter_dt
unsigned format_not_saved : 1;
/* 14 unused bits. */
char last_char;
/* Used for ungetc() style functionality. Possible values
are an unsigned char, EOF, or EOF - 1 used to mark the
field as not valid. */
int last_char;
char nml_delim;
int repeat_count;
......@@ -438,7 +440,6 @@ typedef struct st_parameter_dt
char *scratch;
char *line_buffer;
struct format_data *fmt;
jmp_buf *eof_jump;
namelist_info *ionml;
/* A flag used to identify when a non-standard expanded namelist read
has occurred. */
......
......@@ -2666,7 +2666,10 @@ data_transfer_init (st_parameter_dt *dtp, int read_flag)
else
{
if ((cf & IOPARM_DT_LIST_FORMAT) != 0)
{
dtp->u.p.last_char = EOF - 1;
dtp->u.p.transfer = list_formatted_read;
}
else
dtp->u.p.transfer = formatted_transfer;
}
......@@ -3362,7 +3365,6 @@ next_record (st_parameter_dt *dtp, int done)
static void
finalize_transfer (st_parameter_dt *dtp)
{
jmp_buf eof_jump;
GFC_INTEGER_4 cf = dtp->common.flags;
if ((dtp->common.flags & IOPARM_DT_HAS_SIZE) != 0)
......@@ -3394,13 +3396,6 @@ finalize_transfer (st_parameter_dt *dtp)
if (dtp->u.p.current_unit == NULL)
return;
dtp->u.p.eof_jump = &eof_jump;
if (setjmp (eof_jump))
{
generate_error (&dtp->common, LIBERROR_END, NULL);
return;
}
if ((cf & IOPARM_DT_LIST_FORMAT) != 0 && dtp->u.p.mode == READING)
{
finish_list_read (dtp);
......
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