Print this page
11972 resync smatch


  38 normally rebuild the database every morning.
  39 
  40 If you are running Smatch over the whole kernel you can use the following
  41 command:
  42 
  43         ~/progs/smatch/devel/smatch_scripts/test_kernel.sh
  44 
  45 The test_kernel.sh script will create a .c.smatch file for every file it tests
  46 and a combined smatch_warns.txt file with all the warnings.
  47 
  48 If you are running Smatch just over one kernel file:
  49 
  50         ~/progs/smatch/devel/smatch_scripts/kchecker drivers/whatever/file.c
  51 
  52 You can also build a directory like this:
  53 
  54         ~/progs/smatch/devel/smatch_scripts/kchecker drivers/whatever/
  55 
  56 The kchecker script prints its warnings to stdout.
  57 




  58 If you are building something else (which is not the Linux kernel) then use
  59 something like:
  60 
  61         make CHECK="~/progs/smatch/devel/smatch --full-path" \
  62                 CC=~/progs/smatch/devel/smatch/cgcc | tee smatch_warns.txt
  63 
  64 The makefile has to let people set the CC with an environment variable for that
  65 to work, of course.
  66 
  67 
  68 Section 3:  Smatch vs Sparse
  69 ----------------------------
  70 
  71 Smatch uses Sparse as a C parser.  I have made a few hacks to Sparse so I
  72 have to distribute the two together.  Sparse is released under the MIT license
  73 and Smatch is GPLv2+.  If you make changes to Sparse please send those to the
  74 Sparse mailing list linux-sparse@vger.kernel.org and I will pick them up from
  75 there.  Partly I do that for licensing reasons because I don't want to pull GPL
  76 changes into the Sparse code I re-distribute.
  77 


  38 normally rebuild the database every morning.
  39 
  40 If you are running Smatch over the whole kernel you can use the following
  41 command:
  42 
  43         ~/progs/smatch/devel/smatch_scripts/test_kernel.sh
  44 
  45 The test_kernel.sh script will create a .c.smatch file for every file it tests
  46 and a combined smatch_warns.txt file with all the warnings.
  47 
  48 If you are running Smatch just over one kernel file:
  49 
  50         ~/progs/smatch/devel/smatch_scripts/kchecker drivers/whatever/file.c
  51 
  52 You can also build a directory like this:
  53 
  54         ~/progs/smatch/devel/smatch_scripts/kchecker drivers/whatever/
  55 
  56 The kchecker script prints its warnings to stdout.
  57 
  58 The above scripts will ensure that any ARCH or CROSS_COMPILE environment
  59 variables are passed to kernel build system - thus allowing for the use of
  60 Smatch with kernels that are normally built with cross-compilers.
  61 
  62 If you are building something else (which is not the Linux kernel) then use
  63 something like:
  64 
  65         make CHECK="~/progs/smatch/devel/smatch --full-path" \
  66                 CC=~/progs/smatch/devel/smatch/cgcc | tee smatch_warns.txt
  67 
  68 The makefile has to let people set the CC with an environment variable for that
  69 to work, of course.
  70 
  71 
  72 Section 3:  Smatch vs Sparse
  73 ----------------------------
  74 
  75 Smatch uses Sparse as a C parser.  I have made a few hacks to Sparse so I
  76 have to distribute the two together.  Sparse is released under the MIT license
  77 and Smatch is GPLv2+.  If you make changes to Sparse please send those to the
  78 Sparse mailing list linux-sparse@vger.kernel.org and I will pick them up from
  79 there.  Partly I do that for licensing reasons because I don't want to pull GPL
  80 changes into the Sparse code I re-distribute.
  81