Clone of https://github.com/NixOS/nixpkgs.git (to stress-test knotserver)
1diff --git a/distdir_deps.bzl b/distdir_deps.bzl
2index 9068f50537..b3f45e8653 100644
3--- a/distdir_deps.bzl
4+++ b/distdir_deps.bzl
5@@ -110,6 +110,8 @@ DIST_DEPS = {
6 "protocolbuffers": {
7 "archive": "2de300726a1ba2de9a468468dc5ff9ed17a3215f.tar.gz",
8 "sha256": "6a5f67874af66b239b709c572ac1a5a00fdb1b29beaf13c3e6f79b1ba10dc7c4",
9+ "patches": ["//:upb-clang16.patch"],
10+ "patch_args": ["-p1"],
11 "urls": [
12 "https://mirror.bazel.build/github.com/protocolbuffers/upb/archive/2de300726a1ba2de9a468468dc5ff9ed17a3215f.tar.gz",
13 "https://github.com/protocolbuffers/upb/archive/2de300726a1ba2de9a468468dc5ff9ed17a3215f.tar.gz",
14@@ -131,6 +133,7 @@ DIST_DEPS = {
15 "patches": [
16 "//third_party/grpc:grpc_1.41.0.patch",
17 "//third_party/grpc:grpc_1.41.0.win_arm64.patch",
18+ "//:grpc-upb-clang16.patch",
19 ],
20 "used_in": [
21 "additional_distfiles",
22diff --git a/grpc-upb-clang16.patch b/grpc-upb-clang16.patch
23new file mode 100644
24index 0000000000..69194099db
25--- /dev/null
26+++ b/grpc-upb-clang16.patch
27@@ -0,0 +1,13 @@
28+diff -r -u a/bazel/grpc_deps.bzl b/bazel/grpc_deps.bzl
29+--- a/bazel/grpc_deps.bzl
30++++ b/bazel/grpc_deps.bzl
31+@@ -340,6 +340,8 @@
32+ name = "upb",
33+ sha256 = "6a5f67874af66b239b709c572ac1a5a00fdb1b29beaf13c3e6f79b1ba10dc7c4",
34+ strip_prefix = "upb-2de300726a1ba2de9a468468dc5ff9ed17a3215f",
35++ patches = ["//:upb-clang16.patch"],
36++ patch_args = ["-p1"],
37+ urls = [
38+ "https://storage.googleapis.com/grpc-bazel-mirror/github.com/protocolbuffers/upb/archive/2de300726a1ba2de9a468468dc5ff9ed17a3215f.tar.gz",
39+ "https://github.com/protocolbuffers/upb/archive/2de300726a1ba2de9a468468dc5ff9ed17a3215f.tar.gz",
40+
41+diff -r -u a/third_party/upb/bazel/build_defs.bzl b/third_party/upb/bazel/build_defs.bzl
42+--- a/third_party/upb/bazel/build_defs.bzl 2021-09-25 04:33:41.000000000 +0200
43++++ b/third_party/upb/bazel/build_defs.bzl 2023-11-22 22:27:39.421459688 +0100
44+@@ -34,6 +34,7 @@
45+ "-Wextra",
46+ # "-Wshorten-64-to-32", # not in GCC (and my Kokoro images doesn't have Clang)
47+ "-Werror",
48++ "-Wno-gnu-offsetof-extensions",
49+ "-Wno-long-long",
50+ # copybara:strip_end
51+ ],
52+@@ -48,6 +49,7 @@
53+ "-pedantic",
54+ "-Werror=pedantic",
55+ "-Wall",
56++ "-Wno-gnu-offsetof-extensions",
57+ "-Wstrict-prototypes",
58+ # GCC (at least) emits spurious warnings for this that cannot be fixed
59+ # without introducing redundant initialization (with runtime cost):
60diff --git a/upb-clang16.patch b/upb-clang16.patch
61new file mode 100644
62index 0000000000..f81855181f
63--- /dev/null
64+++ upb-clang16.patch
65@@ -0,0 +1,18 @@
66+--- a/bazel/build_defs.bzl
67++++ b/bazel/build_defs.bzl
68+@@ -34,6 +34,7 @@
69+ "-Wextra",
70+ # "-Wshorten-64-to-32", # not in GCC (and my Kokoro images doesn't have Clang)
71+ "-Werror",
72++ "-Wno-gnu-offsetof-extensions",
73+ "-Wno-long-long",
74+ # copybara:strip_end
75+ ],
76+@@ -48,6 +49,7 @@
77+ "-pedantic",
78+ "-Werror=pedantic",
79+ "-Wall",
80++ "-Wno-gnu-offsetof-extensions",
81+ "-Wstrict-prototypes",
82+ # GCC (at least) emits spurious warnings for this that cannot be fixed
83+ # without introducing redundant initialization (with runtime cost):