Integrating LeaveScan into Codewarrior 3.x
LeaveScan is a command-line utility developped by Symbian Ltd that checks that your code respects the naming conventions for leaving functions.
This article will show you how to integrate it and use it directly from Nokia Codewarrior (version 3.x is required).
1. Download LeaveScan
The utility is available for download on Symbian web site. Download the LeaveScan.exe file and install it in:
C:\Program Files\Symbian OS Tools\LeaveScan
The same technique can be used to integrate the SymScan which detect a few more issues but is more verbose.
2. Create a tool entry in Codewarrior
Go to the installation directory of your Codewarrior IDE and locate the Nokia x86 Compiler.cwcomp file and make a copy of it called LeaveScan.cwcomp.
If you are using Codewarrior 3.1 and installed it in its default location, the file should be in:
C:\Program Files\Nokia\CodeWarrior for Symbian v3.1\Bin\Plugins\Support\CompilerDescriptors\Symbian\
Open the new file "LeaveScan.cwcomp" in a text editor and make the following changes:
Find the following text in the file (around line 88):
<!-- End of Compiler Definition -->
<struct>
...
Right after the "End of Compiler Definition" comment, add the following text:
<!-- +++++++++++++++Leave Scan++++++++++++++ -->
<setting uuid-alias="." entry="toolSymbolicCommandDef">
<simple>${var:TOOL_NAME} "${source.name}"</simple>
</setting>
<setting uuid-alias="." entry="toolType">
<simple>kToolLeaveScan</simple>
</setting>
<setting uuid-alias="." entry="toolDisplayName">
<simple>Symbian Leave Scan tool</simple>
</setting>
<setting uuid-alias="." entry="toolExecutableName">
<simple>C:\Program Files\Symbian OS Tools\LeaveScan\leavescan.exe</simple>
</setting>
<setting uuid-alias="." entry="parseStdOut">
<simple>true</simple>
</setting>
<setting uuid-alias="." entry="parseStdErr">
<simple>false</simple>
</setting>
<setting uuid-alias="." entry="defaultSwitch">
<simple></simple>
</setting>
<setting uuid-alias="." entry="outputParser">
<simple>kGCCMessageFormatParser</simple>
</setting>
</struct>
This adds a tool call defintion that can be executed during compilation.
3. Setup the new tool
In the same file, find the following text (line 51):
<array inheritance="none">
<simple>kToolSize</simple>
</array>
</setting>
and add a line after the kTookSize call:
<simple>kToolLeaveScan</simple> :
The new block shall now look like:
<array inheritance="none">
<simple>kToolSize</simple>
<simple>kToolLeaveScan</simple>
</array>
</setting>
This makes a call to the leavescan utility after a successful call to the compiler and size tool.
Now you can save the file and choose the tool you just created.
4. Set up your project target
Open up a project's WINSCW target settings and navigate to the Code Generation | Symbian Compiler preference, change the compiler option from Nokia x86 Compiler to LeaveScan:

A warning message will now be emitted each time a leaving function does not have a trailing L in its name:

5. Enjoy...
... or fix your code. (and now you have no excuses for mis-naming your functions!






Integrating LeaveScan into Codewarrior 3.x
Hi Eric,
I've a custom created setup for SymScan for CW 3.0. You've to keep my zip file in the :\Program Files\Nokia\CodeWarrior for Symbian v3.1\Thrill_Seekers\ folder and extract that and then run install_symscan_cwide.cmd, that's it. If you can upload it in to the article then I can mail you.
vin2ktalks
Integrating LeaveScan into Codewarrior 3.x