[libvirt PATCH 00/19] Build with -Wdeclaration-after-statement

Ján Tomko posted 19 patches 3 years, 8 months ago
Test syntax-check failed
Failed in applying to current master (apply log)
meson.build                               |   2 +-
src/bhyve/bhyve_parse_command.c           |   3 +-
src/conf/backup_conf.c                    |   2 +-
src/conf/checkpoint_conf.c                |   2 +-
src/conf/cpu_conf.c                       |   2 +-
src/conf/domain_conf.c                    | 118 +++++++++++-----------
src/conf/interface_conf.c                 |   8 +-
src/conf/netdev_vlan_conf.c               |   2 +-
src/conf/network_conf.c                   |  21 ++--
src/conf/networkcommon_conf.c             |   2 +-
src/conf/node_device_conf.c               |  34 +++----
src/conf/numa_conf.c                      |   6 +-
src/conf/nwfilter_conf.c                  |   5 +-
src/conf/snapshot_conf.c                  |   2 +-
src/conf/storage_adapter_conf.c           |   2 +-
src/conf/storage_conf.c                   |   2 +-
src/conf/virsavecookie.c                  |   2 +-
src/conf/virstorageobj.c                  |   3 +-
src/cpu/cpu_map.c                         |   4 +-
src/cpu/cpu_x86.c                         |   2 +-
src/internal.h                            |   9 ++
src/lxc/lxc_container.c                   |   4 +-
src/lxc/lxc_controller.c                  |   6 +-
src/lxc/lxc_domain.c                      |   2 +-
src/lxc/lxc_driver.c                      |   5 +-
src/nwfilter/nwfilter_ebiptables_driver.c |   8 +-
src/nwfilter/nwfilter_learnipaddr.c       |   2 +-
src/openvz/openvz_conf.c                  |  12 +--
src/qemu/qemu_capabilities.c              |   2 +-
src/qemu/qemu_command.c                   |   8 +-
src/qemu/qemu_domain.c                    |  12 ++-
src/qemu/qemu_domainjob.c                 |   4 +-
src/qemu/qemu_migration_cookie.c          |   6 +-
src/qemu/qemu_monitor.c                   |   9 +-
src/qemu/qemu_process.c                   |  10 +-
src/remote/remote_daemon_dispatch.c       |   6 +-
src/remote/remote_daemon_stream.c         |  13 ++-
src/remote/remote_driver.c                |  24 +++--
src/rpc/virnetclient.c                    |   8 +-
src/rpc/virnetmessage.c                   |   4 +-
src/rpc/virnetsocket.c                    |   9 +-
src/security/security_dac.c               |  20 ++--
src/security/security_selinux.c           |  20 ++--
src/storage/storage_backend_disk.c        |   2 +-
src/storage/storage_file_fs.c             |   3 +-
src/storage/storage_util.c                |   2 +-
src/util/vircgroupbackend.h               |  26 ++---
src/util/virdaemon.c                      |   4 +-
src/util/virdbus.c                        |   4 +-
src/util/virerror.c                       |   3 +-
src/util/virfile.c                        |  14 ++-
src/util/virfirewall.c                    |   3 +-
src/util/virhostmem.c                     |  37 ++++---
src/util/virkeycode.c                     |   4 +-
src/util/virnetdevbridge.c                |   6 +-
src/util/virnetdevip.c                    |   4 +-
src/util/virnetlink.c                     |  10 +-
src/util/virobject.c                      |   5 +-
src/util/virprocess.c                     |   3 +-
src/util/virqemu.c                        |   2 +-
src/util/virrandom.c                      |   3 +-
src/util/virstorageencryption.c           |   4 +-
src/util/virstoragefile.c                 |  20 ++--
src/util/virutil.c                        |   8 +-
src/util/virxml.h                         |   3 +-
src/vbox/vbox_common.c                    |  21 ++--
src/vbox/vbox_snapshot_conf.c             |   8 +-
src/vz/vz_driver.c                        |  10 +-
tests/commandhelper.c                     |   5 +-
tests/domaincapstest.c                    |   2 +
tests/eventtest.c                         |   5 +-
tests/nodedevmdevctltest.c                |   3 +-
tests/sockettest.c                        |  24 +++--
tests/virauthconfigtest.c                 |  28 ++---
tests/vircgroupmock.c                     |   8 +-
tests/viriscsitest.c                      |  47 +++++----
tests/virnetsockettest.c                  |   2 +
tests/virnettlscontexttest.c              |   3 +
tests/virnettlssessiontest.c              |   3 +
tests/virrotatingfiletest.c               |   7 +-
tests/virstoragetest.c                    |   2 +
tests/virstringtest.c                     |   4 +
tests/viruritest.c                        |   2 +
tools/virsh-domain.c                      |  12 ++-
tools/virsh-interface.c                   |   3 +-
tools/virsh-network.c                     |   3 +-
tools/virsh-nodedev.c                     |   2 +-
tools/virsh-util.c                        |   3 +-
tools/virsh-volume.c                      |   5 +-
tools/virt-host-validate-common.c         |   3 +-
tools/wireshark/src/packet-libvirt.c      |   3 +-
91 files changed, 481 insertions(+), 334 deletions(-)
[libvirt PATCH 00/19] Build with -Wdeclaration-after-statement
Posted by Ján Tomko 3 years, 8 months ago
Most of the changes required to build with
-Wdeclaration-after-statement seem pretty reasonable.
Not so sure about the lack of semicolon after
VIR_XPATH_NODE_AUTORESTORE

