aboutsummaryrefslogtreecommitdiff
path: root/gcc/fortran/expr.c
diff options
context:
space:
mode:
authorJanus Weil <janus@gcc.gnu.org>2016-12-13 19:55:20 +0100
committerJanus Weil <janus@gcc.gnu.org>2016-12-13 19:55:20 +0100
commit7a28353e36d0c2b1dc81883437d2064a50c00e8e (patch)
tree9d1e9d025f22b461e270aae2ebd39ebc4c5a4ffb /gcc/fortran/expr.c
parentc3c54e0f074083d3bdfe97153a704f5584ec3fa4 (diff)
downloadgcc-7a28353e36d0c2b1dc81883437d2064a50c00e8e.zip
gcc-7a28353e36d0c2b1dc81883437d2064a50c00e8e.tar.gz
gcc-7a28353e36d0c2b1dc81883437d2064a50c00e8e.tar.bz2
re PR fortran/78798 ([cleanup] some int-valued functions should be bool)
2016-12-13 Janus Weil <janus@gcc.gnu.org> PR fortran/78798 * gfortran.h (gfc_is_constant_expr, gfc_is_formal_arg, gfc_is_compile_time_shape): Return bool instead of int. * array.c (gfc_is_compile_time_shape): Ditto. * expr.c (gfc_is_constant_expr): Ditto. * resolve.c (gfc_is_formal_arg): Ditto. Make formal_arg_flag bool. From-SVN: r243621
Diffstat (limited to 'gcc/fortran/expr.c')
-rw-r--r--gcc/fortran/expr.c23
1 files changed, 11 insertions, 12 deletions
diff --git a/gcc/fortran/expr.c b/gcc/fortran/expr.c
index c4a6ae1..f57198f 100644
--- a/gcc/fortran/expr.c
+++ b/gcc/fortran/expr.c
@@ -882,17 +882,16 @@ done:
/* Determine if an expression is constant in the sense of F08:7.1.12.
- * This function expects that the expression has already been simplified.
- * FIXME: Return a bool, not an int. */
+ * This function expects that the expression has already been simplified. */
-int
+bool
gfc_is_constant_expr (gfc_expr *e)
{
gfc_constructor *c;
gfc_actual_arglist *arg;
if (e == NULL)
- return 1;
+ return true;
switch (e->expr_type)
{
@@ -902,7 +901,7 @@ gfc_is_constant_expr (gfc_expr *e)
|| gfc_is_constant_expr (e->value.op.op2)));
case EXPR_VARIABLE:
- return 0;
+ return false;
case EXPR_FUNCTION:
case EXPR_PPC:
@@ -915,7 +914,7 @@ gfc_is_constant_expr (gfc_expr *e)
{
for (arg = e->value.function.actual; arg; arg = arg->next)
if (!gfc_is_constant_expr (arg->expr))
- return 0;
+ return false;
}
if (e->value.function.isym
@@ -923,13 +922,13 @@ gfc_is_constant_expr (gfc_expr *e)
|| e->value.function.isym->pure
|| e->value.function.isym->inquiry
|| e->value.function.isym->transformational))
- return 1;
+ return true;
- return 0;
+ return false;
case EXPR_CONSTANT:
case EXPR_NULL:
- return 1;
+ return true;
case EXPR_SUBSTRING:
return e->ref == NULL || (gfc_is_constant_expr (e->ref->u.ss.start)
@@ -943,14 +942,14 @@ gfc_is_constant_expr (gfc_expr *e)
for (; c; c = gfc_constructor_next (c))
if (!gfc_is_constant_expr (c->expr))
- return 0;
+ return false;
- return 1;
+ return true;
default:
gfc_internal_error ("gfc_is_constant_expr(): Unknown expression type");
- return 0;
+ return false;
}
}