diff options
Diffstat (limited to 'platform/linux-generic/include/odp/api/plat/strong_types.h')
-rw-r--r-- | platform/linux-generic/include/odp/api/plat/strong_types.h | 16 |
1 files changed, 9 insertions, 7 deletions
diff --git a/platform/linux-generic/include/odp/api/plat/strong_types.h b/platform/linux-generic/include/odp/api/plat/strong_types.h index a53d76352..3866c8080 100644 --- a/platform/linux-generic/include/odp/api/plat/strong_types.h +++ b/platform/linux-generic/include/odp/api/plat/strong_types.h @@ -1,7 +1,5 @@ -/* Copyright (c) 2015, Linaro Limited - * All rights reserved. - * - * SPDX-License-Identifier: BSD-3-Clause +/* SPDX-License-Identifier: BSD-3-Clause + * Copyright (c) 2015-2018 Linaro Limited */ @@ -15,9 +13,13 @@ #ifndef STRONG_TYPES_H_ #define STRONG_TYPES_H_ +#include <odp/api/std_types.h> + /** Use strong typing for ODP types */ #ifdef __cplusplus -#define ODP_HANDLE_T(type) struct _##type { uint8_t unused_dummy_var; } *type +/* Allow type to be expanded before concatenation with underscore */ +#define _ODP_HANDLE_T(type) struct _##type { uint8_t unused_dummy_var; } *type +#define ODP_HANDLE_T(type) _ODP_HANDLE_T(type) #else #define odp_handle_t struct { uint8_t unused_dummy_var; } * /** C/C++ helper macro for strong typing */ @@ -25,10 +27,10 @@ #endif /** Internal macro to get value of an ODP handle */ -#define _odp_typeval(handle) ((uint32_t)(uintptr_t)(handle)) +#define _odp_typeval(handle) ((uintptr_t)(handle)) /** Internal macro to get printable value of an ODP handle */ -#define _odp_pri(handle) ((uint64_t)_odp_typeval(handle)) +#define _odp_pri(handle) ((uint64_t)(uintptr_t)(handle)) /** Internal macro to convert a scalar to a typed handle */ #define _odp_cast_scalar(type, val) ((type)(uintptr_t)(val)) |