From f29acca244b8708523f3ad61d823cb7e29af48c1 Mon Sep 17 00:00:00 2001 From: Jim Harris Date: Mon, 14 Jun 2021 14:46:14 +0000 Subject: [PATCH] util: use __typeof__ instead of typeof 'typeof' is a GNU extension - let's use __typeof__ instead which is ISO C compliant. Allows building SPDK header files with -std=c11 as long as _GNU_SOURCE is also defined. Next patch will enable omitting _GNU_SOURCE as well. Signed-off-by: Jim Harris Change-Id: Ibd6c984627b553d6f87f302800abc52157fe9b1e Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/8332 Reviewed-by: Paul Luse Reviewed-by: Changpeng Liu Reviewed-by: Aleksey Marchuk Reviewed-by: Jacek Kalwas Tested-by: SPDK CI Jenkins Community-CI: Mellanox Build Bot --- include/spdk/util.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/include/spdk/util.h b/include/spdk/util.h index 6358524fa..363aebdf4 100644 --- a/include/spdk/util.h +++ b/include/spdk/util.h @@ -66,7 +66,7 @@ extern "C" { * power-of-two value. */ #define SPDK_ALIGN_FLOOR(val, align) \ - (typeof(val))((val) & (~((typeof(val))((align) - 1)))) + (__typeof__(val))((val) & (~((__typeof__(val))((align) - 1)))) /** * Macro to align a value to a given power-of-two. The resultant value * will be of the same type as the first parameter, and will be no lower @@ -74,7 +74,7 @@ extern "C" { * value. */ #define SPDK_ALIGN_CEIL(val, align) \ - SPDK_ALIGN_FLOOR(((val) + ((typeof(val)) (align) - 1)), align) + SPDK_ALIGN_FLOOR(((val) + ((__typeof__(val)) (align) - 1)), align) uint32_t spdk_u32log2(uint32_t x);