From 78f6129427265bd7ff088eda0a325210cb9051a2 Mon Sep 17 00:00:00 2001 From: Marek Polacek Date: Tue, 11 Oct 2016 09:32:44 +0000 Subject: [PATCH] c-common.c (warning_candidate_p): Change the return type to bool and return true/false instead of 1/0. * c-common.c (warning_candidate_p): Change the return type to bool and return true/false instead of 1/0. (vector_mode_valid_p): Likewise. From-SVN: r240974 --- gcc/c-family/ChangeLog | 6 ++++++ gcc/c-family/c-common.c | 25 +++++++++++++------------ 2 files changed, 19 insertions(+), 12 deletions(-) diff --git a/gcc/c-family/ChangeLog b/gcc/c-family/ChangeLog index c198fa806cd..78a494722cb 100644 --- a/gcc/c-family/ChangeLog +++ b/gcc/c-family/ChangeLog @@ -1,3 +1,9 @@ +2016-10-11 Marek Polacek + + * c-common.c (warning_candidate_p): Change the return type to bool + and return true/false instead of 1/0. + (vector_mode_valid_p): Likewise. + 2016-10-11 Marek Polacek * c-common.c (fold_for_warn): No longer static. diff --git a/gcc/c-family/c-common.c b/gcc/c-family/c-common.c index 4437ffbf8a9..c4a0ce89c38 100644 --- a/gcc/c-family/c-common.c +++ b/gcc/c-family/c-common.c @@ -1881,7 +1881,7 @@ static struct tlist_cache *save_expr_cache; static void add_tlist (struct tlist **, struct tlist *, tree, int); static void merge_tlist (struct tlist **, struct tlist *, int); static void verify_tree (tree, struct tlist **, struct tlist **, tree); -static int warning_candidate_p (tree); +static bool warning_candidate_p (tree); static bool candidate_equal_p (const_tree, const_tree); static void warn_for_collisions (struct tlist *); static void warn_for_collisions_1 (tree, tree, struct tlist *, int); @@ -2000,32 +2000,33 @@ warn_for_collisions (struct tlist *list) /* Return nonzero if X is a tree that can be verified by the sequence point warnings. */ -static int + +static bool warning_candidate_p (tree x) { if (DECL_P (x) && DECL_ARTIFICIAL (x)) - return 0; + return false; if (TREE_CODE (x) == BLOCK) - return 0; + return false; /* VOID_TYPE_P (TREE_TYPE (x)) is workaround for cp/tree.c (lvalue_p) crash on TRY/CATCH. */ if (TREE_TYPE (x) == NULL_TREE || VOID_TYPE_P (TREE_TYPE (x))) - return 0; + return false; if (!lvalue_p (x)) - return 0; + return false; /* No point to track non-const calls, they will never satisfy operand_equal_p. */ if (TREE_CODE (x) == CALL_EXPR && (call_expr_flags (x) & ECF_CONST) == 0) - return 0; + return false; if (TREE_CODE (x) == STRING_CST) - return 0; + return false; - return 1; + return true; } /* Return nonzero if X and Y appear to be the same candidate (or NULL) */ @@ -6315,7 +6316,7 @@ handle_destructor_attribute (tree *node, tree name, tree args, This returns nonzero even if there is no hardware support for the vector mode, but we can emulate with narrower modes. */ -static int +static bool vector_mode_valid_p (machine_mode mode) { enum mode_class mclass = GET_MODE_CLASS (mode); @@ -6328,11 +6329,11 @@ vector_mode_valid_p (machine_mode mode) && mclass != MODE_VECTOR_UFRACT && mclass != MODE_VECTOR_ACCUM && mclass != MODE_VECTOR_UACCUM) - return 0; + return false; /* Hardware support. Woo hoo! */ if (targetm.vector_mode_supported_p (mode)) - return 1; + return true; innermode = GET_MODE_INNER (mode); -- 2.30.2