diff mbox

[1/3] sparse: Just use simple ints for decision variables

Message ID 1402315082-14102-2-git-send-email-phil@dovecot.fi (mailing list archive)
State Rejected, archived
Headers show

Commit Message

Phil Carmody June 9, 2014, 11:58 a.m. UTC
The expressions are just ints, and const is pointess.

Signed-off-by: Phil Carmody <phil@dovecot.fi>
---
 evaluate.c | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

Comments

Josh Triplett June 9, 2014, 1:27 p.m. UTC | #1
On Mon, Jun 09, 2014 at 02:58:00PM +0300, Phil Carmody wrote:
> The expressions are just ints, and const is pointess.

"bool" actually seems more appropriate here.  As for the const, it
does in fact hold true, as neither changes afte rdeclaration; why not
keep it?

> Signed-off-by: Phil Carmody <phil@dovecot.fi>
> ---
>  evaluate.c | 8 ++++----
>  1 file changed, 4 insertions(+), 4 deletions(-)
> 
> diff --git a/evaluate.c b/evaluate.c
> index 6655615..9052962 100644
> --- a/evaluate.c
> +++ b/evaluate.c
> @@ -917,10 +917,10 @@ static struct symbol *evaluate_binop(struct expression *expr)
>  			rtype = integer_promotion(rtype);
>  		} else {
>  			// The rest do usual conversions
> -			const unsigned left_not  = expr->left->type == EXPR_PREOP
> -			                           && expr->left->op == '!';
> -			const unsigned right_not = expr->right->type == EXPR_PREOP
> -			                           && expr->right->op == '!';
> +			int left_not  = expr->left->type == EXPR_PREOP
> +					&& expr->left->op == '!';
> +			int right_not = expr->right->type == EXPR_PREOP
> +			                && expr->right->op == '!';
>  			if ((op == '&' || op == '|') && (left_not || right_not))
>  				warning(expr->pos, "dubious: %sx %c %sy",
>  				        left_not ? "!" : "",
> -- 
> 2.0.0
> 
> --
> To unsubscribe from this list: send the line "unsubscribe linux-sparse" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html
--
To unsubscribe from this list: send the line "unsubscribe linux-sparse" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
diff mbox

Patch

diff --git a/evaluate.c b/evaluate.c
index 6655615..9052962 100644
--- a/evaluate.c
+++ b/evaluate.c
@@ -917,10 +917,10 @@  static struct symbol *evaluate_binop(struct expression *expr)
 			rtype = integer_promotion(rtype);
 		} else {
 			// The rest do usual conversions
-			const unsigned left_not  = expr->left->type == EXPR_PREOP
-			                           && expr->left->op == '!';
-			const unsigned right_not = expr->right->type == EXPR_PREOP
-			                           && expr->right->op == '!';
+			int left_not  = expr->left->type == EXPR_PREOP
+					&& expr->left->op == '!';
+			int right_not = expr->right->type == EXPR_PREOP
+			                && expr->right->op == '!';
 			if ((op == '&' || op == '|') && (left_not || right_not))
 				warning(expr->pos, "dubious: %sx %c %sy",
 				        left_not ? "!" : "",