Re: [Qemu-devel] [PATCH 3/3] maint: Fix macros with broken 'do/while(0); ' usage

2017-11-30 Thread Dr. David Alan Gilbert
* Eric Blake (ebl...@redhat.com) wrote: > The point of writing a macro embedded in a 'do { ... } while (0)' > loop is so that the macro can be used as a drop-in statement with > the caller supplying the trailing ';'. Although our coding style > frowns on brace-less 'if': > if (cond) > statem

Re: [Qemu-devel] [PATCH 3/3] maint: Fix macros with broken 'do/while(0); ' usage

2017-11-30 Thread Eric Blake
On 11/30/2017 08:43 AM, Michael S. Tsirkin wrote: On Thu, Nov 30, 2017 at 07:41:59AM -0600, Eric Blake wrote: The point of writing a macro embedded in a 'do { ... } while (0)' loop is so that the macro can be used as a drop-in statement with the caller supplying the trailing ';'. Although our c

Re: [Qemu-devel] [PATCH 3/3] maint: Fix macros with broken 'do/while(0); ' usage

2017-11-30 Thread Michael S. Tsirkin
On Thu, Nov 30, 2017 at 07:41:59AM -0600, Eric Blake wrote: > The point of writing a macro embedded in a 'do { ... } while (0)' > loop is so that the macro can be used as a drop-in statement with > the caller supplying the trailing ';'. Although our coding style > frowns on brace-less 'if': > if

Re: [Qemu-devel] [PATCH 3/3] maint: Fix macros with broken 'do/while(0); ' usage

2017-11-30 Thread Cornelia Huck
On Thu, 30 Nov 2017 07:41:59 -0600 Eric Blake wrote: > The point of writing a macro embedded in a 'do { ... } while (0)' > loop is so that the macro can be used as a drop-in statement with > the caller supplying the trailing ';'. Although our coding style > frowns on brace-less 'if': > if (con

[Qemu-devel] [PATCH 3/3] maint: Fix macros with broken 'do/while(0); ' usage

2017-11-30 Thread Eric Blake
The point of writing a macro embedded in a 'do { ... } while (0)' loop is so that the macro can be used as a drop-in statement with the caller supplying the trailing ';'. Although our coding style frowns on brace-less 'if': if (cond) statement; else something else; the use of do/while