All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] Fix gcc4 compiler warning
@ 2006-02-14 20:58 Steve Dobbelstein
  0 siblings, 0 replies; only message in thread
From: Steve Dobbelstein @ 2006-02-14 20:58 UTC (permalink / raw)
  To: xen-devel

[-- Attachment #1: Type: text/plain, Size: 1256 bytes --]

gcc 4 has stricter type checking.  It catches a type mismatch in
xen/arch/x86/cpu/intel.c.  The num_cpu_cores() function declares:
unsigned int eax, ebx, ecx, edx;

then calls
cpuid_count(4, 0, &eax, &ebx, &ecx, &edx);

but xen/include/asm-x86/processor.h defines:
static inline void cpuid_count(int op, int count, int *eax, int *ebx, int
*ecx, int *edx)

gcc 4 catches the type mismatch between the unsigned ints declared in
num_cpu_cores() and the ints declared in the  cpuid_count() prototype and
says:
cc1: warnings being treated as errors
cpu/intel.c: In function ?num_cpu_cores?:
cpu/intel.c:88: warning: pointer targets in passing argument 3 of
?cpuid_count? differ in signedness
cpu/intel.c:88: warning: pointer targets in passing argument 4 of
?cpuid_count? differ in signedness
cpu/intel.c:88: warning: pointer targets in passing argument 5 of
?cpuid_count? differ in signedness
cpu/intel.c:88: warning: pointer targets in passing argument 6 of
?cpuid_count? differ in signedness
make[2]: *** [cpu/intel.o] Error 1

which halts the build.

This patch changes the declaration of eax, ebx, ecx, and edx to ints to
match the cpuid_count() prototype.

Signed-off-by: Steve Dobbelstein <steved@us.ibm.com>

(See attached file: num_cpu_cores_fix.patch)

[-- Attachment #2: num_cpu_cores_fix.patch --]
[-- Type: application/octet-stream, Size: 438 bytes --]

gcc 4 has stricter type checking.
It throws an error when compiling xen/arch/x86/cpu/intel.c which stops the build.

--- a/xen/arch/x86/cpu/intel.c	2006-02-14 11:01:33.000000000 -0600
+++ b/xen/arch/x86/cpu/intel.c	2006-02-14 11:12:13.000000000 -0600
@@ -79,7 +79,7 @@
  */
 static int __devinit num_cpu_cores(struct cpuinfo_x86 *c)
 {
-	unsigned int eax, ebx, ecx, edx;
+	int eax, ebx, ecx, edx;
 
 	if (c->cpuid_level < 4)
 		return 1;

[-- Attachment #3: Type: text/plain, Size: 138 bytes --]

_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xensource.com
http://lists.xensource.com/xen-devel

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2006-02-14 20:58 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2006-02-14 20:58 [PATCH] Fix gcc4 compiler warning Steve Dobbelstein

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.