2014-09-18 Janne Blomqvist <jb@gcc.gnu.org>
PR libfortran/62768
* io/inquire.c (inquire_via_unit): Use gfc_unit.filename also when
HAVE_TTYNAME{_R} is not defined.
From-SVN: r215338
2014-09-10 Janne Blomqvist <jb@gcc.gnu.org>
* io/transfer.c (read_block_form): Fix pad status check (found by
Thomas Schwinge with -Wlogical-not-parentheses).
From-SVN: r215092
2014-07-20 Jerry DeLisle <jvdelisle@gcc.gnu.org>
PR libgfortran/61632
* io/format.c (format_error): Avoid invalid string pointer by
using the fortran string length values to generate error string.
(parse_format): Allocate the null terminator for the format
string.
From-SVN: r212875
2014-06-28 Jerry DeLisle <jvdelisle@gcc.gnu.org>
PR libgfortran/61640
* io/list_read.c (next_char_internal): Adjust the read length to
a single wide character. (eat_spaces): Add missing paren.
* io/unix.c (mem_read4): Use the correct mem_alloc function for
wide character internal reads.
From-SVN: r212118
2014-06-26 Jerry DeLisle <jvdelisle@gcc.gnu.org>
PR libgfortran/61499
* io/list_read.c (eat_spaces): Use a 'for' loop instead of
'while' loop to skip the loop if there are no bytes left in the
string. Only seek if actual spaces can be skipped.
From-SVN: r212059
2014-05-26 Tobias Burnus <burnus@net-b.de>
PR fortran/55117
* trans-io.c (nml_full_name, transfer_namelist_element): Insert
a '+' rather then '%' to differentiate namelist variable names
that are based on extended derived types.
2014-05-26 Jerry DeLisle <jvdelisle@gcc.gnu.org>
PR libgfortran/55117
* io/list_read.c (extended_look_ahead): New helper function to
scan the namelist name and look for matches with the new '+'
extended type parent indicator. (str_comp_extended): New
helper function to compare the namelist name with the varname
namelist. (find_nml_name): Use the new helper functions to match
the extended type varnames.
From-SVN: r210934
2014-05-23 Jerry DeLisle <jvdelisle@gcc.gnu>
PR libfortran/61173
* io/list_read.c (eat_spaces): If the next character pointed to
is a space, don't seek, must be at the end.
From-SVN: r210898
2014-05-17 Jerry DeLisle <jvdelisle@gcc.gnu>
PR libfortran/52539
* io/io.h (gfc_unit): New function pointers *next_char_fn_ptr
and *push_char_fn_ptr.
*io/list_read.c (next_char): Create macro with this name to call
the new function pointer. Split the original next_char function
into three new functions. (next_char_default, next_char_internal,
next_char_utf8): New functions. (push_char): Create macro with
this name to call new function pointer. Split the original
push_char into three new functions. (push_char_default,
push_char_internal, push_char4): New functions. (set_workers):
New function to initilize the function pointers depending on the
type of IO to be performed. (list_formatted_read_scalar): Use
set_workers function. (finish_list_read): Likewise.
(namelist_read): Likewise.
(nml_get_obj_data): Use push_char_default.
From-SVN: r210574
2014-05-16 Janne Blomqvist <jb@gcc.gnu.org>
PR libfortran/61187
* io/unix.c (raw_close): Check if s->fd is -1.
(fd_to_stream): Check return value of fstat(), handle error.
From-SVN: r210527
2014-04-26 Jerry DeLisle <jvdelisle@gcc.gnu>
PR libfortran/52539
* io/list_read.c: Add uchar typedef. (push_char4): New function
to save kind=4 character. (next_char_utf8): New function to read
a single UTF-8 encoded character value. (read_chracter): Update
to use the new functions for reading UTF-8 strings.
(list_formatted_read_scalar): Update to handle list directed
reads of UTF-8 strings. (nml_read_obj): Likewise update for
UTF-8 strings in namelists.
* io/write.c (nml_write_obj): Add kind=4 character support for
namelist writes.
From-SVN: r209828
2014-03-21 Jerry DeLisle <jvdelisle@gcc.gnu>
PR libfortran/60148
* io/transfer.c (data_transfer_init): If std= was specified, set
delim status to DELIM_NONE of no other was specified.
From-SVN: r208759
2014-03-17 Jerry DeLisle <jvdelisle@gcc.gnu>
PR libfortran/46800
* io/list_read.c (list_formatted_read_scalar): Do not use
eat_separator. Explicitly set the comma and end-of-line flags.
Check for END condition from finish_separator.
From-SVN: r208629
2014-03-15 Jerry DeLisle <jvdelisle@gcc.gnu>
PR libfortran/58324
* io/list_read.c (finish_list_read): Read one character to check
for the end of the file. If it is the end, then issue the file
end error message. If not, use eat_line to reach the end
without giving error. The next attempt to read will then
issue the error as described above.
From-SVN: r208591
2014-03-12 Jerry DeLisle <jvdelisle@gcc.gnu>
PR libfortran/38199
* io/read.c (read_decimal): Quickly skip spaces to avoid calls
to next_char.
* io/unit.c (is_trim_ok): New helper function to check various
conditions to see if its OK to trim the internal unit string.
(get_internal_unit): Use LEN_TRIM to shorten selected internal
unit strings for optimizing READ. Enable this optimization for
formatted READ.
* io/list_read.c (finish_list_read): Don't call eat_line for
internal units.
From-SVN: r208528
2014-03-08 Jerry DeLisle <jvdelisle@gcc.gnu>
PR libfortran/38199
* io/list_read.c (next_char): Delete unuseful error checks.
(eat_spaces): For character array reading, skip ahead over
spaces rather than call next_char multiple times.
From-SVN: r208438
2014-03-08 Dominique d'Humieres <dominiq@lps.ens.fr>
PR libgfortran/60128
* io/write_float.def (output_float): Remove unused variable
nzero_real. Replace a double space with a single one.
(determine_en_precision): Fix wrong handling of the EN format.
PR libfortran/60128
* gfortran.dg/fmt_en.f90: New test.
From-SVN: r208423
2014-03-03 Jerry DeLisle <jvdelisle@gcc.gnu>
PR libfortran/60148
* io/inquire.c (inquire_via_unit): In the case of
DELIM_UNSPECIFIED set inquire return string to "NONE".
* io/list_read.c (read_character): In the case of DELIM_NONE and
namelists, complete the character read using the namelist
variable length.
* io/open.c (new_unit): Don't set delim status to none if not
specified so that DELIM_UNSPECIFIED can be used later.
* io/transfer.c (data_transfer_init): For namelist I/O, if the
unit delim status is unspecified set the current status to quote.
Otherwise, set current status to the unit status.
* io/unit.c (get_internel_unit, init_unit): Remember to set
flags_delim initially to DELIM_UNSPECIFIED so defaults come out
correctly.
* io/write.c (write_character): Add a new function argument
"mode" to signify that raw output is to be used vs output with
delimiters. If the mode is set to DELIM (1) proceed with
delimiters. (list_formatted_write_scalar): Write the separator
only if a delimiter was previously specified. Update the call to
write_character with the mode argument given.
(namelist_write_newline): Use the mode argument. (nml_write_obj):
Use the mode argument. Remove use of tmp_delim. Write the
semi-colon or comma correctly only when needed with using
delimiters. Cleanup whitespace.
(namelist_write): If delim is not specified in namelist I/O,
default to using quotes. Get rid of the tmp_delim variable and
use the new mode argument in write_character.
From-SVN: r208302
2014-02-21 Tobias Burnus <burnus@net-b.de>
PR fortran/60286
* libgfortran/io/inquire.c (yes, no): New static const char
* vars.
(inquire_via_unit): Use them. Use OPEN mode instead of using
POSIX's access to query about write=, read= and readwrite=.
2014-02-21 Tobias Burnus <burnus@net-b.de>
PR fortran/60286
* gfortran.dg/inquire_16.f90: New.
From-SVN: r207979
2014-01-11 Jerry DeLisle <jvdelisle@gcc.gnu>
Dominique d'Humieres <dominiq@lps.ens.fr>
Steven G. Kargl <kargl@gcc.gnu.org>
PR libfortran/59700
PR libfortran/59764
* io/io.h (struct st_parameter_dt): Assign expanded_read flag to
unused bit. Define new variable line_buffer_pos.
* io/list_read.c (free_saved, next_char, l_push_char,
read_logical, read_real): Replace use of item_count with
line_buffer_pos for line_buffer look ahead.
(read_logical, read_integer, parse_real, read_real, check_type):
Adjust location of free_line to after generating error messages
to retain the correct item count for the message.
Co-Authored-By: Dominique d'Humieres <dominiq@lps.ens.fr>
Co-Authored-By: Steven G. Kargl <kargl@gcc.gnu.org>
From-SVN: r206553
2013-12-18 Steven G. Kargl <kargl@gcc.gnu.org>
* io/read.c (read_f): Convert assert to runtime error.
2013-12-18 Steven G. Kargl <kargl@gcc.gnu.org>
* gfortran.dg/io_err_1.f90: New test.
From-SVN: r206102
2013-12-16 Jerry DeLisle <jvdelisle@gcc.gnu>
PR libfortran/59419
* io/file_pos.c (st_rewind): Do proper return after
generate_error.
* io/open.c (edit_modes): Move action code inside block that
checks for library ok. (new_unit): Do cleanup after error.
(st_open): Do proper return after error.
* io/transfer.c (data_transfer_init): Likewise.
From-SVN: r206039
2013-11-15 Janne Blomqvist <jb@gcc.gnu.org>
Jerry DeLisle <jvdelisle@gcc.gnu.org>
PR fortran/59108
* io/unix.c (regular_file): Don't set O_CREAT when opening a file
read-only with unknown status. Mask out O_CREAT when falling back
to opening read-only if ACTION= is not set and read-write fails.
Co-Authored-By: Jerry DeLisle <jvdelisle@gcc.gnu.org>
From-SVN: r204864
2013-11-10 Janne Blomqvist <jb@gcc.gnu.org>
* configure.ac: Check presence of mkostemp.
* io/unix.c (set_close_on_exec): New function.
(tempfile_open): Use mkostemp and O_CLOEXEC if available, fallback
to calling set_close_on_exec.
(regular_file): Add O_CLOEXEC to flags if defined.
(open_external): Call set_close_on_exec if O_CLOEXEC is not
defined.
* config.h.in: Regenerated.
* configure: Regenerated.
* Makefile.in: Regenerated.
* aclocal.m4: Regenerated.
From-SVN: r204654
2013-04-01 Jerry DeLisle <jvdelisle@gcc.gnu.org>
PR libfortran/56660
* io/list_read.c (nml_read_obj): Do not reset the read error flag
inside nml_read_obj. If the read error flag is found set just exit.
Fix some whitespace on comments.
(nml_read_obj_data): Reset the read error flag before the first call
to nml_read_object.
From-SVN: r197321
2013-03-31 Jerry DeLisle <jvdelisle@gcc.gnu.org>
PR libfortran/56786
* io/list_read.c (nml_parse_qualifier): Remove spurious next_char call
when checking for EOF. Use error return mechanism when EOF detected.
Do not return false unless parse_err_msg and parse_err_msg_size have
been set. Use hit_eof.
(nml_get_obj_data): Likewise use the correct error mechanism.
* io/transfer.c (hit_eof): Do not set AFTER_ENDFILE if in namelist
mode.
From-SVN: r197290
2013-03-25 Tilo Schwarz <tilo@tilo-schwarz.de>
PR libfortran/52512
* io/list_read.c (nml_parse_qualifier): To check for a derived type
don't use the namelist head element type but the current element type.
(nml_get_obj_data): Add current namelist element type to
nml_parse_qualifier call.
2013-03-25 Tilo Schwarz <tilo@tilo-schwarz.de>
PR libfortran/52512
* gfortran.dg/namelist_79.f90: New.
From-SVN: r197061