From 2022401d7fee1bda45c44241535d827547f8ae06 Mon Sep 17 00:00:00 2001 From: Andrei Litvin Date: Mon, 24 Jul 2023 09:49:02 -0400 Subject: [PATCH] Start switching platforms to C++17 (linux, mac) (#28170) * Switch linux, mac, android to C++17 by default * Update build/config/compiler/compiler.gni Co-authored-by: Boris Zbarsky * Restyled by gn --------- Co-authored-by: Andrei Litvin Co-authored-by: Boris Zbarsky Co-authored-by: Restyled.io --- build/config/compiler/compiler.gni | 3 ++- examples/all-clusters-app/linux/args.gni | 3 --- examples/all-clusters-minimal-app/linux/args.gni | 3 --- examples/bridge-app/linux/args.gni | 3 --- examples/chef/linux/with_pw_rpc.gni | 2 -- examples/contact-sensor-app/linux/args.gni | 3 --- examples/lighting-app/linux/args.gni | 3 --- examples/lighting-app/linux/with_pw_rpc.gni | 2 -- examples/lock-app/linux/args.gni | 3 --- examples/log-source-app/linux/args.gni | 3 --- examples/ota-provider-app/linux/args.gni | 3 --- examples/ota-requestor-app/linux/args.gni | 3 --- examples/persistent-storage/linux/args.gni | 3 --- examples/placeholder/linux/args.gni | 3 --- examples/thermostat/linux/args.gni | 3 --- examples/tv-app/linux/args.gni | 3 --- examples/tv-casting-app/linux/args.gni | 3 --- src/tracing/tracing_args.gni | 5 +---- 18 files changed, 3 insertions(+), 51 deletions(-) diff --git a/build/config/compiler/compiler.gni b/build/config/compiler/compiler.gni index 5610b832b3ac16..12a93863be8ce0 100644 --- a/build/config/compiler/compiler.gni +++ b/build/config/compiler/compiler.gni @@ -43,7 +43,8 @@ declare_args() { c_standard = "gnu11" # C++ standard level (value for -std flag). - if (current_os == "android") { + if (current_os == "linux" || current_os == "mac" || current_os == "ios" || + current_os == "android") { cpp_standard = "gnu++17" } else { cpp_standard = "gnu++14" diff --git a/examples/all-clusters-app/linux/args.gni b/examples/all-clusters-app/linux/args.gni index 38e844a7016951..c4c9a18cec9cf5 100644 --- a/examples/all-clusters-app/linux/args.gni +++ b/examples/all-clusters-app/linux/args.gni @@ -27,6 +27,3 @@ chip_project_config_include_dirs += [ "${chip_root}/config/standalone" ] matter_enable_tracing_support = true matter_log_json_payload_decode_full = true matter_log_json_payload_hex = true - -# Perfetto requires C++17 -cpp_standard = "gnu++17" diff --git a/examples/all-clusters-minimal-app/linux/args.gni b/examples/all-clusters-minimal-app/linux/args.gni index a87d4da8fd9320..8b332edc7e2b06 100644 --- a/examples/all-clusters-minimal-app/linux/args.gni +++ b/examples/all-clusters-minimal-app/linux/args.gni @@ -25,6 +25,3 @@ chip_project_config_include_dirs = chip_project_config_include_dirs += [ "${chip_root}/config/standalone" ] matter_enable_tracing_support = true - -# Perfetto requires C++17 -cpp_standard = "gnu++17" diff --git a/examples/bridge-app/linux/args.gni b/examples/bridge-app/linux/args.gni index ba90537f6ea0b7..5b3e2965d4c77b 100644 --- a/examples/bridge-app/linux/args.gni +++ b/examples/bridge-app/linux/args.gni @@ -25,6 +25,3 @@ chip_project_config_include_dirs = chip_project_config_include_dirs += [ "${chip_root}/config/standalone" ] matter_enable_tracing_support = true - -# Perfetto requires C++17 -cpp_standard = "gnu++17" diff --git a/examples/chef/linux/with_pw_rpc.gni b/examples/chef/linux/with_pw_rpc.gni index 82ffc618f90078..0f1ab1ea89c121 100644 --- a/examples/chef/linux/with_pw_rpc.gni +++ b/examples/chef/linux/with_pw_rpc.gni @@ -21,8 +21,6 @@ import("${chip_root}/config/standalone/args.gni") import("//build_overrides/pigweed.gni") -cpp_standard = "gnu++17" - pw_log_BACKEND = "$dir_pw_log_basic" pw_assert_BACKEND = "$dir_pw_assert_log:check_backend" pw_sys_io_BACKEND = "$dir_pw_sys_io_stdio" diff --git a/examples/contact-sensor-app/linux/args.gni b/examples/contact-sensor-app/linux/args.gni index a94078f1c1c071..f8fea8ea9e2e09 100644 --- a/examples/contact-sensor-app/linux/args.gni +++ b/examples/contact-sensor-app/linux/args.gni @@ -26,6 +26,3 @@ chip_project_config_include_dirs = [ "${chip_root}/examples/contact-sensor-app/linux/include" ] chip_project_config_include_dirs += [ "${chip_root}/config/standalone" ] matter_enable_tracing_support = true - -# Perfetto requires C++17 -cpp_standard = "gnu++17" diff --git a/examples/lighting-app/linux/args.gni b/examples/lighting-app/linux/args.gni index 03e65b9c89f3e3..d07e8c87cdb15c 100644 --- a/examples/lighting-app/linux/args.gni +++ b/examples/lighting-app/linux/args.gni @@ -27,6 +27,3 @@ chip_project_config_include_dirs = chip_project_config_include_dirs += [ "${chip_root}/config/standalone" ] matter_enable_tracing_support = true - -# Perfetto requires C++17 -cpp_standard = "gnu++17" diff --git a/examples/lighting-app/linux/with_pw_rpc.gni b/examples/lighting-app/linux/with_pw_rpc.gni index 82ffc618f90078..0f1ab1ea89c121 100644 --- a/examples/lighting-app/linux/with_pw_rpc.gni +++ b/examples/lighting-app/linux/with_pw_rpc.gni @@ -21,8 +21,6 @@ import("${chip_root}/config/standalone/args.gni") import("//build_overrides/pigweed.gni") -cpp_standard = "gnu++17" - pw_log_BACKEND = "$dir_pw_log_basic" pw_assert_BACKEND = "$dir_pw_assert_log:check_backend" pw_sys_io_BACKEND = "$dir_pw_sys_io_stdio" diff --git a/examples/lock-app/linux/args.gni b/examples/lock-app/linux/args.gni index db4d2e8c274da4..0d7bc33826b704 100644 --- a/examples/lock-app/linux/args.gni +++ b/examples/lock-app/linux/args.gni @@ -24,6 +24,3 @@ chip_project_config_include_dirs = [ "${chip_root}/examples/lock-app/linux/include" ] chip_project_config_include_dirs += [ "${chip_root}/config/standalone" ] matter_enable_tracing_support = true - -# Perfetto requires C++17 -cpp_standard = "gnu++17" diff --git a/examples/log-source-app/linux/args.gni b/examples/log-source-app/linux/args.gni index 5c36fb0cb40b6f..7882354c242127 100644 --- a/examples/log-source-app/linux/args.gni +++ b/examples/log-source-app/linux/args.gni @@ -17,6 +17,3 @@ import("//build_overrides/chip.gni") import("${chip_root}/config/standalone/args.gni") matter_enable_tracing_support = true - -# Perfetto requires C++17 -cpp_standard = "gnu++17" diff --git a/examples/ota-provider-app/linux/args.gni b/examples/ota-provider-app/linux/args.gni index 442c2ba4d43edc..8b4e77541610e6 100644 --- a/examples/ota-provider-app/linux/args.gni +++ b/examples/ota-provider-app/linux/args.gni @@ -24,6 +24,3 @@ chip_project_config_include_dirs = [ "${chip_root}/examples/ota-provider-app/linux/include" ] chip_project_config_include_dirs += [ "${chip_root}/config/standalone" ] matter_enable_tracing_support = true - -# Perfetto requires C++17 -cpp_standard = "gnu++17" diff --git a/examples/ota-requestor-app/linux/args.gni b/examples/ota-requestor-app/linux/args.gni index ee072aeca2defc..f149ba204b1ea0 100644 --- a/examples/ota-requestor-app/linux/args.gni +++ b/examples/ota-requestor-app/linux/args.gni @@ -26,6 +26,3 @@ chip_project_config_include_dirs += [ "${chip_root}/config/standalone" ] chip_enable_ota_requestor = true matter_enable_tracing_support = true - -# Perfetto requires C++17 -cpp_standard = "gnu++17" diff --git a/examples/persistent-storage/linux/args.gni b/examples/persistent-storage/linux/args.gni index 7ee4af9262fd15..001edb60de8cdb 100644 --- a/examples/persistent-storage/linux/args.gni +++ b/examples/persistent-storage/linux/args.gni @@ -16,6 +16,3 @@ import("//build_overrides/chip.gni") import("${chip_root}/config/standalone/args.gni") matter_enable_tracing_support = true - -# Perfetto requires C++17 -cpp_standard = "gnu++17" diff --git a/examples/placeholder/linux/args.gni b/examples/placeholder/linux/args.gni index 7a3a063a488116..ae1dbad6452207 100644 --- a/examples/placeholder/linux/args.gni +++ b/examples/placeholder/linux/args.gni @@ -23,6 +23,3 @@ chip_project_config_include_dirs = [ "${chip_root}/examples/placeholder/linux/include" ] chip_project_config_include_dirs += [ "${chip_root}/config/standalone" ] matter_enable_tracing_support = true - -# Perfetto requires C++17 -cpp_standard = "gnu++17" diff --git a/examples/thermostat/linux/args.gni b/examples/thermostat/linux/args.gni index 9de55497298118..edb7411256d831 100644 --- a/examples/thermostat/linux/args.gni +++ b/examples/thermostat/linux/args.gni @@ -16,6 +16,3 @@ import("//build_overrides/chip.gni") import("${chip_root}/config/standalone/args.gni") matter_enable_tracing_support = true - -# Perfetto requires C++17 -cpp_standard = "gnu++17" diff --git a/examples/tv-app/linux/args.gni b/examples/tv-app/linux/args.gni index 5193be22ff4cbb..aa476d37b80c30 100644 --- a/examples/tv-app/linux/args.gni +++ b/examples/tv-app/linux/args.gni @@ -31,6 +31,3 @@ chip_enable_additional_data_advertising = true chip_enable_rotating_device_id = true matter_enable_tracing_support = true - -# Perfetto requires C++17 -cpp_standard = "gnu++17" diff --git a/examples/tv-casting-app/linux/args.gni b/examples/tv-casting-app/linux/args.gni index 0fb9de6aafe83f..03ba28645f8940 100644 --- a/examples/tv-casting-app/linux/args.gni +++ b/examples/tv-casting-app/linux/args.gni @@ -33,6 +33,3 @@ chip_enable_rotating_device_id = true chip_max_discovered_ip_addresses = 20 matter_enable_tracing_support = true - -# Perfetto requires C++17 -cpp_standard = "gnu++17" diff --git a/src/tracing/tracing_args.gni b/src/tracing/tracing_args.gni index e62a4e21410955..7c27f9ecaba39a 100644 --- a/src/tracing/tracing_args.gni +++ b/src/tracing/tracing_args.gni @@ -43,10 +43,7 @@ declare_args() { # since tracing is very noisy, we generally expect it to be explicitly # set up. # - # TODO: cpp_standard check is not ideal, it should be >= 17, - # however for now this is what we use in compilations - if ((current_os == "linux" || current_os == "android") && - cpp_standard == "gnu++17") { + if (current_os == "linux" || current_os == "android") { matter_trace_config = "${chip_root}/src/tracing/perfetto:perfetto_tracing" } else { matter_trace_config = "${chip_root}/src/tracing/none"