Skip to content

cmake: toolchain: generalize exclusion of CXX options #21398

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

Merged
merged 1 commit into from
Dec 18, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 8 additions & 1 deletion cmake/compiler/clang/target_warnings.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -27,9 +27,9 @@ macro(toolchain_cc_warning_dw_1)
-Wno-unused-parameter
-Wmissing-declarations
-Wmissing-format-attribute
-Wold-style-definition
)
zephyr_cc_option(
-Wold-style-definition
-Wmissing-prototypes
-Wmissing-include-dirs
-Wunused-but-set-variable
Expand Down Expand Up @@ -115,3 +115,10 @@ endmacro()
macro(toolchain_cc_cpp_warning_error_misra_sane dest_var_name)
set_ifndef(${dest_var_name} "-Werror=vla")
endmacro()

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

list(APPEND CXX_EXCLUDED_OPTIONS
-Werror=implicit-int
-Wold-style-definition
)
9 changes: 8 additions & 1 deletion cmake/compiler/gcc/target_warnings.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -34,9 +34,9 @@ macro(toolchain_cc_warning_dw_1)
-Wno-unused-parameter
-Wmissing-declarations
-Wmissing-format-attribute
-Wold-style-definition
)
zephyr_cc_option(
-Wold-style-definition
-Wmissing-prototypes
-Wmissing-include-dirs
-Wunused-but-set-variable
Expand Down Expand Up @@ -108,3 +108,10 @@ endmacro()
macro(toolchain_cc_cpp_warning_error_misra_sane dest_var_name)
set_ifndef(${dest_var_name} "-Werror=vla")
endmacro()

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

list(APPEND CXX_EXCLUDED_OPTIONS
-Werror=implicit-int
-Wold-style-definition
)
8 changes: 4 additions & 4 deletions cmake/extensions.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -851,10 +851,10 @@ function(zephyr_check_compiler_flag lang option check)
endfunction()

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))
# Various flags that are not supported for CXX may not be testable
# because they would produce a warning instead of an error during
# the test. Exclude them by toolchain-specific blacklist.
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

set(check 0 PARENT_SCOPE)
set(exists 1 PARENT_SCOPE)
else()
Expand Down