| This document describes how to use the sparse source code checking tool |
| to check the source code of the open source XFS commands and utilites |
| ("xfsprogs"). |
| |
| First you need to install sparse, either from your distribution or from |
| source as provided at http://www.kernel.org/pub/software/devel/sparse/. |
| |
| Then, run make with "make C=1" to run sparse on all the C files that get |
| recompiled, or use "make C=2" to run sparse on the files whether they need to |
| be recompiled or not. The latter is a fast way to check the whole tree if you |
| have already built it. |
| |
| See the top-level Makefile for a list of which sparse flags are enabled. |
| |
| If you'd rather run sparse more manually, just set the compiler to cgcc, |
| which is a wrapper that calls both sparse and gcc using: |
| |
| CC=cgcc ./configure |
| |
| Now that default warnings from sparse are a little bit verbose checking |
| for various not that important things and also complaining about the |
| glibc system headers. It does however not check for bitwise annotation |
| which are very important for xfsprogs to verify the endianess handling |
| of the on-disk structures is correct. To get a more reasonable set |
| of warnings build xfsprogs using: |
| |
| LCFLAGS="-Wbitwise -Wno-transparent-union -Wno-old-initializer -Wno-decl" make |
| |
| You are of course free to experiment with the warnings flags documented |
| in the sparse manpage to check xfsprogs for other issues. |