[PATCH i-g-t 10/33] cocci: Condense logging function rules
Lyude
lyude at redhat.com
Mon Jun 10 15:02:58 UTC 2019
From: Lyude Paul <lyude at redhat.com>
We can combine all of the rules we have for enforcing the use of logging
functions into a single rule by simply using a few more disjoint
operators. So, let's do that to simplify things a bit.
Signed-off-by: Lyude Paul <lyude at redhat.com>
---
lib/igt.cocci | 24 +++++++-----------------
1 file changed, 7 insertions(+), 17 deletions(-)
diff --git a/lib/igt.cocci b/lib/igt.cocci
index 373fbc15..1ae218af 100644
--- a/lib/igt.cocci
+++ b/lib/igt.cocci
@@ -50,23 +50,13 @@ expression list[n] Ep;
@@
expression list[n] Ep;
@@
--fprintf(stderr, Ep);
-+igt_warn(Ep);
-@@
-expression E;
-@@
--perror(E);
-+igt_warn(E);
-@@
-expression list[n] Ep;
-@@
--fprintf(stdout, Ep);
-+igt_info(Ep);
-@@
-expression list[n] Ep;
-@@
--printf(Ep);
-+igt_info(Ep);
+(
+- \( fprintf(stderr, Ep) \| perror(Ep) \);
++ igt_warn(Ep);
+|
+- \( fprintf(stdout, Ep) \| printf(Ep) \);
++ igt_info(Ep);
+)
// No abort for tests, really. Should only be used for internal library checks
// in lib/*
--
2.21.0
More information about the Intel-gfx-trybot
mailing list