On Mon, Mar 22, 2021 at 6:58 PM Richard Guy Briggs <r...@redhat.com> wrote: > > On 2021-03-22 17:28, Arnd Bergmann wrote: > > On Mon, Mar 22, 2021 at 3:33 PM Richard Guy Briggs <r...@redhat.com> wrote: > > > > Change the macros to use the usual "do { } while (0)" instead, and > > > > change a > > > > few more that were (void)0, for consistency. > > > > > > So what about audit_put_watch() and audit_get_watch() which are set to > > > {}? (And all of include/linux/audit.h that uses the latter...) Does > > > this only matter if they are the only action called in an if or loop? > > > > I missed those, thanks for pointing it out. I sent a v2 patch now. > > Ok, cool, that looks more consistent. Can you answer my question about > include/linux/audit.h and exactly what conditions require > "do { } while (0)" over "{ }"?
This is the usual way of constructing a C expression that can be used e.g. in if (x) foo(); else bar(); If foo() is defined as '{}', this causes a syntax error. Arnd