Splint is a really useful utility to check your source code, but it doesn’t seem to be installed by default on MacOS X. It is not too difficult to download the source and install except for the minor issue that it doesn’t build. The good news is it doesn’t take much to fix the build problem. Here are the instructions.
- Download the source from http://www.splint.org/downloads/splint-3.1.2.src.tgz
- Open the .tgz file by double clicking.
- Open a terminal window and cd to the splint-3.1.2 folder
- Configure by using sudo ./configure and enter your password
- Open the osd.c file using nano src/osd.c
- Scroll down to around line 500 and change the line __pid_t pid = getpid (); to pid_t pid = getpid (); then save the file (control-x).
- Type sudo make install to install splint
You should now be able to use splint (eg splint foo.c) and have a look at how many little issues are in your code :) It will fail a few of the tests, but it appears to still work.
Edit Sept 2017. This is a pretty old post. My advice is use brew to install splint.