Skip to contentSkip to conversation

New build warnings on Windows

DISCUSSION Applied Bruce Cran 2 participants 4 messages Feb 11, 2014 – Feb 12, 2014

lore
Share & tools
lore

Bruce Cran

author
#0 lore raw

There are some new warnings in 2.1.5 when building on Windows:

In file included from io_u.c:14:0:
err.h: In function �ERR_PTR�:
err.h:18:9: warning: cast to pointer from integer of different size [-Wint-to-pointer-cast] return (void *) error;
^
err.h: In function �PTR_ERR�:
err.h:23:9: warning: cast from pointer to integer of different size [-Wpointer-to-int-cast] return (long) ptr;
^
err.h: In function �IS_ERR�:
err.h:28:22: warning: cast from pointer to integer of different size [-Wpointer-to-int-cast] return IS_ERR_VALUE((unsigned long)ptr);
^
err.h:14:27: note: in definition of macro �IS_ERR_VALUE�
#define IS_ERR_VALUE(x) ((x) >= (unsigned long)-MAX_ERRNO)
^
err.h: In function �IS_ERR_OR_NULL�:
err.h:33:30: warning: cast from pointer to integer of different size [-Wpointer-to-int-cast] return !ptr || IS_ERR_VALUE((unsigned long)ptr);
^
err.h:14:27: note: in definition of macro �IS_ERR_VALUE�
#define IS_ERR_VALUE(x) ((x) >= (unsigned long)-MAX_ERRNO)

Signature · 1 line
Bruce
#1 lore raw
Quoted 20 lines · Bruce Cran

There are some new warnings in 2.1.5 when building on Windows:

In file included from io_u.c:14:0:
err.h: In function ‘ERR_PTR’:
err.h:18:9: warning: cast to pointer from integer of different size [-Wint-to-pointer-cast]
return (void *) error;
^
err.h: In function ‘PTR_ERR’:
err.h:23:9: warning: cast from pointer to integer of different size [-Wpointer-to-int-cast]
return (long) ptr;
^
err.h: In function ‘IS_ERR’:
err.h:28:22: warning: cast from pointer to integer of different size [-Wpointer-to-int-cast]
return IS_ERR_VALUE((unsigned long)ptr);
^
err.h:14:27: note: in definition of macro ‘IS_ERR_VALUE’ #define IS_ERR_VALUE(x) ((x) >= (unsigned long)-MAX_ERRNO)

Quoted 8 lines

^
err.h: In function ‘IS_ERR_OR_NULL’:
err.h:33:30: warning: cast from pointer to integer of different size [-Wpointer-to-int-cast]
return !ptr || IS_ERR_VALUE((unsigned long)ptr);
^
err.h:14:27: note: in definition of macro ‘IS_ERR_VALUE’ #define IS_ERR_VALUE(x) ((x) >= (unsigned long)-MAX_ERRNO)

Gah, I should have caught that. Looks like I'll be spinning a 2.1.5.1 or 2.1.6 shortly too. Does the below fix it up?

err.h +0 -0
index 5c024ee88786..fef5c545bf3c 100644
@@ -11,26 +11,26 @@
 */

#define MAX_ERRNO 4095

-#define IS_ERR_VALUE(x) ((x) >= (unsigned long)-MAX_ERRNO) +#define IS_ERR_VALUE(x) ((x) >= (uintptr_t)-MAX_ERRNO)

static inline void *ERR_PTR(long error)

{
	return (void *) error;
}

-static inline long PTR_ERR(const void *ptr)
+static inline uintptr_t PTR_ERR(const void *ptr)
{
- return (long) ptr;
+ return (uintptr_t) ptr;
}

-static inline long IS_ERR(const void *ptr)
+static inline uintptr_t IS_ERR(const void *ptr)
{
- return IS_ERR_VALUE((unsigned long)ptr);
+ return IS_ERR_VALUE((uintptr_t) ptr);
}

-static inline long IS_ERR_OR_NULL(const void *ptr) +static inline uintptr_t IS_ERR_OR_NULL(const void *ptr) {

-	return !ptr || IS_ERR_VALUE((unsigned long)ptr);
+	return !ptr || IS_ERR_VALUE((uintptr_t)ptr);

}

static inline int PTR_ERR_OR_ZERO(const void *ptr)

Signature · 1 line
Jens Axboe
author
#2 lore raw
Quoted 1 line · Jens Axboe

Does the below fix it up?

Yup, that fixes it.

Signature · 1 line
Bruce
Applied
#3 lore raw
Quoted 4 lines · Bruce Cran
Quoted 1 line · Jens Axboe

Does the below fix it up?

Yup, that fixes it.

Applied!

Signature · 1 line
Jens Axboe