aboutsummaryrefslogtreecommitdiffstats
path: root/tools/check-c-style.sh
diff options
context:
space:
mode:
authorXavier Claessens <xclaesse@src.gnome.org>2008-02-26 21:31:02 +0800
committerXavier Claessens <xclaesse@src.gnome.org>2008-02-26 21:31:02 +0800
commitc3751daec7cca3e44abfed1db475cf0fc4703d66 (patch)
tree4ba009a19d6f3254acb8d91be788d49a7e259fc2 /tools/check-c-style.sh
parent035e672692a3c63ccf7b927b0b7b74438c1f0e24 (diff)
downloadgsoc2013-empathy-c3751daec7cca3e44abfed1db475cf0fc4703d66.tar
gsoc2013-empathy-c3751daec7cca3e44abfed1db475cf0fc4703d66.tar.gz
gsoc2013-empathy-c3751daec7cca3e44abfed1db475cf0fc4703d66.tar.bz2
gsoc2013-empathy-c3751daec7cca3e44abfed1db475cf0fc4703d66.tar.lz
gsoc2013-empathy-c3751daec7cca3e44abfed1db475cf0fc4703d66.tar.xz
gsoc2013-empathy-c3751daec7cca3e44abfed1db475cf0fc4703d66.tar.zst
gsoc2013-empathy-c3751daec7cca3e44abfed1db475cf0fc4703d66.zip
Import tools from telepathy-glib 0.7.3 and build a static libemp-extensions.la.
Link that library into libempathy (it's not actually used for anything at this point). Extensions currently built: ChannelHandler and StreamEngine. The namespacing convention used is emp_*, Emp*, EMP_* so it won't be included in the library ABI. svn path=/trunk/; revision=663
Diffstat (limited to 'tools/check-c-style.sh')
-rw-r--r--tools/check-c-style.sh36
1 files changed, 36 insertions, 0 deletions
diff --git a/tools/check-c-style.sh b/tools/check-c-style.sh
new file mode 100644
index 000000000..357fdb365
--- /dev/null
+++ b/tools/check-c-style.sh
@@ -0,0 +1,36 @@
+#!/bin/sh
+fail=0
+
+( . "${tools_dir}"/check-misc.sh ) || fail=$?
+
+if grep -n '^ *GError *\*[[:alpha:]_][[:alnum:]_]* *;' "$@"
+then
+ echo "^^^ The above files contain uninitialized GError*s - they should be"
+ echo " initialized to NULL"
+ fail=1
+fi
+
+# The first regex finds function calls like foo() (as opposed to foo ()).
+# It attempts to ignore string constants (may cause false negatives).
+# The second and third ignore block comments (gtkdoc uses foo() as markup).
+# The fourth ignores cpp so you can
+# #define foo(bar) (_real_foo (__FUNC__, bar)) (cpp insists on foo() style).
+if grep -n '^[^"]*[[:lower:]](' "$@" \
+ | grep -v '^[-[:alnum:]_./]*:[[:digit:]]*: *\*' \
+ | grep -v '^[-[:alnum:]_./]*:[[:digit:]]*: */\*' \
+ | grep -v '^[-[:alnum:]_./]*:[[:digit:]]*: *#'
+then
+ echo "^^^ Our coding style is to use function calls like foo (), not foo()"
+ fail=1
+fi
+
+if test -n "$CHECK_FOR_LONG_LINES"
+then
+ if egrep -n '.{80,}' "$@"
+ then
+ echo "^^^ The above files contain long lines"
+ fail=1
+ fi
+fi
+
+exit $fail