diff mbox

[lng-odp-dpdk,1/3] linux-dpdk: Add ODP_ABORT

Message ID 1412591001-6850-2-git-send-email-ciprian.barbu@linaro.org
State New
Headers show

Commit Message

Ciprian Barbu Oct. 6, 2014, 10:23 a.m. UTC
Signed-off-by: Ciprian Barbu <ciprian.barbu@linaro.org>
---
 platform/linux-dpdk/include/api/odp_debug.h | 87 +++++++++++++++++++++++++++++
 platform/linux-dpdk/include/odp_debug.h     | 75 -------------------------
 2 files changed, 87 insertions(+), 75 deletions(-)
 create mode 100644 platform/linux-dpdk/include/api/odp_debug.h
 delete mode 100644 platform/linux-dpdk/include/odp_debug.h
diff mbox

Patch

diff --git a/platform/linux-dpdk/include/api/odp_debug.h b/platform/linux-dpdk/include/api/odp_debug.h
new file mode 100644
index 0000000..6b145b5
--- /dev/null
+++ b/platform/linux-dpdk/include/api/odp_debug.h
@@ -0,0 +1,87 @@ 
+/* 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>
+#include <stdlib.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
+
+/**
+ * Runtime assertion-macro - aborts if 'cond' is false.
+ */
+#ifndef ODP_NO_DEBUG
+#define ODP_ASSERT(cond, msg) \
+	do { if (!(cond)) {ODP_ERR("%s\n", msg); abort(); } } while (0)
+#else
+#define ODP_ASSERT(cond, msg)
+#endif
+
+/**
+ * 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(1, 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, ...) \
+do { fprintf(stderr, "%s:%d:%s(): " fmt, __FILE__, \
+	__LINE__, __func__, ##__VA_ARGS__); \
+} while (0)
+
+/**
+ * Print output to stderr (file, line and function),
+ * then abort.
+ */
+#define ODP_ABORT(fmt, ...) \
+do { fprintf(stderr, "%s:%d:%s(): " fmt, __FILE__, \
+	__LINE__, __func__, ##__VA_ARGS__); \
+	abort(); \
+} while (0)
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif
diff --git a/platform/linux-dpdk/include/odp_debug.h b/platform/linux-dpdk/include/odp_debug.h
deleted file mode 100644
index 489a22e..0000000
--- a/platform/linux-dpdk/include/odp_debug.h
+++ /dev/null
@@ -1,75 +0,0 @@ 
-/* 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
-
-/**
- * Runtime assertion-macro - aborts if 'cond' is false.
- */
-#ifndef ODP_NO_DEBUG
-#define ODP_ASSERT(cond, msg) \
-	do { if (!(cond)) {ODP_ERR("%s\n", msg); abort(); } } while (0)
-#else
-#define ODP_ASSERT(cond, msg)
-#endif
-
-/**
- * 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(1, 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