Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

lib: fix compilation error with gcc++ #190

Merged
merged 1 commit into from
Dec 16, 2021
Merged

lib: fix compilation error with gcc++ #190

merged 1 commit into from
Dec 16, 2021

Conversation

arnopo
Copy link
Contributor

@arnopo arnopo commented Nov 22, 2021

The header files including must be outside of the extern "C" { statement.
To be able to be included from C++ code.

Else such error can occur (reproduce on STM32MP1Cube distribution)
gcc/arm-none-eabi/include/c++/10.2.1/atomic:1467:3: error: template with C linkage
1467 | template
| ^~~~~~~~
In file included from STM32CubeMP1/Middlewares/Third_Party/OpenAMP/open-amp/lib/include/openamp/rpmsg.h:16,
from STM32CubeMP1/Middlewares/Third_Party/OpenAMP/open-amp/lib/include/openamp/open_amp.h:11,
from empty_main.cpp:1:
STM32CubeMP1/Middlewares/Third_Party/OpenAMP/libmetal/lib/include/metal/mutex.h:16:1: note: 'extern "C"' linkage
started here
16 | extern "C" {
| ^~~~~~~~~~

Signed-off-by: Arnaud Pouliquen arnaud.pouliquen@foss.st.com

The header files including must be outside of the extern "C" { statement.
To be able to be included from C++ code.

Else such error can occur (reproduce on STM32MP1Cube distribution)
gcc/arm-none-eabi/include/c++/10.2.1/atomic:1467:3: error: template
with C linkage
 1467 |   template<typename _ITp>
      |   ^~~~~~~~
In file included from STM32CubeMP1/Middlewares/Third_Party/OpenAMP/
                      open-amp/lib/include/openamp/rpmsg.h:16,
                 from STM32CubeMP1/Middlewares/Third_Party/OpenAMP/
                      open-amp/lib/include/openamp/open_amp.h:11,
                 from empty_main.cpp:1:
STM32CubeMP1/Middlewares/Third_Party/OpenAMP/libmetal/lib/include/
metal/mutex.h:16:1: note: 'extern "C"' linkage
started here
   16 | extern "C" {
      | ^~~~~~~~~~

Signed-off-by: Arnaud Pouliquen <arnaud.pouliquen@foss.st.com>
Copy link
Contributor

@edmooring edmooring left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good to me. Do we have any C++ test cases in our CI?

@arnopo
Copy link
Contributor Author

arnopo commented Dec 16, 2021

Looks good to me. Do we have any C++ test cases in our CI?

Unfortunately not. But we can start by creating an issue to track it.

I use the following project to test the API:
https://github.com/sergeyblagodarnyy/rpmsg_cpp_compatibility.

But it does not provide exhaustive tests

@arnopo arnopo merged commit cca7003 into OpenAMP:main Dec 16, 2021
@arnopo arnopo deleted the gcc++ branch January 17, 2022 14:42
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants