Skip to content

Commit

Permalink
Add '-Wextra' to compiler flags
Browse files Browse the repository at this point in the history
  • Loading branch information
vivien-apple committed Nov 25, 2020
1 parent f6ad93c commit 2fe336b
Show file tree
Hide file tree
Showing 8 changed files with 42 additions and 10 deletions.
2 changes: 2 additions & 0 deletions build/config/compiler/BUILD.gn
Original file line number Diff line number Diff line change
Expand Up @@ -138,6 +138,7 @@ config("disabled_warnings") {
"-Wno-deprecated-declarations",
"-Wno-unknown-warning-option",
"-Wno-missing-field-initializers",
"-Wno-unused-parameter",
]
if (!is_debug) {
# assert() causes unused variable warnings in release.
Expand All @@ -154,6 +155,7 @@ config("disabled_warnings") {
config("strict_warnings") {
cflags = [
"-Wall",
"-Wextra",
"-Wshadow",
]

Expand Down
29 changes: 29 additions & 0 deletions examples/common/QRCode/BUILD.gn
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
# Copyright (c) 2020 Project CHIP Authors
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# 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.

config("qrcode-common_config") {
include_dirs = [ "repo/c" ]

cflags = [ "-Wno-type-limits" ]
}

static_library("QRCode") {
output_name = "libqrcode-common"

output_dir = "${root_out_dir}/lib"

sources = [ "repo/c/qrcodegen.c" ]

public_configs = [ ":qrcode-common_config" ]
}
3 changes: 1 addition & 2 deletions examples/lighting-app/efr32/BUILD.gn
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,7 @@ efr32_executable("lighting_app") {

public_deps = [
":sdk",
"${chip_root}/examples/common/QRCode",
"${chip_root}/examples/common/chip-app-server:chip-app-server",
"${chip_root}/examples/lighting-app/lighting-common",
"${chip_root}/src/lib",
Expand All @@ -81,11 +82,9 @@ efr32_executable("lighting_app") {
"${efr32_project_dir}/include",
"${chip_root}/src/app/util",
"${examples_plat_dir}",
"${chip_root}/examples/common/QRCode/repo/c",
]

sources = [
"${chip_root}/examples/common/QRCode/repo/c/qrcodegen.c",
"${examples_plat_dir}/${efr32_family}/${efr32_board}/hal-config.h",
"${examples_plat_dir}/${efr32_family}/${efr32_board}/init_board.c",
"${examples_plat_dir}/${efr32_family}/${efr32_board}/init_mcu.c",
Expand Down
3 changes: 1 addition & 2 deletions examples/lock-app/efr32/BUILD.gn
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,7 @@ efr32_executable("lock_app") {

public_deps = [
":sdk",
"${chip_root}/examples/common/QRCode",
"${chip_root}/examples/common/chip-app-server:chip-app-server",
"${chip_root}/examples/lock-app/lock-common",
"${chip_root}/src/lib",
Expand All @@ -81,11 +82,9 @@ efr32_executable("lock_app") {
"${efr32_project_dir}/include",
"${chip_root}/src/app/util",
"${examples_plat_dir}",
"${chip_root}/examples/common/QRCode/repo/c",
]

sources = [
"${chip_root}/examples/common/QRCode/repo/c/qrcodegen.c",
"${examples_plat_dir}/${efr32_family}/${efr32_board}/hal-config.h",
"${examples_plat_dir}/${efr32_family}/${efr32_board}/init_board.c",
"${examples_plat_dir}/${efr32_family}/${efr32_board}/init_mcu.c",
Expand Down
2 changes: 1 addition & 1 deletion src/lib/core/CHIPKeyIds.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@ uint32_t ChipKeyId::MakeAppKeyId(uint32_t keyType, uint32_t rootKeyId, uint32_t
bool useCurrentEpochKey)
{
return (keyType | (rootKeyId & kMask_RootKeyNumber) | (appGroupMasterKeyId & kMask_GroupLocalNumber) |
(useCurrentEpochKey ? kFlag_UseCurrentEpochKey : (epochKeyId & kMask_EpochKeyNumber)));
(useCurrentEpochKey ? static_cast<uint32_t>(kFlag_UseCurrentEpochKey) : (epochKeyId & kMask_EpochKeyNumber)));
}

/**
Expand Down
2 changes: 1 addition & 1 deletion src/lib/support/logging/CHIPLoggingLogV.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -123,7 +123,7 @@ DLL_EXPORT __CHIP_LOGGING_LINK_ATTRIBUTE void LogV(uint8_t module, uint8_t categ
return;
}

if (prefixLen >= sizeof(formattedMsg))
if (static_cast<size_t>(prefixLen) >= sizeof(formattedMsg))
{
prefixLen = sizeof(formattedMsg) - 1;
}
Expand Down
6 changes: 3 additions & 3 deletions src/platform/EFR32/freertos_bluetooth.c
Original file line number Diff line number Diff line change
Expand Up @@ -34,9 +34,9 @@ void BluetoothUpdate();
volatile struct gecko_cmd_packet * bluetooth_evt;
SemaphoreHandle_t BluetoothMutex = NULL;

volatile static uint32_t command_header;
volatile static void * command_data;
volatile static gecko_cmd_handler command_handler_func = NULL;
static volatile uint32_t command_header;
static volatile void * command_data;
static volatile gecko_cmd_handler command_handler_func = NULL;

// Bluetooth task
#ifndef BLUETOOTH_STACK_SIZE
Expand Down
5 changes: 4 additions & 1 deletion third_party/mbedtls/mbedtls.gni
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,10 @@ template("mbedtls_target") {
_mbedtls_root = "${mbedtls_root}/repo"

config("${mbedtls_target_name}_warnings") {
cflags = [ "-Wno-maybe-uninitialized" ]
cflags = [
"-Wno-maybe-uninitialized",
"-Wno-string-concatenation",
]
}

config("${mbedtls_target_name}_config") {
Expand Down

0 comments on commit 2fe336b

Please sign in to comment.