Developer helper scripts for compiler warnings and clang analyzer.
authorEmil Mikulic <emikulic@gmail.com>
Sat, 25 Jan 2014 07:19:56 +0000 (18:19 +1100)
committerEmil Mikulic <emikulic@gmail.com>
Sat, 25 Jan 2014 09:39:47 +0000 (20:39 +1100)
dev_all.c [new file with mode: 0644]
dev_analyze.sh [new file with mode: 0755]
dev_clang_warns.sh [new file with mode: 0755]
dev_gcc_warns.sh [new file with mode: 0755]

diff --git a/dev_all.c b/dev_all.c
new file mode 100644 (file)
index 0000000..288014b
--- /dev/null
+++ b/dev_all.c
@@ -0,0 +1,31 @@
+/* darkstat 3
+ * copyright (c) 2014 Emil Mikulic.
+ *
+ * dev_all.c: a single compilation unit of all darkstat code.
+ * Useful for static analysis.
+ *
+ * You may use, modify and redistribute this file under the terms of the
+ * GNU General Public License version 2. (see COPYING.GPL)
+ */
+#include "acct.c"
+#include "addr.c"
+#include "bsd.c"
+#include "cap.c"
+#include "conv.c"
+#include "daylog.c"
+#include "db.c"
+#include "decode.c"
+#include "dns.c"
+#include "err.c"
+#include "graph_db.c"
+#include "hosts_db.c"
+#include "hosts_sort.c"
+#include "html.c"
+#include "http.c"
+#include "localip.c"
+#include "ncache.c"
+#include "now.c"
+#include "pidfile.c"
+#include "str.c"
+
+#include "darkstat.c"
diff --git a/dev_analyze.sh b/dev_analyze.sh
new file mode 100755 (executable)
index 0000000..84c67b4
--- /dev/null
@@ -0,0 +1,15 @@
+#!/bin/sh -x
+#
+# Run the clang static analyzer.
+#
+TARGET=dev_all.c
+
+# Adjust to suit:
+LLVM=$HOME/llvm
+CHECKER=$LLVM/llvm/tools/clang/tools/scan-build/ccc-analyzer
+CLANG=$LLVM/install/bin/clang
+
+$LLVM/llvm/tools/clang/tools/scan-build/scan-build \
+  -analyze-headers \
+  --use-analyzer=$LLVM/install/bin/clang \
+  $CLANG -c $TARGET
diff --git a/dev_clang_warns.sh b/dev_clang_warns.sh
new file mode 100755 (executable)
index 0000000..4c3c6c5
--- /dev/null
@@ -0,0 +1,11 @@
+#!/bin/sh -x
+#
+# Build with lots of Clang warnings enabled.
+#
+TARGET=dev_all.c
+
+# Adjust to suit:
+LLVM=$HOME/llvm
+CLANG=$LLVM/install/bin/clang
+
+$CLANG -Weverything -O -c $TARGET
diff --git a/dev_gcc_warns.sh b/dev_gcc_warns.sh
new file mode 100755 (executable)
index 0000000..00b42b9
--- /dev/null
@@ -0,0 +1,7 @@
+#!/bin/sh -x
+#
+# Build with lots of GCC warnings enabled.
+#
+TARGET=dev_all.c
+
+gcc -O -c -fstrict-aliasing --all-warnings --extra-warnings $TARGET