1/* 2 env-vc6.lnt: environment parameters for Microsoft's Visual C++ 6.x 3 4 If you are using the Microsoft Developer Studio and you wish to invoke 5 PC-lint from that environment then add one or more commands to the 6 Tools menu as follows. 7 8 Unit Checkout 9 ------------- 10 11 For example, to add a unit check-out facility to the tools menu do 12 the following: 13 14 1. From the Tools Menu choose "Customize ..." 15 The Customize ... Dialog Box appears 16 2. Select the "Tools" tab 17 3. In the "Menu Contents" box, cursor down to the bottom where 18 you see an open rectangle. Click on this line which will enable 19 you to enter in a label that will identify the tool. 20 Type "PC-lint (unit check)" or equivalent and hit Enter. 21 4. You will now be able to edit the fields of this Tool. 22 Modify them so that they approximate the following: 23 24 Command: C:\LINT\LINT-NT.EXE 25 Arguments: -i"C:\LINT" -u std.lnt env-vc6.lnt "$(FileName)$(FileExt)" 26 Init. Directory $(FileDir) 27 28 X_Use Output Window __Prompt for arguments __Close window on exit 29 30 5. Select Close to return to the main environment. 31 32 This will result in the Tools menu containing the additional item 33 "PC-lint (unit check)". Checking 'X' on 'Use Output Window' is 34 important because in this way you can advance from error to error 35 using the F4 key (Shift F4 to reverse) or, less handily, using the 36 "Next Error" ("Prev Error") entries in the "Search" menu. 37 38 You probably want to advance your new tool upward into the initial 39 position of all tools while you are testing and modifying the command. 40 You can do this by using the stylized up-arrow button that appears 41 on the Tools dialog. 42 43 Note that by providing an "Initial Directory" and a local 44 "$(FileName)S(FileExt)" the containing directory can have a std.lnt that 45 overrides the global std.lnt. Also file-names in messages are not so long. 46 47 HOWEVER, you may need to use $(FilePath) in place of $(FileName)$(FileExt) 48 if the files are in a directory other that FileDir. If they are then 49 use of $(FileName) will render Visual Studio incapable of locating 50 the files when bouncing from message to message. 51 52 *Caution* -- You MUST have parentheses with $(Filename)$(FileExt) and 53 $(FileDir) or you will receive an incomprehensible diagnostic. 54 Historically, you did not always need parentheses with VC++, so people have 55 made this mistake. 56 57 Project Check 58 ------------- 59 60 You will probably want to create a second item on the Tools menu 61 called "PC-lint (project check)". For this tool follow the steps 62 1-5 doing exactly the same thing as above except in step 4, the 63 information entered should be: 64 65 Command: C:\LINT\LINT-NT.EXE 66 Arguments -i"C:\LINT" std.lnt env-vc6.lnt project.lnt 67 Initial Directory $(FileDir) 68 69 This will require that the file that you are currently editing reside 70 in a directory that contains a file called 'project.lnt'. This file 71 you will create and maintain yourself; it is a list of the names of 72 the modules (all files except headers) in your project. 73 Such a list can usually be prepared with the help of the DIR command. 74 For example, the following batch command will produce a list of all 75 the .CPP files within a directory: 76 77 DIR /b *.cpp >project.lnt 78 79 If you are using full path names in your visual environment, in order 80 to use the F4 key to bounce to the next error you should give an option 81 to PC-lint to produce full file names. The option you will need is: 82 83 +ffn 84 85 If your project spans multiple directories or if multiple 86 projects fit within a single directory the above simple-minded project 87 linting scheme will not work. Rather do the following. 88 In step 4 enter: 89 90 Command: C:\LINT\LINT-NT.EXE 91 Arguments +ffn -i"C:\LINT" std.lnt env-vc6.lnt $(WkspName).lnt 92 Initial Directory $(WkspDir) 93 94 The WkspDir is only slightly misnamed. It is actually the project 95 directory and contains a file called NAME.dsp where NAME is the project 96 name. You will have to create a file NAME.lnt bearing the names of your 97 modules relative to the project directory. The best way of capturing the 98 names is to use PC-lint itself. 99 100 C:\LINT\LINT-NT NAME.dsp >NAME.lnt 101 102 where, again, NAME is the name of the project. 103 104 If you are working with a Workspace containing multiple Projects 105 use the following commands for converting .dsp's to .lnt's: 106 107 Command: C:\LINT\LINT-NT.EXE 108 Arguments: -v -os(project.lnt) $(WkspName).dsp 109 Initial Directory: $(WkspDir) 110 111 You will need to set a project as the active project before you can convert 112 its .dsp to a .lnt. To do so, select Project from the menu bar, then select 113 Set Active Project and choose a Project. You then click the newly added 114 conversion tool on the tools menu and then lint the project. 115 116 Tool Bar 117 -------- 118 119 You also have the option of creating a PC-lint toolbar for your Visual C++ 120 IDE. First create one or more tools as described above. Then, look at 121 the Tools menu and make note of the icon(s) next to the menu item(s). 122 It's usually a subscripted hammer; remember the subscript(s). 123 Choose Customize from the Tools menu and select the Toolbars tab. 124 Select New... and provide Visual C++ with the toolbar name "PC-lint". 125 Confirm that the checkbox next to this name is selected. Click the 126 Commands tab. In the drop-down box labelled Category, choose Tools. 127 Drag the icon(s) corresponding to the PC-lint menu item(s) to your 128 toolbar. Click Close and you now have your own PC-lint for C/C++ button. 129 (Note: If you change the location of the PC-lint menu item on the Tools 130 menu, you will change the subscript and you will need to change the 131 button(s) on the toolbar.) 132 133 */ 134 135 136-"format=%(%F(%l):%) error %n: (%t -- %m)" // Messages will contain 137 // file information (%F), the line number (%l), the 138 // message number (%n), message type (%t) and message text (%m). 139 140-hF2 // Make sure we ALWAYS provide file information ('F') and use 2 141 // lines (line in error plus message). 142 143-width(0) // don't break messages at any particular width 144-t4 // Presume that tabs are every 4 stops 145+e900 // issue a message at termination. 146