* [Qemu-devel] [PATCH 1/3] tests/hd-geo-test.c: Remove unused test_image variable
2014-12-23 22:26 [Qemu-devel] [PATCH 0/3] miscellaneous minor clang fixes Peter Maydell
@ 2014-12-23 22:26 ` Peter Maydell
2014-12-23 22:26 ` [Qemu-devel] [PATCH 2/3] translate-all: Mark map_exec() with the 'unused' attribute Peter Maydell
` (2 subsequent siblings)
3 siblings, 0 replies; 5+ messages in thread
From: Peter Maydell @ 2014-12-23 22:26 UTC (permalink / raw)
To: qemu-devel; +Cc: qemu-trivial
Remove unused variable test_image; this silences a clang warning.
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
---
tests/hd-geo-test.c | 2 --
1 file changed, 2 deletions(-)
diff --git a/tests/hd-geo-test.c b/tests/hd-geo-test.c
index 7cc8dff..00afc20 100644
--- a/tests/hd-geo-test.c
+++ b/tests/hd-geo-test.c
@@ -22,8 +22,6 @@
#include "qemu-common.h"
#include "libqtest.h"
-static const char test_image[] = "/tmp/qtest.XXXXXX";
-
static char *create_test_img(int secs)
{
char *template = strdup("/tmp/qtest.XXXXXX");
--
1.9.1
^ permalink raw reply related [flat|nested] 5+ messages in thread
* [Qemu-devel] [PATCH 2/3] translate-all: Mark map_exec() with the 'unused' attribute
2014-12-23 22:26 [Qemu-devel] [PATCH 0/3] miscellaneous minor clang fixes Peter Maydell
2014-12-23 22:26 ` [Qemu-devel] [PATCH 1/3] tests/hd-geo-test.c: Remove unused test_image variable Peter Maydell
@ 2014-12-23 22:26 ` Peter Maydell
2014-12-23 22:26 ` [Qemu-devel] [PATCH 3/3] migration/qemu-file.c: Don't shift left into sign bit Peter Maydell
2015-01-12 8:52 ` [Qemu-devel] [PATCH 0/3] miscellaneous minor clang fixes Michael Tokarev
3 siblings, 0 replies; 5+ messages in thread
From: Peter Maydell @ 2014-12-23 22:26 UTC (permalink / raw)
To: qemu-devel; +Cc: qemu-trivial
From: SeokYeon Hwang <syeon.hwang@samsung.com>
Mark map_exec() with the 'unused' attribute to avoid '-Wunused-function'
warnings on clang 3.4 or later. This means we don't need to mark it
'inline', which is what we were previously using to suppress the warning
(a trick which only works with gcc, not clang).
Signed-off-by: SeokYeon Hwang <syeon.hwang@samsung.com>
Reviewed-by: Paolo Bonzini <pbonzini@redhat.com>
[PMM: tweaked comment message a little]
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
---
translate-all.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/translate-all.c b/translate-all.c
index c24cfe8..62b2efa 100644
--- a/translate-all.c
+++ b/translate-all.c
@@ -276,14 +276,14 @@ bool cpu_restore_state(CPUState *cpu, uintptr_t retaddr)
}
#ifdef _WIN32
-static inline void map_exec(void *addr, long size)
+static __attribute__((unused)) void map_exec(void *addr, long size)
{
DWORD old_protect;
VirtualProtect(addr, size,
PAGE_EXECUTE_READWRITE, &old_protect);
}
#else
-static inline void map_exec(void *addr, long size)
+static __attribute__((unused)) void map_exec(void *addr, long size)
{
unsigned long start, end, page_size;
--
1.9.1
^ permalink raw reply related [flat|nested] 5+ messages in thread
* [Qemu-devel] [PATCH 3/3] migration/qemu-file.c: Don't shift left into sign bit
2014-12-23 22:26 [Qemu-devel] [PATCH 0/3] miscellaneous minor clang fixes Peter Maydell
2014-12-23 22:26 ` [Qemu-devel] [PATCH 1/3] tests/hd-geo-test.c: Remove unused test_image variable Peter Maydell
2014-12-23 22:26 ` [Qemu-devel] [PATCH 2/3] translate-all: Mark map_exec() with the 'unused' attribute Peter Maydell
@ 2014-12-23 22:26 ` Peter Maydell
2015-01-12 8:52 ` [Qemu-devel] [PATCH 0/3] miscellaneous minor clang fixes Michael Tokarev
3 siblings, 0 replies; 5+ messages in thread
From: Peter Maydell @ 2014-12-23 22:26 UTC (permalink / raw)
To: qemu-devel; +Cc: qemu-trivial
Add a cast in qemu_get_be32() to avoid shifting left into the sign
bit of a signed integer (which is undefined behaviour in C).
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
---
migration/qemu-file.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/migration/qemu-file.c b/migration/qemu-file.c
index d2d4007..a7f2a34 100644
--- a/migration/qemu-file.c
+++ b/migration/qemu-file.c
@@ -503,7 +503,7 @@ unsigned int qemu_get_be16(QEMUFile *f)
unsigned int qemu_get_be32(QEMUFile *f)
{
unsigned int v;
- v = qemu_get_byte(f) << 24;
+ v = (unsigned int)qemu_get_byte(f) << 24;
v |= qemu_get_byte(f) << 16;
v |= qemu_get_byte(f) << 8;
v |= qemu_get_byte(f);
--
1.9.1
^ permalink raw reply related [flat|nested] 5+ messages in thread
* Re: [Qemu-devel] [PATCH 0/3] miscellaneous minor clang fixes
2014-12-23 22:26 [Qemu-devel] [PATCH 0/3] miscellaneous minor clang fixes Peter Maydell
` (2 preceding siblings ...)
2014-12-23 22:26 ` [Qemu-devel] [PATCH 3/3] migration/qemu-file.c: Don't shift left into sign bit Peter Maydell
@ 2015-01-12 8:52 ` Michael Tokarev
3 siblings, 0 replies; 5+ messages in thread
From: Michael Tokarev @ 2015-01-12 8:52 UTC (permalink / raw)
To: Peter Maydell, qemu-devel; +Cc: qemu-trivial
24.12.2014 01:26, Peter Maydell wrote:
> This is a collection of three miscellaneous minor fixes for
> clang compile warnings, which I think could reasonably go via
> the -trivial tree. The map_exec patch has been on list and
> reviewed before; the other two are new.
>
> Peter Maydell (2):
> tests/hd-geo-test.c: Remove unused test_image variable
> migration/qemu-file.c: Don't shift left into sign bit
>
> SeokYeon Hwang (1):
> translate-all: Mark map_exec() with the 'unused' attribute
Applied all to -trivial, thank you!
/mjt
^ permalink raw reply [flat|nested] 5+ messages in thread