SlideShare a Scribd company logo
1 of 41
Download to read offline
Installation of PC-Lint and its using in
Visual Studio 2005
Author: Andrey Karpov

Date: 23.12.2008


Abstract
The article is devoted to the first acquaintance with the PC-Lint 8.0 static analyzer of C++ code. The
process of the tool installation and its initial setting is described.


Introduction
C++ language is one of the most powerful but at the same time one of the most difficult programming
languages. Countless amount of literature is written about creating a high-quality code, using different
methodologies of development and testing. But the problem of increasing the quality of developing
code is still an actual sphere, which is not entirely studied.

Among the tools that help in testing and upgrading the program code it is possible to point out several
classes.

The systems for automating unit-testing can be referred to the fist class. Such well-known program tools
as AutomatedQA TestComplete (http://www.automatedqa.com) or Parasoft Jtest
(http://www.parasoft.com) can be given as examples. This testing methodology is applied in many
companies with great success and is irreplaceable in case of working at a dynamically developing
program product.

The other direction is reducing the costs of the software testing stage is identification of the changed
software parts. This helps to considerably reduce the amount of manual testing and to point out the
modified areas for a more careful checking. This approach supports high testing quality at less time
expense. The representative of this tool class is Testing Relief (http://www.testingrelief.net).

During debugging of large applications the dynamic analyzers proved good. Valgrind
(http://valgrind.org) and Compuware BoundsChecker (http://www.compuware.com) may be referred
there.

A wide range of tasks of program code checking is solved by static analyzers of both general and specific.
To the first, for example, can be referred the production of Coverity Incorporated company
(http://www.coverity.com) or Gimpel Software PC-Lint (http://www.gimpel.com), which we will
describe more carefully. To the specific static analyzers we can refer Viva64 tool
(http://www.viva64.com ) aimed for detect 64-bit portability issues and errors.

In this article the first steps are considered of the studying static analyzer Gimpel Software PC-Lint 8.0
version. It is connected with its popularity among developers of software and their interest in using
similar static analyzers. Using static code analyzers has become culture in many large companies long
ago and the interest to such tools is constantly increasing.
1. PC-Lint Installation
At the first acquaintance of a beginning user with PC-lint some difficulties may arouse in understanding
the principles of work of this program and its settings. Having accomplished the recommendations given
in this article you can get down to the code analysis proper quicker and not waist time on studying the
peculiarities of settings at the first stages of work.

This article on installing and setting PC-lint will be represented as a simple manual consisting of pictures
which show different steps and an explanation text to them.
Picture 1. Run setup wizard.




Picture 2. Look through the first pages of setup wizard.
Picture 3. Agree with the license agreement.
Picture 4. Input your name and the name of the organization.
Picture 5. Choosing the directory for the installation. For you will have to work with the folder where PC-
lint is installed quite often, we do not recommend you to install it in a directory that is more than one
level from a root directory to correct the configuration file or read the documentation. On the other
hand, after installing you will be able to configure necessary links to the files you are interested in, and
then the file location is of no importance. We agree for the installation in the root catalogue of disc C.
Picture 6. Continue the process of installation.
Picture 7. When the installation is finished, agree with the running of the configuration program.
Picture 8. Now it's time to make coffee and get ready for the setting your new tool.
Picture 9. PC-lint makes it possible to use itself standalone in a batch mode. But in our opinion more
convenient is its interactive using from Visual Studio sphere. The description of integration process of
PC-lint into the sphere you can find in env-vc7.lnt file. This file contains information on integration into
Visual Studio 2003, but the difference in the integration into Visual Studio 2005 is not much noticeable.
You may not address this file but use our document, where all the necessary corrections concerning
Visual Studio 2005 have already been done.


2. Primary Setting
Picture 10. Choosing the location of the configuration file, which is going to be created by the wizard.
We recommend to put it in the same place with PC-lint for all the files referring to this utility to be
located in the same place. In the opposite case you will have to waste some more time on path settings
to different files. You can also use the existing configuration file. Let us choose creating of new
configuration file.
Picture 11. Choose a more appropriate configuration file for our compiler. Unfortunately, we will not
find Visual C++ 2005 in the list, so we stop at Visual C++ 2003. Further on we will manually correct the
configuration file "STD.LNT" generated by the setup wizard.
Picture 12. Choosing the database we are interested in.
Picture 13. We will evidently need the support of MFC, STL and Win32API libraries, so we include the
corresponding configuration files. This setting does a very important thing: it copies LNT files necessary
for work from "C:Lintlnt" catalogue into "C:Lint" catalogue. Otherwise you will have to do it manually.
These files will not be found in "C:Lintlnt" catalogue even if you add this directory to the path
environment.
Picture 14. It is for you to decide what to choose from the list of different sets of rules of code
verification. For now you may choose nothing, and then manually or with the help of the same wizard to
add or remove different sets analyzing then the result of verification on your programs.
Picture 15. If you use in your program not only standard include files but also external libraries (for
example, Mesa), then you will have to write the corresponding paths.
Picture 16. Writhe the paths to the necessary include files. It is strongly recommended to be done,
otherwise PC-lint will simply stop at the lines #include "unknown.h".
Picture 17. That's it, the creating of the base configuration file is over.




Picture 18. Now we can, using it as an example, make configuration files we need. We will not create
other configurations, that's why we choose "No".
Picture 19. We can also execute some additional settings on PC lint behavior. Now we will pass through
                                                            PC-lint
this stage to demonstrate further on the connection between these settings with the "options.lnt"
configuration file.




Picture 20. We will not describe further settings in detail. It will be up to you to decide what to consider
to be a suspicious code and what not. But we would like to say that we decided not to consider the
following construction suspicious:

if ( (a = b) ) {

    ...

}
Picture 21. Choose more appropriate settings for our environment. Choosing "env-vc7.lnt" is not
reflected on generated configuration files. The sense of this setting is not clear. A mistake possibly exists
in the master of configuration. We will later add "env-vc7.lnt" into the configuration ourselves.
Picture 22. For we are not going to use PC-lint in a batch mode, we can skip this step of configuration.
Picture 23. The installation of the utility is finished completely, now it is possible to get down to the final
setting and integration into Visual Studio 2005.

In the beginning we need to go to the site http://www.gimpel.com and get new updates for PC-lint and
new configuration files. As we use 8.00 version, we download the updates for it from the page
http://www.viva64.com/go.php?url=501.

If you do not have "co-msc80.lnt" file, then get it. It is represented as a configuration file for working in
Visual Studio 2005. In any case it must be placed in the folder "C:Lint" (see also picture 10).

You may also see other updates and do what you think is necessary.

Now we are ready to get down to completion of configuration files. First of all let us look at the files,
which were generated during the installation of PC-lint utility. These are the files "options.lnt" and
"std.lnt". Let us start with the file "options.lnt". It looks like the following:

// Please note -- this is a representative set of error suppression

// options. Please adjust to suit your own policies

// See manual (chapter LIVING WITH LINT)

// for further details.

-e820 // allow test of parenthesized assignment

In this file the wizard saved our wishes concerning the analysis of some situations (see picture 15). Do
you remember we decided that the construction of the kind

if ( (a = b) ) {

     ...

}

correct? The result of this solution will be reflected in the file "options.lnt" as a line

-e820 // allow test of parenthesized assignment

which says to consider these constructions safe.

The file "options.lnt" is included in "std.lnt". The ideology of the including of one PC-lint configuration
file into another is the same as the ideology of using the file "#include" in C/C++ languages.

Now let us have a look at the file "std.lnt"

// Microsoft Visual C++ .NET 2003,

// -si4 -sl4 -sp8, lib-mfc.lnt lib-stl.lnt lib-w32.lnt

// Standard lint options

co-msc71.lnt
lib-mfc.lnt lib-stl.lnt lib-w32.lnt

options.lnt -si4 -sl4 -sp8

-iD:ASRCfox-libfox-1.4.4include

-iD:ASRCLibrariesmesainclude

The line "co-msc71.lnt" includes (like #include in C/C++) the setups for Visual C++ compiler in our main
configuration file. Change this line into "co-msc80.lnt" at once.

The line "lib-mfc.lnt lib-stl.lnt lib-w32.lnt" can be left without changes.

Let us add "env-vc7.lnt". We do not have the file "env-vc8.lnt" but everything will work perfectly well
with "env-vc7.lnt". It is suggested not to include "env-vc7.lnt" in your configuration files in the
documentation to PC-lint but to use it as one of the parameters at the call from the MSVC environment.
But to our mind it is more convenient that all the settings should stay at the same place. Anyway
"std.lnt" is already oriented to the work in Visual Studio environment. And when, for example, "env-
vc8.lnt" appears, it is easier to correct in one place (in "std.lnt") than to correct several commands in
Visual Studio environment, which call PC-lint.

The line "options.lnt -si4 -sl4 -sp8" seems to be difficult, but in fact four simple and independent keys of
setting are located in it. The first on includes "options.lnt" into the file "std.lnt". The rest serve to set
sizing of data types. You should see the documentation, which is included in the PC-lint set, for the
details.

The idea of using the included files is very convenient. It is possible to collect separately path settings to
the headline files or to include/exclude a number of warnings. And then to build the final configuration
files with them like with the bricks. We suppose that you will cope with it quite easily yourselves. Now
let us get rid of the file "options.lnt" to make it simpler having transferred its contents in "std.lnt".

Let us add one more level of warnings to configurations, which is set with the key -w##.

After the corrections the file "std.lnt" looks the following way:

-iD:ASRCfox-libfox-1.4.4include

-iD:ASRCLibrariesmesainclude

co-msc80.lnt

env-vc7.lnt

lib-mfc.lnt

lib-stl.lnt

lib-w32.lnt

-si4 -sl4 -sp8

-w3

-e820
It is quite a working variant of the configuration, and it's time to integrate PC-lint into MSVC
                                                                               PC-
environment.


3. Integration into Visual Studio 2005
Picture 24. Let us start Visual Studio 2005 and get down to PC-lint integration. We are going to create
                                                               lint
tree new options in Tools menu:

Project Creation is the creation of PC lint project for verification of all files in MSVC project;
                                    PC-lint

Project Check the verification according to the earlier created project (verification of all the files);
                                                                        (verification

Unit Check is the verification of the current file;

In the documentation to PC-lint using the operation called "Simple Check" for the verification of a
                            lint
separate unit of the compilation. But in practice one can rarely run across independent modules.
Picture 25. Choose the option "External Tools ..." in Tools menu.
Picture 26. Push the button "Add".
Picture 27. Let us fill in the corresponding fields like it is shown in the picture.




Picture28. Push the button OK. And now we can see the option "PC-lint (Project Creation)" in "Tools"
menu.
Picture 29. Now we are going to create the option "Project Check" like we did with the "Project
Creation". We will have to repeat all the previous steps for it but we are going to fill in the fields in
another way (pay attention to check boxes).
Picture 30. The last command is "Unit Check". All those steps are made to create it.
Picture 31. If you want to check if you hade done everything correctly, then in the "Tools" menu you can
see three new options. Here the integration of PC-lint in Visual Studio is finished.

If you want to check all your project, you will have to use the option PC-lint (Project Creation) first and
then PC-lint (Project Check).
You must use PC-lint (Project Creation) again when you add or delete files from the project or modify
                   nt
the settings of the project.

PC-lint (Unit Check) serves for the code verification in the active window. It is convenient while writing
    lint
new code. Take into consideration th you will have to execute PC-lint (Project Creation) first to use PC
                                     that                              lint                              PC-
lint (Unit Check).




Picture 32. Now praise yourself with one more cup of coffee for the work done and we will assay this
new utility.
Picture 33. Create a simple Win32 console application.
Picture 34. We need the simplest application, that's why we push the button "Finish".

Write the following program. Let us get assured that the program compiles, and the compiler does not
give out warnings even at the fourth level (/W4).
                    en

#include "stdafx.h"

TCHAR FooTxt[] = _T("foo");

bool Foo(int argc, _TCHAR* argv[])

{

    for (int i = 0; i != argc; ++i) {

        if (_tcscmp(argv[i], FooTxt) == 0)

        {

            return true;

        }

    }

    return false;

}

int _tmain(int argc, _TCHAR* argv[])
           int

{

    if (Foo(argc, argv))
return 1;

    return 0;

}

No it's timeto use PC-lint. First we execute "PC-lint (Project Creation)", and then "PC-lint (Project
Check)". If everything is set correctly, you must get approximately the following conclusion:

PC-lint for C/C++ (NT) Vers. 8.00u, Copyright Gimpel Software 1985-2006

--- Module: .SimpleProjectForPClint.cpp (C++)

}

.SimpleProjectForPClint.cpp(14): error 818: (Info -- Pointer parameter 'argv' (line 5) could be declared
as pointing to const)

.SimpleProjectForPClint.cpp(5): error 830: (Info -- Location cited in prior message)

--- Module: .stdafx.cpp (C++)

--- Wrap-up for Module: .stdafx.cpp

.stdafx.cpp(9): error 766: (Info -- Header file
'D:WORK3SimpleProjectForPClintSimpleProjectForPClintstdafx.h' not used in module '.stdafx.cpp')

--- Global Wrap-up

.SimpleProjectForPClint.cpp(5): error 765: (Info -- external 'Foo(int, unsigned short **)' (line 5, file
.SimpleProjectForPClint.cpp) could be made static)

.SimpleProjectForPClint.cpp(3): error 765: (Info -- external 'FooTxt' (line 3, file
.SimpleProjectForPClint.cpp) could be made static)

 D:WORK3SimpleProjectForPClintSimpleProjectForPClintstdafx.h(9): error 755: (Info -- global macro
'WIN32_LEAN_AND_MEAN' (line 9, file
D:WORK3SimpleProjectForPClintSimpleProjectForPClintstdafx.h) not referenced)

error 900: (Note -- Successful completion, 6 messages produced)

It's hard to disagree with. Now you have a wonderful tool in your arms, which will make it possible to
you're your code better and to find both potential and present errors.

But if you get the message:

PC-lint for C/C++ (NT) Vers. 8.00u, Copyright Gimpel Software 1985-2006

--- Module: .pclint.cpp (C++)

_

#include <stdio.h>

D:Sourcespclintstdafx.h(10) : Error 322: Unable to open include file
'stdio.h'

then it means that you have not set the environment settings and you will have to check the
environment settings INCLUDE. Let us write in the command line

echo %INCLUDE%

As the result you must see:

C:Program FilesMicrosoft Visual Studio 8
                  Microsoft              8VCATLMFCINCLUDE;C:Program Files
                                                                    Program FilesMicrosoft Visual
Studio 8VCINCLUDE;C:Program Files
                          Program FilesMicrosoft Visual Studio 8VCPlatformSDK
                                                                     PlatformSDKinclude;C:Program
FilesMicrosoft Visual Studio 8
      Microsoft               8SDKv2.0include;7

If the paths to the Visual Studio headline files are absent, then it is necessary to correct the environment
settings or to write the paths to the files in PC
                                               PC-lint configuration files.
Picture 35. Pushing the button F4 in the window Output you can easily navigate among the warnings of
PC-lint.

That's where the installation of PC lint and its integration into Visual Studio 2005 can be considered
                                 PC-lint
finished. Your following step must be getting acquainted with the documentation and tuning of the
configuration files to your specific needs. Good luck in your work!


References
    1.   Wikipedia, "Unit testing", http://www.viva64.com/go.php?url=44
    2.   Wikipedia, "Dynamic testing", http://www.viva64.com/go.php?url=45
    3.   Wikipedia, "Static testing", http://www.viva64.com/go.php?url=46
            ipedia,
    4.   Wikipedia, "Static code analysis", http://www.viva64.com/go.php?url=31
    5.   Wikipedia, "White box t testing", http://www.viva64.com/go.php?url=47
    6.   Wikipedia, "Black box testing", http://www.viva64.com/go.php?url=48

More Related Content

What's hot

Part II: LLVM Intermediate Representation
Part II: LLVM Intermediate RepresentationPart II: LLVM Intermediate Representation
Part II: LLVM Intermediate RepresentationWei-Ren Chen
 
C programming interview questions
C programming interview questionsC programming interview questions
C programming interview questionsadarshynl
 
llvm-py: Writing Compilers In Python
llvm-py: Writing Compilers In Pythonllvm-py: Writing Compilers In Python
llvm-py: Writing Compilers In Pythonmdevan
 
Embedded C programming based on 8051 microcontroller
Embedded C programming based on 8051 microcontrollerEmbedded C programming based on 8051 microcontroller
Embedded C programming based on 8051 microcontrollerGaurav Verma
 
Embedded c programming22 for fdp
Embedded c programming22 for fdpEmbedded c programming22 for fdp
Embedded c programming22 for fdpPradeep Kumar TS
 
Top five reasons why every DV engineer will love the latest systemverilog 201...
Top five reasons why every DV engineer will love the latest systemverilog 201...Top five reasons why every DV engineer will love the latest systemverilog 201...
Top five reasons why every DV engineer will love the latest systemverilog 201...Srinivasan Venkataramanan
 
Introduction of c language
Introduction of c languageIntroduction of c language
Introduction of c languagefarishah
 
Digital design with Systemc
Digital design with SystemcDigital design with Systemc
Digital design with SystemcMarc Engels
 
Brief introduction to the c programming language
Brief introduction to the c programming languageBrief introduction to the c programming language
Brief introduction to the c programming languageKumar Gaurav
 
COM1407: Introduction to C Programming
COM1407: Introduction to C Programming COM1407: Introduction to C Programming
COM1407: Introduction to C Programming Hemantha Kulathilake
 
Code Difference Visualization by a Call Tree
Code Difference Visualization by a Call TreeCode Difference Visualization by a Call Tree
Code Difference Visualization by a Call TreeKamiya Toshihiro
 
C Programming Language Tutorial for beginners - JavaTpoint
C Programming Language Tutorial for beginners - JavaTpointC Programming Language Tutorial for beginners - JavaTpoint
C Programming Language Tutorial for beginners - JavaTpointJavaTpoint.Com
 
Safety on the Max: How to Write Reliable C/C++ Code for Embedded Systems
Safety on the Max: How to Write Reliable C/C++ Code for Embedded SystemsSafety on the Max: How to Write Reliable C/C++ Code for Embedded Systems
Safety on the Max: How to Write Reliable C/C++ Code for Embedded SystemsAndrey Karpov
 
2009 10-28-peeking-into-pandoras-bochs red-team-pentesting
2009 10-28-peeking-into-pandoras-bochs red-team-pentesting2009 10-28-peeking-into-pandoras-bochs red-team-pentesting
2009 10-28-peeking-into-pandoras-bochs red-team-pentestingSteph Cliche
 
Introduction to programming with c,
Introduction to programming with c,Introduction to programming with c,
Introduction to programming with c,Hossain Md Shakhawat
 

What's hot (20)

Part II: LLVM Intermediate Representation
Part II: LLVM Intermediate RepresentationPart II: LLVM Intermediate Representation
Part II: LLVM Intermediate Representation
 
C programming interview questions
C programming interview questionsC programming interview questions
C programming interview questions
 
llvm-py: Writing Compilers In Python
llvm-py: Writing Compilers In Pythonllvm-py: Writing Compilers In Python
llvm-py: Writing Compilers In Python
 
Embedded C programming based on 8051 microcontroller
Embedded C programming based on 8051 microcontrollerEmbedded C programming based on 8051 microcontroller
Embedded C programming based on 8051 microcontroller
 
Embedded c programming22 for fdp
Embedded c programming22 for fdpEmbedded c programming22 for fdp
Embedded c programming22 for fdp
 
Top five reasons why every DV engineer will love the latest systemverilog 201...
Top five reasons why every DV engineer will love the latest systemverilog 201...Top five reasons why every DV engineer will love the latest systemverilog 201...
Top five reasons why every DV engineer will love the latest systemverilog 201...
 
C programming session10
C programming  session10C programming  session10
C programming session10
 
Introduction of c language
Introduction of c languageIntroduction of c language
Introduction of c language
 
Digital design with Systemc
Digital design with SystemcDigital design with Systemc
Digital design with Systemc
 
Brief introduction to the c programming language
Brief introduction to the c programming languageBrief introduction to the c programming language
Brief introduction to the c programming language
 
COM1407: Introduction to C Programming
COM1407: Introduction to C Programming COM1407: Introduction to C Programming
COM1407: Introduction to C Programming
 
Code Difference Visualization by a Call Tree
Code Difference Visualization by a Call TreeCode Difference Visualization by a Call Tree
Code Difference Visualization by a Call Tree
 
C language introduction
C language introduction C language introduction
C language introduction
 
C programming session8
C programming  session8C programming  session8
C programming session8
 
C programming session3
C programming  session3C programming  session3
C programming session3
 
C Programming Language Tutorial for beginners - JavaTpoint
C Programming Language Tutorial for beginners - JavaTpointC Programming Language Tutorial for beginners - JavaTpoint
C Programming Language Tutorial for beginners - JavaTpoint
 
Embedded c
Embedded cEmbedded c
Embedded c
 
Safety on the Max: How to Write Reliable C/C++ Code for Embedded Systems
Safety on the Max: How to Write Reliable C/C++ Code for Embedded SystemsSafety on the Max: How to Write Reliable C/C++ Code for Embedded Systems
Safety on the Max: How to Write Reliable C/C++ Code for Embedded Systems
 
2009 10-28-peeking-into-pandoras-bochs red-team-pentesting
2009 10-28-peeking-into-pandoras-bochs red-team-pentesting2009 10-28-peeking-into-pandoras-bochs red-team-pentesting
2009 10-28-peeking-into-pandoras-bochs red-team-pentesting
 
Introduction to programming with c,
Introduction to programming with c,Introduction to programming with c,
Introduction to programming with c,
 

Similar to Installation of PC-Lint and its using in Visual Studio 2005

How to work with code blocks
How to work with code blocksHow to work with code blocks
How to work with code blocksTech Bikram
 
Compile open cpn on windows
Compile open cpn on windowsCompile open cpn on windows
Compile open cpn on windowsrandikaucsc
 
Changes in programmer tools' infrastructure
Changes in programmer tools' infrastructureChanges in programmer tools' infrastructure
Changes in programmer tools' infrastructurePVS-Studio
 
Vb net xp_16
Vb net xp_16Vb net xp_16
Vb net xp_16Niit Care
 
Kinect installation guide
Kinect installation guideKinect installation guide
Kinect installation guidegilmsdn
 
Diving into VS 2015 Day2
Diving into VS 2015 Day2Diving into VS 2015 Day2
Diving into VS 2015 Day2Akhil Mittal
 
N-Tier Application with Windows Forms - Deployment and Security
N-Tier Application with Windows Forms - Deployment and SecurityN-Tier Application with Windows Forms - Deployment and Security
N-Tier Application with Windows Forms - Deployment and SecurityPeter Gfader
 
Static Analysis: From Getting Started to Integration
Static Analysis: From Getting Started to IntegrationStatic Analysis: From Getting Started to Integration
Static Analysis: From Getting Started to IntegrationAndrey Karpov
 
Changes in programmer tools' infrastructure
Changes in programmer tools' infrastructureChanges in programmer tools' infrastructure
Changes in programmer tools' infrastructureAndrey Karpov
 
tybsc it asp.net full unit 1,2,3,4,5,6 notes
tybsc it asp.net full unit 1,2,3,4,5,6 notestybsc it asp.net full unit 1,2,3,4,5,6 notes
tybsc it asp.net full unit 1,2,3,4,5,6 notesWE-IT TUTORIALS
 
Comparing static analysis in Visual Studio 2012 (Visual C++ 2012) and PVS-Studio
Comparing static analysis in Visual Studio 2012 (Visual C++ 2012) and PVS-StudioComparing static analysis in Visual Studio 2012 (Visual C++ 2012) and PVS-Studio
Comparing static analysis in Visual Studio 2012 (Visual C++ 2012) and PVS-StudioPVS-Studio
 
Fr net programmermanual-en
Fr net programmermanual-enFr net programmermanual-en
Fr net programmermanual-enMorenita Batista
 
Programming in c_in_7_days
Programming in c_in_7_daysProgramming in c_in_7_days
Programming in c_in_7_daysAnkit Dubey
 
3 Ways to Get Started with a React App in 2024.pdf
3 Ways to Get Started with a React App in 2024.pdf3 Ways to Get Started with a React App in 2024.pdf
3 Ways to Get Started with a React App in 2024.pdfBOSC Tech Labs
 
Microsoft .NET 6 -What's All About The New Update
Microsoft .NET 6 -What's All About The New UpdateMicrosoft .NET 6 -What's All About The New Update
Microsoft .NET 6 -What's All About The New UpdateAdam John
 
tutorials-visual-studio_visual-studio-2015-preview-comes-with-emulator-for-an...
tutorials-visual-studio_visual-studio-2015-preview-comes-with-emulator-for-an...tutorials-visual-studio_visual-studio-2015-preview-comes-with-emulator-for-an...
tutorials-visual-studio_visual-studio-2015-preview-comes-with-emulator-for-an...Anil Sharma
 
PVS-Studio confesses its love for Linux
PVS-Studio confesses its love for LinuxPVS-Studio confesses its love for Linux
PVS-Studio confesses its love for LinuxPVS-Studio
 

Similar to Installation of PC-Lint and its using in Visual Studio 2005 (20)

How to work with code blocks
How to work with code blocksHow to work with code blocks
How to work with code blocks
 
Compile open cpn on windows
Compile open cpn on windowsCompile open cpn on windows
Compile open cpn on windows
 
Readme trainer
Readme trainerReadme trainer
Readme trainer
 
Changes in programmer tools' infrastructure
Changes in programmer tools' infrastructureChanges in programmer tools' infrastructure
Changes in programmer tools' infrastructure
 
Vb net xp_16
Vb net xp_16Vb net xp_16
Vb net xp_16
 
Impl installation manual
Impl installation manualImpl installation manual
Impl installation manual
 
Kinect installation guide
Kinect installation guideKinect installation guide
Kinect installation guide
 
Diving into VS 2015 Day2
Diving into VS 2015 Day2Diving into VS 2015 Day2
Diving into VS 2015 Day2
 
N-Tier Application with Windows Forms - Deployment and Security
N-Tier Application with Windows Forms - Deployment and SecurityN-Tier Application with Windows Forms - Deployment and Security
N-Tier Application with Windows Forms - Deployment and Security
 
Static Analysis: From Getting Started to Integration
Static Analysis: From Getting Started to IntegrationStatic Analysis: From Getting Started to Integration
Static Analysis: From Getting Started to Integration
 
Changes in programmer tools' infrastructure
Changes in programmer tools' infrastructureChanges in programmer tools' infrastructure
Changes in programmer tools' infrastructure
 
tybsc it asp.net full unit 1,2,3,4,5,6 notes
tybsc it asp.net full unit 1,2,3,4,5,6 notestybsc it asp.net full unit 1,2,3,4,5,6 notes
tybsc it asp.net full unit 1,2,3,4,5,6 notes
 
Readme
ReadmeReadme
Readme
 
Comparing static analysis in Visual Studio 2012 (Visual C++ 2012) and PVS-Studio
Comparing static analysis in Visual Studio 2012 (Visual C++ 2012) and PVS-StudioComparing static analysis in Visual Studio 2012 (Visual C++ 2012) and PVS-Studio
Comparing static analysis in Visual Studio 2012 (Visual C++ 2012) and PVS-Studio
 
Fr net programmermanual-en
Fr net programmermanual-enFr net programmermanual-en
Fr net programmermanual-en
 
Programming in c_in_7_days
Programming in c_in_7_daysProgramming in c_in_7_days
Programming in c_in_7_days
 
3 Ways to Get Started with a React App in 2024.pdf
3 Ways to Get Started with a React App in 2024.pdf3 Ways to Get Started with a React App in 2024.pdf
3 Ways to Get Started with a React App in 2024.pdf
 
Microsoft .NET 6 -What's All About The New Update
Microsoft .NET 6 -What's All About The New UpdateMicrosoft .NET 6 -What's All About The New Update
Microsoft .NET 6 -What's All About The New Update
 
tutorials-visual-studio_visual-studio-2015-preview-comes-with-emulator-for-an...
tutorials-visual-studio_visual-studio-2015-preview-comes-with-emulator-for-an...tutorials-visual-studio_visual-studio-2015-preview-comes-with-emulator-for-an...
tutorials-visual-studio_visual-studio-2015-preview-comes-with-emulator-for-an...
 
PVS-Studio confesses its love for Linux
PVS-Studio confesses its love for LinuxPVS-Studio confesses its love for Linux
PVS-Studio confesses its love for Linux
 

Recently uploaded

Driving Behavioral Change for Information Management through Data-Driven Gree...
Driving Behavioral Change for Information Management through Data-Driven Gree...Driving Behavioral Change for Information Management through Data-Driven Gree...
Driving Behavioral Change for Information Management through Data-Driven Gree...Enterprise Knowledge
 
WhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure service
WhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure serviceWhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure service
WhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure servicePooja Nehwal
 
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
08448380779 Call Girls In Diplomatic Enclave Women Seeking MenDelhi Call girls
 
08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking Men08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking MenDelhi Call girls
 
Salesforce Community Group Quito, Salesforce 101
Salesforce Community Group Quito, Salesforce 101Salesforce Community Group Quito, Salesforce 101
Salesforce Community Group Quito, Salesforce 101Paola De la Torre
 
Finology Group – Insurtech Innovation Award 2024
Finology Group – Insurtech Innovation Award 2024Finology Group – Insurtech Innovation Award 2024
Finology Group – Insurtech Innovation Award 2024The Digital Insurer
 
08448380779 Call Girls In Civil Lines Women Seeking Men
08448380779 Call Girls In Civil Lines Women Seeking Men08448380779 Call Girls In Civil Lines Women Seeking Men
08448380779 Call Girls In Civil Lines Women Seeking MenDelhi Call girls
 
Exploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone ProcessorsExploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone Processorsdebabhi2
 
Scaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organizationScaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organizationRadu Cotescu
 
Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...
Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...
Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...Neo4j
 
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptxEIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptxEarley Information Science
 
Top 5 Benefits OF Using Muvi Live Paywall For Live Streams
Top 5 Benefits OF Using Muvi Live Paywall For Live StreamsTop 5 Benefits OF Using Muvi Live Paywall For Live Streams
Top 5 Benefits OF Using Muvi Live Paywall For Live StreamsRoshan Dwivedi
 
TrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law DevelopmentsTrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law DevelopmentsTrustArc
 
Tata AIG General Insurance Company - Insurer Innovation Award 2024
Tata AIG General Insurance Company - Insurer Innovation Award 2024Tata AIG General Insurance Company - Insurer Innovation Award 2024
Tata AIG General Insurance Company - Insurer Innovation Award 2024The Digital Insurer
 
[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdf[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdfhans926745
 
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...apidays
 
A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)Gabriella Davis
 
GenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day PresentationGenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day PresentationMichael W. Hawkins
 
How to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerHow to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerThousandEyes
 
From Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time AutomationFrom Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time AutomationSafe Software
 

Recently uploaded (20)

Driving Behavioral Change for Information Management through Data-Driven Gree...
Driving Behavioral Change for Information Management through Data-Driven Gree...Driving Behavioral Change for Information Management through Data-Driven Gree...
Driving Behavioral Change for Information Management through Data-Driven Gree...
 
WhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure service
WhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure serviceWhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure service
WhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure service
 
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
 
08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking Men08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking Men
 
Salesforce Community Group Quito, Salesforce 101
Salesforce Community Group Quito, Salesforce 101Salesforce Community Group Quito, Salesforce 101
Salesforce Community Group Quito, Salesforce 101
 
Finology Group – Insurtech Innovation Award 2024
Finology Group – Insurtech Innovation Award 2024Finology Group – Insurtech Innovation Award 2024
Finology Group – Insurtech Innovation Award 2024
 
08448380779 Call Girls In Civil Lines Women Seeking Men
08448380779 Call Girls In Civil Lines Women Seeking Men08448380779 Call Girls In Civil Lines Women Seeking Men
08448380779 Call Girls In Civil Lines Women Seeking Men
 
Exploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone ProcessorsExploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone Processors
 
Scaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organizationScaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organization
 
Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...
Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...
Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...
 
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptxEIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
 
Top 5 Benefits OF Using Muvi Live Paywall For Live Streams
Top 5 Benefits OF Using Muvi Live Paywall For Live StreamsTop 5 Benefits OF Using Muvi Live Paywall For Live Streams
Top 5 Benefits OF Using Muvi Live Paywall For Live Streams
 
TrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law DevelopmentsTrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
 
Tata AIG General Insurance Company - Insurer Innovation Award 2024
Tata AIG General Insurance Company - Insurer Innovation Award 2024Tata AIG General Insurance Company - Insurer Innovation Award 2024
Tata AIG General Insurance Company - Insurer Innovation Award 2024
 
[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdf[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdf
 
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
 
A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)
 
GenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day PresentationGenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day Presentation
 
How to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerHow to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected Worker
 
From Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time AutomationFrom Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time Automation
 

Installation of PC-Lint and its using in Visual Studio 2005

  • 1. Installation of PC-Lint and its using in Visual Studio 2005 Author: Andrey Karpov Date: 23.12.2008 Abstract The article is devoted to the first acquaintance with the PC-Lint 8.0 static analyzer of C++ code. The process of the tool installation and its initial setting is described. Introduction C++ language is one of the most powerful but at the same time one of the most difficult programming languages. Countless amount of literature is written about creating a high-quality code, using different methodologies of development and testing. But the problem of increasing the quality of developing code is still an actual sphere, which is not entirely studied. Among the tools that help in testing and upgrading the program code it is possible to point out several classes. The systems for automating unit-testing can be referred to the fist class. Such well-known program tools as AutomatedQA TestComplete (http://www.automatedqa.com) or Parasoft Jtest (http://www.parasoft.com) can be given as examples. This testing methodology is applied in many companies with great success and is irreplaceable in case of working at a dynamically developing program product. The other direction is reducing the costs of the software testing stage is identification of the changed software parts. This helps to considerably reduce the amount of manual testing and to point out the modified areas for a more careful checking. This approach supports high testing quality at less time expense. The representative of this tool class is Testing Relief (http://www.testingrelief.net). During debugging of large applications the dynamic analyzers proved good. Valgrind (http://valgrind.org) and Compuware BoundsChecker (http://www.compuware.com) may be referred there. A wide range of tasks of program code checking is solved by static analyzers of both general and specific. To the first, for example, can be referred the production of Coverity Incorporated company (http://www.coverity.com) or Gimpel Software PC-Lint (http://www.gimpel.com), which we will describe more carefully. To the specific static analyzers we can refer Viva64 tool (http://www.viva64.com ) aimed for detect 64-bit portability issues and errors. In this article the first steps are considered of the studying static analyzer Gimpel Software PC-Lint 8.0 version. It is connected with its popularity among developers of software and their interest in using similar static analyzers. Using static code analyzers has become culture in many large companies long ago and the interest to such tools is constantly increasing.
  • 2. 1. PC-Lint Installation At the first acquaintance of a beginning user with PC-lint some difficulties may arouse in understanding the principles of work of this program and its settings. Having accomplished the recommendations given in this article you can get down to the code analysis proper quicker and not waist time on studying the peculiarities of settings at the first stages of work. This article on installing and setting PC-lint will be represented as a simple manual consisting of pictures which show different steps and an explanation text to them.
  • 3. Picture 1. Run setup wizard. Picture 2. Look through the first pages of setup wizard.
  • 4. Picture 3. Agree with the license agreement.
  • 5. Picture 4. Input your name and the name of the organization.
  • 6. Picture 5. Choosing the directory for the installation. For you will have to work with the folder where PC- lint is installed quite often, we do not recommend you to install it in a directory that is more than one level from a root directory to correct the configuration file or read the documentation. On the other hand, after installing you will be able to configure necessary links to the files you are interested in, and then the file location is of no importance. We agree for the installation in the root catalogue of disc C.
  • 7. Picture 6. Continue the process of installation.
  • 8. Picture 7. When the installation is finished, agree with the running of the configuration program.
  • 9. Picture 8. Now it's time to make coffee and get ready for the setting your new tool.
  • 10. Picture 9. PC-lint makes it possible to use itself standalone in a batch mode. But in our opinion more convenient is its interactive using from Visual Studio sphere. The description of integration process of
  • 11. PC-lint into the sphere you can find in env-vc7.lnt file. This file contains information on integration into Visual Studio 2003, but the difference in the integration into Visual Studio 2005 is not much noticeable. You may not address this file but use our document, where all the necessary corrections concerning Visual Studio 2005 have already been done. 2. Primary Setting
  • 12. Picture 10. Choosing the location of the configuration file, which is going to be created by the wizard. We recommend to put it in the same place with PC-lint for all the files referring to this utility to be located in the same place. In the opposite case you will have to waste some more time on path settings to different files. You can also use the existing configuration file. Let us choose creating of new configuration file.
  • 13.
  • 14. Picture 11. Choose a more appropriate configuration file for our compiler. Unfortunately, we will not find Visual C++ 2005 in the list, so we stop at Visual C++ 2003. Further on we will manually correct the configuration file "STD.LNT" generated by the setup wizard.
  • 15. Picture 12. Choosing the database we are interested in.
  • 16. Picture 13. We will evidently need the support of MFC, STL and Win32API libraries, so we include the corresponding configuration files. This setting does a very important thing: it copies LNT files necessary for work from "C:Lintlnt" catalogue into "C:Lint" catalogue. Otherwise you will have to do it manually. These files will not be found in "C:Lintlnt" catalogue even if you add this directory to the path environment.
  • 17. Picture 14. It is for you to decide what to choose from the list of different sets of rules of code verification. For now you may choose nothing, and then manually or with the help of the same wizard to add or remove different sets analyzing then the result of verification on your programs.
  • 18. Picture 15. If you use in your program not only standard include files but also external libraries (for example, Mesa), then you will have to write the corresponding paths.
  • 19. Picture 16. Writhe the paths to the necessary include files. It is strongly recommended to be done, otherwise PC-lint will simply stop at the lines #include "unknown.h".
  • 20. Picture 17. That's it, the creating of the base configuration file is over. Picture 18. Now we can, using it as an example, make configuration files we need. We will not create other configurations, that's why we choose "No".
  • 21.
  • 22. Picture 19. We can also execute some additional settings on PC lint behavior. Now we will pass through PC-lint this stage to demonstrate further on the connection between these settings with the "options.lnt" configuration file. Picture 20. We will not describe further settings in detail. It will be up to you to decide what to consider to be a suspicious code and what not. But we would like to say that we decided not to consider the following construction suspicious: if ( (a = b) ) { ... }
  • 23.
  • 24. Picture 21. Choose more appropriate settings for our environment. Choosing "env-vc7.lnt" is not reflected on generated configuration files. The sense of this setting is not clear. A mistake possibly exists in the master of configuration. We will later add "env-vc7.lnt" into the configuration ourselves.
  • 25. Picture 22. For we are not going to use PC-lint in a batch mode, we can skip this step of configuration.
  • 26. Picture 23. The installation of the utility is finished completely, now it is possible to get down to the final setting and integration into Visual Studio 2005. In the beginning we need to go to the site http://www.gimpel.com and get new updates for PC-lint and new configuration files. As we use 8.00 version, we download the updates for it from the page http://www.viva64.com/go.php?url=501. If you do not have "co-msc80.lnt" file, then get it. It is represented as a configuration file for working in Visual Studio 2005. In any case it must be placed in the folder "C:Lint" (see also picture 10). You may also see other updates and do what you think is necessary. Now we are ready to get down to completion of configuration files. First of all let us look at the files, which were generated during the installation of PC-lint utility. These are the files "options.lnt" and "std.lnt". Let us start with the file "options.lnt". It looks like the following: // Please note -- this is a representative set of error suppression // options. Please adjust to suit your own policies // See manual (chapter LIVING WITH LINT) // for further details. -e820 // allow test of parenthesized assignment In this file the wizard saved our wishes concerning the analysis of some situations (see picture 15). Do you remember we decided that the construction of the kind if ( (a = b) ) { ... } correct? The result of this solution will be reflected in the file "options.lnt" as a line -e820 // allow test of parenthesized assignment which says to consider these constructions safe. The file "options.lnt" is included in "std.lnt". The ideology of the including of one PC-lint configuration file into another is the same as the ideology of using the file "#include" in C/C++ languages. Now let us have a look at the file "std.lnt" // Microsoft Visual C++ .NET 2003, // -si4 -sl4 -sp8, lib-mfc.lnt lib-stl.lnt lib-w32.lnt // Standard lint options co-msc71.lnt
  • 27. lib-mfc.lnt lib-stl.lnt lib-w32.lnt options.lnt -si4 -sl4 -sp8 -iD:ASRCfox-libfox-1.4.4include -iD:ASRCLibrariesmesainclude The line "co-msc71.lnt" includes (like #include in C/C++) the setups for Visual C++ compiler in our main configuration file. Change this line into "co-msc80.lnt" at once. The line "lib-mfc.lnt lib-stl.lnt lib-w32.lnt" can be left without changes. Let us add "env-vc7.lnt". We do not have the file "env-vc8.lnt" but everything will work perfectly well with "env-vc7.lnt". It is suggested not to include "env-vc7.lnt" in your configuration files in the documentation to PC-lint but to use it as one of the parameters at the call from the MSVC environment. But to our mind it is more convenient that all the settings should stay at the same place. Anyway "std.lnt" is already oriented to the work in Visual Studio environment. And when, for example, "env- vc8.lnt" appears, it is easier to correct in one place (in "std.lnt") than to correct several commands in Visual Studio environment, which call PC-lint. The line "options.lnt -si4 -sl4 -sp8" seems to be difficult, but in fact four simple and independent keys of setting are located in it. The first on includes "options.lnt" into the file "std.lnt". The rest serve to set sizing of data types. You should see the documentation, which is included in the PC-lint set, for the details. The idea of using the included files is very convenient. It is possible to collect separately path settings to the headline files or to include/exclude a number of warnings. And then to build the final configuration files with them like with the bricks. We suppose that you will cope with it quite easily yourselves. Now let us get rid of the file "options.lnt" to make it simpler having transferred its contents in "std.lnt". Let us add one more level of warnings to configurations, which is set with the key -w##. After the corrections the file "std.lnt" looks the following way: -iD:ASRCfox-libfox-1.4.4include -iD:ASRCLibrariesmesainclude co-msc80.lnt env-vc7.lnt lib-mfc.lnt lib-stl.lnt lib-w32.lnt -si4 -sl4 -sp8 -w3 -e820
  • 28. It is quite a working variant of the configuration, and it's time to integrate PC-lint into MSVC PC- environment. 3. Integration into Visual Studio 2005
  • 29. Picture 24. Let us start Visual Studio 2005 and get down to PC-lint integration. We are going to create lint tree new options in Tools menu: Project Creation is the creation of PC lint project for verification of all files in MSVC project; PC-lint Project Check the verification according to the earlier created project (verification of all the files); (verification Unit Check is the verification of the current file; In the documentation to PC-lint using the operation called "Simple Check" for the verification of a lint separate unit of the compilation. But in practice one can rarely run across independent modules.
  • 30. Picture 25. Choose the option "External Tools ..." in Tools menu.
  • 31. Picture 26. Push the button "Add".
  • 32. Picture 27. Let us fill in the corresponding fields like it is shown in the picture. Picture28. Push the button OK. And now we can see the option "PC-lint (Project Creation)" in "Tools" menu.
  • 33. Picture 29. Now we are going to create the option "Project Check" like we did with the "Project Creation". We will have to repeat all the previous steps for it but we are going to fill in the fields in another way (pay attention to check boxes).
  • 34. Picture 30. The last command is "Unit Check". All those steps are made to create it.
  • 35. Picture 31. If you want to check if you hade done everything correctly, then in the "Tools" menu you can see three new options. Here the integration of PC-lint in Visual Studio is finished. If you want to check all your project, you will have to use the option PC-lint (Project Creation) first and then PC-lint (Project Check).
  • 36. You must use PC-lint (Project Creation) again when you add or delete files from the project or modify nt the settings of the project. PC-lint (Unit Check) serves for the code verification in the active window. It is convenient while writing lint new code. Take into consideration th you will have to execute PC-lint (Project Creation) first to use PC that lint PC- lint (Unit Check). Picture 32. Now praise yourself with one more cup of coffee for the work done and we will assay this new utility.
  • 37. Picture 33. Create a simple Win32 console application.
  • 38. Picture 34. We need the simplest application, that's why we push the button "Finish". Write the following program. Let us get assured that the program compiles, and the compiler does not give out warnings even at the fourth level (/W4). en #include "stdafx.h" TCHAR FooTxt[] = _T("foo"); bool Foo(int argc, _TCHAR* argv[]) { for (int i = 0; i != argc; ++i) { if (_tcscmp(argv[i], FooTxt) == 0) { return true; } } return false; } int _tmain(int argc, _TCHAR* argv[]) int { if (Foo(argc, argv))
  • 39. return 1; return 0; } No it's timeto use PC-lint. First we execute "PC-lint (Project Creation)", and then "PC-lint (Project Check)". If everything is set correctly, you must get approximately the following conclusion: PC-lint for C/C++ (NT) Vers. 8.00u, Copyright Gimpel Software 1985-2006 --- Module: .SimpleProjectForPClint.cpp (C++) } .SimpleProjectForPClint.cpp(14): error 818: (Info -- Pointer parameter 'argv' (line 5) could be declared as pointing to const) .SimpleProjectForPClint.cpp(5): error 830: (Info -- Location cited in prior message) --- Module: .stdafx.cpp (C++) --- Wrap-up for Module: .stdafx.cpp .stdafx.cpp(9): error 766: (Info -- Header file 'D:WORK3SimpleProjectForPClintSimpleProjectForPClintstdafx.h' not used in module '.stdafx.cpp') --- Global Wrap-up .SimpleProjectForPClint.cpp(5): error 765: (Info -- external 'Foo(int, unsigned short **)' (line 5, file .SimpleProjectForPClint.cpp) could be made static) .SimpleProjectForPClint.cpp(3): error 765: (Info -- external 'FooTxt' (line 3, file .SimpleProjectForPClint.cpp) could be made static) D:WORK3SimpleProjectForPClintSimpleProjectForPClintstdafx.h(9): error 755: (Info -- global macro 'WIN32_LEAN_AND_MEAN' (line 9, file D:WORK3SimpleProjectForPClintSimpleProjectForPClintstdafx.h) not referenced) error 900: (Note -- Successful completion, 6 messages produced) It's hard to disagree with. Now you have a wonderful tool in your arms, which will make it possible to you're your code better and to find both potential and present errors. But if you get the message: PC-lint for C/C++ (NT) Vers. 8.00u, Copyright Gimpel Software 1985-2006 --- Module: .pclint.cpp (C++) _ #include <stdio.h> D:Sourcespclintstdafx.h(10) : Error 322: Unable to open include file
  • 40. 'stdio.h' then it means that you have not set the environment settings and you will have to check the environment settings INCLUDE. Let us write in the command line echo %INCLUDE% As the result you must see: C:Program FilesMicrosoft Visual Studio 8 Microsoft 8VCATLMFCINCLUDE;C:Program Files Program FilesMicrosoft Visual Studio 8VCINCLUDE;C:Program Files Program FilesMicrosoft Visual Studio 8VCPlatformSDK PlatformSDKinclude;C:Program FilesMicrosoft Visual Studio 8 Microsoft 8SDKv2.0include;7 If the paths to the Visual Studio headline files are absent, then it is necessary to correct the environment settings or to write the paths to the files in PC PC-lint configuration files.
  • 41. Picture 35. Pushing the button F4 in the window Output you can easily navigate among the warnings of PC-lint. That's where the installation of PC lint and its integration into Visual Studio 2005 can be considered PC-lint finished. Your following step must be getting acquainted with the documentation and tuning of the configuration files to your specific needs. Good luck in your work! References 1. Wikipedia, "Unit testing", http://www.viva64.com/go.php?url=44 2. Wikipedia, "Dynamic testing", http://www.viva64.com/go.php?url=45 3. Wikipedia, "Static testing", http://www.viva64.com/go.php?url=46 ipedia, 4. Wikipedia, "Static code analysis", http://www.viva64.com/go.php?url=31 5. Wikipedia, "White box t testing", http://www.viva64.com/go.php?url=47 6. Wikipedia, "Black box testing", http://www.viva64.com/go.php?url=48