diff mbox

[PATCHv7,2/2] ODP-DPDK compilation fix

Message ID 1405923737-3338-1-git-send-email-venkatesh.vivekanandan@linaro.org
State Accepted
Commit 3fdeee1af8e264df96247eef02724178b86a1a4c
Headers show

Commit Message

Venkatesh Vivekanandan July 21, 2014, 6:22 a.m. UTC
From: Venkatesh Vivekanandan <venkatesh.vivekanandan@linaro.org>

- Added new file platform/linux-dpdk/include/odp_debug.h
- ODP_ASSERT complains of array getting a negative value. Root cause is,
	struct rte_mbuf {
		.
		.
	} __rte_cache_aligned; <-- this alignment causes the error.

	Since dpdk code can't be changed, added new file odp_debug.h as
	a temporary fix. Further analysis will be done and fixed cleanly
	later.

Signed-off-by: Venkatesh Vivekanandan <venkatesh.vivekanandan@linaro.org>
---
 platform/linux-dpdk/include/odp_debug.h | 70 +++++++++++++++++++++++++++++++++
 1 file changed, 70 insertions(+)
 create mode 100644 platform/linux-dpdk/include/odp_debug.h
diff mbox

Patch

diff --git a/platform/linux-dpdk/include/odp_debug.h b/platform/linux-dpdk/include/odp_debug.h
new file mode 100644
index 0000000..e37ca8d
--- /dev/null
+++ b/platform/linux-dpdk/include/odp_debug.h
@@ -0,0 +1,70 @@ 
+/* Copyright (c) 2013, Linaro Limited
+ * All rights reserved.
+ *
+ * SPDX-License-Identifier:     BSD-3-Clause
+ */
+/**
+ * @file
+ *
+ * ODP debug
+ */
+
+#ifndef ODP_DEBUG_H_
+#define ODP_DEBUG_H_
+
+#include <stdio.h>
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#ifdef __GNUC__
+
+/**
+ * Indicate deprecated variables, functions or types
+ */
+#define ODP_DEPRECATED __attribute__((__deprecated__))
+
+/**
+ * Intentionally unused variables ot functions
+ */
+#define ODP_UNUSED     __attribute__((__unused__))
+
+#else
+
+#define ODP_DEPRECATED
+#define ODP_UNUSED
+
+#endif
+
+/**
+ * Compile time assertion-macro - fail compilation if cond is false.
+ */
+#define ODP_ASSERT(cond, msg)  typedef char msg[(cond) ? 1 : 0]
+
+/**
+ * Compile time assertion-macro - fail compilation if cond is false.
+ * @note This macro has zero runtime overhead
+ */
+#define ODP_STATIC_ASSERT(cond, msg)  _static_assert(cond, msg)
+
+/**
+ * Debug printing macro, which prints output when DEBUG flag is set.
+ */
+#define ODP_DBG(fmt, ...) \
+		do { if (ODP_DEBUG_PRINT == 1) \
+			printf(fmt, ##__VA_ARGS__); \
+		} while (0)
+
+/**
+ * Print output to stderr (file, line and function).
+ */
+#define ODP_ERR(fmt, ...) \
+	fprintf(stderr, "%s:%d:%s(): " fmt, __FILE__, \
+		__LINE__, __func__, ##__VA_ARGS__)
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif