[libvirt PATCH 0/9] Remove some unused macros

I built with -Wunused-macros again after five years [0] the good news is we don't really have that many - most of them are VIR_FROM_THIS or macros we have included for completeness. https://gitlab.com/jano.tomko/libvirt/-/pipelines/171383854 [0] a0482396d7e0b164e71b2bdd881d9db5c6521303 Ján Tomko (9): locking: sanlock: drop unused LOCKSPACE_SLEEP storage: logical: drop unused PV_BLANK_SECTOR_SIZE storage: scsi: remove unused LINUX_SYSFS_SCSI_HOST_POSTFIX test: remove unused NUM_CELLS util: remove unused VIR_MCAST_ADDR_LEN virsh: remove unused FILTER macro virt-admin: remove unused VIRT_ADMIN_TIME_BUFLEN util: vportprofile: remove unused constants util: netdevip: remove unused VIR_NETDEV_FAMILY src/locking/lock_driver_sanlock.c | 2 -- src/storage/storage_backend_logical.c | 2 -- src/storage/storage_backend_scsi.c | 1 - src/test/test_driver.c | 2 -- src/util/virnetdev.c | 1 - src/util/virnetdevip.c | 5 ----- src/util/virnetdevvportprofile.c | 4 ---- tools/virsh-network.c | 4 ---- tools/virt-admin.c | 3 --- 9 files changed, 24 deletions(-) -- 2.26.2

After dropping support for sanlock < 2.4, this constant is no longer used. Signed-off-by: Ján Tomko <jtomko@redhat.com> Fixes: c4951694786ecd45424769979762c17e4c8e56d0 --- src/locking/lock_driver_sanlock.c | 2 -- 1 file changed, 2 deletions(-) diff --git a/src/locking/lock_driver_sanlock.c b/src/locking/lock_driver_sanlock.c index f414e3ec07..d4816030cf 100644 --- a/src/locking/lock_driver_sanlock.c +++ b/src/locking/lock_driver_sanlock.c @@ -185,8 +185,6 @@ virLockManagerSanlockInitLockspace(virLockManagerSanlockDriverPtr driver, return ret; } -/* How much ms sleep before retrying to add a lockspace? */ -#define LOCKSPACE_SLEEP 100 /* How many times try adding a lockspace? */ #define LOCKSPACE_RETRIES 10 -- 2.26.2

Signed-off-by: Ján Tomko <jtomko@redhat.com> Fixes: d942bf6e9e8e3991808ca5185098257e84acab5d --- src/storage/storage_backend_logical.c | 2 -- 1 file changed, 2 deletions(-) diff --git a/src/storage/storage_backend_logical.c b/src/storage/storage_backend_logical.c index 60958d3d2c..43cf3a1598 100644 --- a/src/storage/storage_backend_logical.c +++ b/src/storage/storage_backend_logical.c @@ -40,8 +40,6 @@ VIR_LOG_INIT("storage.storage_backend_logical"); -#define PV_BLANK_SECTOR_SIZE 512 - static int virStorageBackendLogicalSetActive(virStoragePoolObjPtr pool, -- 2.26.2

Unused since its introduction. Signed-off-by: Ján Tomko <jtomko@redhat.com> Fixes: 81d0ffbc3baee53467f664ea03b1349e8b6dba5a --- src/storage/storage_backend_scsi.c | 1 - 1 file changed, 1 deletion(-) diff --git a/src/storage/storage_backend_scsi.c b/src/storage/storage_backend_scsi.c index 37ae4325ca..e528d7622c 100644 --- a/src/storage/storage_backend_scsi.c +++ b/src/storage/storage_backend_scsi.c @@ -41,7 +41,6 @@ VIR_LOG_INIT("storage.storage_backend_scsi"); #define LINUX_SYSFS_SCSI_HOST_PREFIX "/sys/class/scsi_host" -#define LINUX_SYSFS_SCSI_HOST_POSTFIX "device" #define LINUX_SYSFS_SCSI_HOST_SCAN_STRING "- - -" typedef struct _virStoragePoolFCRefreshInfo virStoragePoolFCRefreshInfo; -- 2.26.2

