All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] kvm: testsuite: silence warnings on x86_64
@ 2008-01-24 16:06 Bernhard Kaindl
       [not found] ` <alpine.LNX.1.00.0801241628040.5231-aORvohZ8rX8NvFgr0RP9cw@public.gmane.org>
  0 siblings, 1 reply; 10+ messages in thread
From: Bernhard Kaindl @ 2008-01-24 16:06 UTC (permalink / raw)
  To: kvm-devel-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f

Hi,
   please find the following trivial warning fix patch for

		kvm-60/user/test/x86/*

   below. Feel free to merge to upstream kvm. It's diffed against kvm-60.

The patch does not change things, just shuts up the warnings.

The deal here is that we check for warnings and are alerted of warnings which
include language like:

	"is used uninitialized in this function"
---------^^ (not may)

which indicate a true programming error and are prominently recognized.

Fixing the same warning message made me fix a terrible bug in libksba
(a library which deals with X.509 certificates, CMS data, and related data
which is used by
GnuPG) which surfaced with the use of the new gcc-4.3 compiler suite.

gcc-4.3 optimizes better and the probabitlity that uninitialized value
actually starts off with a non-zero value really increases with gcc-4.3.

I did not test this patch as I did not find documentation on how to run the
test cases and I could not find a make target to run them from make.

Bernhard

----------------

This patch fixes the following warnings on x86_64:

test/x86/access.c: In function 'ac_test_exec':
test/x86/access.c:541: warning: implicit declaration of function 'strcat'
test/x86/access.c: In function 'main':
test/x86/access.c:577: warning: passing argument 1 of 'smp_init' from incompatible pointer type

test/x86/emulator.c: In function 'test_cmps':
test/x86/emulator.c:26: warning: unused variable 'i'
test/x86/emulator.c: In function 'test_push':
test/x86/emulator.c:115: warning: 'tmp' is used uninitialized in this function

test/x86/lib/printf.c: In function 'vsnprintf':
test/x86/lib/printf.c:95: warning: unused variable 'n'

Note: 'tmp' is only used in inline assembly, so the initialisation of it may be
done in a more elegant way, but just setting it to 0 should hopefully just
achive the same functional result as no initialisation (most of the time...).

Signed-off-by: Bernhard Kaindl <bk-l3A5Bk7waGM@public.gmane.org>
---
 access.c     |    8 +++++++-
 emulator.c   |    3 +--
 lib/printf.c |    1 -
 3 files changed, 8 insertions(+), 4 deletions(-)

--- kvm-60/user/test/x86/access.c
+++ kvm-60/user/test/x86/access.c	2008/01/24 15:14:16
@@ -1,6 +1,7 @@
 
 #include "smp.h"
 #include "printf.h"
+#include "string.h"
 
 #define true 1
 #define false 0
@@ -569,7 +570,7 @@
     int r;
 
     printf("starting test\n\n");
-    smp_init(ac_test_run);
+    smp_init((void (*)(void))ac_test_run);
     r = ac_test_run();
     return r ? 0 : 1;
 }
--- kvm-60/user/test/x86/emulator.c
+++ kvm-60/user/test/x86/emulator.c	2008/01/24 15:08:16
@@ -23,7 +23,6 @@
 	unsigned char m3[1024];
 	void *rsi, *rdi;
 	long rcx, tmp;
-	int i;
 
 	for (int i = 0; i < 100; ++i)
 		m1[i] = m2[i] = m3[i] = i;
@@ -105,7 +104,7 @@
 
 void test_push(void *mem)
 {
-	unsigned long tmp;
+	unsigned long tmp = 0;
 	unsigned long *stack_top = mem + 4096;
 	unsigned long *new_stack_top;
 	unsigned long memw = 0x123456789abcdeful;
--- kvm-60/user/test/x86/lib/printf.c
+++ kvm-60/user/test/x86/lib/printf.c	2008/01/24 15:10:35
@@ -92,7 +92,6 @@
 
 int vsnprintf(char *buf, int size, const char *fmt, va_list va)
 {
-    int n;
     pstream_t s;
 
     s.buffer = buf;

-------------------------------------------------------------------------
This SF.net email is sponsored by: Microsoft
Defy all challenges. Microsoft(R) Visual Studio 2008.
http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/

^ permalink raw reply	[flat|nested] 10+ messages in thread

end of thread, other threads:[~2008-01-31 12:20 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2008-01-24 16:06 [PATCH] kvm: testsuite: silence warnings on x86_64 Bernhard Kaindl
     [not found] ` <alpine.LNX.1.00.0801241628040.5231-aORvohZ8rX8NvFgr0RP9cw@public.gmane.org>
2008-01-24 16:21   ` Avi Kivity
     [not found]     ` <4798BB24.9080100-atKUWr5tajBWk0Htik3J/w@public.gmane.org>
2008-01-24 17:43       ` Bernhard Kaindl
     [not found]         ` <alpine.LNX.1.00.0801241808470.5231-aORvohZ8rX8NvFgr0RP9cw@public.gmane.org>
2008-01-27  7:15           ` Avi Kivity
2008-01-31 10:23       ` Carlo Marcelo Arenas Belon
2008-01-31 10:38         ` Avi Kivity
2008-01-31 10:45         ` Avi Kivity
     [not found]           ` <47A1A6DB.6080804-atKUWr5tajBWk0Htik3J/w@public.gmane.org>
2008-01-31 12:15             ` [PATCH 0/2] testsuite: fixes for smp compilation issues Carlo Marcelo Arenas Belon
2008-01-31 12:18               ` [PATCH 1/2] testsuite: make smp_init parameter be a function that returns int Carlo Marcelo Arenas Belon
2008-01-31 12:20               ` [PATCH 2/2] testsuite: fix building smp.flat Carlo Marcelo Arenas Belon

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.