https://gitlab.com/jano.tomko/libvirt/-/pipelines/173793788

Ján Tomko (19):
  util: virRandomInt: remove temporary variable
  util: virHostMemSetParameters: remove pointless variable
  util: virHostMem*Parameters: split out non-Linux stubs
  util: move declarations in virStorageFileChainLookup
  Move declarations before statements
  Split declarations from initializations
  Move debug statements after declarations
  rpc: move lock after declaration
  security: move chardevData declaration
  util: virNetDevBridgeSet: split declarations
  tests: sockettest: move declarations
  tests: authconfigtest: move declarations
  util: cgroup: wrap BACKEND_CALL macro in a block
  tests: iscsitest: split out testISCSIScanTargetsTests
  util: xml: use pragma in VIR_XPATH_NODE_AUTORESTORE
  VIR_XPATH_NODE_AUTORESTORE: remove semicolon from users
  src: internal: add VIR_WARNINGS_NO_DECLARATION_AFTER_STATEMENT
  tests: use VIR_WARNINGS_NO_DECLARATION_AFTER_STATEMENT
  build: add -Wdeclaration-after-statement

 meson.build                               |   2 +-
 src/bhyve/bhyve_parse_command.c           |   3 +-
 src/conf/backup_conf.c                    |   2 +-
 src/conf/checkpoint_conf.c                |   2 +-
 src/conf/cpu_conf.c                       |   2 +-
 src/conf/domain_conf.c                    | 118 +++++++++++-----------
 src/conf/interface_conf.c                 |   8 +-
 src/conf/netdev_vlan_conf.c               |   2 +-
 src/conf/network_conf.c                   |  21 ++--
 src/conf/networkcommon_conf.c             |   2 +-
 src/conf/node_device_conf.c               |  34 +++----
 src/conf/numa_conf.c                      |   6 +-
 src/conf/nwfilter_conf.c                  |   5 +-
 src/conf/snapshot_conf.c                  |   2 +-
 src/conf/storage_adapter_conf.c           |   2 +-
 src/conf/storage_conf.c                   |   2 +-
 src/conf/virsavecookie.c                  |   2 +-
 src/conf/virstorageobj.c                  |   3 +-
 src/cpu/cpu_map.c                         |   4 +-
 src/cpu/cpu_x86.c                         |   2 +-
 src/internal.h                            |   9 ++
 src/lxc/lxc_container.c                   |   4 +-
 src/lxc/lxc_controller.c                  |   6 +-
 src/lxc/lxc_domain.c                      |   2 +-
 src/lxc/lxc_driver.c                      |   5 +-
 src/nwfilter/nwfilter_ebiptables_driver.c |   8 +-
 src/nwfilter/nwfilter_learnipaddr.c       |   2 +-
 src/openvz/openvz_conf.c                  |  12 +--
 src/qemu/qemu_capabilities.c              |   2 +-
 src/qemu/qemu_command.c                   |   8 +-
 src/qemu/qemu_domain.c                    |  12 ++-
 src/qemu/qemu_domainjob.c                 |   4 +-
 src/qemu/qemu_migration_cookie.c          |   6 +-
 src/qemu/qemu_monitor.c                   |   9 +-
 src/qemu/qemu_process.c                   |  10 +-
 src/remote/remote_daemon_dispatch.c       |   6 +-
 src/remote/remote_daemon_stream.c         |  13 ++-
 src/remote/remote_driver.c                |  24 +++--
 src/rpc/virnetclient.c                    |   8 +-
 src/rpc/virnetmessage.c                   |   4 +-
 src/rpc/virnetsocket.c                    |   9 +-
 src/security/security_dac.c               |  20 ++--
 src/security/security_selinux.c           |  20 ++--
 src/storage/storage_backend_disk.c        |   2 +-
 src/storage/storage_file_fs.c             |   3 +-
 src/storage/storage_util.c                |   2 +-
 src/util/vircgroupbackend.h               |  26 ++---
 src/util/virdaemon.c                      |   4 +-
 src/util/virdbus.c                        |   4 +-
 src/util/virerror.c                       |   3 +-
 src/util/virfile.c                        |  14 ++-
 src/util/virfirewall.c                    |   3 +-
 src/util/virhostmem.c                     |  37 ++++---
 src/util/virkeycode.c                     |   4 +-
 src/util/virnetdevbridge.c                |   6 +-
 src/util/virnetdevip.c                    |   4 +-
 src/util/virnetlink.c                     |  10 +-
 src/util/virobject.c                      |   5 +-
 src/util/virprocess.c                     |   3 +-
 src/util/virqemu.c                        |   2 +-
 src/util/virrandom.c                      |   3 +-
 src/util/virstorageencryption.c           |   4 +-
 src/util/virstoragefile.c                 |  20 ++--
 src/util/virutil.c                        |   8 +-
 src/util/virxml.h                         |   3 +-
 src/vbox/vbox_common.c                    |  21 ++--
 src/vbox/vbox_snapshot_conf.c             |   8 +-
 src/vz/vz_driver.c                        |  10 +-
 tests/commandhelper.c                     |   5 +-
 tests/domaincapstest.c                    |   2 +
 tests/eventtest.c                         |   5 +-
 tests/nodedevmdevctltest.c                |   3 +-
 tests/sockettest.c                        |  24 +++--
 tests/virauthconfigtest.c                 |  28 ++---
 tests/vircgroupmock.c                     |   8 +-
 tests/viriscsitest.c                      |  47 +++++----
 tests/virnetsockettest.c                  |   2 +
 tests/virnettlscontexttest.c              |   3 +
 tests/virnettlssessiontest.c              |   3 +
 tests/virrotatingfiletest.c               |   7 +-
 tests/virstoragetest.c                    |   2 +
 tests/virstringtest.c                     |   4 +
 tests/viruritest.c                        |   2 +
 tools/virsh-domain.c                      |  12 ++-
 tools/virsh-interface.c                   |   3 +-
 tools/virsh-network.c                     |   3 +-
 tools/virsh-nodedev.c                     |   2 +-
 tools/virsh-util.c                        |   3 +-
 tools/virsh-volume.c                      |   5 +-
 tools/virt-host-validate-common.c         |   3 +-
 tools/wireshark/src/packet-libvirt.c      |   3 +-
 91 files changed, 481 insertions(+), 334 deletions(-)

-- 
2.26.2

Re: [libvirt PATCH 00/19] Build with -Wdeclaration-after-statement
Posted by Michal Privoznik 3 years, 7 months ago
On 8/3/20 6:56 PM, Ján Tomko wrote:
> Most of the changes required to build with
> -Wdeclaration-after-statement seem pretty reasonable.
> Not so sure about the lack of semicolon after
> VIR_XPATH_NODE_AUTORESTORE
> 
> https://gitlab.com/jano.tomko/libvirt/-/pipelines/173793788
> 
> Ján Tomko (19):
>    util: virRandomInt: remove temporary variable
>    util: virHostMemSetParameters: remove pointless variable
>    util: virHostMem*Parameters: split out non-Linux stubs
>    util: move declarations in virStorageFileChainLookup
>    Move declarations before statements
>    Split declarations from initializations
>    Move debug statements after declarations
>    rpc: move lock after declaration
>    security: move chardevData declaration
>    util: virNetDevBridgeSet: split declarations
>    tests: sockettest: move declarations
>    tests: authconfigtest: move declarations
>    util: cgroup: wrap BACKEND_CALL macro in a block
>    tests: iscsitest: split out testISCSIScanTargetsTests
>    util: xml: use pragma in VIR_XPATH_NODE_AUTORESTORE
>    VIR_XPATH_NODE_AUTORESTORE: remove semicolon from users
>    src: internal: add VIR_WARNINGS_NO_DECLARATION_AFTER_STATEMENT
>    tests: use VIR_WARNINGS_NO_DECLARATION_AFTER_STATEMENT
>    build: add -Wdeclaration-after-statement
> 
>   meson.build                               |   2 +-
>   src/bhyve/bhyve_parse_command.c           |   3 +-
>   src/conf/backup_conf.c                    |   2 +-
>   src/conf/checkpoint_conf.c                |   2 +-
>   src/conf/cpu_conf.c                       |   2 +-
>   src/conf/domain_conf.c                    | 118 +++++++++++-----------
>   src/conf/interface_conf.c                 |   8 +-
>   src/conf/netdev_vlan_conf.c               |   2 +-
>   src/conf/network_conf.c                   |  21 ++--
>   src/conf/networkcommon_conf.c             |   2 +-
>   src/conf/node_device_conf.c               |  34 +++----
>   src/conf/numa_conf.c                      |   6 +-
>   src/conf/nwfilter_conf.c                  |   5 +-
>   src/conf/snapshot_conf.c                  |   2 +-
>   src/conf/storage_adapter_conf.c           |   2 +-
>   src/conf/storage_conf.c                   |   2 +-
>   src/conf/virsavecookie.c                  |   2 +-
>   src/conf/virstorageobj.c                  |   3 +-
>   src/cpu/cpu_map.c                         |   4 +-
>   src/cpu/cpu_x86.c                         |   2 +-
>   src/internal.h                            |   9 ++
>   src/lxc/lxc_container.c                   |   4 +-
>   src/lxc/lxc_controller.c                  |   6 +-
>   src/lxc/lxc_domain.c                      |   2 +-
>   src/lxc/lxc_driver.c                      |   5 +-
>   src/nwfilter/nwfilter_ebiptables_driver.c |   8 +-
>   src/nwfilter/nwfilter_learnipaddr.c       |   2 +-
>   src/openvz/openvz_conf.c                  |  12 +--
>   src/qemu/qemu_capabilities.c              |   2 +-
>   src/qemu/qemu_command.c                   |   8 +-
>   src/qemu/qemu_domain.c                    |  12 ++-
>   src/qemu/qemu_domainjob.c                 |   4 +-
>   src/qemu/qemu_migration_cookie.c          |   6 +-
>   src/qemu/qemu_monitor.c                   |   9 +-
>   src/qemu/qemu_process.c                   |  10 +-
>   src/remote/remote_daemon_dispatch.c       |   6 +-
>   src/remote/remote_daemon_stream.c         |  13 ++-
>   src/remote/remote_driver.c                |  24 +++--
>   src/rpc/virnetclient.c                    |   8 +-
>   src/rpc/virnetmessage.c                   |   4 +-
>   src/rpc/virnetsocket.c                    |   9 +-
>   src/security/security_dac.c               |  20 ++--
>   src/security/security_selinux.c           |  20 ++--
>   src/storage/storage_backend_disk.c        |   2 +-
>   src/storage/storage_file_fs.c             |   3 +-
>   src/storage/storage_util.c                |   2 +-
>   src/util/vircgroupbackend.h               |  26 ++---
>   src/util/virdaemon.c                      |   4 +-
>   src/util/virdbus.c                        |   4 +-
>   src/util/virerror.c                       |   3 +-
>   src/util/virfile.c                        |  14 ++-
>   src/util/virfirewall.c                    |   3 +-
>   src/util/virhostmem.c                     |  37 ++++---
>   src/util/virkeycode.c                     |   4 +-
>   src/util/virnetdevbridge.c                |   6 +-
>   src/util/virnetdevip.c                    |   4 +-
>   src/util/virnetlink.c                     |  10 +-
>   src/util/virobject.c                      |   5 +-
>   src/util/virprocess.c                     |   3 +-
>   src/util/virqemu.c                        |   2 +-
>   src/util/virrandom.c                      |   3 +-
>   src/util/virstorageencryption.c           |   4 +-
>   src/util/virstoragefile.c                 |  20 ++--
>   src/util/virutil.c                        |   8 +-
>   src/util/virxml.h                         |   3 +-
>   src/vbox/vbox_common.c                    |  21 ++--
>   src/vbox/vbox_snapshot_conf.c             |   8 +-
>   src/vz/vz_driver.c                        |  10 +-
>   tests/commandhelper.c                     |   5 +-
>   tests/domaincapstest.c                    |   2 +
>   tests/eventtest.c                         |   5 +-
>   tests/nodedevmdevctltest.c                |   3 +-
>   tests/sockettest.c                        |  24 +++--
>   tests/virauthconfigtest.c                 |  28 ++---
>   tests/vircgroupmock.c                     |   8 +-
>   tests/viriscsitest.c                      |  47 +++++----
>   tests/virnetsockettest.c                  |   2 +
>   tests/virnettlscontexttest.c              |   3 +
>   tests/virnettlssessiontest.c              |   3 +
>   tests/virrotatingfiletest.c               |   7 +-
>   tests/virstoragetest.c                    |   2 +
>   tests/virstringtest.c                     |   4 +
>   tests/viruritest.c                        |   2 +
>   tools/virsh-domain.c                      |  12 ++-
>   tools/virsh-interface.c                   |   3 +-
>   tools/virsh-network.c                     |   3 +-
>   tools/virsh-nodedev.c                     |   2 +-
>   tools/virsh-util.c                        |   3 +-
>   tools/virsh-volume.c                      |   5 +-
>   tools/virt-host-validate-common.c         |   3 +-
>   tools/wireshark/src/packet-libvirt.c      |   3 +-
>   91 files changed, 481 insertions(+), 334 deletions(-)
> 

We need those RFC patches too, because otherwise GCC will see 
VIR_XPATH_NODE_AUTORESTORE() as a start of a code block and error out.

Reviewed-by: Michal Privoznik <mprivozn@redhat.com>

Michal