From 1076519bb60283d1dff54fed8dfba0b6537ebc50 Mon Sep 17 00:00:00 2001 From: Andrei Litvin Date: Tue, 25 Jul 2023 14:44:22 -0400 Subject: [PATCH] Make C++17 the default everywhere (#28269) * 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 --- .github/workflows/build.yaml | 2 ++ build/config/compiler/compiler.gni | 7 +------ config/ameba/args.gni | 1 - config/mbed/CMakeLists.txt | 4 +--- examples/chef/silabs/with_pw_rpc.gni | 2 -- examples/chip-tool/args.gni | 3 --- examples/common/tracing/BUILD.gn | 5 +---- examples/light-switch-app/genio/with_pw_rpc.gni | 2 -- examples/lighting-app/bouffalolab/bl602/with_pw_rpc.gni | 2 -- examples/lighting-app/bouffalolab/bl702/with_pw_rpc.gni | 2 -- examples/lighting-app/bouffalolab/bl702l/with_pw_rpc.gni | 2 -- examples/lighting-app/genio/with_pw_rpc.gni | 2 -- examples/lighting-app/qpg/with_pw_rpc.gni | 2 -- examples/lighting-app/silabs/with_pw_rpc.gni | 2 -- examples/lock-app/genio/with_pw_rpc.gni | 2 -- examples/lock-app/qpg/with_pw_rpc.gni | 2 -- examples/lock-app/silabs/with_pw_rpc.gni | 2 -- examples/ota-requestor-app/genio/with_pw_rpc.gni | 2 -- examples/pump-app/silabs/with_pw_rpc.gni | 2 -- examples/smoke-co-alarm-app/silabs/with_pw_rpc.gni | 2 -- examples/thermostat/genio/with_pw_rpc.gni | 2 -- src/test_driver/efr32/args.gni | 1 - 22 files changed, 5 insertions(+), 48 deletions(-) diff --git a/.github/workflows/build.yaml b/.github/workflows/build.yaml index 14ced0ab7474a8..c3914b86230305 100644 --- a/.github/workflows/build.yaml +++ b/.github/workflows/build.yaml @@ -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 diff --git a/build/config/compiler/compiler.gni b/build/config/compiler/compiler.gni index 12a93863be8ce0..74dc224f3ecec7 100644 --- a/build/config/compiler/compiler.gni +++ b/build/config/compiler/compiler.gni @@ -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 diff --git a/config/ameba/args.gni b/config/ameba/args.gni index 51634a9d738da6..a60eee6db2887c 100755 --- a/config/ameba/args.gni +++ b/config/ameba/args.gni @@ -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" diff --git a/config/mbed/CMakeLists.txt b/config/mbed/CMakeLists.txt index a7006062f12ace..88567b604e3254 100644 --- a/config/mbed/CMakeLists.txt +++ b/config/mbed/CMakeLists.txt @@ -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=) -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) diff --git a/examples/chef/silabs/with_pw_rpc.gni b/examples/chef/silabs/with_pw_rpc.gni index f07744d855c6f9..ec2d4cff28e7ad 100644 --- a/examples/chef/silabs/with_pw_rpc.gni +++ b/examples/chef/silabs/with_pw_rpc.gni @@ -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" diff --git a/examples/chip-tool/args.gni b/examples/chip-tool/args.gni index 96dd37f02f03a1..a0b30a430f23f3 100644 --- a/examples/chip-tool/args.gni +++ b/examples/chip-tool/args.gni @@ -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 diff --git a/examples/common/tracing/BUILD.gn b/examples/common/tracing/BUILD.gn index 57eaaca3952245..266c3fc0f31581 100644 --- a/examples/common/tracing/BUILD.gn +++ b/examples/common/tracing/BUILD.gn @@ -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") { diff --git a/examples/light-switch-app/genio/with_pw_rpc.gni b/examples/light-switch-app/genio/with_pw_rpc.gni index 581b4f415d5654..b8fc451b7c4a3a 100644 --- a/examples/light-switch-app/genio/with_pw_rpc.gni +++ b/examples/light-switch-app/genio/with_pw_rpc.gni @@ -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" diff --git a/examples/lighting-app/bouffalolab/bl602/with_pw_rpc.gni b/examples/lighting-app/bouffalolab/bl602/with_pw_rpc.gni index f398cda41f8c7d..4b76ad23d426ac 100644 --- a/examples/lighting-app/bouffalolab/bl602/with_pw_rpc.gni +++ b/examples/lighting-app/bouffalolab/bl602/with_pw_rpc.gni @@ -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. diff --git a/examples/lighting-app/bouffalolab/bl702/with_pw_rpc.gni b/examples/lighting-app/bouffalolab/bl702/with_pw_rpc.gni index 0a075b0e27228c..130936065cd57c 100644 --- a/examples/lighting-app/bouffalolab/bl702/with_pw_rpc.gni +++ b/examples/lighting-app/bouffalolab/bl702/with_pw_rpc.gni @@ -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. diff --git a/examples/lighting-app/bouffalolab/bl702l/with_pw_rpc.gni b/examples/lighting-app/bouffalolab/bl702l/with_pw_rpc.gni index 81aacad443b43c..5d7ce27c99df3d 100644 --- a/examples/lighting-app/bouffalolab/bl702l/with_pw_rpc.gni +++ b/examples/lighting-app/bouffalolab/bl702l/with_pw_rpc.gni @@ -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" diff --git a/examples/lighting-app/genio/with_pw_rpc.gni b/examples/lighting-app/genio/with_pw_rpc.gni index 581b4f415d5654..b8fc451b7c4a3a 100644 --- a/examples/lighting-app/genio/with_pw_rpc.gni +++ b/examples/lighting-app/genio/with_pw_rpc.gni @@ -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" diff --git a/examples/lighting-app/qpg/with_pw_rpc.gni b/examples/lighting-app/qpg/with_pw_rpc.gni index 2c388aa153388e..a2d2b536b17682 100644 --- a/examples/lighting-app/qpg/with_pw_rpc.gni +++ b/examples/lighting-app/qpg/with_pw_rpc.gni @@ -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" diff --git a/examples/lighting-app/silabs/with_pw_rpc.gni b/examples/lighting-app/silabs/with_pw_rpc.gni index f8af7659ce1ed8..b53832f4b3d468 100644 --- a/examples/lighting-app/silabs/with_pw_rpc.gni +++ b/examples/lighting-app/silabs/with_pw_rpc.gni @@ -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" diff --git a/examples/lock-app/genio/with_pw_rpc.gni b/examples/lock-app/genio/with_pw_rpc.gni index 581b4f415d5654..b8fc451b7c4a3a 100644 --- a/examples/lock-app/genio/with_pw_rpc.gni +++ b/examples/lock-app/genio/with_pw_rpc.gni @@ -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" diff --git a/examples/lock-app/qpg/with_pw_rpc.gni b/examples/lock-app/qpg/with_pw_rpc.gni index 60eff2c6f10c42..6f195eee957169 100644 --- a/examples/lock-app/qpg/with_pw_rpc.gni +++ b/examples/lock-app/qpg/with_pw_rpc.gni @@ -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" diff --git a/examples/lock-app/silabs/with_pw_rpc.gni b/examples/lock-app/silabs/with_pw_rpc.gni index 2592790c03e2ce..c919d90189eb7c 100644 --- a/examples/lock-app/silabs/with_pw_rpc.gni +++ b/examples/lock-app/silabs/with_pw_rpc.gni @@ -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 diff --git a/examples/ota-requestor-app/genio/with_pw_rpc.gni b/examples/ota-requestor-app/genio/with_pw_rpc.gni index 581b4f415d5654..b8fc451b7c4a3a 100644 --- a/examples/ota-requestor-app/genio/with_pw_rpc.gni +++ b/examples/ota-requestor-app/genio/with_pw_rpc.gni @@ -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" diff --git a/examples/pump-app/silabs/with_pw_rpc.gni b/examples/pump-app/silabs/with_pw_rpc.gni index bade7c7ea1f376..fb05fde8b4ccc3 100644 --- a/examples/pump-app/silabs/with_pw_rpc.gni +++ b/examples/pump-app/silabs/with_pw_rpc.gni @@ -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" diff --git a/examples/smoke-co-alarm-app/silabs/with_pw_rpc.gni b/examples/smoke-co-alarm-app/silabs/with_pw_rpc.gni index d06a784404a350..9b757515aceca9 100644 --- a/examples/smoke-co-alarm-app/silabs/with_pw_rpc.gni +++ b/examples/smoke-co-alarm-app/silabs/with_pw_rpc.gni @@ -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" diff --git a/examples/thermostat/genio/with_pw_rpc.gni b/examples/thermostat/genio/with_pw_rpc.gni index 581b4f415d5654..b8fc451b7c4a3a 100644 --- a/examples/thermostat/genio/with_pw_rpc.gni +++ b/examples/thermostat/genio/with_pw_rpc.gni @@ -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" diff --git a/src/test_driver/efr32/args.gni b/src/test_driver/efr32/args.gni index 2ef6653a0181e2..a8d442d5c2140e 100644 --- a/src/test_driver/efr32/args.gni +++ b/src/test_driver/efr32/args.gni @@ -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