Uploaded image for project: 'SonarCFamily'
  1. SonarCFamily
  2. CPP-3428

S995: replicate minus a FP for functions passed as callbacks

    XMLWordPrintable

    Details

      Description

      The rule must not flag functions that have to correspond to a pre-selected signature: if they are passed as a callback with the fixed type (callback of a type that is a template parameter is fine). More often than not, this happens across a library interface, so the developer has to define a function with a specific signature whether it complies with our rule or not.

      Since this is a strict MISRA rule, create a duplicate rule with this FP fixed.

      typedef void (*TaskFunction_t)( void * );
      
      void myTask(void *p) {
          (void)*p;
      }
      
      void bar(TaskFunction_t task);
      
      void foo() {
          bar(&myTask);
      }
      

        Attachments

          Issue Links

            Activity

              People

              Assignee:
              Unassigned Unassigned
              Reporter:
              arseniy.zaostrovnykh Arseniy Zaostrovnykh
              Votes:
              0 Vote for this issue
              Watchers:
              1 Start watching this issue

                Dates

                Created:
                Updated: