Closed Bug 282659 Opened 20 years ago Closed 7 years ago

Support running PREfast static analysis (aka /analyze compiler switch)

Categories

(Firefox Build System :: General, enhancement)

x86
Windows XP
enhancement
Not set
normal

Tracking

(Not tracked)

RESOLVED INCOMPLETE

People

(Reporter: David.R.Gardiner, Unassigned)

References

()

Details

User-Agent:       Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.7.5) Gecko/20041107 Firefox/1.0
Build Identifier: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.7.5) Gecko/20041107 Firefox/1.0

PREfast is a code static analysis tool that is currently part of the Microsoft
Server 2003 DDK.

It would be interesting to be able to run it over the Mozilla codebase to see if
any of the warnings turn out to be problems that should be fixed.

-dave

Reproducible: Always

Steps to Reproduce:
To install PREfast on your PC:

1. get hold of the DDK
2. run setup.exe
3. Deselect everything
4. Just select Build Environment | Windows Driver Development Kit Required Build
Tools

Add the prefast scripts folder to your path: 
PATH %PATH%;C:\WINDDK\3790.1433\bin\x86\prefast\scripts

Set the following environment variable:
SET PREFAST_ROOT=C:\WINDDK\3790~1.143\bin\x86\prefast

You should now be able to run prefast.exe from the command-line.

-dave
It looks like the 'normal' way that you'd run PREfast would be as a prefix
before the build/make command..  eg.

prefast make -f client.mk

However that doesn't work with Mozilla - which I think is related to the way
that the Mozilla build system works (using cygwin, unix paths etc).

All is not lost however.

As a quick hack, I've found that if you edit the MOZ_OBJDIR/config/autoconf.mk
file and insert a reference to prefast in the following line then you can get it
to work:

CXX		    = $(CYGWIN_WRAPPER) prefast /noreset cl

You need the (not well documented) /noreset switch to prevent prefast from
resetting the defects.xml file. (This is the default for prefast as it normally
expects to be run just the once rather than for each time you run the compiler)

-dave
Blocks: 283681
Updated summary to indicate that prefast is built in to the compiler if you have either the Windows Vista Beta 2 SDK (or later) or Visual Studio Team System Developer (part of Code Analysis)

-dave
Summary: Support running PREfast static analysis tool → Support running PREfast static analysis (aka /analyze compiler switch)
QA Contact: build-config
Mass bug cleanup for Core:Build Config.

If you feel this bug has been closed in error, please re-open with new details.
Status: NEW → RESOLVED
Closed: 7 years ago
Resolution: --- → INCOMPLETE
Product: Core → Firefox Build System
You need to log in before you can comment on or make changes to this bug.