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 <andreilitvin@google.com>
diff --git a/.github/workflows/build.yaml b/.github/workflows/build.yaml
index 14ced0a..c3914b8 100644
--- a/.github/workflows/build.yaml
+++ b/.github/workflows/build.yaml
@@ -174,6 +174,8 @@
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 12a9386..74dc224 100644
--- a/build/config/compiler/compiler.gni
+++ b/build/config/compiler/compiler.gni
@@ -43,12 +43,7 @@
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 51634a9..a60eee6 100755
--- a/config/ameba/args.gni
+++ b/config/ameba/args.gni
@@ -37,4 +37,3 @@
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 a700606..88567b6 100644
--- a/config/mbed/CMakeLists.txt
+++ b/config/mbed/CMakeLists.txt
@@ -106,9 +106,7 @@
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)
diff --git a/examples/chef/silabs/with_pw_rpc.gni b/examples/chef/silabs/with_pw_rpc.gni
index f07744d..ec2d4cf 100644
--- a/examples/chef/silabs/with_pw_rpc.gni
+++ b/examples/chef/silabs/with_pw_rpc.gni
@@ -24,7 +24,5 @@
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 96dd37f..a0b30a4 100644
--- a/examples/chip-tool/args.gni
+++ b/examples/chip-tool/args.gni
@@ -25,8 +25,5 @@
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 57eaaca..266c3fc 100644
--- a/examples/common/tracing/BUILD.gn
+++ b/examples/common/tracing/BUILD.gn
@@ -19,10 +19,7 @@
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 581b4f4..b8fc451 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 @@
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 f398cda..4b76ad2 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 @@
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 0a075b0..1309360 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 @@
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 81aacad..5d7ce27 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 @@
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 581b4f4..b8fc451 100644
--- a/examples/lighting-app/genio/with_pw_rpc.gni
+++ b/examples/lighting-app/genio/with_pw_rpc.gni
@@ -23,5 +23,3 @@
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 2c388aa..a2d2b53 100644
--- a/examples/lighting-app/qpg/with_pw_rpc.gni
+++ b/examples/lighting-app/qpg/with_pw_rpc.gni
@@ -22,5 +22,3 @@
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 f8af765..b53832f 100644
--- a/examples/lighting-app/silabs/with_pw_rpc.gni
+++ b/examples/lighting-app/silabs/with_pw_rpc.gni
@@ -25,7 +25,5 @@
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 581b4f4..b8fc451 100644
--- a/examples/lock-app/genio/with_pw_rpc.gni
+++ b/examples/lock-app/genio/with_pw_rpc.gni
@@ -23,5 +23,3 @@
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 60eff2c..6f195ee 100644
--- a/examples/lock-app/qpg/with_pw_rpc.gni
+++ b/examples/lock-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
-
-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 2592790..c919d90 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_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 581b4f4..b8fc451 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 @@
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 bade7c7..fb05fde 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_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 d06a784..9b75751 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 @@
"${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 581b4f4..b8fc451 100644
--- a/examples/thermostat/genio/with_pw_rpc.gni
+++ b/examples/thermostat/genio/with_pw_rpc.gni
@@ -23,5 +23,3 @@
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 2ef6653..a8d442d 100644
--- a/src/test_driver/efr32/args.gni
+++ b/src/test_driver/efr32/args.gni
@@ -21,7 +21,6 @@
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