From 6672d6edfe230f11443d0959783ab9faec880b44 Mon Sep 17 00:00:00 2001 From: Michael Spang Date: Fri, 29 Apr 2022 02:33:07 -0400 Subject: [PATCH] Suppress clang warnings -Wparentheses-equality, -Wself-assign, unknown argument (#17860) clang-14: error: unknown argument: '-fno-optimize-strlen' /home/spang/sdk/k32w_sdk/boards/k32w061dk6/wireless_examples/openthread/reed/bm/board.c:1581:23: error: equality comparison with extraneous parentheses [-Werror,-Wparentheses-equality] if ( (reset_cause == RESET_WAKE_PD) ) ~~~~~~~~~~~~^~~~~~~~~~~~~~~~ /home/spang/sdk/k32w_sdk/boards/k32w061dk6/wireless_examples/openthread/reed/bm/board.c:1581:23: note: remove extraneous parentheses around the comparison to silence this warning if ( (reset_cause == RESET_WAKE_PD) ) ~ ^ ~ /home/spang/sdk/k32w_sdk/boards/k32w061dk6/wireless_examples/openthread/reed/bm/board.c:1581:23: note: use '=' to turn this equality comparison into an assignment if ( (reset_cause == RESET_WAKE_PD) ) ^~ = 1 error generated. /home/spang/sdk/k32w_sdk/middleware/wireless/framework/Keyboard/Source/Keyboard.c:590:20: error: explicitly assigning value of variable of type 'switchScan_t' (aka 'unsigned int') to itself [-Werror,-Wself-assign] previousPressed=previousPressed; /* avoid compiler warnings */ ~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~ 1 error generated. --- third_party/nxp/k32w0_sdk/k32w0_sdk.gni | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/third_party/nxp/k32w0_sdk/k32w0_sdk.gni b/third_party/nxp/k32w0_sdk/k32w0_sdk.gni index 4206ceded05c79..2a2c122397c9a3 100644 --- a/third_party/nxp/k32w0_sdk/k32w0_sdk.gni +++ b/third_party/nxp/k32w0_sdk/k32w0_sdk.gni @@ -11,10 +11,14 @@ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. + +import("//build_overrides/build.gni") import("//build_overrides/chip.gni") import("//build_overrides/k32w0_sdk.gni") import("//build_overrides/mbedtls.gni") import("//build_overrides/openthread.gni") + +import("${build_root}/config/compiler/compiler.gni") import("${chip_root}/src/crypto/crypto.gni") import("${chip_root}/src/platform/nxp/k32w/k32w0/args.gni") @@ -268,12 +272,20 @@ template("k32w0_sdk") { "-Wno-sign-compare", "-Wno-clobbered", "-Wno-implicit-fallthrough", - "-fno-optimize-strlen", "-mthumb", "-MMD", "-MP", ] + if (is_clang) { + cflags += [ + "-Wno-self-assign", + "-Wno-parentheses-equality", + ] + } else { + cflags += [ "-fno-optimize-strlen" ] + } + # Now add our "system-header" include dirs foreach(include_dir, _sdk_include_dirs) { cflags += [ "-isystem" + rebase_path(include_dir, root_build_dir) ]