From 3e1ac21c3bcbc0e27dcf058900e9572d3c135a20 Mon Sep 17 00:00:00 2001 From: Richard Howell Date: Tue, 12 Jul 2022 14:49:16 +0000 Subject: [PATCH] [c10] move fexceptions to compiler_flags (#80387) Summary: Move `-fexceptions` out of the exported preprocessor flags and in to the libraries compiler flags. Apply the same changes to all rdeps of this library in the caffe2 subtree. Test Plan: Verify no rdeps are missing `-fexceptions` that have cpp sources: ``` % buck uquery 'kind(cxx*, rdeps(//xplat/caffe2/..., //xplat/caffe2/c10:c10, 1))' > /tmp/rdeps % buck uquery '%Ss - attrfilter(preprocessor_flags, "-fexceptions", %Ss) - attrfilter(compiler_flags, "-fexceptions", %Ss)' @/tmp/rdeps //xplat/pytorch_models/build/pytorch_dev_mobilenetv3/v1/nnc:asm //xplat/pytorch_models/build/aot_test_model/v1/nnc:asm //xplat/pytorch_models/build/pytorch_dev_linear/v1/nnc:asm //xplat/pytorch_models/build/bi_bytedoc_nnc/v1/nnc:asm //xplat/pytorch_models/build/bi_bytedoc_nnc/v2/nnc:asm ``` Differential Revision: D37386802 Pull Request resolved: https://github.com/pytorch/pytorch/pull/80387 Approved by: https://github.com/linbinyu --- buckbuild.bzl | 3 +++ build.bzl | 1 + 2 files changed, 4 insertions(+) diff --git a/buckbuild.bzl b/buckbuild.bzl index bb3522b722521..070e6241dbb61 100644 --- a/buckbuild.bzl +++ b/buckbuild.bzl @@ -156,6 +156,7 @@ def get_pt_compiler_flags(): }) _PT_COMPILER_FLAGS = [ + "-fexceptions", "-frtti", "-Os", "-Wno-unknown-pragmas", @@ -1116,6 +1117,7 @@ def define_buck_targets( deps = [ C10, ], + compiler_flags = ["-fexceptions"], ) # Base library shared by lite-interpreter and full-jit. @@ -1844,6 +1846,7 @@ def define_buck_targets( ":torch_core", C10, ], + compiler_flags = ["-fexceptions"], ) # aten_cpu and aten_native_cpu diff --git a/build.bzl b/build.bzl index 8141ee4958800..3ad4d3e8f7adc 100644 --- a/build.bzl +++ b/build.bzl @@ -27,6 +27,7 @@ def define_targets(rules): "//c10", "//third_party/miniz-2.1.0:miniz", ], + copts = ["-fexceptions"], ) #