From 1feb1c2bdb48e952d6ac88e7d5513ec662a35032 Mon Sep 17 00:00:00 2001 From: Boris Zbarsky Date: Thu, 21 Sep 2023 10:17:59 -0400 Subject: [PATCH] Add a compile flag to allow setting -fexceptions. Fixes https://github.com/project-chip/connectedhomeip/issues/29368 --- build/config/compiler/BUILD.gn | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/build/config/compiler/BUILD.gn b/build/config/compiler/BUILD.gn index 31f396a4574c3a..c508d657b17ab2 100644 --- a/build/config/compiler/BUILD.gn +++ b/build/config/compiler/BUILD.gn @@ -485,8 +485,12 @@ config("coverage_default") { } declare_args() { - # Enable Runtime Type Information (RTTI) + # Enable or disable Runtime Type Information (RTTI). + # Defaults true on darwin because Darwin.framework uses it. enable_rtti = current_os == "mac" || current_os == "ios" + + # Enable or disable support for C++ exceptions. + enable_exceptions = false } config("no_rtti") { @@ -514,7 +518,11 @@ config("exceptions") { } config("exceptions_default") { - configs = [ ":no_exceptions" ] + if (enable_exceptions) { + configs = [ ":exceptions" ] + } else { + configs = [ ":no_exceptions" ] + } } config("unwind_tables") {