Skip to content

Commit e7b8adc

Browse files
habermancopybara-github
authored andcommitted
Removed the third_party/upb/upb/bazel directory.
We are absorbing its contents into other directories. This will reduce the 3:1 merge to `upb/bazel` in GitHub to 2:1 (soon to be 1:1). PiperOrigin-RevId: 845466189
1 parent b76faa9 commit e7b8adc

File tree

27 files changed

+96
-78
lines changed

27 files changed

+96
-78
lines changed
Lines changed: 53 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,53 @@
1+
# Copyright (c) 2009-2021, Google LLC
2+
# All rights reserved.
3+
#
4+
# Use of this source code is governed by a BSD-style
5+
# license that can be found in the LICENSE file or at
6+
# https://developers.google.com/open-source/licenses/bsd
7+
8+
"""Common copts for building upb."""
9+
10+
_DEFAULT_CPPOPTS = []
11+
_DEFAULT_COPTS = [
12+
# this is a compile error in C++ clang and GNU C, but not clang C by default
13+
"-Werror=incompatible-pointer-types",
14+
# GCC does not seem to support the no_sanitize attribute in some places
15+
# where we use it.
16+
"-Wno-error=attributes",
17+
]
18+
19+
_DEFAULT_CPPOPTS.extend([
20+
"-Wextra",
21+
# "-Wshorten-64-to-32", # not in GCC (and my Kokoro images doesn't have Clang)
22+
"-Wno-unused-parameter",
23+
"-Wno-long-long",
24+
])
25+
_DEFAULT_COPTS.extend([
26+
"-std=c99",
27+
"-Wall",
28+
"-Wstrict-prototypes",
29+
# GCC (at least) emits spurious warnings for this that cannot be fixed
30+
# without introducing redundant initialization (with runtime cost):
31+
# https://gcc.gnu.org/bugzilla/show_bug.cgi?id=80635
32+
#"-Wno-maybe-uninitialized",
33+
])
34+
35+
UPB_DEFAULT_CPPOPTS = select({
36+
"//upb:windows": [],
37+
"//conditions:default": _DEFAULT_CPPOPTS,
38+
}) + select({
39+
"//upb:fasttable_enabled_setting": ["-DUPB_ENABLE_FASTTABLE"],
40+
"//conditions:default": [],
41+
}) + select({
42+
"//conditions:default": [],
43+
})
44+
45+
UPB_DEFAULT_COPTS = select({
46+
"//upb:windows": [],
47+
"//conditions:default": _DEFAULT_COPTS,
48+
}) + select({
49+
"//upb:fasttable_enabled_setting": ["-DUPB_ENABLE_FASTTABLE"],
50+
"//conditions:default": [],
51+
}) + select({
52+
"//conditions:default": [],
53+
})

upb/bazel/BUILD renamed to google3/third_party/upb/bazel/private/oss/BUILD

File renamed without changes.

upb/bazel/amalgamate.py renamed to google3/third_party/upb/bazel/private/oss/amalgamate.py

Lines changed: 18 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -30,17 +30,20 @@
3030
# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
3131
# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
3232

33-
import sys
34-
import re
3533
import os
34+
import re
35+
import sys
3636

3737
INCLUDE_RE = re.compile('^#include "([^"]*)"')
3838

39+
3940
def parse_include(line):
4041
match = INCLUDE_RE.match(line)
4142
return match.groups()[0] if match else None
4243

44+
4345
class Amalgamator:
46+
4447
def __init__(self, h_out, c_out):
4548
self.include_paths = ["."]
4649
self.included = set()
@@ -53,7 +56,9 @@ def amalgamate(self, h_files, c_files):
5356
self.output_c.write("/* Amalgamated source file */\n")
5457
self.output_c.write('#include "%s"\n' % (self.h_out))
5558
if self.h_out == "ruby-upb.h":
56-
self.output_h.write("// Ruby is still using proto3 enum semantics for proto2\n")
59+
self.output_h.write(
60+
"// Ruby is still using proto3 enum semantics for proto2\n"
61+
)
5762
self.output_h.write("#define UPB_DISABLE_CLOSED_ENUM_CHECKING\n")
5863

5964
self.output_h.write("/* Amalgamated source file */\n")
@@ -103,7 +108,9 @@ def _process_include(self, line):
103108
or include.startswith("google")
104109
):
105110
return False
106-
if include and (include.endswith("port/def.inc") or include.endswith("port/undef.inc")):
111+
if include and (
112+
include.endswith("port/def.inc") or include.endswith("port/undef.inc")
113+
):
107114
# Skip, we handle this separately
108115
return True
109116
if include.endswith("hpp"):
@@ -124,7 +131,13 @@ def _process_include(self, line):
124131
self.included.add(include)
125132
self._process_file(h_file, self.output_h)
126133
return True
127-
raise RuntimeError("Couldn't find include: " + include + ", h_files=" + repr(self.h_files))
134+
raise RuntimeError(
135+
"Couldn't find include: "
136+
+ include
137+
+ ", h_files="
138+
+ repr(self.h_files)
139+
)
140+
128141

129142
# ---- main ----
130143

upb/bazel/amalgamation.bzl renamed to google3/third_party/upb/bazel/private/oss/amalgamation.bzl

