On 14.06.2023 11:21, Andrew Cooper wrote: > On 14/06/2023 7:52 am, Jan Beulich wrote: >> On 13.06.2023 21:47, Roberto Bagnara wrote: >>> On 13/06/23 19:45, Andrew Cooper wrote: >>>> On 13/06/2023 6:39 pm, Julien Grall wrote: >>>>> Hi, >>>>> >>>>> On 13/06/2023 17:22, Andrew Cooper wrote: >>>>>> These are disliked specifically by MISRA, but they also interfere >>>>>> with code >>>>> Please explicitly name the rule. >>>> I can't remember it off the top of my head. >>>> >>>> Stefano/Bertrand? >>> Rule 2.1 >> That's about unreachable code, but inside the constructs there's nothing >> that's unreachable afaics. Plus expanding "manually" them wouldn't change >> reachability, would it? > > I bet it's complaining about the while() after the goto. > > I can see why things end up caring - because this violation can only be > spotted in the fully-preprocessed source where the macro-ness has gone > away, and *then* applying blanket rules.
Hmm, perhaps. > Which comes back to the original point I made on the call yesterday that > do{}while(0) correctness for macros is far more important than some, > honestly suspect, claim about the resulting code being somehow "better" > without the macro safety. Even further I would claim that the while(0) part of the construct isn't unreachable code simply because it doesn't result in any code being generated. But of course "code" here may mean "source code", not the resulting binary representation. Jan