At times the users of PVS-Studio static analyzer encounter the following issue while starting the analysis using Visual Studio 2008 IDE.
The analysis does not start and only one message of the following kind is produced
\Utilities\Bin\x86";"C:\WINDOWS\system32";"C:\WINDOWS";
"C:\WINDOWS\System32\Wbem";"C:\Program. was unexpected at this time.
After thoroughly investigating this issue we've determined that such a behavior is caused by an error in one of Visual Studio's environment configuration bat files. And this file is:
..\Microsoft Visual Studio 9.0\Common7\Tools\vsvars32.bat
The PVS-Studio analyzer uses vsvars32.bat file to configure the environment before launching Visual C++ preprocessor. It turns out that this particular issue is caused by the following fragment of the file:
@if not "%WindowsSdkDir%" == "" (
set "PATH=%WindowsSdkDir%bin;%PATH%"
set "INCLUDE=%WindowsSdkDir%include;%INCLUDE%"
set "LIB=%WindowsSdkDir%lib;%LIB%"
)
The issue will manifest itself if the PATH environmental variable will have been containing the '(' and ')' characters, as if for example Microsoft DirectX SDK will have been included into it - "C:\Program Files\Microsoft DirectX SDK (August 2006)\Utilities\Bin\x86". Than the statement following the 'if' operator
@if not "%WindowsSdkDir%" == "" (
set "PATH=%WindowsSdkDir%bin;%PATH%"
will be terminated by one of the closing parentheses in PATH, as in this case ..August 2006), which results in the issue at hand.
This leaves us with two solutions of the problem:
@if "%WindowsSdkDir%" == "" goto SkipSDKVariableSet
@set "PATH=%WindowsSdkDir%bin;%PATH%"
@set "INCLUDE=%WindowsSdkDir%include;%INCLUDE%"
@set "LIB=%WindowsSdkDir%lib;%LIB%"
:SkipSDKVariableSet
The second path here creates another problem with installation of updates as they could rewrite this code fragment in vsvars32.bat file.