-
Notifications
You must be signed in to change notification settings - Fork 8k
tests: lib: cpp: cxx: Add test to verify C++ compilation #96944
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
base: main
Are you sure you want to change the base?
Conversation
When using clang to build for RISC-V with these configs: CONFIG_CPP=y CONFIG_USERSPACE=n CONFIG_SMP=n CONFIG_FPU_SHARING=n we get the following warnings: include/zephyr/arch/riscv/structs.h:11:1: error: empty struct has size 0 in C, size 1 in C++ [-Werror,-Wextern-c-compat] 11 | struct _cpu_arch { | ^ include/zephyr/arch/riscv/thread.h:68:1: error: empty struct has size 0 in C, size 1 in C++ [-Werror,-Wextern-c-compat] 68 | struct _thread_arch { | ^ This commit adds a test with those configs to verify compilation succeeds. Although gcc doesn't emit these warnings, we can test with gcc as well with a BUILD_ASSERT in include/zephyr/arch/riscv/thread.h and include/zephyr/arch/riscv/structs.h. Signed-off-by: Tom Hughes <[email protected]>
38e5a41
to
dcd2b17
Compare
|
- CONFIG_STD_CPP23=y | ||
# Verify struct _cpu_arch struct _thread_arch are compatible with C++ when | ||
# specific configs are enabled. | ||
cpp.main.empty_struct_size: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It might be good to limit this to run on native_sim
and also to elicit coverage with both gcc and llvm.
platform_allow:
- native_sim
integration_platforms:
- native_sim
integration_toolchains:
- host
- llvm
# Verify struct _cpu_arch struct _thread_arch are compatible with C++ when | ||
# specific configs are enabled. | ||
cpp.main.empty_struct_size: | ||
build_only: true | ||
extra_configs: | ||
- CONFIG_USERSPACE=n | ||
- CONFIG_SMP=n | ||
- CONFIG_FPU_SHARING=n |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
AFAICS, this is a RISC-V specific issue; so, this should be limited to arch_allow: riscv
. Also, a RISC-V integration_platforms
should be added.
When using clang to build for RISC-V with these configs:
we get the following warnings:
This commit adds a test with those configs to verify compilation
succeeds. Although gcc doesn't emit these warnings, we can test with gcc
as well with a
BUILD_ASSERT
ininclude/zephyr/arch/riscv/thread.h
andinclude/zephyr/arch/riscv/structs.h
that was added in #96943.