Skip to contentSkip to conversation

warning: pointer of type `void *' used in arithmetic'

PATCH In review Paweł Sikora 3 participants 4 messages Jul 3, 2004 – Jul 4, 2004

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 warning: pointer of type `void *' used in arithmetic'

warning killed.

Signature · 3 lines
/* Copyright (C) 2003, SCO, Inc. This is valuable Intellectual Property. */

                           #define say(x) lie(x)
var/tmp/linux/include/linux/prefetch.h renamed from var/tmp/linux/include/linux/prefetch.h.orig +1 -1
@@ -59,7 +59,7 @@
 {
 #ifdef ARCH_HAS_PREFETCH
 	char *cp;
-	char *end = addr + len;
+	char *end = (char *)addr + len;
 
 	for (cp = addr; cp < end; cp += PREFETCH_STRIDE)
 		prefetch(cp);
#1 lore raw
Quoted 11 lines · Pawe__ Sikora

warning killed.

--- /var/tmp/linux/include/linux/prefetch.h.orig 2004-06-16 07:20:25.000000000 +0200
+++ /var/tmp/linux/include/linux/prefetch.h 2004-07-03 18:28:10.478861720 +0200
@@ -59,7 +59,7 @@
{
#ifdef ARCH_HAS_PREFETCH
char *cp;
- char *end = addr + len;
+ char *end = (char *)addr + len;

What version of the compiler is generating this warning?

#2 lore raw
Quoted 13 lines · Andrew Morton
Quoted 11 lines · Pawe__ Sikora

warning killed.

--- /var/tmp/linux/include/linux/prefetch.h.orig 2004-06-16 07:20:25.000000000 +0200
+++ /var/tmp/linux/include/linux/prefetch.h 2004-07-03 18:28:10.478861720 +0200
@@ -59,7 +59,7 @@
{
#ifdef ARCH_HAS_PREFETCH
char *cp;
- char *end = addr + len;
+ char *end = (char *)addr + len;

Quoted 1 line

What version of the compiler is generating this warning?

As far as I know, any gcc if and only if you pass "-Wpointer-arith" to it. The kernel doesn't do that, leaving me wondering ...

Signature · 2 lines
Vojtech Pavlik
SuSE Labs, SuSE CR
#3 lore raw
Quoted 15 lines · Vojtech Pavlik
Quoted 13 lines · Andrew Morton
Quoted 11 lines · Pawe__ Sikora

warning killed.

--- /var/tmp/linux/include/linux/prefetch.h.orig 2004-06-16 07:20:25.000000000 +0200
+++ /var/tmp/linux/include/linux/prefetch.h 2004-07-03 18:28:10.478861720 +0200
@@ -59,7 +59,7 @@
{
#ifdef ARCH_HAS_PREFETCH
char *cp;
- char *end = addr + len;
+ char *end = (char *)addr + len;

Quoted 5 lines
Quoted 1 line

What version of the compiler is generating this warning?

As far as I know, any gcc if and only if you pass "-Wpointer-arith" to it. The kernel doesn't do that, leaving me wondering ...

This discussion fell off the mailing list (grr).

The warning was encountered when building the nvidia driver, and it indeed uses -Wpointer-arith.