summaryrefslogtreecommitdiff
path: root/bin/find-unused-defines.awk
diff options
context:
space:
mode:
authorNoel Grandin <noel@peralex.com>2014-12-23 09:47:48 +0200
committerNoel Grandin <noel@peralex.com>2015-01-08 10:39:36 +0200
commit45ec1d9b56cec41596f806ebf845ebfcd30c9f46 (patch)
treee368da6d3ae2c8a5c8e214b99dd0f95861d0fc78 /bin/find-unused-defines.awk
parent0748a5f8298e2ea817e131234f5e99300ed7f9f7 (diff)
brute-force find-and-remove of unused #define constants.
Change-Id: I7223530ae37297a76654cd00cc1fedb56dbe3adb
Diffstat (limited to 'bin/find-unused-defines.awk')
-rw-r--r--bin/find-unused-defines.awk18
1 files changed, 18 insertions, 0 deletions
diff --git a/bin/find-unused-defines.awk b/bin/find-unused-defines.awk
new file mode 100644
index 000000000000..2649e41d0534
--- /dev/null
+++ b/bin/find-unused-defines.awk
@@ -0,0 +1,18 @@
+{
+ x++
+ y=$0
+}
+
+END {
+ tmp = substr(y, 0, index(y, ":"))
+ if (x==1) print "sed -i '/[[:space:]]" p1 "[[:space:]]/d' " tmp
+}
+
+
+
+
+# | xargs -P 4 -Ixxx sh -c "git grep -w 'xxx' | awk '{ x++; y=\$0 } END { if (x==1) print y }' && echo \"xxx\" 1>&2"
+
+# sed -i '' '/pattern/d'
+# | awk 'arr[$0]++ END { for (i in arr) { if(arr[i]==1) print i } }' \
+# | awk -f find-unused-defines.awk