Skip to content

Commit

Permalink
[pytorch] add missing -fexceptions flags (pytorch#81394)
Browse files Browse the repository at this point in the history
Summary:
Add missing `-fexceptions` flags that are currently being passed through `exported_preprocessor_flags`. The exported preprocessor flags will be removed in a subsequent diff.

This is a rediff of D37386802 (pytorch@3e1ac21) with the changes split out to avoid reverts.

Test Plan:
Check flag is present:
```
$ buck uquery xplat/caffe2:common_core -a 'compiler_flags'
{
  "//xplat/caffe2:common_core" : {
    "compiler_flags" : [
      "-fexceptions",
      "-frtti",
      "-Os",
      "-Wno-unknown-pragmas",
      "-Wno-write-strings",
      "-Wno-unused-variable",
      "-Wno-unused-function",
      "-Wno-deprecated-declarations",
      "-Wno-shadow",
      "-Wno-global-constructors",
      "-Wno-missing-prototypes",
      "-std=gnu++17",
      "/EHsc",
      "/GR",
      "/O1",
      "/wd4101"
    ]
  }
}
```

Differential Revision: D37813869

Pull Request resolved: pytorch#81394
Approved by: https://github.com/linbinyu
  • Loading branch information
rmaz authored and pytorchmergebot committed Jul 14, 2022
1 parent 0adc2e3 commit 51cc614
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 0 deletions.
3 changes: 3 additions & 0 deletions buckbuild.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -156,6 +156,7 @@ def get_pt_compiler_flags():
})

_PT_COMPILER_FLAGS = [
"-fexceptions",
"-frtti",
"-Os",
"-Wno-unknown-pragmas",
Expand Down Expand Up @@ -1099,6 +1100,7 @@ def define_buck_targets(
srcs = [
"torch/csrc/jit/mobile/observer.cpp",
] + ([] if IS_OSS else ["torch/fb/observers/MobileObserverUtil.cpp"]),
compiler_flags = ["-fexceptions"],
header_namespace = "",
exported_headers = subdir_glob(
[
Expand Down Expand Up @@ -1833,6 +1835,7 @@ def define_buck_targets(
"torch/csrc/jit/runtime/static/passes.cpp",
"torch/csrc/jit/runtime/static/te_wrapper.cpp",
],
compiler_flags = ["-fexceptions"],
labels = labels,
# @lint-ignore BUCKLINT link_whole
link_whole = True,
Expand Down
1 change: 1 addition & 0 deletions build.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ def define_targets(rules):
"caffe2/serialize/istream_adapter.cc",
"caffe2/serialize/read_adapter_interface.cc",
],
copts = ["-fexceptions"],
tags = [
"supermodule:android/default/pytorch",
"supermodule:ios/default/public.pytorch",
Expand Down

0 comments on commit 51cc614

Please sign in to comment.