diff mbox series

[API-NEXT,v9,4/10] linux-gen: fix ODP_HANDLE_T expansion with c++ if type is compound

Message ID 1499781629-30670-5-git-send-email-odpbot@yandex.ru
State New
Headers show
Series [API-NEXT,v9,1/10] linux-generic: events subtype implementation | expand

Commit Message

Github ODP bot July 11, 2017, 2 p.m. UTC
From: Dmitry Eremin-Solenikov <dmitry.ereminsolenikov@linaro.org>


Currently expansion of ODP_HANDLE_T defined in strong_types.h would
result in concatenating undercrore with 'type'. If type defined using
macro, this can result in underscore being concatenated with macro name,
resulting in further errors. Use two-stage ODP_HANDLE_T expansion in C++
case so that macro params are expanded first, before being concatenated
with underscore.

Signed-off-by: Dmitry Eremin-Solenikov <dmitry.ereminsolenikov@linaro.org>

---
/** Email created from pull request 64 (lumag:crypto-packet)
 ** https://github.com/Linaro/odp/pull/64
 ** Patch: https://github.com/Linaro/odp/pull/64.patch
 ** Base sha: c7718962c6633c80eb71a0400d89c31f11f88045
 ** Merge commit sha: 6b4b95ac299d32801f55cf75ba31016675ac1afb
 **/
 platform/linux-generic/include/odp/api/plat/strong_types.h | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)
diff mbox series

Patch

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 a53d7635..2e3070f8 100644
--- a/platform/linux-generic/include/odp/api/plat/strong_types.h
+++ b/platform/linux-generic/include/odp/api/plat/strong_types.h
@@ -17,7 +17,9 @@ 
 
 /** 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 */