Re: [PATCH 3/4] dtrace-probe: Put semicolon after while on its own line

Simon Marchi
2017-06-25T10:48:34Z

On 2017-06-21 23:36, Pedro Alves wrote:
> On 06/21/2017 09:15 PM, Simon Marchi wrote:
>> /* Use strtab_size as a sentinel. */
>> - while (*p++ != '\0' && p - strtab < strtab_size);
>> + while (*p++ != '\0' && p - strtab < strtab_size)
>> + ; /* Silence clang's -Wempty-body warning. */
>
> I'd must put the ; on its own line (there's probably something
> in the coding conventions about this already), and without the
> comment. It's quite common to write for/while loop like that,
> see e.g.,:
>
> $ grep "^[ |\t]*;[ |\t]*$" *.c -C 2
>
> Sure the comment makes sense in the context of the patch,
> but when reading the code without considering the patch's context,
> it just looks like noise to me.

Ok, since that's already a common practice in our codebase, I added it
to our wiki (I didn't find anything related to that in the GNU
standards):

https://sourceware.org/gdb/wiki/Internals%20GDB-C-Coding-Standards#preview

I am pushing without the comment.

Thanks,

Simon