summaryrefslogtreecommitdiff
path: root/scripts/coccinelle
diff options
context:
space:
mode:
authorAlexander Færøy <ahf@torproject.org>2017-06-05 14:20:39 +0000
committerNick Mathewson <nickm@torproject.org>2017-08-24 15:19:11 -0400
commit7c3e980fb939aa93e9ea950a3ed96b53bb525adb (patch)
treed003f004201d1c148dda57274aefa567223917bb /scripts/coccinelle
parent91c6bc160b1d2be60e5756f13d28ba469049351c (diff)
downloadtor-7c3e980fb939aa93e9ea950a3ed96b53bb525adb.tar.gz
tor-7c3e980fb939aa93e9ea950a3ed96b53bb525adb.zip
Add script for cleaning op operator usage in test files.
This patch adds a script written by Nick for bug #13172 to clean up the usage of ==, !=, <, >, <=, and >= by replacing them with their symbolic OP_* counterpart. This will ensure that a tool like Coccinelle doesn't get confused and silently ignore large blocks of code.
Diffstat (limited to 'scripts/coccinelle')
-rwxr-xr-xscripts/coccinelle/test-operator-cleanup11
1 files changed, 11 insertions, 0 deletions
diff --git a/scripts/coccinelle/test-operator-cleanup b/scripts/coccinelle/test-operator-cleanup
new file mode 100755
index 0000000000..e7822542a4
--- /dev/null
+++ b/scripts/coccinelle/test-operator-cleanup
@@ -0,0 +1,11 @@
+#!/usr/bin/perl -w -p -i
+
+next if m#^ */\*# or m#^ *\* #;
+
+s/<([,)])/OP_LT$1/;
+s/(?<=[\s,])>([,)])/OP_GT$1/;
+#s/>([,)])/OP_GT$1/;
+s/==([,)])/OP_EQ$1/;
+s/>=([,)])/OP_GE$1/;
+s/<=([,)])/OP_LE$1/;
+s/!=([,)])/OP_NE$1/;