From c6b8e301e41ae13fcbadbc4878e0d284f3723e4c Mon Sep 17 00:00:00 2001 From: Christian Blichmann Date: Wed, 25 Sep 2019 07:13:33 -0700 Subject: [PATCH] This fixes broken _proto_cc_cc_proto build target suffixes. These where inadvertently introduced in an internal cleanup change. This change also removes a C++17-ism in var_proto.h. To make things easier for downstream projects, we should stick to C++11 for the time being. PiperOrigin-RevId: 271117700 Change-Id: I4eaacec88be16e1a561d3f77a61acce0a1af0b9d --- sandboxed_api/BUILD.bazel | 8 +-- sandboxed_api/bazel/BUILD | 2 +- sandboxed_api/bazel/external/zlib.BUILD | 2 +- sandboxed_api/bazel/proto.bzl | 69 +++++++++++-------- sandboxed_api/bazel/sapi.bzl | 10 +-- sandboxed_api/examples/stringop/BUILD.bazel | 6 +- .../examples/stringop/lib/BUILD.bazel | 6 +- sandboxed_api/examples/sum/BUILD.bazel | 4 +- sandboxed_api/examples/sum/lib/BUILD.bazel | 6 +- sandboxed_api/examples/zlib/BUILD.bazel | 2 +- sandboxed_api/sandbox2/BUILD.bazel | 30 ++++---- .../sandbox2/examples/crc4/BUILD.bazel | 2 +- .../sandbox2/examples/custom_fork/BUILD.bazel | 2 +- .../sandbox2/examples/network/BUILD.bazel | 2 +- .../examples/network_proxy/BUILD.bazel | 2 +- .../sandbox2/examples/static/BUILD.bazel | 2 +- .../sandbox2/examples/tool/BUILD.bazel | 2 +- .../sandbox2/examples/zlib/BUILD.bazel | 2 +- sandboxed_api/sandbox2/unwind/BUILD.bazel | 2 +- sandboxed_api/tools/generator2/BUILD | 2 +- sandboxed_api/util/BUILD.bazel | 4 +- sandboxed_api/var_proto.h | 3 +- 22 files changed, 91 insertions(+), 79 deletions(-) diff --git a/sandboxed_api/BUILD.bazel b/sandboxed_api/BUILD.bazel index 0f88767..ab456fc 100644 --- a/sandboxed_api/BUILD.bazel +++ b/sandboxed_api/BUILD.bazel @@ -12,7 +12,7 @@ # See the License for the specific language governing permissions and # limitations under the License. -licenses(["notice"]) # Apache 2.0 +licenses(["notice"]) exports_files(["LICENSE"]) @@ -142,7 +142,7 @@ cc_library( deps = [ ":call", ":lenval_core", - ":proto_arg_cc_cc_proto", + ":proto_arg_cc_proto", ":var_type", "//sandboxed_api/sandbox2:comms", "//sandboxed_api/util:status", @@ -169,7 +169,7 @@ cc_library( deps = [ ":call", ":lenval_core", - ":proto_arg_cc_cc_proto", + ":proto_arg_cc_proto", ":vars", "//sandboxed_api/sandbox2:client", "//sandboxed_api/sandbox2:comms", @@ -190,7 +190,7 @@ cc_test( deps = [ ":sapi", "//sandboxed_api/examples/stringop/lib:stringop-sapi", - "//sandboxed_api/examples/stringop/lib:stringop_params_proto_cc", + "//sandboxed_api/examples/stringop/lib:stringop_params_cc_proto", "//sandboxed_api/examples/sum/lib:sum-sapi", "//sandboxed_api/examples/sum/lib:sum-sapi_embed", "//sandboxed_api/util:status", diff --git a/sandboxed_api/bazel/BUILD b/sandboxed_api/bazel/BUILD index da8502c..716d1c8 100644 --- a/sandboxed_api/bazel/BUILD +++ b/sandboxed_api/bazel/BUILD @@ -12,7 +12,7 @@ # See the License for the specific language governing permissions and # limitations under the License. -licenses(["notice"]) # Apache v2.0 +licenses(["notice"]) exports_files([ "proto.bzl", diff --git a/sandboxed_api/bazel/external/zlib.BUILD b/sandboxed_api/bazel/external/zlib.BUILD index 4a49408..a340dbd 100644 --- a/sandboxed_api/bazel/external/zlib.BUILD +++ b/sandboxed_api/bazel/external/zlib.BUILD @@ -12,7 +12,7 @@ # See the License for the specific language governing permissions and # limitations under the License. -licenses(["notice"]) # BSD/MIT-like license +licenses(["notice"]) cc_library( name = "zlib", diff --git a/sandboxed_api/bazel/proto.bzl b/sandboxed_api/bazel/proto.bzl index a074088..b2cd1e4 100644 --- a/sandboxed_api/bazel/proto.bzl +++ b/sandboxed_api/bazel/proto.bzl @@ -14,11 +14,41 @@ """Generates proto targets in various languages.""" -load( - "@com_google_protobuf//:protobuf.bzl", - "cc_proto_library", - "py_proto_library", -) +load("@com_google_protobuf//:protobuf.bzl", "cc_proto_library") + +def _cc_proto_library_name_from_proto_name(name): + """Converts proto name to cc_proto_library name. + + Several suffixes will be considered. + Args: + name: the proto name + Returns: + The cc_proto_library name. + """ + name = name.replace("-", "_") + if name == "proto": + # replace 'proto' with 'cc_proto' + return "cc_proto" + for suffix in [ + ".protolib", + "protolib", + "proto2lib", + "proto_lib", + "proto2", + "protos", + "proto2_lib", + "libproto", + "genproto", + "proto", + ]: + # replace 'suffix' or '_suffix' with '_cc_proto' + if name.endswith("_" + suffix): + return name[:-len("_" + suffix)] + "_cc_proto" + elif name.endswith(suffix): + return name[:-len(suffix)] + "_cc_proto" + + # no match; simply append '_cc_proto' to the end + return name + "_cc_proto" def sapi_proto_library( name, @@ -30,7 +60,7 @@ def sapi_proto_library( Args: name: Name for proto_library and base for the cc_proto_library name, name + - "_cc". + "_cc_proto". srcs: Same as proto_library deps. deps: Same as proto_library deps. alwayslink: Same as cc_library. @@ -39,10 +69,6 @@ def sapi_proto_library( if kwargs.get("has_services", False): fail("Services are not currently supported.") - # TODO(cblichmann): For the time being, rely on the non-native rule - # provided by Protobuf. Once the Starlark C++ API has - # landed, it'll become possible to implement alwayslink - # natively. cc_proto_library( name = name, srcs = srcs, @@ -51,25 +77,8 @@ def sapi_proto_library( **kwargs ) native.cc_library( - name = name + "_cc", - deps = [":" + name], - **kwargs - ) - -def sapi_py_proto_library(name, srcs = [], deps = [], **kwargs): - """Generates proto targets for Python. - - Args: - name: Name for proto_library. - srcs: Same as py_proto_library deps. - deps: Ignored, provided for compatibility only. - **kwargs: proto_library arguments. - """ - _ignore = [deps] - py_proto_library( - name = name, - srcs = srcs, - default_runtime = "@com_google_protobuf//:protobuf_python", - protoc = "@com_google_protobuf//:protoc", + name = _cc_proto_library_name_from_proto_name(name), + deps = [name], + alwayslink = alwayslink, **kwargs ) diff --git a/sandboxed_api/bazel/sapi.bzl b/sandboxed_api/bazel/sapi.bzl index bfc59df..2cc9f3c 100644 --- a/sandboxed_api/bazel/sapi.bzl +++ b/sandboxed_api/bazel/sapi.bzl @@ -157,6 +157,8 @@ def sapi_library( visibility = None): """BUILD rule providing implementation of a Sandboxed API library.""" + repo_name = native.repository_name() + rprefix = "@com_google_sandboxed_api" if repo_name != "@" else "" common = { "tags": tags, } @@ -180,7 +182,7 @@ def sapi_library( else: lib_hdrs += [generated_header] - default_deps = ["@com_google_sandboxed_api//sandboxed_api/sandbox2"] + default_deps = [rprefix + "//sandboxed_api/sandbox2"] # Library that contains generated interface and sandboxed binary as a data # dependency. Add this as a dependency instead of original library. @@ -191,8 +193,8 @@ def sapi_library( data = [":" + name + ".bin"], deps = sort_deps( [ - "@com_google_sandboxed_api//sandboxed_api:sapi", - "@com_google_sandboxed_api//sandboxed_api:vars", + rprefix + "//sandboxed_api:sapi", + rprefix + "//sandboxed_api:vars", ] + deps + ([":" + name + "_embed"] if embed else []) + (default_deps if add_default_deps else []), @@ -208,7 +210,7 @@ def sapi_library( ] + exported_funcs, # must be both referenced, and exported deps = [ ":" + name + ".lib", - "@com_google_sandboxed_api//sandboxed_api:client", + rprefix + "//sandboxed_api:client", ], **common ) diff --git a/sandboxed_api/examples/stringop/BUILD.bazel b/sandboxed_api/examples/stringop/BUILD.bazel index 71b8342..ec8ff3e 100644 --- a/sandboxed_api/examples/stringop/BUILD.bazel +++ b/sandboxed_api/examples/stringop/BUILD.bazel @@ -12,9 +12,9 @@ # See the License for the specific language governing permissions and # limitations under the License. -# Description: Examples using dynamic length structures for Sandboxed-API +# Description: Example using dynamic length structures for Sandboxed API -licenses(["notice"]) # Apache 2.0 +licenses(["notice"]) load("//sandboxed_api/bazel:build_defs.bzl", "sapi_platform_copts") @@ -27,7 +27,7 @@ cc_test( "//sandboxed_api:sapi", "//sandboxed_api:vars", "//sandboxed_api/examples/stringop/lib:stringop-sapi", - "//sandboxed_api/examples/stringop/lib:stringop_params_proto_cc_cc_proto", + "//sandboxed_api/examples/stringop/lib:stringop_params_cc_proto", "//sandboxed_api/util:flags", "//sandboxed_api/util:status", "//sandboxed_api/util:status_matchers", diff --git a/sandboxed_api/examples/stringop/lib/BUILD.bazel b/sandboxed_api/examples/stringop/lib/BUILD.bazel index 54fbaeb..c21c95c 100644 --- a/sandboxed_api/examples/stringop/lib/BUILD.bazel +++ b/sandboxed_api/examples/stringop/lib/BUILD.bazel @@ -12,7 +12,7 @@ # See the License for the specific language governing permissions and # limitations under the License. -licenses(["notice"]) # Apache 2.0 +licenses(["notice"]) load("//sandboxed_api/bazel:build_defs.bzl", "sapi_platform_copts") load("//sandboxed_api/bazel:proto.bzl", "sapi_proto_library") @@ -30,7 +30,7 @@ cc_library( copts = sapi_platform_copts(), visibility = ["//visibility:public"], deps = [ - ":stringop_params_proto_cc_cc_proto", + ":stringop_params_cc_proto", "//sandboxed_api:lenval_core", ], alwayslink = 1, # All functions are linked into dependent binaries @@ -55,5 +55,5 @@ sapi_library( lib_name = "Stringop", namespace = "", visibility = ["//visibility:public"], - deps = [":stringop_params_proto_cc"], + deps = [":stringop_params_cc_proto"], ) diff --git a/sandboxed_api/examples/sum/BUILD.bazel b/sandboxed_api/examples/sum/BUILD.bazel index 9ad6db1..7760d62 100644 --- a/sandboxed_api/examples/sum/BUILD.bazel +++ b/sandboxed_api/examples/sum/BUILD.bazel @@ -12,7 +12,7 @@ # See the License for the specific language governing permissions and # limitations under the License. -licenses(["notice"]) # Apache 2.0 +licenses(["notice"]) load("//sandboxed_api/bazel:build_defs.bzl", "sapi_platform_copts") @@ -25,7 +25,7 @@ cc_binary( "//sandboxed_api:sapi", "//sandboxed_api:vars", "//sandboxed_api/examples/sum/lib:sum-sapi", - "//sandboxed_api/examples/sum/lib:sum_params_proto_cc_cc_proto", + "//sandboxed_api/examples/sum/lib:sum_params_cc_proto", "//sandboxed_api/util:flags", "//sandboxed_api/util:status", "@com_google_absl//absl/memory", diff --git a/sandboxed_api/examples/sum/lib/BUILD.bazel b/sandboxed_api/examples/sum/lib/BUILD.bazel index c3a2f58..559e839 100644 --- a/sandboxed_api/examples/sum/lib/BUILD.bazel +++ b/sandboxed_api/examples/sum/lib/BUILD.bazel @@ -12,7 +12,7 @@ # See the License for the specific language governing permissions and # limitations under the License. -licenses(["notice"]) # Apache 2.0 +licenses(["notice"]) load("//sandboxed_api/bazel:build_defs.bzl", "sapi_platform_copts") load("//sandboxed_api/bazel:proto.bzl", "sapi_proto_library") @@ -34,7 +34,7 @@ cc_library( copts = sapi_platform_copts(), visibility = ["//visibility:public"], deps = [ - ":sum_params_proto_cc_cc_proto", + ":sum_params_cc_proto", "@com_google_glog//:glog", ], alwayslink = 1, # All functions are linked into depending binaries @@ -68,5 +68,5 @@ sapi_library( lib_name = "Sum", namespace = "", visibility = ["//visibility:public"], - deps = [":sum_params_proto_cc"], + deps = [":sum_params_cc_proto"], ) diff --git a/sandboxed_api/examples/zlib/BUILD.bazel b/sandboxed_api/examples/zlib/BUILD.bazel index 4d018e9..5a2617b 100644 --- a/sandboxed_api/examples/zlib/BUILD.bazel +++ b/sandboxed_api/examples/zlib/BUILD.bazel @@ -14,7 +14,7 @@ # Description: Sandboxed API reimplementation of zlib's zpipe.c example. -licenses(["notice"]) # Apache 2.0 +licenses(["notice"]) load("//sandboxed_api/bazel:build_defs.bzl", "sapi_platform_copts") load("//sandboxed_api/bazel:sapi.bzl", "sapi_library") diff --git a/sandboxed_api/sandbox2/BUILD.bazel b/sandboxed_api/sandbox2/BUILD.bazel index ef85701..8c5f396 100644 --- a/sandboxed_api/sandbox2/BUILD.bazel +++ b/sandboxed_api/sandbox2/BUILD.bazel @@ -39,7 +39,7 @@ cc_library( copts = sapi_platform_copts(), deps = [ ":syscall", - ":violation_proto_cc_cc_proto", + ":violation_cc_proto", "//sandboxed_api/sandbox2/util:strerror", "//sandboxed_api/util:status", "@com_google_absl//absl/base:core_headers", @@ -105,7 +105,7 @@ cc_library( copts = sapi_platform_copts(), deps = [ ":comms", - ":logserver_proto_cc_cc_proto", + ":logserver_cc_proto", "@com_google_glog//:glog", ], ) @@ -118,7 +118,7 @@ cc_library( visibility = ["//visibility:public"], deps = [ ":comms", - ":logserver_proto_cc_cc_proto", + ":logserver_cc_proto", "@com_google_absl//absl/strings", "@com_google_absl//absl/synchronization", "@com_google_glog//:glog", @@ -183,7 +183,7 @@ cc_library( ":namespace", ":regs", ":syscall", - ":violation_proto_cc_cc_proto", + ":violation_cc_proto", "//sandboxed_api/sandbox2/util:bpf_helper", "//sandboxed_api/util:flags", "@com_google_absl//absl/base:core_headers", @@ -259,7 +259,7 @@ cc_library( copts = sapi_platform_copts(), deps = [ ":forkserver", - ":forkserver_proto_cc", + ":forkserver_cc_proto", ":global_forkserver", ":ipc", ":limits", @@ -304,9 +304,9 @@ cc_library( ":client", ":executor", ":comms", - ":violation_proto_cc_cc_proto", + ":violation_cc_proto", ":forkserver", - ":forkserver_proto_cc_cc_proto", + ":forkserver_cc_proto", ":global_forkserver", ":ipc", ":limits", @@ -332,7 +332,7 @@ cc_library( "@com_google_absl//absl/types:optional", "@org_kernel_libcap//:libcap", "//sandboxed_api/sandbox2/unwind", - "//sandboxed_api/sandbox2/unwind:unwind_proto_cc_cc_proto", + "//sandboxed_api/sandbox2/unwind:unwind_cc_proto", "//sandboxed_api/sandbox2/util:bpf_helper", "//sandboxed_api/sandbox2/util:file_base", "//sandboxed_api/sandbox2/util:fileops", @@ -383,14 +383,14 @@ cc_library( deps = [ ":client", ":comms", - ":forkserver_proto_cc_cc_proto", + ":forkserver_cc_proto", ":namespace", ":policy", ":syscall", ":util", "//sandboxed_api/sandbox2/unwind", "//sandboxed_api/sandbox2/unwind:ptrace_hook", - "//sandboxed_api/sandbox2/unwind:unwind_proto_cc_cc_proto", + "//sandboxed_api/sandbox2/unwind:unwind_cc_proto", "//sandboxed_api/sandbox2/util:bpf_helper", "//sandboxed_api/sandbox2/util:fileops", "//sandboxed_api/sandbox2/util:strerror", @@ -410,7 +410,7 @@ cc_library( hdrs = ["mounts.h"], copts = sapi_platform_copts(), deps = [ - ":mounttree_proto_cc_cc_proto", + ":mounttree_cc_proto", "//sandboxed_api/sandbox2/util:file_base", "//sandboxed_api/sandbox2/util:fileops", "//sandboxed_api/sandbox2/util:minielf", @@ -449,9 +449,9 @@ cc_library( copts = sapi_platform_copts(), deps = [ ":mounts", - ":mounttree_proto_cc_cc_proto", + ":mounttree_cc_proto", ":util", - ":violation_proto_cc_cc_proto", + ":violation_cc_proto", "//sandboxed_api/sandbox2/util:file_base", "//sandboxed_api/sandbox2/util:fileops", "//sandboxed_api/sandbox2/util:strerror", @@ -597,7 +597,7 @@ cc_test( copts = sapi_platform_copts(), deps = [ ":comms", - ":comms_test_proto_cc_cc_proto", + ":comms_test_cc_proto", "//sandboxed_api/util:status_matchers", "@com_google_absl//absl/container:fixed_array", "@com_google_absl//absl/strings", @@ -618,7 +618,7 @@ cc_test( deps = [ ":comms", ":forkserver", - ":forkserver_proto_cc_cc_proto", + ":forkserver_cc_proto", ":sandbox2", ":testing", "@com_google_absl//absl/strings", diff --git a/sandboxed_api/sandbox2/examples/crc4/BUILD.bazel b/sandboxed_api/sandbox2/examples/crc4/BUILD.bazel index 60be656..9c444d2 100644 --- a/sandboxed_api/sandbox2/examples/crc4/BUILD.bazel +++ b/sandboxed_api/sandbox2/examples/crc4/BUILD.bazel @@ -19,7 +19,7 @@ # - Using sandbox2::Comms for data exchange (IPC) # - Test to ensure sandbox executor runs sandboxee without issue -licenses(["notice"]) # Apache 2.0 +licenses(["notice"]) load("//sandboxed_api/bazel:build_defs.bzl", "sapi_platform_copts") diff --git a/sandboxed_api/sandbox2/examples/custom_fork/BUILD.bazel b/sandboxed_api/sandbox2/examples/custom_fork/BUILD.bazel index 37554e7..37afe6f 100644 --- a/sandboxed_api/sandbox2/examples/custom_fork/BUILD.bazel +++ b/sandboxed_api/sandbox2/examples/custom_fork/BUILD.bazel @@ -16,7 +16,7 @@ # - create a custom fork-server, which will prepare and fork a sandboxee # from the current process -licenses(["notice"]) # Apache 2.0 +licenses(["notice"]) load("//sandboxed_api/bazel:build_defs.bzl", "sapi_platform_copts") diff --git a/sandboxed_api/sandbox2/examples/network/BUILD.bazel b/sandboxed_api/sandbox2/examples/network/BUILD.bazel index fd7dd06..93dc17c 100644 --- a/sandboxed_api/sandbox2/examples/network/BUILD.bazel +++ b/sandboxed_api/sandbox2/examples/network/BUILD.bazel @@ -18,7 +18,7 @@ # - strict syscall policy # - sandbox2::Comms for data exchange (IPC) -licenses(["notice"]) # Apache 2.0 +licenses(["notice"]) load("//sandboxed_api/bazel:build_defs.bzl", "sapi_platform_copts") diff --git a/sandboxed_api/sandbox2/examples/network_proxy/BUILD.bazel b/sandboxed_api/sandbox2/examples/network_proxy/BUILD.bazel index c931d7a..3022e92 100644 --- a/sandboxed_api/sandbox2/examples/network_proxy/BUILD.bazel +++ b/sandboxed_api/sandbox2/examples/network_proxy/BUILD.bazel @@ -14,7 +14,7 @@ # The 'network proxy' example demonstrates how to use network proxy server. -licenses(["notice"]) # Apache 2.0 +licenses(["notice"]) load("//sandboxed_api/bazel:build_defs.bzl", "sapi_platform_copts") diff --git a/sandboxed_api/sandbox2/examples/static/BUILD.bazel b/sandboxed_api/sandbox2/examples/static/BUILD.bazel index 2c03279..40bc971 100644 --- a/sandboxed_api/sandbox2/examples/static/BUILD.bazel +++ b/sandboxed_api/sandbox2/examples/static/BUILD.bazel @@ -19,7 +19,7 @@ # - communication with file descriptors and MapFd # - test to ensure sandbox executor runs sandboxee without issue -licenses(["notice"]) # Apache 2.0 +licenses(["notice"]) load("//sandboxed_api/bazel:build_defs.bzl", "sapi_platform_copts") diff --git a/sandboxed_api/sandbox2/examples/tool/BUILD.bazel b/sandboxed_api/sandbox2/examples/tool/BUILD.bazel index 9745474..6b0bf11 100644 --- a/sandboxed_api/sandbox2/examples/tool/BUILD.bazel +++ b/sandboxed_api/sandbox2/examples/tool/BUILD.bazel @@ -20,7 +20,7 @@ # - set limits, wall time, filesystem checks, asynchronous run # - test to ensure sandbox executor runs sandboxee without issue -licenses(["notice"]) # Apache 2.0 +licenses(["notice"]) load("//sandboxed_api/bazel:build_defs.bzl", "sapi_platform_copts") diff --git a/sandboxed_api/sandbox2/examples/zlib/BUILD.bazel b/sandboxed_api/sandbox2/examples/zlib/BUILD.bazel index 1e17e7e..92e26bf 100644 --- a/sandboxed_api/sandbox2/examples/zlib/BUILD.bazel +++ b/sandboxed_api/sandbox2/examples/zlib/BUILD.bazel @@ -12,7 +12,7 @@ # See the License for the specific language governing permissions and # limitations under the License. -licenses(["notice"]) # Apache 2.0 +licenses(["notice"]) load("//sandboxed_api/bazel:build_defs.bzl", "sapi_platform_copts") diff --git a/sandboxed_api/sandbox2/unwind/BUILD.bazel b/sandboxed_api/sandbox2/unwind/BUILD.bazel index a41f48a..2bac5ae 100644 --- a/sandboxed_api/sandbox2/unwind/BUILD.bazel +++ b/sandboxed_api/sandbox2/unwind/BUILD.bazel @@ -50,7 +50,7 @@ cc_library( ] ]), deps = [ - ":unwind_proto_cc_cc_proto", + ":unwind_cc_proto", "//sandboxed_api/sandbox2:comms", "//sandboxed_api/sandbox2/util:maps_parser", "//sandboxed_api/sandbox2/util:minielf", diff --git a/sandboxed_api/tools/generator2/BUILD b/sandboxed_api/tools/generator2/BUILD index c26e29a..519f9c9 100644 --- a/sandboxed_api/tools/generator2/BUILD +++ b/sandboxed_api/tools/generator2/BUILD @@ -12,7 +12,7 @@ # See the License for the specific language governing permissions and # limitations under the License. -licenses(["notice"]) # Apache 2.0 +licenses(["notice"]) load("//sandboxed_api/bazel:build_defs.bzl", "sapi_platform_copts") load("//sandboxed_api/bazel:sapi.bzl", "sapi_library") diff --git a/sandboxed_api/util/BUILD.bazel b/sandboxed_api/util/BUILD.bazel index d63a0e4..d17bc33 100644 --- a/sandboxed_api/util/BUILD.bazel +++ b/sandboxed_api/util/BUILD.bazel @@ -14,7 +14,7 @@ package(default_visibility = ["//sandboxed_api:__subpackages__"]) -licenses(["notice"]) # Apache 2.0 +licenses(["notice"]) load("//sandboxed_api/bazel:proto.bzl", "sapi_proto_library") load("//sandboxed_api/bazel:build_defs.bzl", "sapi_platform_copts") @@ -41,7 +41,7 @@ cc_library( copts = sapi_platform_copts(), visibility = ["//visibility:public"], deps = [ - ":status_proto_cc_cc_proto", + ":status_cc_proto", "@com_google_absl//absl/base:core_headers", "@com_google_absl//absl/meta:type_traits", "@com_google_absl//absl/strings", diff --git a/sandboxed_api/var_proto.h b/sandboxed_api/var_proto.h index 17aaa33..11e32f9 100644 --- a/sandboxed_api/var_proto.h +++ b/sandboxed_api/var_proto.h @@ -68,7 +68,8 @@ class Proto : public Pointable, public Var { ABSL_DEPRECATED("Use GetMessage() instead") std::unique_ptr GetProtoCopy() const { - if (auto result_or = GetMessage(); result_or.ok()) { + auto result_or = GetMessage(); + if (result_or.ok()) { return absl::make_unique(std::move(result_or).ValueOrDie()); } return nullptr;