Message ID | 1596110248-7366-1-git-send-email-likaige@loongson.cn |
---|---|
State | New |
Headers | show |
Series | [v2,1/2] virtio-mem: Change PRIx32 to PRIXPTR to fix compile error. | expand |
On 30.07.20 13:57, Kaige Li wrote: > When I compile qemu with such as: > > git clone https://git.qemu.org/git/qemu.git > cd qemu > git submodule init > git submodule update --recursive > ./configure > make > > There is error log: > > /home/LiKaige/qemu/hw/virtio/virtio-mem.c: In function ‘virtio_mem_set_block_size’: > /home/LiKaige/qemu/hw/virtio/virtio-mem.c:756:9: error: format ‘%x’ expects argument of type ‘unsigned int’, but argument 7 has type ‘uintptr_t’ [-Werror=format=] > error_setg(errp, "'%s' property has to be at least 0x%" PRIx32, name, > ^ > cc1: all warnings being treated as errors > /home/LiKaige/qemu/rules.mak:69: recipe for target 'hw/virtio/virtio-mem.o' failed > > So, change PRIx32 to PRIXPTR to fix this. > > Signed-off-by: Kaige Li <likaige@loongson.cn> > --- > hw/virtio/virtio-mem.c | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) > > diff --git a/hw/virtio/virtio-mem.c b/hw/virtio/virtio-mem.c > index c12e9f7..3dcaf9a 100644 > --- a/hw/virtio/virtio-mem.c > +++ b/hw/virtio/virtio-mem.c > @@ -753,7 +753,7 @@ static void virtio_mem_set_block_size(Object *obj, Visitor *v, const char *name, > } > > if (value < VIRTIO_MEM_MIN_BLOCK_SIZE) { > - error_setg(errp, "'%s' property has to be at least 0x%" PRIx32, name, > + error_setg(errp, "'%s' property has to be at least 0x%" PRIXPTR "\n", name, > VIRTIO_MEM_MIN_BLOCK_SIZE); > return; > } else if (!is_power_of_2(value)) { > That's not what I suggested ... and you should mention the compiler/host architecture used.
On 30.07.20 14:03, David Hildenbrand wrote: > On 30.07.20 13:57, Kaige Li wrote: >> When I compile qemu with such as: >> >> git clone https://git.qemu.org/git/qemu.git >> cd qemu >> git submodule init >> git submodule update --recursive >> ./configure >> make >> >> There is error log: >> >> /home/LiKaige/qemu/hw/virtio/virtio-mem.c: In function ‘virtio_mem_set_block_size’: >> /home/LiKaige/qemu/hw/virtio/virtio-mem.c:756:9: error: format ‘%x’ expects argument of type ‘unsigned int’, but argument 7 has type ‘uintptr_t’ [-Werror=format=] >> error_setg(errp, "'%s' property has to be at least 0x%" PRIx32, name, >> ^ >> cc1: all warnings being treated as errors >> /home/LiKaige/qemu/rules.mak:69: recipe for target 'hw/virtio/virtio-mem.o' failed >> >> So, change PRIx32 to PRIXPTR to fix this. >> >> Signed-off-by: Kaige Li <likaige@loongson.cn> >> --- >> hw/virtio/virtio-mem.c | 2 +- >> 1 file changed, 1 insertion(+), 1 deletion(-) >> >> diff --git a/hw/virtio/virtio-mem.c b/hw/virtio/virtio-mem.c >> index c12e9f7..3dcaf9a 100644 >> --- a/hw/virtio/virtio-mem.c >> +++ b/hw/virtio/virtio-mem.c >> @@ -753,7 +753,7 @@ static void virtio_mem_set_block_size(Object *obj, Visitor *v, const char *name, >> } >> >> if (value < VIRTIO_MEM_MIN_BLOCK_SIZE) { >> - error_setg(errp, "'%s' property has to be at least 0x%" PRIx32, name, >> + error_setg(errp, "'%s' property has to be at least 0x%" PRIXPTR "\n", name, >> VIRTIO_MEM_MIN_BLOCK_SIZE); >> return; >> } else if (!is_power_of_2(value)) { >> > > That's not what I suggested ... and you should mention the compiler/host > architecture used. > Sorry, I thought this was a resend from Bruce: https://lkml.kernel.org/r/1b00c0e25ec65e113d4c7fa98b1466689f05a986.camel@suse.com
On 7/30/20 1:57 PM, Kaige Li wrote: > When I compile qemu with such as: > > git clone https://git.qemu.org/git/qemu.git > cd qemu > git submodule init > git submodule update --recursive > ./configure > make ^ this timeless description is pointless (think at a developer who read this in 2 weeks, 3 months, 1 year). > > There is error log: > > /home/LiKaige/qemu/hw/virtio/virtio-mem.c: In function ‘virtio_mem_set_block_size’: > /home/LiKaige/qemu/hw/virtio/virtio-mem.c:756:9: error: format ‘%x’ expects argument of type ‘unsigned int’, but argument 7 has type ‘uintptr_t’ [-Werror=format=] What compiler are you using? That is the relevant information to include. > error_setg(errp, "'%s' property has to be at least 0x%" PRIx32, name, > ^ > cc1: all warnings being treated as errors > /home/LiKaige/qemu/rules.mak:69: recipe for target 'hw/virtio/virtio-mem.o' failed > > So, change PRIx32 to PRIXPTR to fix this. > > Signed-off-by: Kaige Li <likaige@loongson.cn> > --- > hw/virtio/virtio-mem.c | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) > > diff --git a/hw/virtio/virtio-mem.c b/hw/virtio/virtio-mem.c > index c12e9f7..3dcaf9a 100644 > --- a/hw/virtio/virtio-mem.c > +++ b/hw/virtio/virtio-mem.c > @@ -753,7 +753,7 @@ static void virtio_mem_set_block_size(Object *obj, Visitor *v, const char *name, > } > > if (value < VIRTIO_MEM_MIN_BLOCK_SIZE) { > - error_setg(errp, "'%s' property has to be at least 0x%" PRIx32, name, > + error_setg(errp, "'%s' property has to be at least 0x%" PRIXPTR "\n", name, > VIRTIO_MEM_MIN_BLOCK_SIZE); > return; > } else if (!is_power_of_2(value)) { >
On 07/30/2020 09:15 PM, Philippe Mathieu-Daudé wrote: > On 7/30/20 1:57 PM, Kaige Li wrote: >> When I compile qemu with such as: >> >> git clone https://git.qemu.org/git/qemu.git >> cd qemu >> git submodule init >> git submodule update --recursive >> ./configure >> make > ^ this timeless description is pointless (think at a developer > who read this in 2 weeks, 3 months, 1 year). Thanks for your suggestions, I will delete it. > >> There is error log: >> >> /home/LiKaige/qemu/hw/virtio/virtio-mem.c: In function ‘virtio_mem_set_block_size’: >> /home/LiKaige/qemu/hw/virtio/virtio-mem.c:756:9: error: format ‘%x’ expects argument of type ‘unsigned int’, but argument 7 has type ‘uintptr_t’ [-Werror=format=] > What compiler are you using? That is the relevant information to > include. Gcc version is 4.9.4. > >> error_setg(errp, "'%s' property has to be at least 0x%" PRIx32, name, >> ^ >> cc1: all warnings being treated as errors >> /home/LiKaige/qemu/rules.mak:69: recipe for target 'hw/virtio/virtio-mem.o' failed >> >> So, change PRIx32 to PRIXPTR to fix this. >> >> Signed-off-by: Kaige Li <likaige@loongson.cn> >> --- >> hw/virtio/virtio-mem.c | 2 +- >> 1 file changed, 1 insertion(+), 1 deletion(-) >> >> diff --git a/hw/virtio/virtio-mem.c b/hw/virtio/virtio-mem.c >> index c12e9f7..3dcaf9a 100644 >> --- a/hw/virtio/virtio-mem.c >> +++ b/hw/virtio/virtio-mem.c >> @@ -753,7 +753,7 @@ static void virtio_mem_set_block_size(Object *obj, Visitor *v, const char *name, >> } >> >> if (value < VIRTIO_MEM_MIN_BLOCK_SIZE) { >> - error_setg(errp, "'%s' property has to be at least 0x%" PRIx32, name, >> + error_setg(errp, "'%s' property has to be at least 0x%" PRIXPTR "\n", name, >> VIRTIO_MEM_MIN_BLOCK_SIZE); >> return; >> } else if (!is_power_of_2(value)) { >>
diff --git a/hw/virtio/virtio-mem.c b/hw/virtio/virtio-mem.c index c12e9f7..3dcaf9a 100644 --- a/hw/virtio/virtio-mem.c +++ b/hw/virtio/virtio-mem.c @@ -753,7 +753,7 @@ static void virtio_mem_set_block_size(Object *obj, Visitor *v, const char *name, } if (value < VIRTIO_MEM_MIN_BLOCK_SIZE) { - error_setg(errp, "'%s' property has to be at least 0x%" PRIx32, name, + error_setg(errp, "'%s' property has to be at least 0x%" PRIXPTR "\n", name, VIRTIO_MEM_MIN_BLOCK_SIZE); return; } else if (!is_power_of_2(value)) {
When I compile qemu with such as: git clone https://git.qemu.org/git/qemu.git cd qemu git submodule init git submodule update --recursive ./configure make There is error log: /home/LiKaige/qemu/hw/virtio/virtio-mem.c: In function ‘virtio_mem_set_block_size’: /home/LiKaige/qemu/hw/virtio/virtio-mem.c:756:9: error: format ‘%x’ expects argument of type ‘unsigned int’, but argument 7 has type ‘uintptr_t’ [-Werror=format=] error_setg(errp, "'%s' property has to be at least 0x%" PRIx32, name, ^ cc1: all warnings being treated as errors /home/LiKaige/qemu/rules.mak:69: recipe for target 'hw/virtio/virtio-mem.o' failed So, change PRIx32 to PRIXPTR to fix this. Signed-off-by: Kaige Li <likaige@loongson.cn> --- hw/virtio/virtio-mem.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)