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
This commit is contained in:
Marek Polacek 2016-10-11 09:32:44 +00:00 committed by Marek Polacek
parent f153e9d5b0
commit 78f6129427
2 changed files with 19 additions and 12 deletions

View File

@ -1,3 +1,9 @@
2016-10-11 Marek Polacek <polacek@redhat.com>
* 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 <polacek@redhat.com> 2016-10-11 Marek Polacek <polacek@redhat.com>
* c-common.c (fold_for_warn): No longer static. * c-common.c (fold_for_warn): No longer static.

View File

@ -1881,7 +1881,7 @@ static struct tlist_cache *save_expr_cache;
static void add_tlist (struct tlist **, struct tlist *, tree, int); static void add_tlist (struct tlist **, struct tlist *, tree, int);
static void merge_tlist (struct tlist **, struct tlist *, int); static void merge_tlist (struct tlist **, struct tlist *, int);
static void verify_tree (tree, struct tlist **, struct tlist **, tree); 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 bool candidate_equal_p (const_tree, const_tree);
static void warn_for_collisions (struct tlist *); static void warn_for_collisions (struct tlist *);
static void warn_for_collisions_1 (tree, tree, struct tlist *, int); 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 /* Return nonzero if X is a tree that can be verified by the sequence point
warnings. */ warnings. */
static int
static bool
warning_candidate_p (tree x) warning_candidate_p (tree x)
{ {
if (DECL_P (x) && DECL_ARTIFICIAL (x)) if (DECL_P (x) && DECL_ARTIFICIAL (x))
return 0; return false;
if (TREE_CODE (x) == BLOCK) if (TREE_CODE (x) == BLOCK)
return 0; return false;
/* VOID_TYPE_P (TREE_TYPE (x)) is workaround for cp/tree.c /* VOID_TYPE_P (TREE_TYPE (x)) is workaround for cp/tree.c
(lvalue_p) crash on TRY/CATCH. */ (lvalue_p) crash on TRY/CATCH. */
if (TREE_TYPE (x) == NULL_TREE || VOID_TYPE_P (TREE_TYPE (x))) if (TREE_TYPE (x) == NULL_TREE || VOID_TYPE_P (TREE_TYPE (x)))
return 0; return false;
if (!lvalue_p (x)) if (!lvalue_p (x))
return 0; return false;
/* No point to track non-const calls, they will never satisfy /* No point to track non-const calls, they will never satisfy
operand_equal_p. */ operand_equal_p. */
if (TREE_CODE (x) == CALL_EXPR && (call_expr_flags (x) & ECF_CONST) == 0) if (TREE_CODE (x) == CALL_EXPR && (call_expr_flags (x) & ECF_CONST) == 0)
return 0; return false;
if (TREE_CODE (x) == STRING_CST) 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) */ /* 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 This returns nonzero even if there is no hardware support for the
vector mode, but we can emulate with narrower modes. */ vector mode, but we can emulate with narrower modes. */
static int static bool
vector_mode_valid_p (machine_mode mode) vector_mode_valid_p (machine_mode mode)
{ {
enum mode_class mclass = GET_MODE_CLASS (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_UFRACT
&& mclass != MODE_VECTOR_ACCUM && mclass != MODE_VECTOR_ACCUM
&& mclass != MODE_VECTOR_UACCUM) && mclass != MODE_VECTOR_UACCUM)
return 0; return false;
/* Hardware support. Woo hoo! */ /* Hardware support. Woo hoo! */
if (targetm.vector_mode_supported_p (mode)) if (targetm.vector_mode_supported_p (mode))
return 1; return true;
innermode = GET_MODE_INNER (mode); innermode = GET_MODE_INNER (mode);