>
>
Cannot process the whole file "foo…

Andrey Karpov
Articles: 643

Cannot process the whole file "foo.cpp"

Sometimes PVS-Studio analyzer cannot analyze a file with a source code completely. There are various reasons. Perhaps, the analyzer did not manage to analyze an especially complex template or something of the kind. Rarely, but it happens. As a rule this is not crucial from the viewpoint of analysis as only a small fragment of code remains unanalyzed. That's why the warning "Cannot process the whole file" is generated by PVS-Studio analyzer only if "Pedantic mode" is enabled in the settings.

In this note I would like to specify that it is not always the fault of PVS-Studio analyzer that the warning "Cannot process the whole file" appears. In some cases the program text can actually contain an error which is nevertheless ignored by Visual C++ compiler. It happens when the error is situated in the body of a function of template class which is never used in the program and consequently never instanced.

As an example you can open the file "Microsoft Visual Studio 8\VC\atlmfc\include\atldb.h" and study the template class CErrorReporterHelper. PostError function contains an error. In one of the lines a semicolon is missing:

template <const GUID* pguidProvider>
class CErrorReporterHelper
public:
  HRESULT PostError(HRESULT hrErr, IID* piid)
  {
    . . .
    errorinfo.hrError  = hrErr;
    errorinfo.iid    = *piid;
    spCrtErrInfo->SetGUID(errorinfo.iid)   //  <- ERROR
    spCrtErrInfo->SetSource(OLESTR("Provider PROGID"));
    . . .

But this error will not prevent you from using the header file atldb.h in your projects. If you do not need CErrorReporterHelper class there will be no compilation error.

But as for PVS-Studio, as it uses different algorithms of code parsing, it will "stumble" inside the function over the same error and show the warning "Cannot process the whole file". The analyzer will also not be able to check the part of this function. But in this case it does not matter absolutely because the code of the incorrect function is not used anywhere.