NOSONAR break compilation on Multiline Macro

I am getting compile error when I add a \\ NOSONAR
I am using Developer Edition Version 8.1 (build 31237)
How to add NOSONAR when we have a multiline macro? like this

/* Macros */
#define MyMacro(T) void operator<<(const T iVal) {::_write(m_fp, &iVal, sizeof(T));} \

              void operator>>(T& iVal)	   {::_read (m_fp, &iVal, sizeof(T));} \                 

So, this is used in order to solve the problem with Parentheses (Sonar rule Each instance of a parameter of a function-like macro should be enclosed in parentheses.)
Is this a bug in SONAR?

Hello @QAsk77,

Welcome to the community!

You can try something like this:

#define MyMacro(T) void operator<<(const T iVal) {::_write(m_fp, &iVal, sizeof(T));} /* NOSONAR */ \ 
void operator>>(T& iVal)	   {::_read (m_fp, &iVal, sizeof(T));} \   

No, this is a MISRA rule. It shouldn’t be enabled unless you are working on a MISRA codebase. This rule is disabled by default. We plan to have a sonarway rule that is similar to this one but includes exceptions like the one you specified.

By the way, are you on the latest version CFamily 6.7?


Thanks, it works. no error when I compile it with this solution.
I think we have version 6.6