diff options
author | yroux <yroux@138bc75d-0d04-0410-961f-82ee72b054a4> | 2015-04-09 14:24:33 +0000 |
---|---|---|
committer | yroux <yroux@138bc75d-0d04-0410-961f-82ee72b054a4> | 2015-04-09 14:24:33 +0000 |
commit | 467967d123b7d09a181a71d09029bb8806a3a054 (patch) | |
tree | 3e8f30a13e8738acb857a1e1b20c2b132ee4e3ac /libgfortran | |
parent | 9a34e26fcd102eeebf3b51adb3862d26f340dad9 (diff) |
Merge branches/gcc-4_9-branch rev 221939
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/branches/linaro/gcc-4_9-branch@221950 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'libgfortran')
-rw-r--r-- | libgfortran/ChangeLog | 29 | ||||
-rw-r--r-- | libgfortran/io/fbuf.c | 36 | ||||
-rw-r--r-- | libgfortran/io/fbuf.h | 3 | ||||
-rw-r--r-- | libgfortran/io/io.h | 2 | ||||
-rw-r--r-- | libgfortran/io/list_read.c | 1 | ||||
-rw-r--r-- | libgfortran/io/transfer.c | 10 | ||||
-rw-r--r-- | libgfortran/io/write.c | 2 |
7 files changed, 77 insertions, 6 deletions
diff --git a/libgfortran/ChangeLog b/libgfortran/ChangeLog index 6b995493057..2cffa1d4d15 100644 --- a/libgfortran/ChangeLog +++ b/libgfortran/ChangeLog @@ -1,3 +1,32 @@ +2015-03-30 Jerry DeLisle <jvdelisle@gcc.gnu.org> + + * io/transfer.c (data_transfer_init): Fix whitespace. + +2015-03-30 Jerry DeLisle <jvdelisle@gcc.gnu.org> + + PR libgfortran/59513 + * io/transfer.c (data_transfer_init): Do not error for + -std=legacy. + +2015-03-28 Jerry DeLisle <jvdelisle@gcc.gnu.org> + + PR libgfortran/65596 + * io/transfer.c (data_transfer_init): If in namelist mode and + delimiter is not specified, set it to DELIM_QUOTE, independent + of -std. + +2015-03-22 Jerry DeLisle <jvdelisle@gcc.gnu.org> + + PR libgfortran/60956 + Backport from mainline + * io/fbuf.c (fbuf_flush_list): New function that only flushes + if current fbuf position exceeds a limit. + * io/fbuf.h: Declare the new function. + * io/io.h (enum unit_mode): Add two new modes. + * io/list_read.c (list_formatted_read_scalar): Call new function. + * io/write.c: Include fbuf.h. (list_formatted_write_scalar): + Call new function. + 2014-10-30 Release Manager * GCC 4.9.2 released. diff --git a/libgfortran/io/fbuf.c b/libgfortran/io/fbuf.c index 170ce9754c9..0c6ae546518 100644 --- a/libgfortran/io/fbuf.c +++ b/libgfortran/io/fbuf.c @@ -174,6 +174,42 @@ fbuf_flush (gfc_unit * u, unit_mode mode) } +/* The mode argument is LIST_WRITING for write mode and LIST_READING for + read. This should only be used for list directed I/O. + Return value is 0 for success, -1 on failure. */ + +int +fbuf_flush_list (gfc_unit * u, unit_mode mode) +{ + int nwritten; + + if (!u->fbuf) + return 0; + + if (u->fbuf->pos < 524288) /* Upper limit for list writing. */ + return 0; + + fbuf_debug (u, "fbuf_flush_list with mode %d: ", mode); + + if (mode == LIST_WRITING) + { + nwritten = swrite (u->s, u->fbuf->buf, u->fbuf->pos); + if (nwritten < 0) + return -1; + } + + /* Salvage remaining bytes for both reading and writing. */ + if (u->fbuf->act > u->fbuf->pos) + memmove (u->fbuf->buf, u->fbuf->buf + u->fbuf->pos, + u->fbuf->act - u->fbuf->pos); + + u->fbuf->act -= u->fbuf->pos; + u->fbuf->pos = 0; + + return 0; +} + + int fbuf_seek (gfc_unit * u, int off, int whence) { diff --git a/libgfortran/io/fbuf.h b/libgfortran/io/fbuf.h index 253b2adcf84..d9a16111727 100644 --- a/libgfortran/io/fbuf.h +++ b/libgfortran/io/fbuf.h @@ -59,6 +59,9 @@ internal_proto(fbuf_alloc); extern int fbuf_flush (gfc_unit *, unit_mode); internal_proto(fbuf_flush); +extern int fbuf_flush_list (gfc_unit *, unit_mode); +internal_proto(fbuf_flush_list); + extern int fbuf_seek (gfc_unit *, int, int); internal_proto(fbuf_seek); diff --git a/libgfortran/io/io.h b/libgfortran/io/io.h index 3481c83d791..a24727271c0 100644 --- a/libgfortran/io/io.h +++ b/libgfortran/io/io.h @@ -207,7 +207,7 @@ typedef enum unit_advance; typedef enum -{READING, WRITING} +{READING, WRITING, LIST_READING, LIST_WRITING} unit_mode; typedef enum diff --git a/libgfortran/io/list_read.c b/libgfortran/io/list_read.c index b64189afe1f..b95721069cc 100644 --- a/libgfortran/io/list_read.c +++ b/libgfortran/io/list_read.c @@ -2054,6 +2054,7 @@ cleanup: free_line (dtp); hit_eof (dtp); } + fbuf_flush_list (dtp->u.p.current_unit, LIST_READING); return err; } diff --git a/libgfortran/io/transfer.c b/libgfortran/io/transfer.c index 60b6012c789..d7f19420a6c 100644 --- a/libgfortran/io/transfer.c +++ b/libgfortran/io/transfer.c @@ -2533,15 +2533,16 @@ data_transfer_init (st_parameter_dt *dtp, int read_flag) return; } - if (dtp->u.p.current_unit->endfile == AFTER_ENDFILE) - { + if (compile_options.warn_std && + dtp->u.p.current_unit->endfile == AFTER_ENDFILE) + { generate_error (&dtp->common, LIBERROR_OPTION_CONFLICT, "Sequential READ or WRITE not allowed after " "EOF marker, possibly use REWIND or BACKSPACE"); return; } - } + /* Process the ADVANCE option. */ dtp->u.p.advance_status @@ -2674,8 +2675,7 @@ data_transfer_init (st_parameter_dt *dtp, int read_flag) if (dtp->u.p.current_unit->delim_status == DELIM_UNSPECIFIED) { if (ionml && dtp->u.p.current_unit->flags.delim == DELIM_UNSPECIFIED) - dtp->u.p.current_unit->delim_status = - compile_options.allow_std & GFC_STD_GNU ? DELIM_QUOTE : DELIM_NONE; + dtp->u.p.current_unit->delim_status = DELIM_QUOTE; else dtp->u.p.current_unit->delim_status = dtp->u.p.current_unit->flags.delim; } diff --git a/libgfortran/io/write.c b/libgfortran/io/write.c index f76ec673b34..a43dc0309e5 100644 --- a/libgfortran/io/write.c +++ b/libgfortran/io/write.c @@ -25,6 +25,7 @@ see the files COPYING3 and COPYING.RUNTIME respectively. If not, see <http://www.gnu.org/licenses/>. */ #include "io.h" +#include "fbuf.h" #include "format.h" #include "unix.h" #include <assert.h> @@ -1585,6 +1586,7 @@ list_formatted_write_scalar (st_parameter_dt *dtp, bt type, void *p, int kind, internal_error (&dtp->common, "list_formatted_write(): Bad type"); } + fbuf_flush_list (dtp->u.p.current_unit, LIST_WRITING); dtp->u.p.char_flag = (type == BT_CHARACTER); } |