File renamed without changes.

python/BUILD.bazel

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,9 +7,9 @@
77

88
load("@bazel_skylib//lib:selects.bzl", "selects")
99
load("@bazel_skylib//rules:common_settings.bzl", "bool_flag", "string_flag")
10+
load("//bazel/private:copts.bzl", "UPB_DEFAULT_COPTS")
1011
load("//python:build_targets.bzl", "build_targets")
1112
load("//python:py_extension.bzl", "py_extension")
12-
load("//upb/bazel:build_defs.bzl", "UPB_DEFAULT_COPTS")
1313

1414
build_targets(name = "python")
1515

upb/BUILD

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,9 +8,9 @@
88
load("@bazel_skylib//rules:common_settings.bzl", "bool_flag")
99
load("@rules_cc//cc:defs.bzl", "cc_library")
1010
load("@rules_python//python:defs.bzl", "py_binary")
11+
load("//bazel/private:copts.bzl", "UPB_DEFAULT_COPTS")
1112
load("//bazel/private:upb_proto_library_internal/copts.bzl", "upb_proto_library_copts")
12-
load("//upb/bazel:amalgamation.bzl", "upb_amalgamation")
13-
load("//upb/bazel:build_defs.bzl", "UPB_DEFAULT_COPTS")
13+
load("//bazel/private/oss:amalgamation.bzl", "upb_amalgamation")
1414

1515
package(default_applicable_licenses = ["//:license"])
1616

upb/base/BUILD

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77

88
load("@rules_cc//cc:cc_test.bzl", "cc_test")
99
load("@rules_cc//cc:defs.bzl", "cc_library")
10-
load("//upb/bazel:build_defs.bzl", "UPB_DEFAULT_COPTS")
10+
load("//bazel/private:copts.bzl", "UPB_DEFAULT_COPTS")
1111

1212
package(default_applicable_licenses = ["//:license"])
1313

upb/conformance/BUILD

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -12,11 +12,8 @@ load(
1212
"upb_c_proto_library",
1313
"upb_proto_reflection_library",
1414
)
15-
load(
16-
"//upb/bazel:build_defs.bzl",
17-
"UPB_DEFAULT_COPTS",
18-
"make_shell_script",
19-
)
15+
load("//bazel/private:copts.bzl", "UPB_DEFAULT_COPTS")
16+
load(":build_defs.bzl", "make_shell_script")
2017

2118
package(default_applicable_licenses = ["//:license"])
2219

Lines changed: 0 additions & 45 deletions
Original file line numberDiff line numberDiff line change
@@ -7,51 +7,6 @@
77

88
"""Internal rules for building upb."""
99

10-
_DEFAULT_CPPOPTS = []
11-
_DEFAULT_COPTS = [
12-
# this is a compile error in C++ clang and GNU C, but not clang C by default
13-
"-Werror=incompatible-pointer-types",
14-
# GCC does not seem to support the no_sanitize attribute in some places
15-
# where we use it.
16-
"-Wno-error=attributes",
17-
]
18-
19-
_DEFAULT_CPPOPTS.extend([
20-
"-Wextra",
21-
# "-Wshorten-64-to-32", # not in GCC (and my Kokoro images doesn't have Clang)
22-
"-Wno-unused-parameter",
23-
"-Wno-long-long",
24-
])
25-
_DEFAULT_COPTS.extend([
26-
"-std=c99",
27-
"-Wall",
28-
"-Wstrict-prototypes",
29-
# GCC (at least) emits spurious warnings for this that cannot be fixed
30-
# without introducing redundant initialization (with runtime cost):
31-
# https://gcc.gnu.org/bugzilla/show_bug.cgi?id=80635
32-
#"-Wno-maybe-uninitialized",
33-
])
34-
35-
UPB_DEFAULT_CPPOPTS = select({
36-
"//upb:windows": [],
37-
"//conditions:default": _DEFAULT_CPPOPTS,
38-
}) + select({
39-
"//upb:fasttable_enabled_setting": ["-DUPB_ENABLE_FASTTABLE"],
40-
"//conditions:default": [],
41-
}) + select({
42-
"//conditions:default": [],
43-
})
44-
45-
UPB_DEFAULT_COPTS = select({
46-
"//upb:windows": [],
47-
"//conditions:default": _DEFAULT_COPTS,
48-
}) + select({
49-
"//upb:fasttable_enabled_setting": ["-DUPB_ENABLE_FASTTABLE"],
50-
"//conditions:default": [],
51-
}) + select({
52-
"//conditions:default": [],
53-
})
54-
5510
runfiles_init = """\
5611
# --- begin runfiles.bash initialization v2 ---
5712
# Copy-pasted from the Bazel Bash runfiles library v2.

upb/hash/BUILD

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77

88
load("@rules_cc//cc:cc_test.bzl", "cc_test")
99
load("@rules_cc//cc:defs.bzl", "cc_library")
10-
load("//upb/bazel:build_defs.bzl", "UPB_DEFAULT_COPTS")
10+
load("//bazel/private:copts.bzl", "UPB_DEFAULT_COPTS")
1111

1212
package(default_applicable_licenses = ["//:license"])
1313

0 commit comments

Comments
 (0)