From: Dmitry Eremin-Solenikov <dmitry.ereminsoleni...@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.ereminsoleni...@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: 7a5813042d58598e1c66243d8cfed548302edfc4
 ** Merge commit sha: 503ae4dbca9c82be6657b05369d23a484ef0cba8
 **/
 platform/linux-generic/include/odp/api/plat/strong_types.h | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

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 */

Reply via email to