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

cmake: fails to filter options for target language #28097

Closed
pabigot opened this issue Sep 6, 2020 · 1 comment · Fixed by #28111
Closed

cmake: fails to filter options for target language #28097

pabigot opened this issue Sep 6, 2020 · 1 comment · Fixed by #28111
Assignees
Labels
area: Build System area: C++ bug The issue is a bug, or the PR is fixing a bug priority: medium Medium impact/importance bug

Comments

@pabigot
Copy link
Collaborator

pabigot commented Sep 6, 2020

Since c55c64e or an earlier commit the CXX_EXCLUDED_OPTIONS variable in toolchain-specific compiler_flags.cmake is not correctly excluding options that are not accepted by the C++ compiler, causing these diagnostics on C++ code:

[19/190] Building CXX object zephyr/CMake.../zephyr.dir/subsys/cpp/cpp_vtable.cpp.obj
cc1plus: warning: '-Werror=' argument '-Werror=implicit-int' is not valid for C++
[23/190] Building CXX object zephyr/CMakeFiles/zephyr.dir/subsys/cpp/cpp_new.cpp.obj
cc1plus: warning: '-Werror=' argument '-Werror=implicit-int' is not valid for C++
[100/190] Building CXX object CMakeFiles/app.dir/src/main.cxx.obj
cc1plus: warning: '-Werror=' argument '-Werror=implicit-int' is not valid for C++
[134/190] Building CXX object modules/zxx.....__zxxpab__lib__utils.dir/now_str.cc.obj
cc1plus: warning: '-Werror=' argument '-Werror=implicit-int' is not valid for C++
[185/190] Linking CXX executable zephyr/zephyr_prebuilt.elf

set_compiler_property is too advanced for me to propose a fix, but this directive:

set_compiler_property(PROPERTY warning_error_implicit_int -Werror=implicit-int)

in cmake/compiler/gcc/compiler_flags.cmake must not be added to the C++ flag set.

Also reported at #21229 (comment).

@pabigot pabigot added bug The issue is a bug, or the PR is fixing a bug area: Build System priority: medium Medium impact/importance bug labels Sep 6, 2020
@pabigot
Copy link
Collaborator Author

pabigot commented Sep 6, 2020

I've made this a medium since it's a regression.

tejlmand added a commit to tejlmand/zephyr that referenced this issue Sep 7, 2020
Fixes: zephyrproject-rtos#28097

The compiler warning flag `-Werror=implicit-int` was added using
`set_compiler_property()` which will always add the compiler flag if the
compiler flag supports it.

This has been changed to `check_set_compiler_property()` which will
check if the flag is among the list of `CXX_EXCLUDED_OPTIONS`, and only
adds the flag if both the compiler supports it, and it is not an
excluded option.

Signed-off-by: Torsten Rasmussen <Torsten.Rasmussen@nordicsemi.no>
carlescufi pushed a commit that referenced this issue Sep 7, 2020
Fixes: #28097

The compiler warning flag `-Werror=implicit-int` was added using
`set_compiler_property()` which will always add the compiler flag if the
compiler flag supports it.

This has been changed to `check_set_compiler_property()` which will
check if the flag is among the list of `CXX_EXCLUDED_OPTIONS`, and only
adds the flag if both the compiler supports it, and it is not an
excluded option.

Signed-off-by: Torsten Rasmussen <Torsten.Rasmussen@nordicsemi.no>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area: Build System area: C++ bug The issue is a bug, or the PR is fixing a bug priority: medium Medium impact/importance bug
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants