Welcome to the new Parasoft forums! We hope you will enjoy the site and try out some of the new features, like sharing an idea you may have for one of our products or following a category.

AUTOSAR A2-7-3 - False positive on implementation

I'm using Parasoft C++Test Professional 2023.1 and I'm getting false positives on AUTOSAR Rule A2-7-3 which states that "Every declaration needs to provide a proper documentation."

The false positives happen when a function is declared in a .hpp file, while being defined/implemented in the corresponding .cpp file, but it is properly documented only in the .hpp file, which raises the above error in the .cpp file.
Since the rule states "Every declaration..." I would expect it to apply only on the function declaration, not its definition.

Answers

  • mstaron
    mstaron Posts: 35

    These rules (AUTOSAR-A2_7_3-a and AUTOSAR-A2_7_3-b) work accordingly to the AUTOSAR guideline, because in C++ every function definition is a declaration. C++11 says about it in:
    3.1 Declarations and definitions:
    2. A declaration is a definition unless it declares a function without specifying the function’s body...

    In the new version of C++test (2023.2) will be a new rule COMMENT-14_c that will check only function declarations that are not definitions and function definitions when other declarations are not available in the translation unit.