From a20ea60c1a18256f9e3b84d3781778067808aa50 Mon Sep 17 00:00:00 2001 From: Luc Van Oostenryck Date: Mon, 27 Jun 2022 02:31:32 +0200 Subject: bitwise: allow compares for bitwise types Currently, bitwise types are restricted to bitwise operations (&, |, ^ and ~) as well as equality comparisons. This patch makes the others comparisons valid for bitwise types too. Warning: This change make sense in the context of [1] but doesn't make sense for the 'main' bitwise types: __be32 and friends. Signed-off-by: Luc Van Oostenryck --- evaluate.c | 4 ++++ validation/bitwise-cmp.c | 1 - validation/linear/bitwise-cmps.c | 1 - 3 files changed, 4 insertions(+), 2 deletions(-) diff --git a/evaluate.c b/evaluate.c index bcbcdf1e..bb8c0caa 100644 --- a/evaluate.c +++ b/evaluate.c @@ -435,6 +435,10 @@ static int restricted_binop(int op, struct symbol *type) case '^': case '?': return 2; /* keep fouled */ + case '<': + case '>': + case SPECIAL_LTE: + case SPECIAL_GTE: case SPECIAL_EQUAL: case SPECIAL_NOTEQUAL: return 3; /* warn if fouled */ diff --git a/validation/bitwise-cmp.c b/validation/bitwise-cmp.c index ca12b5e5..8c3e6894 100644 --- a/validation/bitwise-cmp.c +++ b/validation/bitwise-cmp.c @@ -28,5 +28,4 @@ static int gtx(b32 x, b32 y) { return (x > y); } /* * check-name: bitwise-cmp - * check-known-to-fail */ diff --git a/validation/linear/bitwise-cmps.c b/validation/linear/bitwise-cmps.c index 6122944a..f83ab7fe 100644 --- a/validation/linear/bitwise-cmps.c +++ b/validation/linear/bitwise-cmps.c @@ -8,7 +8,6 @@ static int gtu(bs32 x, bs32 y) { return (x > y); } /* * check-name: bitwise-cmps * check-command: test-linearize -Wno-decl $file - * check-known-to-fail * * check-output-ignore * check-output-excludes: setb\\. -- cgit 1.2.3-korg