summaryrefslogtreecommitdiff
path: root/tools
diff options
context:
space:
mode:
authorSimon McVittie <simon.mcvittie@collabora.co.uk>2008-07-21 13:18:54 +0000
committerSimon McVittie <simon.mcvittie@collabora.co.uk>2008-07-21 13:18:54 +0000
commit8f50e97a03dd1eb2d0cf6eae4297a12d75308f96 (patch)
treee9c7f1037ca4491daee69d6fe801200878fd030a /tools
parent7035166c8608034d0ad4cd4dde250b54f375ed29 (diff)
check-c-style.sh: be strict about formatting of casts and pointer types
Diffstat (limited to 'tools')
-rw-r--r--tools/check-c-style.sh20
1 files changed, 20 insertions, 0 deletions
diff --git a/tools/check-c-style.sh b/tools/check-c-style.sh
index 357fdb365..6ed106cf6 100644
--- a/tools/check-c-style.sh
+++ b/tools/check-c-style.sh
@@ -24,6 +24,26 @@ then
fail=1
fi
+if grep -En '[(][[:alnum:]_]+ ?\*[)][(]?[[:alpha:]_]' "$@"; then
+ echo "^^^ Our coding style is to have a space between a cast and the "
+ echo " thing being cast"
+ fail=1
+fi
+
+# this only spots casts
+if grep -En '[(][[:alnum:]_]+\*+[)]' "$@"; then
+ echo "^^^ Our coding style is to have a space before the * of pointer types"
+ echo " (regex 1)"
+ fail=1
+fi
+# ... and this only spots variable declarations and function return types
+if grep -En '^ *(static |const |)* *[[:alnum:]_]+\*+([[:alnum:]_]|;|$)' \
+ "$@"; then
+ echo "^^^ Our coding style is to have a space before the * of pointer types"
+ echo " (regex 2)"
+ fail=1
+fi
+
if test -n "$CHECK_FOR_LONG_LINES"
then
if egrep -n '.{80,}' "$@"