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: toolchain: generalize exclusion of CXX options #21398

Merged
merged 1 commit into from
Dec 18, 2019

Conversation

pabigot
Copy link
Collaborator

@pabigot pabigot commented Dec 14, 2019

-Wold-style-definition is not a supported option for C++ builds. To prevent it being passed:

  • the list of compiler flags to be excluded from C++ builds is moved to be toolchain-specific;
  • -Wold-style-definition is added to that list for gcc and clang;
  • -Wold-style-definition is moved from zephyr_compiler_options to zephyr_cc_option so the option checking code is executed for it.

Fixes #16239


# List the warnings that are not supported for C++ compilations

set(CXX_EXCLUDED_OPTIONS
Copy link
Collaborator

Choose a reason for hiding this comment

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

list(APPEND

then it could be populated elsewhere as well.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

thanks; updated.

@@ -854,7 +854,7 @@ function(zephyr_check_compiler_flag_hardcoded lang option check exists)
# -Werror=implicit-int is not supported for CXX and we are not able
# to automatically test for it because it produces a warning
# instead of an error during the test.
if((${lang} STREQUAL CXX) AND ("${option}" STREQUAL -Werror=implicit-int))
if((${lang} STREQUAL CXX) AND ("${option}" IN_LIST CXX_EXCLUDED_OPTIONS))
Copy link
Collaborator

Choose a reason for hiding this comment

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

# -Werror=implicit-int and other flags in CXX_EXCLUDED_OPTIONS are not supported for CXX and we are not able

Sorry for the stepwise feedback.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Is the new wording OK? I didn't want to mention specific flags because they might not apply to certain toolchains.

Copy link
Collaborator

Choose a reason for hiding this comment

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

Looks great

-Wold-style-definition is not a supported option for C++ builds.  To
prevent it being passed:
* the list of compiler flags to be excluded from C++ builds is moved
  to be toolchain-specific;
* -Wold-style-definition is added to that list for gcc and clang;
* -Wold-style-definition is moved from zephyr_compiler_options to
  zephyr_cc_option so the option checking code is executed for it.

Signed-off-by: Peter A. Bigot <pab@pabigot.com>
@carlescufi carlescufi merged commit 60ca233 into zephyrproject-rtos:master Dec 18, 2019
@pabigot pabigot deleted the pabigot/20191214b branch December 19, 2019 14:23
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Build: C++ compiler warning '-Wold-style-definition'
3 participants