*/
#define typecheck(type,x) \
({ type __dummy; \
- typeof(x) __dummy2; \
+ __typeof__(x) __dummy2; \
(void)(&__dummy == &__dummy2); \
1; \
})
#ifdef FIO_INTERNAL
#define ARRAY_SIZE(x) (sizeof((x)) / (sizeof((x)[0])))
-#define FIELD_SIZE(s, f) (sizeof(((typeof(s))0)->f))
+#define FIELD_SIZE(s, f) (sizeof(((__typeof__(s))0)->f))
#endif
#endif
#include <stdlib.h>
#include <stddef.h>
-#define container_of(ptr, type, member) ({ \
- const typeof( ((type *)0)->member ) *__mptr = (ptr); \
+#define container_of(ptr, type, member) ({ \
+ const __typeof__( ((type *)0)->member ) *__mptr = (ptr); \
(type *)( (char *)__mptr - offsetof(type,member) );})
/*
#ifndef min
#define min(x,y) ({ \
- typeof(x) _x = (x); \
- typeof(y) _y = (y); \
+ __typeof__(x) _x = (x); \
+ __typeof__(y) _y = (y); \
(void) (&_x == &_y); \
_x < _y ? _x : _y; })
#endif
#ifndef max
#define max(x,y) ({ \
- typeof(x) _x = (x); \
- typeof(y) _y = (y); \
+ __typeof__(x) _x = (x); \
+ __typeof__(y) _y = (y); \
(void) (&_x == &_y); \
_x > _y ? _x : _y; })
#endif
#define min_not_zero(x, y) ({ \
- typeof(x) __x = (x); \
- typeof(y) __y = (y); \
+ __typeof__(x) __x = (x); \
+ __typeof__(y) __y = (y); \
__x == 0 ? __y : ((__y == 0) ? __x : min(__x, __y)); })
#endif
#define min(a, b) MIN(a, b) /* glue for linux kernel source */
#define ARRAY_SIZE(a) (sizeof(a) / sizeof((a)[0]))
-#define ALIGN(x,a) __ALIGN_MASK(x,(typeof(x))(a)-1)
+#define ALIGN(x,a) __ALIGN_MASK(x,(__typeof__(x))(a)-1)
#define __ALIGN_MASK(x,mask) (((x)+(mask))&~(mask))
#define min_t(t,x,y) ({ \
- typeof((x)) _x = (x); \
- typeof((y)) _y = (y); \
+ __typeof__((x)) _x = (x); \
+ __typeof__((y)) _y = (y); \
(_x < _y) ? _x : _y; \
})
#define max_t(t,x,y) ({ \
- typeof((x)) _x = (x); \
- typeof((y)) _y = (y); \
+ __typeof__((x)) _x = (x); \
+ __typeof__((y)) _y = (y); \
(_x > _y) ? _x : _y; \
})
struct io_u *io = priv;
unsigned long long off;
- typecheck(typeof(off), io->offset);
+ typecheck(__typeof__(off), io->offset);
off = cpu_to_le64((uint64_t)io->offset);
len = min(len, (unsigned int)sizeof(off));
memcpy(buf, &off, len);