This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "".
The branch, master has been updated via 3e5a07edf190614e739c8dba76cf165330e1b035 (commit) from 8c0df898b6f90564037fba43b1e9e6224e4ee740 (commit)
Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below.
- Log ----------------------------------------------------------------- commit 3e5a07edf190614e739c8dba76cf165330e1b035 Author: Bill Fischofer bill.fischofer@linaro.org Date: Sun Apr 2 17:55:20 2017 -0500
linux-generic: debug: enable helper use from c++ programs
The ODP_STATIC_ASSERT() macro expands to _Static_assert(), however when used in C++ programs this needs to expand to static_assert().
This resolves Bug https://bugs.linaro.org/show_bug.cgi?id=2852
Reported-by: Moshe Tubul moshe.tubul@firmitas-cs.com Signed-off-by: Bill Fischofer bill.fischofer@linaro.org Signed-off-by: Maxim Uvarov maxim.uvarov@linaro.org
diff --git a/platform/linux-generic/include/odp/api/debug.h b/platform/linux-generic/include/odp/api/debug.h index 7db14339..b0f91b1c 100644 --- a/platform/linux-generic/include/odp/api/debug.h +++ b/platform/linux-generic/include/odp/api/debug.h @@ -19,17 +19,36 @@ extern "C" {
#include <odp/api/spec/debug.h>
-#if defined(__GNUC__) && !defined(__clang__) - -#if __GNUC__ < 4 || (__GNUC__ == 4 && (__GNUC_MINOR__ < 6)) - /** - * @internal _Static_assert was only added in GCC 4.6. Provide a weak replacement - * for previous versions. + * @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 _Static_assert(e, s) (extern int (*static_assert_checker(void)) \ - [sizeof(struct { unsigned int error_if_negative:(e) ? 1 : -1; })]) +#define _odp_merge(a, b) a##b +#define _odp_label(a) _odp_merge(_ODP_SASSERT_, a) +#define _ODP_SASSERT _odp_label(__COUNTER__) +#define _ODP_SASSERT_ENUM(e) { _ODP_SASSERT = 1 / !!(e) } +#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) +#define static_assert(e, s) _odp_static_assert(e, s) +#endif +#elif !__has_feature(c_static_assert) && !defined(_Static_assert) +#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) +#define static_assert(e, s) _odp_static_assert(e, s) +#endif +#elif !defined(_Static_assert) +#define _Static_assert(e, s) _odp_static_assert(e, s) +#endif #endif
#endif @@ -39,9 +58,11 @@ extern "C" { * if condition 'cond' is false. Macro definition is empty when compiler is not * supported or the compiler does not support static assertion. */ -#define ODP_STATIC_ASSERT(cond, msg) _Static_assert(cond, msg) +#ifndef __cplusplus +#define ODP_STATIC_ASSERT(cond, msg) _Static_assert(cond, msg)
-#ifdef __cplusplus +#else +#define ODP_STATIC_ASSERT(cond, msg) static_assert(cond, msg) } #endif
diff --git a/test/common_plat/miscellaneous/odp_api_from_cpp.cpp b/test/common_plat/miscellaneous/odp_api_from_cpp.cpp index 2b307864..4578ae4b 100644 --- a/test/common_plat/miscellaneous/odp_api_from_cpp.cpp +++ b/test/common_plat/miscellaneous/odp_api_from_cpp.cpp @@ -1,10 +1,9 @@ #include <cstdio> #include <odp_api.h> -#include <odp/helper/threads.h> +#include <odp/helper/odph_api.h>
int main(int argc ODP_UNUSED, const char *argv[] ODP_UNUSED) { - printf("\tODP API version: %s\n", odp_version_api_str()); printf("\tODP implementation version: %s\n", odp_version_impl_str());
-----------------------------------------------------------------------
Summary of changes: platform/linux-generic/include/odp/api/debug.h | 41 ++++++++++++++++------ .../common_plat/miscellaneous/odp_api_from_cpp.cpp | 3 +- 2 files changed, 32 insertions(+), 12 deletions(-)
hooks/post-receive