[10/33] cocci: Condense logging function rules

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

Details

Message ID 20190610150321.512-10-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:02 p.m.
From: Lyude Paul <lyude@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@redhat.com>
---
 lib/igt.cocci | 24 +++++++-----------------
 1 file changed, 7 insertions(+), 17 deletions(-)

Patch hide | download patch | download mbox

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/*