[12/33] cocci: Update comparison macro rules

Submitted by Lyude Paul on June 10, 2019, 3:03 p.m.

Details

Message ID 20190610150321.512-12-lyude@redhat.com
State New
Headers show
Series "Series without cover letter" ( rev: 1 ) in IGT - Trybot

Not browsing as part of any series.

Commit Message

Lyude Paul June 10, 2019, 3:03 p.m.
From: Lyude Paul <lyude@redhat.com>

Since this rule was written, we've got rid of the lt and lte variants of
u32, added u64 and s64 variants of all of the comparison macros, and
added double versions of the eq and neq macros. So, let's update it to
match that.

Signed-off-by: Lyude Paul <lyude@redhat.com>
---
 lib/igt.cocci | 87 ++++++++++++++++++++++++++++++++++++---------------
 1 file changed, 61 insertions(+), 26 deletions(-)

Patch hide | download patch | download mbox

diff --git a/lib/igt.cocci b/lib/igt.cocci
index f28e04e7..4f3916ff 100644
--- a/lib/igt.cocci
+++ b/lib/igt.cocci
@@ -125,45 +125,80 @@  binary operator gt_op = {>,>=};
 // Use comparison macros instead of raw igt_assert when possible
 @@
 typedef uint32_t;
-uint32_t E1, E2;
-int E3, E4;
+typedef uint64_t;
+typedef int64_t;
+int int_1, int_2;
+double double_1, double_2;
+uint32_t u32_1, u32_2;
+uint64_t u64_1, u64_2;
+int64_t s64_1, s64_2;
 @@
 (
-- igt_assert(E1 == E2);
-+ igt_assert_eq_u32(E1, E2);
+- igt_assert(int_1 == int_2);
++ igt_assert_eq(int_1, int_2);
 |
-- igt_assert(E1 != E2);
-+ igt_assert_neq_u32(E1, E2);
+- igt_assert(u32_1 == u32_2);
++ igt_assert_eq_u32(u32_1, u32_2);
 |
-- igt_assert(E1 <= E2);
-+ igt_assert_lte_u32(E1, E2);
+- igt_assert(s64_1 == s64_2);
++ igt_assert_eq_s64(s64_1, s64_2);
 |
-- igt_assert(E1 < E2);
-+ igt_assert_lt_u32(E1, E2);
+- igt_assert(u64_1 == u64_2);
++ igt_assert_eq_u64(u64_1, u64_2);
 |
-- igt_assert(E1 >= E2);
-+ igt_assert_lte_u32(E2, E1);
+- igt_assert(double_1 == double_2);
++ igt_assert_eq_double(double_1, double_2);
 |
-- igt_assert(E1 > E2);
-+ igt_assert_lt_u32(E2, E1);
+- igt_assert(int_1 != int_2);
++ igt_assert_neq(int_1, int_2);
 |
-- igt_assert(E3 == E4);
-+ igt_assert_eq(E3, E4);
+- igt_assert(u32_1 != u32_2);
++ igt_assert_neq_u32(u32_1, u32_2);
 |
-- igt_assert(E3 != E4);
-+ igt_assert_neq(E3, E4);
+- igt_assert(s64_1 != s64_2);
++ igt_assert_neq_s64(s64_1, s64_2);
 |
-- igt_assert(E3 <= E4);
-+ igt_assert_lte(E3, E4);
+- igt_assert(u64_1 != u64_2);
++ igt_assert_neq_u64(u64_1, u64_2);
 |
-- igt_assert(E3 < E4);
-+ igt_assert_lt(E3, E4);
+- igt_assert(double_1 != double_2);
++ igt_assert_neq_double(double_1, double_2);
 |
-- igt_assert(E3 >= E4);
-+ igt_assert_lte(E4, E3);
+- igt_assert(int_1 < int_2);
++ igt_assert_lt(int_1, int_2);
 |
-- igt_assert(E3 > E4);
-+ igt_assert_lt(E4, E3);
+- igt_assert(s64_1 < s64_2);
++ igt_assert_lt_s64(s64_1, s64_2);
+|
+- igt_assert(u64_1 < u64_2);
++ igt_assert_lt_u64(u64_1, u64_2);
+|
+- igt_assert(int_1 <= int_2);
++ igt_assert_lte(int_1, int_2);
+|
+- igt_assert(s64_1 <= s64_2);
++ igt_assert_lte_s64(s64_1, s64_2);
+|
+- igt_assert(u64_1 <= u64_2);
++ igt_assert_lte_u64(u64_1, u64_2);
+|
+- igt_assert(int_1 > int_2);
++ igt_assert_lt(int_2, int_1);
+|
+- igt_assert(s64_1 > s64_2);
++ igt_assert_lt_s64(s64_2, s64_1);
+|
+- igt_assert(u64_1 > u64_2);
++ igt_assert_lt_u64(u64_2, u64_1);
+|
+- igt_assert(int_1 >= int_2);
++ igt_assert_lte(int_2, int_1);
+|
+- igt_assert(s64_1 >= s64_2);
++ igt_assert_lte_s64(s64_2, s64_1);
+|
+- igt_assert(u64_1 >= u64_2);
++ igt_assert_lte_u64(u64_2, u64_1);
 )
 
 // avoid unused-result warnings when compiling with _FORTIFY_SOURCE defined