Skip to content

Commit

Permalink
Make C++17 the default everywhere (project-chip#28269)
Browse files Browse the repository at this point in the history
* Make cpp17 the default

* Restyle

* Add a clean for build on linux, since I had a run out of space

---------

Co-authored-by: Andrei Litvin <[email protected]>
  • Loading branch information
2 people authored and cliffamzn committed Jul 25, 2023
1 parent aef213a commit a55fbb4
Show file tree
Hide file tree
Showing 22 changed files with 5 additions and 48 deletions.
2 changes: 2 additions & 0 deletions .github/workflows/build.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -174,6 +174,8 @@ jobs:
BUILD_TYPE=gcc_release scripts/build/gn_gen.sh --args="is_debug=false"
scripts/run_in_build_env.sh "ninja -C ./out/gcc_release"
BUILD_TYPE=gcc_release scripts/tests/gn_tests.sh
- name: Clean output
run: rm -rf ./out
- name: Run Tests with sanitizers
env:
LSAN_OPTIONS: detect_leaks=1
Expand Down
7 changes: 1 addition & 6 deletions build/config/compiler/compiler.gni
Original file line number Diff line number Diff line change
Expand Up @@ -43,12 +43,7 @@ declare_args() {
c_standard = "gnu11"

# C++ standard level (value for -std flag).
if (current_os == "linux" || current_os == "mac" || current_os == "ios" ||
current_os == "android") {
cpp_standard = "gnu++17"
} else {
cpp_standard = "gnu++14"
}
cpp_standard = "gnu++17"

# enable libfuzzer
is_libfuzzer = false
Expand Down
1 change: 0 additions & 1 deletion config/ameba/args.gni
Original file line number Diff line number Diff line change
Expand Up @@ -37,4 +37,3 @@ custom_toolchain = "//third_party/connectedhomeip/config/ameba/toolchain:ameba"

pw_build_PIP_CONSTRAINTS =
[ "//third_party/connectedhomeip/scripts/setup/constraints.txt" ]
cpp_standard = "c++17"
4 changes: 1 addition & 3 deletions config/mbed/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -106,9 +106,7 @@ matter_get_compiler_flags_from_targets("${CONFIG_CHIP_EXTERNAL_TARGETS}")
matter_add_flags(-D__LINUX_ERRNO_EXTENSIONS__=1)
matter_add_flags(-DCHIP_ADDRESS_RESOLVE_IMPL_INCLUDE_HEADER=<lib/address_resolve/AddressResolve_DefaultImpl.h>)

if (CONFIG_CHIP_PW_RPC)
matter_add_gnu_cpp_standard("17")
endif()
matter_add_gnu_cpp_standard("17")

if (CONFIG_MBED_BSD_SOCKET_TRACE)
matter_add_flags(-DMBED_BSD_SOCKET_TRACE=1)
Expand Down
2 changes: 0 additions & 2 deletions examples/chef/silabs/with_pw_rpc.gni
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,5 @@ silabs_sdk_target = get_label_info(":sdk", "label_no_toolchain")
chip_enable_pw_rpc = true
chip_enable_openthread = true

cpp_standard = "gnu++17"

# Light app on EFR enables tracing server
pw_trace_BACKEND = "$dir_pw_trace_tokenized"
3 changes: 0 additions & 3 deletions examples/chip-tool/args.gni
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,5 @@ chip_project_config_include_dirs += [ "${chip_root}/config/standalone" ]

matter_enable_tracing_support = true

# Perfetto requires C++17
cpp_standard = "gnu++17"

matter_log_json_payload_hex = true
matter_log_json_payload_decode_full = true
5 changes: 1 addition & 4 deletions examples/common/tracing/BUILD.gn
Original file line number Diff line number Diff line change
Expand Up @@ -19,10 +19,7 @@ import("${chip_root}/build/chip/buildconfig_header.gni")
import("${chip_root}/src/lib/lib.gni")

declare_args() {
# TODO: cpp_standard check is not ideal, it should be >= 17,
# however for now this is what we use in compilations
matter_commandline_enable_perfetto_tracing =
current_os == "linux" && cpp_standard == "gnu++17"
matter_commandline_enable_perfetto_tracing = current_os == "linux"
}

config("default_config") {
Expand Down
2 changes: 0 additions & 2 deletions examples/light-switch-app/genio/with_pw_rpc.gni
Original file line number Diff line number Diff line change
Expand Up @@ -23,5 +23,3 @@ mt793x_sdk_target = get_label_info(":sdk", "label_no_toolchain")

chip_enable_pw_rpc = true
chip_enable_openthread = true

cpp_standard = "gnu++17"
2 changes: 0 additions & 2 deletions examples/lighting-app/bouffalolab/bl602/with_pw_rpc.gni
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,6 @@ import("${chip_root}/examples/platform/bouffalolab/bl602/args.gni")

chip_enable_pw_rpc = true

cpp_standard = "gnu++17"

# pigweed updated to a1bd248 makes compile conversion errors;
# it seems riscv gcc (version > 10) can fixes this issue.
# let's disable strict warnings for RPC enabled for now.
Expand Down
2 changes: 0 additions & 2 deletions examples/lighting-app/bouffalolab/bl702/with_pw_rpc.gni
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,6 @@ import("${chip_root}/examples/platform/bouffalolab/bl702/args.gni")

chip_enable_pw_rpc = true

cpp_standard = "gnu++17"

# pigweed updated to a1bd248 makes compile conversion errors;
# it seems riscv gcc (version > 10) can fixes this issue.
# let's disable strict warnings for RPC enabled for now.
Expand Down
2 changes: 0 additions & 2 deletions examples/lighting-app/bouffalolab/bl702l/with_pw_rpc.gni
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,4 @@ import("${chip_root}/examples/platform/bouffalolab/bl702l/args.gni")

chip_enable_pw_rpc = true
chip_build_pw_trace_lib = false

cpp_standard = "gnu++17"
#pw_trace_BACKEND = "$dir_pw_trace_tokenized"
2 changes: 0 additions & 2 deletions examples/lighting-app/genio/with_pw_rpc.gni
Original file line number Diff line number Diff line change
Expand Up @@ -23,5 +23,3 @@ mt793x_sdk_target = get_label_info(":sdk", "label_no_toolchain")

chip_enable_pw_rpc = true
chip_enable_openthread = true

cpp_standard = "gnu++17"
2 changes: 0 additions & 2 deletions examples/lighting-app/qpg/with_pw_rpc.gni
Original file line number Diff line number Diff line change
Expand Up @@ -22,5 +22,3 @@ qpg_sdk_target = get_label_info(":sdk", "label_no_toolchain")

chip_enable_pw_rpc = true
chip_enable_openthread = true

cpp_standard = "gnu++17"
2 changes: 0 additions & 2 deletions examples/lighting-app/silabs/with_pw_rpc.gni
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,5 @@ app_data_model = "${chip_root}/examples/lighting-app/lighting-common"
chip_enable_pw_rpc = true
chip_enable_openthread = true

cpp_standard = "gnu++17"

# Light app on EFR enables tracing server
pw_trace_BACKEND = "$dir_pw_trace_tokenized"
2 changes: 0 additions & 2 deletions examples/lock-app/genio/with_pw_rpc.gni
Original file line number Diff line number Diff line change
Expand Up @@ -23,5 +23,3 @@ mt793x_sdk_target = get_label_info(":sdk", "label_no_toolchain")

chip_enable_pw_rpc = true
chip_enable_openthread = true

cpp_standard = "gnu++17"
2 changes: 0 additions & 2 deletions examples/lock-app/qpg/with_pw_rpc.gni
Original file line number Diff line number Diff line change
Expand Up @@ -22,5 +22,3 @@ import("${chip_root}/examples/platform/qpg/args.gni")
qpg_sdk_target = get_label_info(":sdk", "label_no_toolchain")

chip_enable_pw_rpc = true

cpp_standard = "gnu++17"
2 changes: 0 additions & 2 deletions examples/lock-app/silabs/with_pw_rpc.gni
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,6 @@ chip_enable_pw_rpc = true
chip_enable_openthread = true
chip_openthread_ftd = true

cpp_standard = "gnu++17"

# To fit in flash
chip_detail_logging = false
show_qr_code = false
2 changes: 0 additions & 2 deletions examples/ota-requestor-app/genio/with_pw_rpc.gni
Original file line number Diff line number Diff line change
Expand Up @@ -23,5 +23,3 @@ mt793x_sdk_target = get_label_info(":sdk", "label_no_toolchain")

chip_enable_pw_rpc = true
chip_enable_openthread = true

cpp_standard = "gnu++17"
2 changes: 0 additions & 2 deletions examples/pump-app/silabs/with_pw_rpc.gni
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,5 @@ chip_enable_pw_rpc = true
chip_enable_openthread = true
chip_build_pw_trace_lib = true

cpp_standard = "gnu++17"

# Light app on EFR enables tracing server
pw_trace_BACKEND = "$dir_pw_trace_tokenized"
2 changes: 0 additions & 2 deletions examples/smoke-co-alarm-app/silabs/with_pw_rpc.gni
Original file line number Diff line number Diff line change
Expand Up @@ -25,5 +25,3 @@ app_data_model =
"${chip_root}/examples/smoke-co-alarm-app/smoke-co-alarm-common"
chip_enable_pw_rpc = true
chip_enable_openthread = true

cpp_standard = "gnu++17"
2 changes: 0 additions & 2 deletions examples/thermostat/genio/with_pw_rpc.gni
Original file line number Diff line number Diff line change
Expand Up @@ -23,5 +23,3 @@ mt793x_sdk_target = get_label_info(":sdk", "label_no_toolchain")

chip_enable_pw_rpc = true
chip_enable_openthread = true

cpp_standard = "gnu++17"
1 change: 0 additions & 1 deletion src/test_driver/efr32/args.gni
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@ import("${chip_root}/src/platform/silabs/efr32/args.gni")
silabs_sdk_target = get_label_info(":sdk", "label_no_toolchain")

chip_enable_pw_rpc = true
cpp_standard = "gnu++17"
chip_build_tests = true
chip_enable_openthread = true
chip_openthread_ftd = true
Expand Down

0 comments on commit a55fbb4

Please sign in to comment.