Sorry, I'm not on the list.
- ok( file != 0, "CreateFileMapping PAGE_READWRITE error %u\n", GetLastError() ); + ok( !!file, "CreateFileMapping PAGE_READWRITE error %u\n", GetLastError() );
Smatch sees those as equivelent. (The new version does at least http://repo.or.cz/w/smatch.git).
There is a wine_checker.sh script in smatch_scripts so you can quickly test individual files. I just pushed a change to make wine_checker.sh find the smatch binary so you may want to pull the most recent changes.
/path/to/smatch_scripts/wine_checker.sh dlls/kernel32/tests/virtual.c
Michael said it could be either real bug or a false positive. I sort of decided it was a false positive and pushed a change to fix that. Now if "file" gets 1) reassigned 2) incremented/decremented 3) passed to a function like this: fuction(&file); it stops being called a filehandle. (Unless it gets reassigned another file handle obviously).
Hope that is Ok.
The check only prints a warning if something is _definitely_ a file handle and it gets compared to zero. I could easily change it to print a message if something is _possibly_ a file handle and gets compared against zero. Like this: if (x) file = CreateFile(); else file = some_func(); if (file) // <- complain
I know smatch has been abandonware for a long time, but I hope to do better now.
regards, dan carpenter
On 1/19/10, Dan Carpenter error27@gmail.com wrote:
There is a wine_checker.sh script in smatch_scripts so you can quickly test individual files. I just pushed a change to make wine_checker.sh find the smatch binary so you may want to pull the most recent changes.
/path/to/smatch_scripts/wine_checker.sh dlls/kernel32/tests/virtual.c
Also if you want to run the new smatch against the entire source you can use the following compile.sh script:
#!/bin/bash
IFS= if echo $* | grep -q '.c$' ; then ~/progs/smatch/devel/smatch -p=wine --full-path -D__i386__ $* fi gcc $*
############ End of compile.sh script ##############
Save that as compile.sh and use the following command to build.
make CC=~/progs/wine/compile.sh 2>&1 | tee warns.txt
Sorry, this was undocumented and complicated. The cgcc that comes with smatch is supposed to be used instead of the compile.sh but it doesn't work for me. I will investigate why.
regards, dan carpenter
On Tue, Jan 19, 2010 at 03:01:20PM +0300, Dan Carpenter wrote:
On 1/19/10, Dan Carpenter error27@gmail.com wrote:
There is a wine_checker.sh script in smatch_scripts so you can quickly test individual files. I just pushed a change to make wine_checker.sh find the smatch binary so you may want to pull the most recent changes.
/path/to/smatch_scripts/wine_checker.sh dlls/kernel32/tests/virtual.c
Also if you want to run the new smatch against the entire source you can use the following compile.sh script:
#!/bin/bash
IFS= if echo $* | grep -q '.c$' ; then ~/progs/smatch/devel/smatch -p=wine --full-path -D__i386__ $* fi gcc $*
############ End of compile.sh script ##############
Save that as compile.sh and use the following command to build.
make CC=~/progs/wine/compile.sh 2>&1 | tee warns.txt
Sorry, this was undocumented and complicated. The cgcc that comes with smatch is supposed to be used instead of the compile.sh but it doesn't work for me. I will investigate why.
cgcc was fixed upstream in sparse. I have applied the change so you don't need to create a compile.sh any more. Here is the command to use:
make CHECK="~/progs/smatch/devel/smatch -p=wine --full-path" \ CC=~/progs/smatch/devel/cgcc 2>&1 | tee warns.txt
According to LKML if your tool takes longer than two minutes setup then no one will use it. Here are the full commands to go from zero to useful.
git clone git://repo.or.cz/smatch.git cd smatch make cd ~/progs/wine/devel make clean make CHECK="~/progs/smatch/devel/smatch -p=wine --full-path" \ CC=~/progs/smatch/devel/cgcc 2>&1 | tee warns.txt
regards, dan carpenter