Merge branch 'fio-c++-engine' of https://github.com/tchaikov/fio
authorJens Axboe <axboe@kernel.dk>
Wed, 25 Jul 2018 14:41:38 +0000 (08:41 -0600)
committerJens Axboe <axboe@kernel.dk>
Wed, 25 Jul 2018 14:41:38 +0000 (08:41 -0600)
* 'fio-c++-engine' of https://github.com/tchaikov/fio:
  replace typeof with __typeof__

compiler/compiler.h
flist.h
minmax.h
oslib/libmtd_common.h
verify.c

index dacb737910c0f890de63bb5b4b3030d6fa1311fc..ddfbcc124e77ac2b1a5d7aea1640ccbc4577a331 100644 (file)
@@ -28,7 +28,7 @@
  */
 #define typecheck(type,x) \
 ({     type __dummy; \
-       typeof(x) __dummy2; \
+       __typeof__(x) __dummy2; \
        (void)(&__dummy == &__dummy2); \
        1; \
 })
@@ -70,7 +70,7 @@
 
 #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
diff --git a/flist.h b/flist.h
index 2ca3d7771232b6d3031d3c73cff118ef2c5dbd50..5437cd80da85ab7581b2282f52669510ef682d20 100644 (file)
--- a/flist.h
+++ b/flist.h
@@ -4,8 +4,8 @@
 #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) );})
 
 /*
index afc78f02e4b3f4cfe2de624d780301a54f8bc926..ec0848c0d67c7f84c549868e60f5063150a0cdeb 100644 (file)
--- a/minmax.h
+++ b/minmax.h
@@ -3,23 +3,23 @@
 
 #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
index 87f93b61971129ef34eb0a24777a298fdc7f47d8..4ed9f0ba8fde036807f163297a333a191aeb623f 100644 (file)
@@ -49,18 +49,18 @@ extern "C" {
 #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; \
 })
 
index 0f2c1182a60962fb64595a02fccec36bd156df4a..01492f24f9a0336c3b09ebb295aa0afe6963c4bd 100644 (file)
--- a/verify.c
+++ b/verify.c
@@ -1517,7 +1517,7 @@ int paste_blockoff(char *buf, unsigned int len, void *priv)
        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);