[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] Re: [XEN PATCH] xen: Add SAF deviations for MISRA C:2012 Rule 7.1
On Tue, 10 Oct 2023, Julien Grall wrote: > Hi Stefano, > > On 09/10/2023 23:19, Stefano Stabellini wrote: > > > > > > I am not sure this is better. This is a long line to read. But this is a > > > personal opinion. > > > > > > On the technical side, can we easily teach a tool to format this kind of > > > exception? If not, then this should not be an exception we should > > > implement. > > > > I am not sure I understand what you mean by "can we easily teach a tool > > to format this kind of exception". Do you mean whether we can teach a > > tool to interpret a multiline statement as a single statement? > > Sorry for the wording was not clear. I was referring to tools formatting the > code (e.g. clang-format). Hopefully, at some point, we will finally have a way > to automatically format the code. So we need a coding style that can be easily > be checked. > > It is not clear to me whether your proposed exception would work. We may have > to allow longer lines (and this has drawback). Yes, that's a good point. It will probably be an issue with clang-format. > > /* cppcheck tag */ > > line1 > > /* cppcheck tag */ > > line2 > > /* cppcheck tag */ > > line3 > > > > and that would end up changing the line numbers in the source files so > > the cppcheck report wouldn't match with the original line numbers any > > longer > > Would cppcheck accepts tag at the end of the line? If so, the following would > not modify the line count: > > /* cppcheck tag */ > line1 /* added cppcheck tag */ > line2 /* added cppcheck tag */ > line3 /* added cppcheck tag */ Luca answered to a similar, more generic, question a few days ago about Coverity: https://marc.info/?l=xen-devel&m=169657904027210 So even if we get cppcheck to work like that, we would lose Coverity support. It doesn't seem there are a lot of good options here. In this case Luca came up with a good idea on how to refactor the code so we should be good. But it doesn't seem we'll be able to come up with a general solution to the multiline statement problem.
|
![]() |
Lists.xenproject.org is hosted with RackSpace, monitoring our |