GNAT SAS 27 Release Notes ========================= We present the Release Notes for GNAT SAS for users who run gnatsas directly or via automation, rather than analyzing with CodeSonar for Ada. For more information about CodeSonar for Ada, see its dedicated release note. You can access the complete list `in the CodeSonar for Ada feature file `_. .. contents:: :local: GNATcheck Rules --------------- Symmetry in 'Nested_paths' Rule ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ The GNATcheck 'Nested_Paths' rule now tries to preserve the if-else branch symmetry, meaning that paths won't be flagged when both contain a breaking statement of the same kind. Raising_External_Exceptions Fix ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ The ``Raising_External_Exceptions`` rule has been enhanced to correctly exclude exceptions that are raised and caught within the same scope. The rule now only flags exceptions that can actually propagate externally, eliminating false positives for internally handled exceptions. Location for a Non-printable ASCII Character ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ GNATcheck now reports precise line and column numbers when flagging code blocks that contain a non-printable ASCII character, pointing directly to the invisible character. Deprecation of stdlib.is_limited_type ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ The `is_limited_type()` function from the LKQL standard library has been deprecated in favor of the Libadalang property `p_is_limited_type`. For example, a call of the form: .. code stdlib.is_limited_type(type) can be rewritten as: .. code type.p_is_limited_type() The stdlib function will be removed in the next release of GNATcheck. The expected type of `type` remains unchanged: it's a `BaseTypeDecl`. New Rule for out_parameter_read_in_exception_handler ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ A new checker (`out_parameter_read_in_exception_handler`) has been added to the GNATcheck predefined set of rules, allowing users to detect mode-out parameters that are read within an exception handler. This helps identify potential read-before-update issues where the write operation may not have occurred. LKQL Language ------------- New version of the Language ~~~~~~~~~~~~~~~~~~~~~~~~~~~ A new version of LKQL is now available as a beta. LKQL V2 introduces significant improvements to the language and its development tools: * **Revised syntax:** A redesigned syntax with new types and simplified language constructs, including streams replacing selectors. * **Static type system:** Type checking detects errors before execution, improving code reliability and maintainability. Type checking can be configured in warning, strict, or disabled mode. * **Improved IDE integration:** A new VS Code extension and LKQL Language Server provide syntax highlighting, code completion, navigation, symbol renaming, and syntactic and semantic diagnostics. A migration tool is also available to help convert existing LKQL V1 code to V2. Libadalang API documentation for the LKQL language ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ LKQL documentation now contains a section about the Libadalang API that describes node types and properties available from the LKQL language. Analysis engines ---------------- Quick Fixes for GNATcheck Rules ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ GNATcheck can suggest a possible remediation for style violations. If you agree with the suggestion, apply it to your code. This new feature can be accessed via an agentic workflow, or you can work interactively in GNAT Studio or VSCode. Report GNATcheck Findings in SARIF ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ Export GNATcheck findings in the Static Analysis Results Interchange Format (SARIF). This industry standard allows static analysis tools It is easier to exchange findings with other tools. Increase Inspector Phi Completion Passes ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ As part of its analysis, Inspector uses a Static Single Assignment (SSA) representation, which uses "phi" nodes to keep track of values that are assigned on multiple paths incoming to a basic block. To avoid possible excessive computation, Inspector limited the number of passes over the control-flow graph of a subprogram to three when iterating to create and initialize phi nodes. In some complex situations, this prior limit of three seems to be inadequate. Therefore, we have increased this limit to six, which should allow certain complex subprograms to be analyzed that before would run into a tool limitation. Add the Possibility to Deactivate Taint Analysis ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ You may now choose to completely deactivate taint analysis by adding the '--no-taint' switch to the 'gnatsas analyze' command. Improved Robustness for Access and Array Types ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ GNAT SAS is now more robust when the Ada front end produces objects with incorrect type information. In some edge cases, a non-access type could be used in an access dereference or array indexing context, potentially causing the analysis to crash or produce incorrect results. GNAT SAS now handles such cases gracefully and continues the analysis. Extend Type State API Annotations ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ Type state analysis now adds support for * ada.text_io.{put|get|look_ahead|get_immediate} * ada.text_io.integer_io.{put|get} More Informative Messages ------------------------- Better Messages about Functions with Side Effects ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ The messages about functions with side effects and functions with side effects in conditionals now include the modified variables. Better error message on generic instances ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ Inspector now mentions the locations of the instances that trigger a check that fails inside a generic body. A generic instantiated inside another generic gives a chain, innermost first. This new information is reported in the following formats: * text (under --show-backtraces): one line per instance. * SARIF: one relatedLocation per instance, tied to the result's own location by an isIncludedBy relationship, and named in the message — as embedded links in the markdown variant, plainly in text. * GNAT Studio: one backtrace frame per instance, after the message's own backtrace and at the level of its roots. User interface -------------- Complete support of GPR standard switches ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ GNAT SAS now supports standard gprbuild project-specific switches, namely: '-aP', '--autoconf', '--config', '--db', '--db-', '--implicit-with', '-el', '--print-gpr-registry', '--root-dir', '--relocate-build-tree', '--RTS', '--src-subdirs', '--target'. More descriptive --show-header output ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ GNAT SAS's --show-header text output now displays a more precise version of the analysis host's version (e.g., "Ubuntu 22.04") if possible, along with its hostname and the amount of time spent analyzing code. Recovering from Windows filesystem errors ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ GNAT SAS is now able to recover from some errors related to file paths being too long on Windows. When these errors happen, a warning is printed along with advice detailing workarounds instead of stopping GNAT SAS's execution.