MISRA Discussion Forums
RTE call - Printable Version

+- MISRA Discussion Forums (https://forum.misra.org.uk)
+-- Forum: MISRA C (https://forum.misra.org.uk/forumdisplay.php?fid=4)
+--- Forum: MISRA C:2012 and MISRA C:2023 guidelines (https://forum.misra.org.uk/forumdisplay.php?fid=21)
+---- Forum: 7.1 The implementation (https://forum.misra.org.uk/forumdisplay.php?fid=178)
+---- Thread: RTE call (/showthread.php?tid=1603)



RTE call - kprzygoda - 10-03-2022

Hi All, I am calling RTE functions using microsar sip tools from vector and getting MISRA C 2012 rules violation:
1) The expression (vspSoundActivation_temp = Rte_CtApNvmWrapper_NV_VSPCfgParameters.VSP_SOUNDACTIVATIONTEMP_CF) , 0 uses the comma operator
2) The value returned by the assignment operator in vspSoundActivation_temp = Rte_CtApNvmWrapper_NV_VSPCfgParameters.VSP_SOUNDACTIVATIONTEMP_CF is being used

Is there any clear way of get rid of the messages?


RE: RTE call - misra-c - 23-04-2022

It is not possible to give a clear comment from the given example of code.  In general the comma operator can be replaced by splitting up the expression.
For example:

Code:
  X = ( A = B, 0 );
    can be replaced by
  A = B; X = 0;
and
  while ( (A = B, A > 0) ) { .... }
      can be replaced by
  A = B;
  while ( A > 0 {  ... A = B; }

If it is not possible to ammend the code, the advisory rule could be disapplied subject to appropriate justificatications.