Signed-off-by: Ján Tomko <jtomko@redhat.com> Fixes: 2bd7ed78a7cd68775de8cb912c7a57db7721a10b --- src/test/test_driver.c | 2 -- 1 file changed, 2 deletions(-) diff --git a/src/test/test_driver.c b/src/test/test_driver.c index 993f405f3c..01c4675c30 100644 --- a/src/test/test_driver.c +++ b/src/test/test_driver.c @@ -83,8 +83,6 @@ struct _testCell { typedef struct _testCell testCell; typedef struct _testCell *testCellPtr; -#define MAX_CELLS 128 - struct _testAuth { char *username; char *password; -- 2.26.2

Unused since its introduction. Signed-off-by: Ján Tomko <jtomko@redhat.com> Fixes: cc0e8c244d080f56392278e836cc378ba848e7aa --- src/util/virnetdev.c | 1 - 1 file changed, 1 deletion(-) diff --git a/src/util/virnetdev.c b/src/util/virnetdev.c index 41dc5bd4c4..b42fa86672 100644 --- a/src/util/virnetdev.c +++ b/src/util/virnetdev.c @@ -72,7 +72,6 @@ VIR_LOG_INIT("util.netdev"); #define MAX_MCAST_SIZE 50*14336 #define VIR_MCAST_NAME_LEN (IFNAMSIZ + 1) #define VIR_MCAST_TOKEN_DELIMS " \n" -#define VIR_MCAST_ADDR_LEN (VIR_MAC_HEXLEN + 1) #if defined(SIOCSIFFLAGS) && defined(HAVE_STRUCT_IFREQ) # define VIR_IFF_UP IFF_UP -- 2.26.2

Signed-off-by: Ján Tomko <jtomko@redhat.com> Fixes: c2dd9ddf7b18ebfb108623d4711c80b716a261d7 --- tools/virsh-network.c | 4 ---- 1 file changed, 4 deletions(-) diff --git a/tools/virsh-network.c b/tools/virsh-network.c index ed90736345..b10cd03bcc 100644 --- a/tools/virsh-network.c +++ b/tools/virsh-network.c @@ -1744,9 +1744,6 @@ static const vshCmdOptDef opts_network_port_list[] = { {.name = NULL} }; -#define FILTER(NAME, FLAG) \ - if (vshCommandOptBool(cmd, NAME)) \ - flags |= (FLAG) static bool cmdNetworkPortList(vshControl *ctl, const vshCmd *cmd) { @@ -1802,7 +1799,6 @@ cmdNetworkPortList(vshControl *ctl, const vshCmd *cmd) virshNetworkPortListFree(list); return ret; } -#undef FILTER const vshCmdDef networkCmds[] = { -- 2.26.2

The switch to GDateTime removed the last use. Signed-off-by: Ján Tomko <jtomko@redhat.com> Fixes: 3caa28dc50df7ec215713075d669b20bef6473a2 --- tools/virt-admin.c | 3 --- 1 file changed, 3 deletions(-) diff --git a/tools/virt-admin.c b/tools/virt-admin.c index fef0332a0d..cc136397bd 100644 --- a/tools/virt-admin.c +++ b/tools/virt-admin.c @@ -42,9 +42,6 @@ #define VIRT_ADMIN_PROMPT "virt-admin # " -/* we don't need precision to milliseconds in this module */ -#define VIRT_ADMIN_TIME_BUFLEN VIR_TIME_STRING_BUFLEN - 3 - static char *progname; static const vshCmdGrp cmdGroups[]; -- 2.26.2

After the switch to libnl these are no longer used. Signed-off-by: Ján Tomko <jtomko@redhat.com> Fixes: 77e7c13b2ef95724c39395d92725b1a892ff84de --- src/util/virnetdevvportprofile.c | 4 ---- 1 file changed, 4 deletions(-) diff --git a/src/util/virnetdevvportprofile.c b/src/util/virnetdevvportprofile.c index ef372aca22..020683fa04 100644 --- a/src/util/virnetdevvportprofile.c +++ b/src/util/virnetdevvportprofile.c @@ -63,10 +63,6 @@ VIR_LOG_INIT("util.netdevvportprofile"); # define MICROSEC_PER_SEC (1000 * 1000) -# define NLMSGBUF_SIZE 256 -# define RATTBUF_SIZE 64 - - # define STATUS_POLL_TIMEOUT_USEC (10 * MICROSEC_PER_SEC) # define STATUS_POLL_INTERVL_USEC (MICROSEC_PER_SEC / 8) -- 2.26.2

Signed-off-by: Ján Tomko <jtomko@redhat.com> Fixes: cf0568b0af4ef4f903da1b184fc9b232c6f29457 --- src/util/virnetdevip.c | 5 ----- 1 file changed, 5 deletions(-) diff --git a/src/util/virnetdevip.c b/src/util/virnetdevip.c index 8b85c7beca..409f062c5c 100644 --- a/src/util/virnetdevip.c +++ b/src/util/virnetdevip.c @@ -43,11 +43,6 @@ #ifdef __linux__ # include <linux/sockios.h> # include <linux/if_vlan.h> -# define VIR_NETDEV_FAMILY AF_UNIX -#elif defined(HAVE_STRUCT_IFREQ) && defined(AF_LOCAL) -# define VIR_NETDEV_FAMILY AF_LOCAL -#else -# undef HAVE_STRUCT_IFREQ #endif #define VIR_DAD_WAIT_TIMEOUT 20 /* seconds */ -- 2.26.2

Reviewed-by: Jonathon Jongsma <jjongsma@redhat.com> On Tue, 2020-07-28 at 13:54 +0200, Ján Tomko wrote:
I built with -Wunused-macros again after five years [0] the good news is we don't really have that many - most of them are VIR_FROM_THIS or macros we have included for completeness.
https://gitlab.com/jano.tomko/libvirt/-/pipelines/171383854
[0] a0482396d7e0b164e71b2bdd881d9db5c6521303
Ján Tomko (9): locking: sanlock: drop unused LOCKSPACE_SLEEP storage: logical: drop unused PV_BLANK_SECTOR_SIZE storage: scsi: remove unused LINUX_SYSFS_SCSI_HOST_POSTFIX test: remove unused NUM_CELLS util: remove unused VIR_MCAST_ADDR_LEN virsh: remove unused FILTER macro virt-admin: remove unused VIRT_ADMIN_TIME_BUFLEN util: vportprofile: remove unused constants util: netdevip: remove unused VIR_NETDEV_FAMILY
src/locking/lock_driver_sanlock.c | 2 -- src/storage/storage_backend_logical.c | 2 -- src/storage/storage_backend_scsi.c | 1 - src/test/test_driver.c | 2 -- src/util/virnetdev.c | 1 - src/util/virnetdevip.c | 5 ----- src/util/virnetdevvportprofile.c | 4 ---- tools/virsh-network.c | 4 ---- tools/virt-admin.c | 3 --- 9 files changed, 24 deletions(-)
participants (2)
-
Jonathon Jongsma
-
Ján Tomko