diff mbox series

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

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

Commit Message

Github ODP bot July 5, 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: 00a21c6dce65a30c8250db59a42a43c658e8ca1b
 ** Merge commit sha: ac9b299a7f3bee72dd9343bbfaa826217d243ea6
 **/
 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 */