[PATCH] virt-host-validate: fix build with clang

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Building with clang 3.8 triggers the following error:

  CC       virt_host_validate-virt-host-validate-qemu.o
virt-host-validate-qemu.c:36:11: error: initializing 'char *' with an expression of type 'const char *' discards qualifiers [-Werror,-Wincompatible-pointer-types-discards-qualifiers]
    char *kvmhint = _("Check that CPU and firmware supports virtualization "
          ^         ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
virt-host-validate-qemu.c:46:17: error: assigning to 'char *' from 'const char *' discards qualifiers [-Werror,-Wincompatible-pointer-types-discards-qualifiers]
        kvmhint = _("Check that the 'kvm-intel' or 'kvm-amd' modules are "
                ^ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
2 errors generated.

Fix by using 'const' for kvmhint declaration.
---
Pushed under the build-breaker rule.

 tools/virt-host-validate-qemu.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/tools/virt-host-validate-qemu.c b/tools/virt-host-validate-qemu.c
index 66377e1..2aa396e 100644
--- a/tools/virt-host-validate-qemu.c
+++ b/tools/virt-host-validate-qemu.c
@@ -33,8 +33,8 @@ int virHostValidateQEMU(void)
     int ret = 0;
     bool hasHwVirt = false;
     bool hasVirtFlag = false;
-    char *kvmhint = _("Check that CPU and firmware supports virtualization "
-                      "and kvm module is loaded");
+    const char *kvmhint = _("Check that CPU and firmware supports virtualization "
+                            "and kvm module is loaded");
 
     if (!(flags = virHostValidateGetCPUFlags()))
         return -1;
-- 
2.7.4

--
libvir-list mailing list
libvir-list@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/libvir-list



[Index of Archives]     [Virt Tools]     [Libvirt Users]     [Lib OS Info]     [Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]     [Fedora Tools]