Run clang-check over the source.

This tool performs static analysis on the code which can go a step
further than the standard compiler warnings. It only catches the things
it is looking for but gives us an extra line of defence.

Change-Id: I6eca5729f2959eeae20ee8684b159614f11d0bc1
diff --git a/Makefile b/Makefile
index d8b80af..e1227e7 100644
--- a/Makefile
+++ b/Makefile
@@ -52,3 +52,10 @@
 	@echo "Tidying..."
 	@find src/ -name *.c -exec clang-tidy -p $(OUT) -fix {} \;
 	@find test/ -name *.c -exec clang-tidy -p $(OUT) -fix {} \;
+
+.PHONY: check
+check: $(OUT)/build.ninja
+	@$(NINJA) -C $(OUT)
+	@echo "Checking..."
+	@find src/ -name *.c -exec clang-check -p $(OUT) -analyze {} \;
+	@find test/ -name *.c -exec clang-check -p $(OUT) -analyze {} \;