From a9a9d8e545f98acb0b26062cfd6dd51bd44f5fab Mon Sep 17 00:00:00 2001 From: Hye Soo Yang Date: Wed, 4 Sep 2019 11:25:15 -0700 Subject: [PATCH] swig deprecation - preset `copt` and `features` values in `tf_python_pybind_extension` macro as they will be the same across all pybind11 wrappers. PiperOrigin-RevId: 267193818 --- tensorflow/python/BUILD | 17 ----------------- tensorflow/tensorflow.bzl | 12 ++++++------ 2 files changed, 6 insertions(+), 23 deletions(-) diff --git a/tensorflow/python/BUILD b/tensorflow/python/BUILD index 7df0397af6b..5b133b4c1b3 100644 --- a/tensorflow/python/BUILD +++ b/tensorflow/python/BUILD @@ -385,11 +385,6 @@ tf_python_pybind_extension( name = "_pywrap_utils", srcs = ["util/util_wrapper.cc"], hdrs = ["util/util.h"], - copts = [ - "-fexceptions", - "-fno-strict-aliasing", - ], - features = ["-use_header_modules"], module_name = "_pywrap_utils", deps = [ "//third_party/python_runtime:headers", @@ -400,11 +395,6 @@ tf_python_pybind_extension( tf_python_pybind_extension( name = "_pywrap_stat_summarizer", srcs = ["util/stat_summarizer_wrapper.cc"], - copts = [ - "-fexceptions", - "-fno-strict-aliasing", - ], - features = ["-use_header_modules"], module_name = "_pywrap_stat_summarizer", deps = [ "//tensorflow/core:framework", @@ -419,11 +409,6 @@ pybind_extension( name = "_pywrap_util_port", srcs = ["util/port_wrapper.cc"], hdrs = ["//tensorflow/core:util_port_hdrs"], - copts = [ - "-fexceptions", - "-fno-strict-aliasing", - ], - features = ["-use_header_modules"], module_name = "_pywrap_util_port", deps = [ "//tensorflow/core:util_port", @@ -4663,8 +4648,6 @@ py_library( pybind_extension( name = "_tf_stack", srcs = ["util/tf_stack.cc"], - copts = ["-fexceptions"], - features = ["-use_header_modules"], # TODO(b/138203821): change to "util._tf_stack" once the bug is fixed. module_name = "_tf_stack", deps = [ diff --git a/tensorflow/tensorflow.bzl b/tensorflow/tensorflow.bzl index 7b251a7dd3a..51128e27961 100644 --- a/tensorflow/tensorflow.bzl +++ b/tensorflow/tensorflow.bzl @@ -2391,7 +2391,7 @@ def pybind_extension( features = [], srcs_version = "PY2AND3", data = [], - copts = None, + copts = [], linkopts = [], deps = [], visibility = None, @@ -2437,7 +2437,7 @@ def pybind_extension( name = so_file, srcs = srcs + hdrs, data = data, - copts = copts, + copts = copts + ["-fexceptions"], linkopts = linkopts + _rpath_linkopts(name) + select({ "@local_config_cuda//cuda:darwin": [ "-Wl,-exported_symbols_list,$(location %s)" % exported_symbols_file, @@ -2452,7 +2452,7 @@ def pybind_extension( exported_symbols_file, version_script_file, ], - features = features, + features = features + ["-use_header_modules"], linkshared = 1, testonly = testonly, licenses = licenses, @@ -2493,9 +2493,9 @@ def tf_python_pybind_extension( name, srcs, module_name, - hdrs = [], features = [], - copts = None, + copts = [], + hdrs = [], deps = []): """A wrapper macro for pybind_extension that is used in tensorflow/python/BUILD. @@ -2506,9 +2506,9 @@ def tf_python_pybind_extension( name, srcs + tf_binary_additional_srcs(), module_name, - hdrs = hdrs, features = features, copts = copts, + hdrs = hdrs, deps = deps + tf_binary_pybind_deps(), )