-
Notifications
You must be signed in to change notification settings - Fork 6.8k
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
cc1plus: warning: '-Werror=' argument '-Werror=implicit-int' is not valid for C++ #21229
Comments
@SebastianBoe could you provide some advice? |
We do compiler flag compatibility tests to be able to support many different toolchains and flags in a scalable way. But the test is not perfect and in these situations we we will need to hardcode whether a flag is compatible or not. To support this we have zephyr_compiler_check first check if the flag is covered by a hardcoded test before testing it. Currently the only hardcoded compatibilty is that -Werror=implicit-int is not supported for CXX. This fixes zephyrproject-rtos#21229 Signed-off-by: Sebastian Bøe <sebastian.boe@nordicsemi.no>
We do compiler flag compatibility tests to be able to support many different toolchains and flags in a scalable way. But the test is not perfect and in these situations we we will need to hardcode whether a flag is compatible or not. To support this we have zephyr_compiler_check first check if the flag is covered by a hardcoded test before testing it. Currently the only hardcoded compatibilty is that -Werror=implicit-int is not supported for CXX. This fixes #21229 Signed-off-by: Sebastian Bøe <sebastian.boe@nordicsemi.no>
I'm also encountering this issue when compiling a project with C++ sources, but with an additional warning:
Not surprisingly, if I comment out target_warnings.cmake:22 and target_warnings.cmake:94 for GCC then the warnings no longer get printed. Am I overlooking something in the configuration for disabling these warnings? OS: |
I recently started testing the
gcc-arm-none-eabi-9-2019-q4-major
compiler in a C++ project, and came across the following for my C++ translation units:This is a known change in
gcc 9
and will likely is or will soon be a part ofclang
.To Reproduce
Enable C++ and add a C++ file to the project.
Expected behavior
The
-Werror=implicit-int
option should not be enabled for C++ translation units.Impact
This is an annoyance because Zephyr appears to really pride itself on "zero warning" builds, which is expected of possible mission- or safety-critical embedded systems.
Environment
gcc-arm-none-eabi-9-2019-q4-major
v2.1.0-rc3-6-gf570f19bef
First Steps Fixing
I'm volunteering to help fix this, if some kind person can give me some pointers!
The macro
toolchain_cc_warning_error_implicit_int
is definedgcc
, andclang
The macro
toolchain_cc_warning_error_implicit_int
is enabled hereNow, following the chain:
toolchain_cc_warning_error_implicit_int
callszephyr_cc_option
zephyr_cc_option
callstarget_cc_option
target_cc_option
callstarget_cc_option_fallback
Now the problem is (I think) that
target_cc_option_fallback
checks to see if the specified option is valid forC
andCXX
and possiblyASM
. But the-Werror=implicit-int
option only produces a warning, not an error in the test, so it's allowed through (for C++).I believe that the GCC release notes say that this will soon become a build-breaking error, not a warning, so it really does need to be fixed sometime.
But for the life of me I can't decipher that kind of CMakeFoo without some help...
The text was updated successfully, but these errors were encountered: