[splint-discuss] A question about parsing windows.h
Michael Wojcik
Michael.Wojcik at MicroFocus.com
Thu May 18 10:17:17 EDT 2006
> From: splint-discuss-bounces at cs.virginia.edu
> [mailto:splint-discuss-bounces at cs.virginia.edu] On Behalf Of
> Daniel Nikolic
> Sent: Thursday, 18 May, 2006 05:05
>
> I'm trying to evaluate Splint and I'm quite
> satisfied, but I don't know what to do with
> errors I get all the time with Windows
> header files:
You could try adding the following to your Splint configuration. These
settings cleaned up the false positives in the MS headers for VC6 for
me:
# Help Splint with Windows idiosyncrasies
-D_M_IX86=400
-DWIN32
-D_NTSYSTEM
-D_WIN32_WINNT=0x0400
-DWINVER=600
-DNOGDI
-DNOKERNEL
-DNOUSER
-DWIN32_LEAN_AND_MEAN
-D__int64=long
-D_int64=int
-D_wtoi=atoi
-DSTRICT
-D__try=
-D__except(x)=
-DGetExceptionCode()=1
They're based on the settings suggested on the Splint site, with some
additions of my own. Note that they may not be appropriate for all
Windows apps (particularly WIN32_LEAN_AND_MEAN), so you may have to
tweak them. I note that the Splint config you supplied doesn't have all
of these.
For VC8 (Visual Studio 2005) you may need other definitions, since it
suffers from "safe coding" diarrhea. (Plus ten points for good
intentions, minus several thousand for the actual implementation...)
I skipped over VC7 (VS2003) myself (life's too short to try to deal with
every bright idea coming out of Microsoft's compiler teams), but I
imagine it has Splint issues all its own.
> Splint 3.1.1 --- 12 April 2003
>
> < Location unknown >: Field name reused:
I must say that this "Location unknown" business really annoys me; if I
ever have time to do some serious repair work on Splint, this will be
one of the first things that I fix. What possible reason could there be
for the parser to not know what file and line it's on?
> My .splintrc:
>
> -sysdirs
>
C:\Progra~1\Micros~2.NET\Vc7\PlatformSDK\include;C:\Progra~1\Micros~2.NE
T\Vc7\include
I haven't found it necessary to set any sysdirs in my Splint
configuration for Windows. I'm not sure Splint correctly handles the
8.3-LSN name conversions anyway.
> I'd like to use Splint under Windows, but I
> see there is not much support. Anyone has
> any experience?
I've had some luck with it. I'm using it in a fairly casual manner
(weakened checking, none of the advanced features), but I do have it to
the point where I've eliminated the false positives and still catch a
fair number of errors.
> By the way, there are some errors in the Splint
> manual, ver 3.1.1 (27 April 2003). Enyone knows
> whom should I mail this?
There doesn't appear to be a current Splint maintainer. A call went out
on this list around the beginning of the year, and I don't recall anyone
stepping up. (I might have missed it, though.)
--
Michael Wojcik
Principal Software Systems Developer, Micro Focus
More information about the splint-discuss
mailing list