Commit f5e3ed2d by Janne Blomqvist

Use C99 bool instead of enum try.

2013-03-19  Janne Blomqvist  <jb@gcc.gnu.org>

	* libgfortran.h: Include stdbool.h.
	(enum try): Remove.
	(notify_std): Change return type to bool.
	* intrinsics/chmod.c: Don't include stdbool.h.
	* intrinsics/execute_command_line.c: Likewise.
	* io/format.c: Likewise.
	* io/list_read.c (nml_parse_qualifier): Change return type to bool.
	(nml_read_obj): Likewise.
	(nml_get_obj_data): Likewise.
	* io/transfer.c (read_block_form): Fix comment.
	(write_buf): Change return type to bool.
	* io/write.c: Don't include stdbool.h.
	* io/write_float.def (output_float): Change return type to bool.
	(output_float_FMT_G_ ## x): Change type of result variable.
	* runtime/error.c (notify_std): Change return type to bool.

From-SVN: r196791
parent 7469b1dc
2013-03-19 Janne Blomqvist <jb@gcc.gnu.org>
* libgfortran.h: Include stdbool.h.
(enum try): Remove.
(notify_std): Change return type to bool.
* intrinsics/chmod.c: Don't include stdbool.h.
* intrinsics/execute_command_line.c: Likewise.
* io/format.c: Likewise.
* io/list_read.c (nml_parse_qualifier): Change return type to bool.
(nml_read_obj): Likewise.
(nml_get_obj_data): Likewise.
* io/transfer.c (read_block_form): Fix comment.
(write_buf): Change return type to bool.
* io/write.c: Don't include stdbool.h.
* io/write_float.def (output_float): Change return type to bool.
(output_float_FMT_G_ ## x): Change type of result variable.
* runtime/error.c (notify_std): Change return type to bool.
2013-03-11 Tobias Burnus <burnus@net-b.de> 2013-03-11 Tobias Burnus <burnus@net-b.de>
* io/transfer.c (read_block_direct): Correct condition. * io/transfer.c (read_block_direct): Correct condition.
......
...@@ -27,7 +27,6 @@ see the files COPYING3 and COPYING.RUNTIME respectively. If not, see ...@@ -27,7 +27,6 @@ see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
#if defined(HAVE_SYS_STAT_H) #if defined(HAVE_SYS_STAT_H)
#include <stdbool.h>
#include <string.h> /* For memcpy. */ #include <string.h> /* For memcpy. */
#include <sys/stat.h> /* For stat, chmod and umask. */ #include <sys/stat.h> /* For stat, chmod and umask. */
......
...@@ -25,7 +25,6 @@ see the files COPYING3 and COPYING.RUNTIME respectively. If not, see ...@@ -25,7 +25,6 @@ see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
#include "libgfortran.h" #include "libgfortran.h"
#include <string.h> #include <string.h>
#include <stdbool.h>
#include <stdlib.h> #include <stdlib.h>
#ifdef HAVE_UNISTD_H #ifdef HAVE_UNISTD_H
......
...@@ -31,7 +31,6 @@ see the files COPYING3 and COPYING.RUNTIME respectively. If not, see ...@@ -31,7 +31,6 @@ see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
#include "format.h" #include "format.h"
#include <ctype.h> #include <ctype.h>
#include <string.h> #include <string.h>
#include <stdbool.h>
#include <stdlib.h> #include <stdlib.h>
......
...@@ -2052,7 +2052,7 @@ calls: ...@@ -2052,7 +2052,7 @@ calls:
/* Inputs a rank-dimensional qualifier, which can contain /* Inputs a rank-dimensional qualifier, which can contain
singlets, doublets, triplets or ':' with the standard meanings. */ singlets, doublets, triplets or ':' with the standard meanings. */
static try static bool
nml_parse_qualifier (st_parameter_dt *dtp, descriptor_dimension *ad, nml_parse_qualifier (st_parameter_dt *dtp, descriptor_dimension *ad,
array_loop_spec *ls, int rank, char *parse_err_msg, array_loop_spec *ls, int rank, char *parse_err_msg,
size_t parse_err_msg_size, size_t parse_err_msg_size,
...@@ -2079,7 +2079,7 @@ nml_parse_qualifier (st_parameter_dt *dtp, descriptor_dimension *ad, ...@@ -2079,7 +2079,7 @@ nml_parse_qualifier (st_parameter_dt *dtp, descriptor_dimension *ad,
/* The next character in the stream should be the '('. */ /* The next character in the stream should be the '('. */
if ((c = next_char (dtp)) == EOF) if ((c = next_char (dtp)) == EOF)
return FAILURE; return false;
/* Process the qualifier, by dimension and triplet. */ /* Process the qualifier, by dimension and triplet. */
...@@ -2093,7 +2093,7 @@ nml_parse_qualifier (st_parameter_dt *dtp, descriptor_dimension *ad, ...@@ -2093,7 +2093,7 @@ nml_parse_qualifier (st_parameter_dt *dtp, descriptor_dimension *ad,
/* Process a potential sign. */ /* Process a potential sign. */
if ((c = next_char (dtp)) == EOF) if ((c = next_char (dtp)) == EOF)
return FAILURE; return false;
switch (c) switch (c)
{ {
case '-': case '-':
...@@ -2112,7 +2112,7 @@ nml_parse_qualifier (st_parameter_dt *dtp, descriptor_dimension *ad, ...@@ -2112,7 +2112,7 @@ nml_parse_qualifier (st_parameter_dt *dtp, descriptor_dimension *ad,
for (;;) for (;;)
{ {
if ((c = next_char (dtp)) == EOF) if ((c = next_char (dtp)) == EOF)
return FAILURE; return false;
switch (c) switch (c)
{ {
...@@ -2141,7 +2141,7 @@ nml_parse_qualifier (st_parameter_dt *dtp, descriptor_dimension *ad, ...@@ -2141,7 +2141,7 @@ nml_parse_qualifier (st_parameter_dt *dtp, descriptor_dimension *ad,
case ' ': case '\t': case ' ': case '\t':
eat_spaces (dtp); eat_spaces (dtp);
if ((c = next_char (dtp) == EOF)) if ((c = next_char (dtp) == EOF))
return FAILURE; return false;
break; break;
default: default:
...@@ -2279,11 +2279,11 @@ nml_parse_qualifier (st_parameter_dt *dtp, descriptor_dimension *ad, ...@@ -2279,11 +2279,11 @@ nml_parse_qualifier (st_parameter_dt *dtp, descriptor_dimension *ad,
ls[dim].idx = ls[dim].start; ls[dim].idx = ls[dim].start;
} }
eat_spaces (dtp); eat_spaces (dtp);
return SUCCESS; return true;
err_ret: err_ret:
return FAILURE; return false;
} }
static namelist_info * static namelist_info *
...@@ -2467,7 +2467,7 @@ query_return: ...@@ -2467,7 +2467,7 @@ query_return:
little data to be available. On the other hand, too much data is an little data to be available. On the other hand, too much data is an
error. */ error. */
static try static bool
nml_read_obj (st_parameter_dt *dtp, namelist_info * nl, index_type offset, nml_read_obj (st_parameter_dt *dtp, namelist_info * nl, index_type offset,
namelist_info **pprev_nl, char *nml_err_msg, namelist_info **pprev_nl, char *nml_err_msg,
size_t nml_err_msg_size, index_type clow, index_type chigh) size_t nml_err_msg_size, index_type clow, index_type chigh)
...@@ -2485,7 +2485,7 @@ nml_read_obj (st_parameter_dt *dtp, namelist_info * nl, index_type offset, ...@@ -2485,7 +2485,7 @@ nml_read_obj (st_parameter_dt *dtp, namelist_info * nl, index_type offset,
/* This object not touched in name parsing. */ /* This object not touched in name parsing. */
if (!nl->touched) if (!nl->touched)
return SUCCESS; return true;
dtp->u.p.repeat_count = 0; dtp->u.p.repeat_count = 0;
eat_spaces (dtp); eat_spaces (dtp);
...@@ -2532,11 +2532,11 @@ nml_read_obj (st_parameter_dt *dtp, namelist_info * nl, index_type offset, ...@@ -2532,11 +2532,11 @@ nml_read_obj (st_parameter_dt *dtp, namelist_info * nl, index_type offset,
if (--dtp->u.p.repeat_count <= 0) if (--dtp->u.p.repeat_count <= 0)
{ {
if (dtp->u.p.input_complete) if (dtp->u.p.input_complete)
return SUCCESS; return true;
if (dtp->u.p.at_eol) if (dtp->u.p.at_eol)
finish_separator (dtp); finish_separator (dtp);
if (dtp->u.p.input_complete) if (dtp->u.p.input_complete)
return SUCCESS; return true;
dtp->u.p.saved_type = BT_UNKNOWN; dtp->u.p.saved_type = BT_UNKNOWN;
free_saved (dtp); free_saved (dtp);
...@@ -2590,18 +2590,18 @@ nml_read_obj (st_parameter_dt *dtp, namelist_info * nl, index_type offset, ...@@ -2590,18 +2590,18 @@ nml_read_obj (st_parameter_dt *dtp, namelist_info * nl, index_type offset,
cmp = cmp->next) cmp = cmp->next)
{ {
if (nml_read_obj (dtp, cmp, (index_type)(pdata - nl->mem_pos), if (!nml_read_obj (dtp, cmp, (index_type)(pdata - nl->mem_pos),
pprev_nl, nml_err_msg, nml_err_msg_size, pprev_nl, nml_err_msg, nml_err_msg_size,
clow, chigh) == FAILURE) clow, chigh))
{ {
free (obj_name); free (obj_name);
return FAILURE; return false;
} }
if (dtp->u.p.input_complete) if (dtp->u.p.input_complete)
{ {
free (obj_name); free (obj_name);
return SUCCESS; return true;
} }
} }
...@@ -2625,7 +2625,7 @@ nml_read_obj (st_parameter_dt *dtp, namelist_info * nl, index_type offset, ...@@ -2625,7 +2625,7 @@ nml_read_obj (st_parameter_dt *dtp, namelist_info * nl, index_type offset,
if (dtp->u.p.nml_read_error) if (dtp->u.p.nml_read_error)
{ {
dtp->u.p.expanded_read = 0; dtp->u.p.expanded_read = 0;
return SUCCESS; return true;
} }
if (dtp->u.p.saved_type == BT_UNKNOWN) if (dtp->u.p.saved_type == BT_UNKNOWN)
...@@ -2711,11 +2711,11 @@ incr_idx: ...@@ -2711,11 +2711,11 @@ incr_idx:
"Repeat count too large for namelist object %s", nl->var_name); "Repeat count too large for namelist object %s", nl->var_name);
goto nml_err_ret; goto nml_err_ret;
} }
return SUCCESS; return true;
nml_err_ret: nml_err_ret:
return FAILURE; return false;
} }
/* Parses the object name, including array and substring qualifiers. It /* Parses the object name, including array and substring qualifiers. It
...@@ -2725,7 +2725,7 @@ nml_err_ret: ...@@ -2725,7 +2725,7 @@ nml_err_ret:
touched. nml_read_obj is called at the end and this reads the data in touched. nml_read_obj is called at the end and this reads the data in
the manner specified by the object name. */ the manner specified by the object name. */
static try static bool
nml_get_obj_data (st_parameter_dt *dtp, namelist_info **pprev_nl, nml_get_obj_data (st_parameter_dt *dtp, namelist_info **pprev_nl,
char *nml_err_msg, size_t nml_err_msg_size) char *nml_err_msg, size_t nml_err_msg_size)
{ {
...@@ -2743,20 +2743,20 @@ nml_get_obj_data (st_parameter_dt *dtp, namelist_info **pprev_nl, ...@@ -2743,20 +2743,20 @@ nml_get_obj_data (st_parameter_dt *dtp, namelist_info **pprev_nl,
eat_separator (dtp); eat_separator (dtp);
if (dtp->u.p.input_complete) if (dtp->u.p.input_complete)
return SUCCESS; return true;
if (dtp->u.p.at_eol) if (dtp->u.p.at_eol)
finish_separator (dtp); finish_separator (dtp);
if (dtp->u.p.input_complete) if (dtp->u.p.input_complete)
return SUCCESS; return true;
if ((c = next_char (dtp)) == EOF) if ((c = next_char (dtp)) == EOF)
return FAILURE; return false;
switch (c) switch (c)
{ {
case '=': case '=':
if ((c = next_char (dtp)) == EOF) if ((c = next_char (dtp)) == EOF)
return FAILURE; return false;
if (c != '?') if (c != '?')
{ {
snprintf (nml_err_msg, nml_err_msg_size, snprintf (nml_err_msg, nml_err_msg_size,
...@@ -2764,11 +2764,11 @@ nml_get_obj_data (st_parameter_dt *dtp, namelist_info **pprev_nl, ...@@ -2764,11 +2764,11 @@ nml_get_obj_data (st_parameter_dt *dtp, namelist_info **pprev_nl,
goto nml_err_ret; goto nml_err_ret;
} }
nml_query (dtp, '='); nml_query (dtp, '=');
return SUCCESS; return true;
case '?': case '?':
nml_query (dtp, '?'); nml_query (dtp, '?');
return SUCCESS; return true;
case '$': case '$':
case '&': case '&':
...@@ -2781,7 +2781,7 @@ nml_get_obj_data (st_parameter_dt *dtp, namelist_info **pprev_nl, ...@@ -2781,7 +2781,7 @@ nml_get_obj_data (st_parameter_dt *dtp, namelist_info **pprev_nl,
} }
case '/': case '/':
dtp->u.p.input_complete = 1; dtp->u.p.input_complete = 1;
return SUCCESS; return true;
default : default :
break; break;
...@@ -2806,7 +2806,7 @@ get_name: ...@@ -2806,7 +2806,7 @@ get_name:
if (!is_separator (c)) if (!is_separator (c))
push_char (dtp, tolower(c)); push_char (dtp, tolower(c));
if ((c = next_char (dtp)) == EOF) if ((c = next_char (dtp)) == EOF)
return FAILURE; return false;
} while (!( c=='=' || c==' ' || c=='\t' || c =='(' || c =='%' )); } while (!( c=='=' || c==' ' || c=='\t' || c =='(' || c =='%' ));
unget_char (dtp, c); unget_char (dtp, c);
...@@ -2866,9 +2866,9 @@ get_name: ...@@ -2866,9 +2866,9 @@ get_name:
if (c == '(' && nl->var_rank) if (c == '(' && nl->var_rank)
{ {
parsed_rank = 0; parsed_rank = 0;
if (nml_parse_qualifier (dtp, nl->dim, nl->ls, nl->var_rank, if (!nml_parse_qualifier (dtp, nl->dim, nl->ls, nl->var_rank,
nml_err_msg, nml_err_msg_size, nml_err_msg, nml_err_msg_size,
&parsed_rank) == FAILURE) &parsed_rank))
{ {
char *nml_err_msg_end = strchr (nml_err_msg, '\0'); char *nml_err_msg_end = strchr (nml_err_msg, '\0');
snprintf (nml_err_msg_end, snprintf (nml_err_msg_end,
...@@ -2882,7 +2882,7 @@ get_name: ...@@ -2882,7 +2882,7 @@ get_name:
qualifier_flag = 1; qualifier_flag = 1;
if ((c = next_char (dtp)) == EOF) if ((c = next_char (dtp)) == EOF)
return FAILURE; return false;
unget_char (dtp, c); unget_char (dtp, c);
} }
else if (nl->var_rank > 0) else if (nl->var_rank > 0)
...@@ -2908,7 +2908,7 @@ get_name: ...@@ -2908,7 +2908,7 @@ get_name:
component_flag = 1; component_flag = 1;
if ((c = next_char (dtp)) == EOF) if ((c = next_char (dtp)) == EOF)
return FAILURE; return false;
goto get_name; goto get_name;
} }
...@@ -2923,9 +2923,8 @@ get_name: ...@@ -2923,9 +2923,8 @@ get_name:
descriptor_dimension chd[1] = { {1, clow, nl->string_length} }; descriptor_dimension chd[1] = { {1, clow, nl->string_length} };
array_loop_spec ind[1] = { {1, clow, nl->string_length, 1} }; array_loop_spec ind[1] = { {1, clow, nl->string_length, 1} };
if (nml_parse_qualifier (dtp, chd, ind, -1, nml_err_msg, if (!nml_parse_qualifier (dtp, chd, ind, -1, nml_err_msg,
nml_err_msg_size, &parsed_rank) nml_err_msg_size, &parsed_rank))
== FAILURE)
{ {
char *nml_err_msg_end = strchr (nml_err_msg, '\0'); char *nml_err_msg_end = strchr (nml_err_msg, '\0');
snprintf (nml_err_msg_end, snprintf (nml_err_msg_end,
...@@ -2946,7 +2945,7 @@ get_name: ...@@ -2946,7 +2945,7 @@ get_name:
} }
if ((c = next_char (dtp)) == EOF) if ((c = next_char (dtp)) == EOF)
return FAILURE; return false;
unget_char (dtp, c); unget_char (dtp, c);
} }
...@@ -2978,15 +2977,15 @@ get_name: ...@@ -2978,15 +2977,15 @@ get_name:
eat_separator (dtp); eat_separator (dtp);
if (dtp->u.p.input_complete) if (dtp->u.p.input_complete)
return SUCCESS; return true;
if (dtp->u.p.at_eol) if (dtp->u.p.at_eol)
finish_separator (dtp); finish_separator (dtp);
if (dtp->u.p.input_complete) if (dtp->u.p.input_complete)
return SUCCESS; return true;
if ((c = next_char (dtp)) == EOF) if ((c = next_char (dtp)) == EOF)
return FAILURE; return false;
if (c != '=') if (c != '=')
{ {
...@@ -3013,15 +3012,15 @@ get_name: ...@@ -3013,15 +3012,15 @@ get_name:
nl = first_nl; nl = first_nl;
} }
if (nml_read_obj (dtp, nl, 0, pprev_nl, nml_err_msg, nml_err_msg_size, if (!nml_read_obj (dtp, nl, 0, pprev_nl, nml_err_msg, nml_err_msg_size,
clow, chigh) == FAILURE) clow, chigh))
goto nml_err_ret; goto nml_err_ret;
return SUCCESS; return true;
nml_err_ret: nml_err_ret:
return FAILURE; return false;
} }
/* Entry point for namelist input. Goes through input until namelist name /* Entry point for namelist input. Goes through input until namelist name
...@@ -3104,8 +3103,7 @@ find_nml_name: ...@@ -3104,8 +3103,7 @@ find_nml_name:
while (!dtp->u.p.input_complete) while (!dtp->u.p.input_complete)
{ {
if (nml_get_obj_data (dtp, &prev_nl, nml_err_msg, sizeof nml_err_msg) if (!nml_get_obj_data (dtp, &prev_nl, nml_err_msg, sizeof nml_err_msg))
== FAILURE)
{ {
if (dtp->u.p.current_unit->unit_number != options.stdin_unit) if (dtp->u.p.current_unit->unit_number != options.stdin_unit)
goto nml_err_ret; goto nml_err_ret;
......
...@@ -401,7 +401,7 @@ read_sf (st_parameter_dt *dtp, int * length) ...@@ -401,7 +401,7 @@ read_sf (st_parameter_dt *dtp, int * length)
/* Function for reading the next couple of bytes from the current /* Function for reading the next couple of bytes from the current
file, advancing the current position. We return FAILURE on end of record or file, advancing the current position. We return NULL on end of record or
end of file. This function is only for formatted I/O, unformatted uses end of file. This function is only for formatted I/O, unformatted uses
read_block_direct. read_block_direct.
...@@ -774,7 +774,7 @@ write_block (st_parameter_dt *dtp, int length) ...@@ -774,7 +774,7 @@ write_block (st_parameter_dt *dtp, int length)
called for unformatted files. There are three cases to consider: called for unformatted files. There are three cases to consider:
Stream I/O, unformatted direct, unformatted sequential. */ Stream I/O, unformatted direct, unformatted sequential. */
static try static bool
write_buf (st_parameter_dt *dtp, void *buf, size_t nbytes) write_buf (st_parameter_dt *dtp, void *buf, size_t nbytes)
{ {
...@@ -790,12 +790,12 @@ write_buf (st_parameter_dt *dtp, void *buf, size_t nbytes) ...@@ -790,12 +790,12 @@ write_buf (st_parameter_dt *dtp, void *buf, size_t nbytes)
if (unlikely (have_written < 0)) if (unlikely (have_written < 0))
{ {
generate_error (&dtp->common, LIBERROR_OS, NULL); generate_error (&dtp->common, LIBERROR_OS, NULL);
return FAILURE; return false;
} }
dtp->u.p.current_unit->strm_pos += (gfc_offset) have_written; dtp->u.p.current_unit->strm_pos += (gfc_offset) have_written;
return SUCCESS; return true;
} }
/* Unformatted direct access. */ /* Unformatted direct access. */
...@@ -805,23 +805,23 @@ write_buf (st_parameter_dt *dtp, void *buf, size_t nbytes) ...@@ -805,23 +805,23 @@ write_buf (st_parameter_dt *dtp, void *buf, size_t nbytes)
if (unlikely (dtp->u.p.current_unit->bytes_left < (gfc_offset) nbytes)) if (unlikely (dtp->u.p.current_unit->bytes_left < (gfc_offset) nbytes))
{ {
generate_error (&dtp->common, LIBERROR_DIRECT_EOR, NULL); generate_error (&dtp->common, LIBERROR_DIRECT_EOR, NULL);
return FAILURE; return false;
} }
if (buf == NULL && nbytes == 0) if (buf == NULL && nbytes == 0)
return SUCCESS; return true;
have_written = swrite (dtp->u.p.current_unit->s, buf, nbytes); have_written = swrite (dtp->u.p.current_unit->s, buf, nbytes);
if (unlikely (have_written < 0)) if (unlikely (have_written < 0))
{ {
generate_error (&dtp->common, LIBERROR_OS, NULL); generate_error (&dtp->common, LIBERROR_OS, NULL);
return FAILURE; return false;
} }
dtp->u.p.current_unit->strm_pos += (gfc_offset) have_written; dtp->u.p.current_unit->strm_pos += (gfc_offset) have_written;
dtp->u.p.current_unit->bytes_left -= (gfc_offset) have_written; dtp->u.p.current_unit->bytes_left -= (gfc_offset) have_written;
return SUCCESS; return true;
} }
/* Unformatted sequential. */ /* Unformatted sequential. */
...@@ -854,7 +854,7 @@ write_buf (st_parameter_dt *dtp, void *buf, size_t nbytes) ...@@ -854,7 +854,7 @@ write_buf (st_parameter_dt *dtp, void *buf, size_t nbytes)
if (unlikely (to_write_subrecord < 0)) if (unlikely (to_write_subrecord < 0))
{ {
generate_error (&dtp->common, LIBERROR_OS, NULL); generate_error (&dtp->common, LIBERROR_OS, NULL);
return FAILURE; return false;
} }
dtp->u.p.current_unit->strm_pos += (gfc_offset) to_write_subrecord; dtp->u.p.current_unit->strm_pos += (gfc_offset) to_write_subrecord;
...@@ -871,9 +871,9 @@ write_buf (st_parameter_dt *dtp, void *buf, size_t nbytes) ...@@ -871,9 +871,9 @@ write_buf (st_parameter_dt *dtp, void *buf, size_t nbytes)
if (unlikely (short_record)) if (unlikely (short_record))
{ {
generate_error (&dtp->common, LIBERROR_SHORT_RECORD, NULL); generate_error (&dtp->common, LIBERROR_SHORT_RECORD, NULL);
return FAILURE; return false;
} }
return SUCCESS; return true;
} }
......
...@@ -31,7 +31,6 @@ see the files COPYING3 and COPYING.RUNTIME respectively. If not, see ...@@ -31,7 +31,6 @@ see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
#include <string.h> #include <string.h>
#include <ctype.h> #include <ctype.h>
#include <stdlib.h> #include <stdlib.h>
#include <stdbool.h>
#include <errno.h> #include <errno.h>
#define star_fill(p, n) memset(p, '*', n) #define star_fill(p, n) memset(p, '*', n)
......
...@@ -110,7 +110,7 @@ determine_precision (st_parameter_dt * dtp, const fnode * f, int len) ...@@ -110,7 +110,7 @@ determine_precision (st_parameter_dt * dtp, const fnode * f, int len)
/* Output a real number according to its format which is FMT_G free. */ /* Output a real number according to its format which is FMT_G free. */
static try static bool
output_float (st_parameter_dt *dtp, const fnode *f, char *buffer, size_t size, output_float (st_parameter_dt *dtp, const fnode *f, char *buffer, size_t size,
int nprinted, int precision, int sign_bit, bool zero_flag) int nprinted, int precision, int sign_bit, bool zero_flag)
{ {
...@@ -244,13 +244,13 @@ output_float (st_parameter_dt *dtp, const fnode *f, char *buffer, size_t size, ...@@ -244,13 +244,13 @@ output_float (st_parameter_dt *dtp, const fnode *f, char *buffer, size_t size,
{ {
generate_error (&dtp->common, LIBERROR_FORMAT, "Precision not " generate_error (&dtp->common, LIBERROR_FORMAT, "Precision not "
"greater than zero in format specifier 'E' or 'D'"); "greater than zero in format specifier 'E' or 'D'");
return FAILURE; return false;
} }
if (p <= -d || p >= d + 2) if (p <= -d || p >= d + 2)
{ {
generate_error (&dtp->common, LIBERROR_FORMAT, "Scale factor " generate_error (&dtp->common, LIBERROR_FORMAT, "Scale factor "
"out of range in format specifier 'E' or 'D'"); "out of range in format specifier 'E' or 'D'");
return FAILURE; return false;
} }
if (!zero_flag) if (!zero_flag)
...@@ -532,7 +532,7 @@ output_float (st_parameter_dt *dtp, const fnode *f, char *buffer, size_t size, ...@@ -532,7 +532,7 @@ output_float (st_parameter_dt *dtp, const fnode *f, char *buffer, size_t size,
/* Create the ouput buffer. */ /* Create the ouput buffer. */
out = write_block (dtp, w); out = write_block (dtp, w);
if (out == NULL) if (out == NULL)
return FAILURE; return false;
/* Check the value fits in the specified field width. */ /* Check the value fits in the specified field width. */
if (nblanks < 0 || edigits == -1 || w == 1 || (w == 2 && sign != S_NONE)) if (nblanks < 0 || edigits == -1 || w == 1 || (w == 2 && sign != S_NONE))
...@@ -541,10 +541,10 @@ output_float (st_parameter_dt *dtp, const fnode *f, char *buffer, size_t size, ...@@ -541,10 +541,10 @@ output_float (st_parameter_dt *dtp, const fnode *f, char *buffer, size_t size,
{ {
gfc_char4_t *out4 = (gfc_char4_t *) out; gfc_char4_t *out4 = (gfc_char4_t *) out;
memset4 (out4, '*', w); memset4 (out4, '*', w);
return FAILURE; return false;
} }
star_fill (out, w); star_fill (out, w);
return FAILURE; return false;
} }
/* See if we have space for a zero before the decimal point. */ /* See if we have space for a zero before the decimal point. */
...@@ -652,7 +652,7 @@ output_float (st_parameter_dt *dtp, const fnode *f, char *buffer, size_t size, ...@@ -652,7 +652,7 @@ output_float (st_parameter_dt *dtp, const fnode *f, char *buffer, size_t size,
memset4 (out4, ' ' , nblanks); memset4 (out4, ' ' , nblanks);
dtp->u.p.no_leading_blank = 0; dtp->u.p.no_leading_blank = 0;
} }
return SUCCESS; return true;
} /* End of character(kind=4) internal unit code. */ } /* End of character(kind=4) internal unit code. */
/* Pad to full field width. */ /* Pad to full field width. */
...@@ -745,7 +745,7 @@ output_float (st_parameter_dt *dtp, const fnode *f, char *buffer, size_t size, ...@@ -745,7 +745,7 @@ output_float (st_parameter_dt *dtp, const fnode *f, char *buffer, size_t size,
dtp->u.p.no_leading_blank = 0; dtp->u.p.no_leading_blank = 0;
} }
return SUCCESS; return true;
} }
...@@ -995,7 +995,7 @@ output_float_FMT_G_ ## x (st_parameter_dt *dtp, const fnode *f, \ ...@@ -995,7 +995,7 @@ output_float_FMT_G_ ## x (st_parameter_dt *dtp, const fnode *f, \
int ubound, lbound;\ int ubound, lbound;\
char *p, pad = ' ';\ char *p, pad = ' ';\
int save_scale_factor, nb = 0;\ int save_scale_factor, nb = 0;\
try result;\ bool result;\
int nprinted, precision;\ int nprinted, precision;\
\ \
save_scale_factor = dtp->u.p.scale_factor;\ save_scale_factor = dtp->u.p.scale_factor;\
...@@ -1087,7 +1087,7 @@ output_float_FMT_G_ ## x (st_parameter_dt *dtp, const fnode *f, \ ...@@ -1087,7 +1087,7 @@ output_float_FMT_G_ ## x (st_parameter_dt *dtp, const fnode *f, \
p = write_block (dtp, nb);\ p = write_block (dtp, nb);\
if (p == NULL)\ if (p == NULL)\
return;\ return;\
if (result == FAILURE)\ if (!result)\
pad = '*';\ pad = '*';\
if (unlikely (is_char4_unit (dtp)))\ if (unlikely (is_char4_unit (dtp)))\
{\ {\
......
...@@ -43,6 +43,7 @@ see the files COPYING3 and COPYING.RUNTIME respectively. If not, see ...@@ -43,6 +43,7 @@ see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
#include <stddef.h> #include <stddef.h>
#include <float.h> #include <float.h>
#include <stdarg.h> #include <stdarg.h>
#include <stdbool.h>
#if HAVE_COMPLEX_H #if HAVE_COMPLEX_H
/* Must appear before math.h on VMS systems. */ /* Must appear before math.h on VMS systems. */
...@@ -561,10 +562,6 @@ typedef enum ...@@ -561,10 +562,6 @@ typedef enum
{ NOTIFICATION_SILENT, NOTIFICATION_WARNING, NOTIFICATION_ERROR } { NOTIFICATION_SILENT, NOTIFICATION_WARNING, NOTIFICATION_ERROR }
notification; notification;
/* This is returned by notify_std and several io functions. */
typedef enum
{ SUCCESS = 1, FAILURE }
try;
/* The filename and line number don't go inside the globals structure. /* The filename and line number don't go inside the globals structure.
They are set by the rest of the program and must be linked to. */ They are set by the rest of the program and must be linked to. */
...@@ -732,7 +729,7 @@ iexport_proto(generate_error); ...@@ -732,7 +729,7 @@ iexport_proto(generate_error);
extern void generate_warning (st_parameter_common *, const char *); extern void generate_warning (st_parameter_common *, const char *);
internal_proto(generate_warning); internal_proto(generate_warning);
extern try notify_std (st_parameter_common *, int, const char *); extern bool notify_std (st_parameter_common *, int, const char *);
internal_proto(notify_std); internal_proto(notify_std);
extern notification notification_std(int); extern notification notification_std(int);
......
...@@ -586,17 +586,17 @@ notification_std (int std) ...@@ -586,17 +586,17 @@ notification_std (int std)
feature. An error/warning will be issued if the currently selected feature. An error/warning will be issued if the currently selected
standard does not contain the requested bits. */ standard does not contain the requested bits. */
try bool
notify_std (st_parameter_common *cmp, int std, const char * message) notify_std (st_parameter_common *cmp, int std, const char * message)
{ {
int warning; int warning;
if (!compile_options.pedantic) if (!compile_options.pedantic)
return SUCCESS; return true;
warning = compile_options.warn_std & std; warning = compile_options.warn_std & std;
if ((compile_options.allow_std & std) != 0 && !warning) if ((compile_options.allow_std & std) != 0 && !warning)
return SUCCESS; return true;
if (!warning) if (!warning)
{ {
...@@ -614,5 +614,5 @@ notify_std (st_parameter_common *cmp, int std, const char * message) ...@@ -614,5 +614,5 @@ notify_std (st_parameter_common *cmp, int std, const char * message)
estr_write (message); estr_write (message);
estr_write ("\n"); estr_write ("\n");
} }
return FAILURE; return false;
} }
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