Index: build/config/compiler/BUILD.gn |
diff --git a/build/config/compiler/BUILD.gn b/build/config/compiler/BUILD.gn |
index 09f8e6270904dfcf32a5ca15d05c00a8e1ae916c..17e6cb61cdec3bb746bf44a550d525877acbc99d 100644 |
--- a/build/config/compiler/BUILD.gn |
+++ b/build/config/compiler/BUILD.gn |
@@ -54,12 +54,6 @@ config("compiler") { |
"/GS", # Enable buffer security checking. |
"/FS", # Preserve previous PDB behavior. |
] |
- if (is_component_build) { |
- cflags += [ |
- "/EHsc", # Assume C functions can't throw exceptions and don't catch |
- # structured exceptions (only C++ ones). |
- ] |
- } |
} else { |
# Common GCC compiler flags setup. |
# -------------------------------- |
@@ -353,9 +347,6 @@ config("runtime_library") { |
} else { |
# Static CRT. |
if (is_win) { |
- # We don't use exceptions, and when we link statically we can just get |
- # rid of them entirely. |
- defines += [ "_HAS_EXCEPTIONS=0" ] |
if (is_debug) { |
cflags += [ "/MTd" ] |
} else { |
@@ -563,6 +554,27 @@ config("no_rtti") { |
} |
} |
+# Exceptions ------------------------------------------------------------------- |
+ |
+# Some code requires turning exceptions back on (off is the default). |
+ |
+config("no_exceptions") { |
+ if (is_win) { |
+ defines = [ "_HAS_EXCEPTIONS=0" ] |
+ } else if (is_posix) { |
+ cflags_cc = [ "-fno-exceptions" ] |
+ } |
+} |
+ |
+config("exceptions") { |
+ if (is_win) { |
+ cflags = [ |
+ "/EHsc", # Assume C functions can't throw exceptions and don't catch |
+ # structured exceptions (only C++ ones). |
+ ] |
+ } |
+} |
+ |
# Warnings --------------------------------------------------------------------- |
# |
# This is where we disable various warnings that we've decided aren't |