aboutsummaryrefslogtreecommitdiff
path: root/platform/linux-generic/include-abi/odp/api/abi/debug.h
diff options
context:
space:
mode:
Diffstat (limited to 'platform/linux-generic/include-abi/odp/api/abi/debug.h')
-rw-r--r--platform/linux-generic/include-abi/odp/api/abi/debug.h68
1 files changed, 68 insertions, 0 deletions
diff --git a/platform/linux-generic/include-abi/odp/api/abi/debug.h b/platform/linux-generic/include-abi/odp/api/abi/debug.h
new file mode 100644
index 000000000..a3a86e64a
--- /dev/null
+++ b/platform/linux-generic/include-abi/odp/api/abi/debug.h
@@ -0,0 +1,68 @@
+/* Copyright (c) 2015-2018, Linaro Limited
+ * All rights reserved.
+ *
+ * SPDX-License-Identifier: BSD-3-Clause
+ */
+
+/**
+ * @file
+ *
+ * ODP atomic operations
+ */
+
+#ifndef ODP_API_ABI_DEBUG_H_
+#define ODP_API_ABI_DEBUG_H_
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/**
+ * @internal _Static_assert was only added in GCC 4.6 and the C++ version
+ * static_assert for g++ 6 and above. Provide a weak replacement for previous
+ * versions.
+ */
+#define _odp_merge(a, b) a##b
+/** @internal */
+#define _odp_label(a) _odp_merge(_ODP_SASSERT_, a)
+/** @internal */
+#define _ODP_SASSERT _odp_label(__COUNTER__)
+/** @internal */
+#define _ODP_SASSERT_ENUM(e) { _ODP_SASSERT = 1 / !!(e) }
+/** @internal */
+#define _odp_static_assert(e, s) enum _ODP_SASSERT_ENUM(e)
+
+#if defined(__clang__)
+#if defined(__cplusplus)
+#if !__has_feature(cxx_static_assert) && !defined(static_assert)
+/** @internal */
+#define static_assert(e, s) _odp_static_assert(e, s)
+#endif
+#elif !__has_feature(c_static_assert) && !defined(_Static_assert)
+/** @internal */
+#define _Static_assert(e, s) _odp_static_assert(e, s)
+#endif
+
+#elif defined(__GNUC__)
+#if __GNUC__ < 4 || (__GNUC__ == 4 && (__GNUC_MINOR__ < 6)) || \
+ (__GNUC__ < 6 && defined(__cplusplus))
+#if defined(__cplusplus)
+#if !defined(static_assert)
+/** @intenral */
+#define static_assert(e, s) _odp_static_assert(e, s)
+#endif
+#elif !defined(_Static_assert)
+/** @internal */
+#define _Static_assert(e, s) _odp_static_assert(e, s)
+#endif
+#endif
+
+#endif
+
+#include <odp/api/abi-default/debug.h>
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif