[PATCH] maint: fix "mixing declarations and code" errors

Daniel P. Berrangé berrange at redhat.com
Wed Nov 9 08:15:10 UTC 2022


On Tue, Nov 08, 2022 at 08:35:31PM +0100, Roman Bogorodskiy wrote:
> clang 14.0.5 complains:
> 
> ../src/bhyve/bhyve_device.c:42:29: error: mixing declarations and code
> is incompatible with standards before C99

Err, we set std=gnu99  so it shouldn't be complaining about that.

> [-Werror,-Wdeclaration-after-statement]
>     virDomainPCIAddressSet *addrs = opaque;
>                             ^
> 1 error generated.
> 
> And a few similar errors in some other places, mainly bhyve related.
> Apply a trivial fix to resolve that.


None the less I don't like the mixing of decls/code, as it has very
confusing/misleading semantics when combined with goto's that jump
over a decl

> 
> Signed-off-by: Roman Bogorodskiy <bogorodskiy at gmail.com>

With regards,
Daniel
-- 
|: https://berrange.com      -o-    https://www.flickr.com/photos/dberrange :|
|: https://libvirt.org         -o-            https://fstop138.berrange.com :|
|: https://entangle-photo.org    -o-    https://www.instagram.com/dberrange :|


More information about the libvir-list mailing list