Posts Tagged ‘Visual Studio’
Goanna 2.6 Released
Goanna 2.6 is now available from the download page. In this release we have focused on the usability of our Goanna Studio for Eclipse offering which at the same time increases stability and flexibility in the face of the many different configurations that are possible within the Eclipse CDT environment. Here is a summary of what has changed in this release:
- All versions
- Bounds checking for arrays of arbitrary dimension
- Bounds checking for arrays within classes, structs and unions
- Arrays of unspecified size are no longer considered to have size 0
- Constant global variables are now modelled with a value that does not change
- The constant “-1U” and others will now be modelled with an appropriately large value instead of -1
- Check FPT-misuse no longer warns about function pointers that are the result of the ternary operator (?:)
- Check ITR-uninit now works correctly for iterators that are initialized using operator=
- Check RED-unused-param no longer warns for parameters that have the GNU attribute (unused)
- Checks RED-cond-const-assign and EXP-cond-assign no longer consider “+=” and similar operators to be constant assignments
- Non-system #include files are now included in the analysis of a file that includes them.
- Goanna Studio for Visual Studio
- preprocessor macros within parentheses are expanded
- macros in comments are not expanded
- Goanna Central
- Cygwin support for windows, use –compiler-sort=cygwin to create a cygwin configuration
- Other compiler sort added, use –compiler-sort=other for an empty configuration
- Remove the dependencies on the hard to manage predefined_macro.txt files
- Predefined macros are now stored in the Goanna resource files, which are generated during configuration
- Goanna Studio for Eclipse
- Completely re-organised configuration
- Per project configuration
- File based (under a goanna directory in the project file system)
- User editable, or use the Goanna Project Properties dialogs. (two way synchronisation)
- Menu item “Run Goanna on Selected File(s)” now appears when right-clicking on folders, and will analyse all files found in the selected folder.
- Cygwin toolchain support on windows
Macro visualization
When Goanna reports a warning, sometimes a C preprocessor macro makes it hard to know what’s really going on in the code. I’ve added a new feature to the Visual Studio implementation that highlights each preprocessor macro invocation with a blue “squiggly”; the associated tooltip shows the (one-level) expansion of the macro. The context menu for the code document allows you to toggle between the macro markers and purple squigglies associated with Goanna warnings.
In the Goanna Central version, you’ll be able to dump all preprocessor macros in a file with an appropriate flag.

Experiments with F#
A couple of customers have asked for a command-line tool to run Goanna over their Visual Studio projects, similar to the way the Linux command-line tool works. The difficult bit for such a tool is to translate the information in a project file to the appropriate arguments to the core Goanna executable, goannacc.exe on Windows. We already have code to do just that in the Visual Studio extension.
The Goanna VS extensions for VS2005/2008/2010 are written in C#, because there’s a wizard that generates a simple extension in C#. From that starting point, we (meaning I) built the current extensions. If there hadn’t been the wizard, I would have written the extensions in F#, because I prefer the functional style of programming. So I decided to write the command-line tool, that was an opportunity to try out F# in earnest. I’d written a wee bit of F# before; here was a chance to try it out on production code.
When writing the command-line tool, my main concern was, how easy would it be to pull in the C# code that does the project-to-command-line translation. It was very easy: just add an F# project reference to the .DLL containing the code, open the namespace, and I was good to go. I had to make some C# classes explicitly public for visibility, but that was the only change I needed to make.
Programming in F# is very much like programming in OCaml, a language I’ve used off and on for maybe 15 years. Nice thing: instead of the clumsy “delegate” syntax of C#, you can just pass a function argument to another function. Not so nice: in VS2010, the editor does not seem to auto-format F# code, the way it does with C# code (the Ctrl-E F magic). And the editor’s Intellisense feature does not appear to suggest variable names that are in scope. Also: although there are surely good reasons for it, the F# list type is distinct from the C#/.Net System.Collections list type, which is slightly maddening. Finally: I have to build the tool for the various VS versions in slightly different ways, and the conditional compilation facility works for that — but why are there no boolean operations allowed, as you have in C#?
Here’s an example of code that uses .Net lists instead of F# lists:
let expandedProjs = new System.Collections.Generic.List() in while projsIter.MoveNext() do expandedProjs.AddRange(ProjectUtil.expandProject(projsIter.Current :?> EnvDTE.Project)) done;
Ooof.
When the command-line tool starts, it fires up an instance of Visual Studio, no GUI. That way it can get information about solutions and projects from VS, like default include paths and configuration information, using code originally written for the extensions. Sometimes the calls to VS fail with COM retry errors, so those calls are done in a loop containing a try-with block. When the tool finishes, or the user hits Ctrl-C, it gracefully shuts down VS. I often run the tool from a Cygwin shell, and I haven’t yet found a way to trap Cygwin SIGKILL signals, so that VS is still running afterwards.
There’s still some work to do on the command-line tool, like deciding what kind of output it should produce, but it’s basically there. Let me know if you’d like to try it out before we make it generally available. The tool is tentatively called “GoRun”, and its syntax is:
GoRun sln-file [projName ...] ...
That is, you supply one or more solution files, and for each solution file, zero or more project names. If you don’t supply project names, GoRun invokes Goanna on all the projects in the solution, otherwise only those specified.
A complaint: Soon after VS2010 was released, the MSDN site was updated with all-new documentation for the .Net libraries. But the only language there’s documentation for is C# (OK, sometimes J#) . In the type signatures, there are no hyperlinks for keywords (like public, final, etc.) and types. You can’t tell when a type is really a forall-quantified type variable. It wouldn’t be much harder to do these pages right.
One last comment: programming in F# doesn’t feel all that different than programming in C#, though the code is more concise. You definitely feel the presence of .Net every step of the way, and there’s statefulness lurking everywhere. Functional programming for the masses … sort of!
Visual Studio 2010
We’re proud to have been selected for simultaneous shipment of our Goanna static analysis extension with Microsoft Visual Studio 2010. Here is a short introductory video demonstrating our Visual Studio 2010 integration, and we’re on schedule for April release:
We have some further news regarding recent developments (more high quality checks being one) and we’ll be posting more information next week.
Goanna 1.1 release
Goanna for Visual Studio 1.1 has been released. Download it now. Changes include:
Fixed a constructor initialization false positive.
Fixed several unused variable false positives related to complex types in C++.
Include paths can now end in a backslash.
Accelerator keys: Alt+F1 (run Goanna on the Solution) and Alt+F2 (Run Goanna on the active project).
Several new checks, including:
Comparison never holds
Comparison always holds
Switch case is unreachable
Expanded the interval analysis.
Checks are now organized by category in the settings dialog.
Underlining (”Squiggles”) of warning-relevant code in the Visual Studio text editor.
Statistics page for monitoring Goanna’s progress.
Analysis of assert() statements for variable bounds.
Improved traces.
Much more internal work has been done, laying the groundwork for inter-procedural analysis and user-defined checks. Visual Studio 2010 support is well underway.
Goanna for Visual Studio 1.0 Released!
Goanna for Visual Studio is out of beta. Version 1.0 is available for download now, for both Visual Studio 2008 and 2005. You can also watch a short introductory video on using Goanna here.
Beta 3 released
We have made Beta 3 of Goanna for Visual Studio 2008 available. There are many bug fixes and user interface enhancements, including:
- Right-click support for Solution Folders.
- A Goanna icon on the toolbar.
- Control-flow ordering of short-circuit operators (&& and ||).
- Solution-wide settings panel.
- Several common false positives have been eliminated.
- Auto-detection of less common MSVC macros in the build process.
You can download it now!
Greater precision from fine grained control flow analysis
To make Goanna fast enough for the desktop, we have to keep our control flow models simple. In the past we combined short-circuit operators in our models into single events, which means we missed some bugs. But some new tricks mean we can have finer-grained control flow models.
(more…)
Visual Studio: now available for download
Just to let you know that Goanna for Visual Studio is now available for download. We are classing it as Beta at this time yet we’re pleased with the progress we’ve made so far, and trust that you will be too. We very much look forward to any and all feedback on this release, and welcome comments to Ralf via ralf[at]redlizards.com . Thank you for your patience and we look foward to hearing from you.
Visual Studio: Looks good BUT…..
I used to be a keen windsurfer and once attended a training camp/holiday in Greece. We covered advanced maneuvers such as 360’s, forward rolls and duck gybes etc. The instructor always said, “Doesn’t matter if you pull it off, just so long as it looks good!”
The reason for this story is that at Red Lizards we have a mantra of “Bringing higher quality software to market faster”, and so the flip side of this coin is that we can’t ship a release until it is of sufficiently high quality. Double edged sword perhaps, yet this is the business we chose.
