Uploaded image for project: 'Rules Repository'
  1. Rules Repository
  2. RSPEC-793

All uses of the #pragma directive should be documented

    Details

    • Type: Code Smell Detection
    • Status: Active
    • Resolution: Unresolved
    • Message:
      Document this #pragma directive
    • Default Severity:
      Major
    • Impact:
      Low
    • Likelihood:
      High
    • Covered Languages:
      C, C++, Objective-C
    • Remediation Function:
      Constant/Issue
    • Constant Cost:
      10min
    • CERT:
      MSC00-C.
    • MISRA C 2004:
      3.4
    • MISRA C++ 2008:
      16-6-1

      Description

      The #pragma directive is implementation-defined, hence it is important both to demonstrate that all uses are correct, and to minimize, localize and encapsulate any use of pragmas within dedicated functions whenever possible.

      The meaning of each pragma shall be documented.
      There shall be sufficient supporting description to demonstrate that the behavior of the pragma and its implications for the application, have been fully understood.

      This rule flags all instances of #pragma directives, and leaves it to the user to determine whether they have been properly documented.

      See

      • MISRA C:2004, 3.4 - All uses of the #pragma directive shall be documented and explained
      • MISRA C++:2008, 16-6-1 - All uses of the #pragma directive shall be documented
      • CERT, MSC00-C - Compile cleanly at high warning levels

        Attachments

          Issue Links

            Activity

              People

              • Assignee:
                Unassigned
                Reporter:
                Anonymous
              • Votes:
                0 Vote for this issue
                Watchers:
                0 Start watching this issue

                Dates

                • Created:
                  Updated: