The Coding Standard menu allows you to edit your coding standard file, as can be understood by gnatcheck, as well as run it against your code, to verifiy its compliance with this coding standard.
Note that you can also use the contextual menu to check the conformance of a particular project or source file against a Coding Standard.
The Coding standard editor is triggered by the menu Tools->Coding Standard->Edit Rules File. The editor allows you to select an existing coding standard file, or create a new one. The editor adapts itself to the version of gnatcheck you are using on your local machine.
The currently used rules are summarized in the bottom of the editor. Once all rules are defined, you can check the box ‘Open rules file after exit’ to manually verify the created file.
Once the Coding Standard file is created, you can define it as the default coding standard file for a project by going to the project editor, selecting the ‘Switches’ tab, and using this file in the ‘Gnatcheck’ section.
The visual comparison, available either from the VCS menus or from the Tools menu, provide a way to display graphically differences between two or three files, or two different versions of the same file.
The 2-file comparison tool is based on the standard text command diff, available on all Unix systems. Under Windows, a default implementation is provided with GPS, called gnudiff.exe. You may want to provide an alternate implementation by e.g. installing a set of Unix tools such as cygwin (http://www.cygwin.com).
The 3-file comparison tool is based on the text command diff3, available on all Unix systems. Under Windows, this tool is not shipped with GPS. It is available as part of cygwin, for example.
When querying a visual comparison in GPS, in Side_By_Side mode, the user area will show, side by side, editors for the files involved in the comparison. The reference file is placed by default on the left side. When in Unified mode, GPS will not open a new editor, but will show all the changes directly in the original editor. Note that Unified mode is relevant only when comparing two files: when comparing three files, the Side_By_Side mode is used.
Color highlighting will be added to the file editors:
These colors can be configured, The Preferences Dialog.
As with all highlighted lines in GPS, the visual differences highlights are visible in the Speed Column at the left of the editors.
Blank lines are also added in the editors, in places that correspond to existing lines in the other editors. The vertical and horizontal scrolling are synchronized between all editors involved in a visual comparison.
When a visual comparison is created, the Locations View is populated with the entries for each chunk of differences, and can be used to navigate between those.
Closing one of the editors involved in a visual comparison removes the highlighting, blank lines, and scrolling in the other editors.
Editors involved in a visual comparison have a contextual menu Visual diff that contains the following entries:
GPS provides an interactive way to fix or improve your source code, based on messages (errors and warnings) generated by the GNAT compiler.
This capability is integrated with the Locations View (see The Locations View): when GPS can take advantage of a compiler message, an icon is added on the left side of the line.
For a simple fix, a wrench icon is displayed. If you click with the left button on this icon, the code will be fixed automatically, and you will see the change in the corresponding source editor. An example of a simple fix, is the addition of a missing semicolon.
You can also check what action will be performed by clicking on the right button which will display a contextual menu with a text explaining the action that will be performed. Similarly, if you display the contextual menu anywhere else on the message line, a sub menu called Auto Fix gives you access to the same information. In the previous example of a missing semicolon, the menu will contain an entry labelled Add expected string ”;”. Two nested menu items let you choose to Apply to this occurrence or Apply to all similar errors. Latter choice will apply the same simple fix for all errors which are detected by the system as being the same kind. This is based on message parsing.
Once the code change has been performed, the tool icon is no longer displayed.
For more complex fixes, where more than one change is possible, a wrench icon with a blue plus sign is displayed. In this case, clicking on the icon will display the contextual menu directly, giving you access to the possible choices. For example, this will be the case when an ambiguity is reported by the compiler for resolving an entity.
Right clicking on a message with a fix will open a contextual menu with an entry “Auto Fix”. Fixes that can be applied by clicking on the wrench are available through that menu as well. In addiditon, if one of the fixes is considered to be safe by GPS, additional entries will be provided to apply fixes on multiple messages:
GPS provides a documentation generator which processes source files and generates annotated HTML files.
It is based on the source cross-reference information (e.g. generated by GNAT for Ada files). This means that you