[LIBMETAL PATCH] atomic: support c++

263 views
Skip to first unread message

Wendy Liang

unread,
Jul 6, 2017, 5:10:19 PM7/6/17
to open...@googlegroups.com, Wendy Liang
Allow using libmetal in c++ program.
When c++ program uses libmetal, it will use
the default atomic impelementation defined
in libmetal library.

Signed-off-by: Wendy Liang <jli...@xilinx.com>
---
lib/atomic.h | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/lib/atomic.h b/lib/atomic.h
index f722d6c..05d8b4f 100644
--- a/lib/atomic.h
+++ b/lib/atomic.h
@@ -38,7 +38,8 @@

#include "metal/config.h"

-#if defined(HAVE_STDATOMIC_H) && !defined(__STDC_NO_ATOMICS__)
+#if defined(HAVE_STDATOMIC_H) && !defined(__STDC_NO_ATOMICS__) && \
+ !defined(__cplusplus)
# include <stdatomic.h>
#elif defined(__GNUC__)
# include <metal/compiler/gcc/atomic.h>
--
2.7.4

scdrod...@gmail.com

unread,
Jul 7, 2017, 2:27:08 AM7/7/17
to open-amp, jli...@xilinx.com

I just tested your patch with the OpenAMP echo test example, it works for the atomics, the compiler now goes through the atomics. But the project is not being compiled. there is still some error that I can't understand.
../../openamp_test_bsp/ps7_cortexa9_1/include/metal/irq.h:119:1: error: expected declaration before '}' token

it comes from the include metal/irq.h in helper.c

Jiaying Liang

unread,
Jul 7, 2017, 1:44:30 PM7/7/17
to scdrod...@gmail.com, open-amp
[Wendy] Thanks for trying the patch, it turned out there are headers missing
'extern "C"'. I have sent another patch for it. We haven't tested C++ program with open-amp, please let us know if you have issues and patches are welcomed.

Best Regards,
Wendy

>
>



This email and any attachments are intended for the sole use of the named recipient(s) and contain(s) confidential information that may be proprietary, privileged or copyrighted under applicable law. If you are not the intended recipient, do not read, copy, or forward this email message or any attachments. Delete this email message and any attachments immediately.

Reply all
Reply to author
Forward
0 new messages