-
Notifications
You must be signed in to change notification settings - Fork 5
/
Copy pathgrpc-v1.54.0.patch
546 lines (510 loc) · 21.9 KB
/
grpc-v1.54.0.patch
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
diff --git a/CMakeLists.txt b/CMakeLists.txt
index ec370e9..d0a489e 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -374,22 +374,22 @@ if (NOT EXISTS ${CMAKE_CURRENT_SOURCE_DIR}/third_party/googleapis)
)
endif()
# Setup external proto library at third_party/opencensus-proto/src with 2 download URLs
-if (NOT EXISTS ${CMAKE_CURRENT_SOURCE_DIR}/third_party/opencensus-proto/src)
+if (NOT EXISTS ${CMAKE_CURRENT_SOURCE_DIR}/third_party/opencensus-proto)
# Download the archive via HTTP, validate the checksum, and extract to third_party/opencensus-proto/src.
download_archive(
- ${CMAKE_CURRENT_SOURCE_DIR}/third_party/opencensus-proto/src
+ ${CMAKE_CURRENT_SOURCE_DIR}/third_party/opencensus-proto
https://storage.googleapis.com/grpc-bazel-mirror/github.com/census-instrumentation/opencensus-proto/archive/v0.3.0.tar.gz
b7e13f0b4259e80c3070b583c2f39e53153085a6918718b1c710caf7037572b0
- opencensus-proto-0.3.0/src
+ opencensus-proto-0.3.0
)
endif()
-if (NOT EXISTS ${CMAKE_CURRENT_SOURCE_DIR}/third_party/opencensus-proto/src)
+if (NOT EXISTS ${CMAKE_CURRENT_SOURCE_DIR}/third_party/opencensus-proto)
# Download the archive via HTTP, validate the checksum, and extract to third_party/opencensus-proto/src.
download_archive(
- ${CMAKE_CURRENT_SOURCE_DIR}/third_party/opencensus-proto/src
+ ${CMAKE_CURRENT_SOURCE_DIR}/third_party/opencensus-proto
https://github.com/census-instrumentation/opencensus-proto/archive/v0.3.0.tar.gz
b7e13f0b4259e80c3070b583c2f39e53153085a6918718b1c710caf7037572b0
- opencensus-proto-0.3.0/src
+ opencensus-proto-0.3.0
)
endif()
# Setup external proto library at third_party/xds with 2 download URLs
@@ -4910,6 +4910,10 @@ endif()
endif()
+file(MAKE_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}/_deps/include/upb/third_party/utf8_range")
+file(COPY third_party/upb/third_party/utf8_range/utf8_range.h
+ DESTINATION "${CMAKE_CURRENT_BINARY_DIR}/_deps/include/upb/third_party/utf8_range" USE_SOURCE_PERMISSIONS)
+
add_library(upb
third_party/upb/third_party/utf8_range/naive.c
third_party/upb/third_party/utf8_range/range2-neon.c
@@ -4955,6 +4959,7 @@ endif()
target_include_directories(upb
PUBLIC $<INSTALL_INTERFACE:${gRPC_INSTALL_INCLUDEDIR}> $<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/include>
+ "$<BUILD_INTERFACE:${CMAKE_CURRENT_BINARY_DIR}/_deps/include>"
PRIVATE
${CMAKE_CURRENT_SOURCE_DIR}
${_gRPC_ADDRESS_SORTING_INCLUDE_DIR}
@@ -4981,6 +4986,11 @@ if(gRPC_INSTALL)
LIBRARY DESTINATION ${gRPC_INSTALL_LIBDIR}
ARCHIVE DESTINATION ${gRPC_INSTALL_LIBDIR}
)
+ install(
+ FILES
+ "${CMAKE_CURRENT_BINARY_DIR}/_deps/include/upb/third_party/utf8_range/utf8_range.h"
+ DESTINATION include/upb/third_party/utf8_range
+ )
endif()
diff --git a/src/core/ext/gcp/metadata_query.cc b/src/core/ext/gcp/metadata_query.cc
index 9383dae..5057732 100644
--- a/src/core/ext/gcp/metadata_query.cc
+++ b/src/core/ext/gcp/metadata_query.cc
@@ -46,15 +46,15 @@ namespace grpc_core {
TraceFlag grpc_metadata_query_trace(false, "metadata_query");
-constexpr const char MetadataQuery::kZoneAttribute[] =
+const char MetadataQuery::kZoneAttribute[] =
"/computeMetadata/v1/instance/zone";
-constexpr const char MetadataQuery::kClusterNameAttribute[] =
+const char MetadataQuery::kClusterNameAttribute[] =
"/computeMetadata/v1/instance/attributes/cluster-name";
-constexpr const char MetadataQuery::kRegionAttribute[] =
+const char MetadataQuery::kRegionAttribute[] =
"/computeMetadata/v1/instance/region";
-constexpr const char MetadataQuery::kInstanceIdAttribute[] =
+const char MetadataQuery::kInstanceIdAttribute[] =
"/computeMetadata/v1/instance/id";
-constexpr const char MetadataQuery::kIPv6Attribute[] =
+const char MetadataQuery::kIPv6Attribute[] =
"/computeMetadata/v1/instance/network-interfaces/0/ipv6s";
MetadataQuery::MetadataQuery(
diff --git a/src/core/lib/event_engine/event_engine.cc b/src/core/lib/event_engine/event_engine.cc
index 3164b18..0c13f53 100644
--- a/src/core/lib/event_engine/event_engine.cc
+++ b/src/core/lib/event_engine/event_engine.cc
@@ -20,10 +20,10 @@
namespace grpc_event_engine {
namespace experimental {
-constexpr EventEngine::TaskHandle EventEngine::TaskHandle::kInvalid = {-1, -1};
-constexpr EventEngine::ConnectionHandle
+const EventEngine::TaskHandle EventEngine::TaskHandle::kInvalid = {-1, -1};
+const EventEngine::ConnectionHandle
EventEngine::ConnectionHandle::kInvalid = {-1, -1};
-constexpr EventEngine::DNSResolver::LookupTaskHandle
+const EventEngine::DNSResolver::LookupTaskHandle
EventEngine::DNSResolver::LookupTaskHandle::kInvalid = {-1, -1};
bool operator==(const EventEngine::TaskHandle& lhs,
diff --git a/src/core/lib/surface/server.cc b/src/core/lib/surface/server.cc
index 2071a23..31087d9 100644
--- a/src/core/lib/surface/server.cc
+++ b/src/core/lib/surface/server.cc
@@ -154,7 +154,8 @@ struct Server::RegisteredMethod {
const grpc_server_register_method_payload_handling payload_handling;
const uint32_t flags;
// One request matcher per method.
- std::unique_ptr<RequestMatcherInterface> matcher;
+ // Fix unique_ptr can not be used before declaration.
+ std::shared_ptr<RequestMatcherInterface> matcher;
};
//
@@ -705,7 +706,7 @@ void Server::Start() {
if (unregistered_request_matcher_ == nullptr) {
unregistered_request_matcher_ = std::make_unique<RealRequestMatcher>(this);
}
- for (std::unique_ptr<RegisteredMethod>& rm : registered_methods_) {
+ for (std::shared_ptr<RegisteredMethod>& rm : registered_methods_) {
if (rm->matcher == nullptr) {
rm->matcher = std::make_unique<RealRequestMatcher>(this);
}
@@ -812,7 +813,7 @@ Server::RegisteredMethod* Server::RegisterMethod(
"grpc_server_register_method method string cannot be NULL");
return nullptr;
}
- for (std::unique_ptr<RegisteredMethod>& m : registered_methods_) {
+ for (std::shared_ptr<RegisteredMethod>& m : registered_methods_) {
if (streq(m->method, method) && streq(m->host, host)) {
gpr_log(GPR_ERROR, "duplicate registration for %s@%s", method,
host ? host : "*");
@@ -877,7 +878,7 @@ void Server::KillPendingWorkLocked(grpc_error_handle error) {
if (started_) {
unregistered_request_matcher_->KillRequests(error);
unregistered_request_matcher_->ZombifyPending();
- for (std::unique_ptr<RegisteredMethod>& rm : registered_methods_) {
+ for (std::shared_ptr<RegisteredMethod>& rm : registered_methods_) {
rm->matcher->KillRequests(error);
rm->matcher->ZombifyPending();
}
@@ -1153,7 +1154,7 @@ void Server::ChannelData::InitTransport(RefCountedPtr<Server> server,
size_t slots = 2 * num_registered_methods;
registered_methods_ =
std::make_unique<std::vector<ChannelRegisteredMethod>>(slots);
- for (std::unique_ptr<RegisteredMethod>& rm : server_->registered_methods_) {
+ for (std::shared_ptr<RegisteredMethod>& rm : server_->registered_methods_) {
Slice host;
Slice method = Slice::FromExternalString(rm->method);
const bool has_host = !rm->host.empty();
diff --git a/src/core/lib/surface/server.h b/src/core/lib/surface/server.h
index d635da5..3f98bea 100644
--- a/src/core/lib/surface/server.h
+++ b/src/core/lib/surface/server.h
@@ -140,7 +140,7 @@ class Server : public InternallyRefCounted<Server>,
}
void set_config_fetcher(
- std::unique_ptr<grpc_server_config_fetcher> config_fetcher) {
+ std::shared_ptr<grpc_server_config_fetcher> config_fetcher) {
config_fetcher_ = std::move(config_fetcher);
}
@@ -444,7 +444,9 @@ class Server : public InternallyRefCounted<Server>,
ChannelArgs const channel_args_;
RefCountedPtr<channelz::ServerNode> channelz_node_;
- std::unique_ptr<grpc_server_config_fetcher> config_fetcher_;
+
+ // Fix static_assert(sizeof(_Tp) >= 0, "cannot delete an incomplete type");
+ std::shared_ptr<grpc_server_config_fetcher> config_fetcher_;
std::vector<grpc_completion_queue*> cqs_;
std::vector<grpc_pollset*> pollsets_;
@@ -465,10 +467,11 @@ class Server : public InternallyRefCounted<Server>,
bool starting_ ABSL_GUARDED_BY(mu_global_) = false;
CondVar starting_cv_;
- std::vector<std::unique_ptr<RegisteredMethod>> registered_methods_;
+ std::vector<std::shared_ptr<RegisteredMethod>> registered_methods_;
// Request matcher for unregistered methods.
- std::unique_ptr<RequestMatcherInterface> unregistered_request_matcher_;
+ // Fix static_assert(sizeof(_Tp) >= 0, "cannot delete an incomplete type");
+ std::shared_ptr<RequestMatcherInterface> unregistered_request_matcher_;
// The shutdown refs counter tracks whether or not shutdown has been called
// and whether there are any AllocatingRequestMatcher requests that have been
diff --git a/third_party/upb/cmake/make_cmakelists.py b/third_party/upb/cmake/make_cmakelists.py
index d64c14f..f267d24 100755
--- a/third_party/upb/cmake/make_cmakelists.py
+++ b/third_party/upb/cmake/make_cmakelists.py
@@ -39,8 +39,13 @@ import sys
import textwrap
import os
+def MappingThirdPartyDep(dep):
+ if dep.startswith("/third_party/"):
+ return dep[13:]
+ return dep
+
def StripFirstChar(deps):
- return [dep[1:] for dep in deps]
+ return [MappingThirdPartyDep(dep[1:]) for dep in deps]
def IsSourceFile(name):
return name.endswith(".c") or name.endswith(".cc")
@@ -81,11 +86,16 @@ class BuildFileFunctions(object):
if list(filter(IsSourceFile, files)):
# Has sources, make this a normal library.
- self.converter.toplevel += "add_library(%s\n %s)\n" % (
- kwargs["name"],
- "\n ".join(found_files)
+ output_name = kwargs["name"]
+ if output_name.lower() != "upb":
+ output_name = "upb-" + output_name
+ self.converter.toplevel += "add_library({0}\n {1})\nset_target_properties({0} PROPERTIES OUTPUT_NAME \"{2}\")\n".format(
+ kwargs["name"],
+ "\n ".join(found_files),
+ output_name
)
- self._add_deps(kwargs)
+ self.converter.export_targets.append(kwargs["name"])
+ self._add_deps(kwargs, " PUBLIC")
else:
# Header-only library, have to do a couple things differently.
# For some info, see:
@@ -93,6 +103,7 @@ class BuildFileFunctions(object):
self.converter.toplevel += "add_library(%s INTERFACE)\n" % (
kwargs["name"]
)
+ self.converter.export_targets.append(kwargs["name"])
self._add_deps(kwargs, " INTERFACE")
def cc_binary(self, **kwargs):
@@ -249,11 +260,13 @@ class Converter(object):
self.prelude = ""
self.toplevel = ""
self.if_lua = ""
+ self.export_targets = []
def convert(self):
return self.template % {
"prelude": converter.prelude,
"toplevel": converter.toplevel,
+ "export_targets": ' '.join(converter.export_targets),
}
template = textwrap.dedent("""\
@@ -284,6 +297,16 @@ class Converter(object):
FORCE)
endif()
+ set(CMAKE_INSTALL_RPATH_USE_LINK_PATH YES)
+ set(CMAKE_BUILD_RPATH_USE_ORIGIN YES)
+ if (UNIX AND NOT APPLE)
+ set(CMAKE_INSTALL_RPATH "$ORIGIN" "$ORIGIN/../lib64" "$ORIGIN/../lib")
+ set(CMAKE_BUILD_RPATH "$ORIGIN" "$ORIGIN/../lib64" "$ORIGIN/../lib")
+ elseif (APPLE)
+ set(CMAKE_INSTALL_RPATH "@loader_path" "@loader_path/../lib64" "@loader_path/../lib")
+ set(CMAKE_BUILD_RPATH "@loader_path" "@loader_path/../lib64" "@loader_path/../lib")
+ endif()
+
# When using Ninja, compiler output won't be colorized without this.
include(CheckCXXCompilerFlag)
CHECK_CXX_COMPILER_FLAG(-fdiagnostics-color=always SUPPORTS_COLOR_ALWAYS)
@@ -315,10 +338,181 @@ class Converter(object):
elseif(UNIX)
set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -Wl,--build-id")
endif()
-
+ if (MSVC)
+ add_compile_options(/wd4146 /wd4703 -D_CRT_SECURE_NO_WARNINGS)
+ endif()
+
enable_testing()
- %(toplevel)s
+
+ if (UPB_BUILD_CODEGEN)
+ find_package(absl CONFIG REQUIRED)
+ find_package(protobuf CONFIG REQUIRED)
+ endif()
+
+ add_library(descriptor_upb_proto)
+ set_target_properties(descriptor_upb_proto PROPERTIES OUTPUT_NAME "upb-descriptor_upb_proto")
+
+ file(MAKE_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}/_deps/include/upb/third_party/utf8_range")
+ file(COPY ../third_party/utf8_range/utf8_range.h
+ DESTINATION "${CMAKE_CURRENT_BINARY_DIR}/_deps/include/upb/third_party/utf8_range" USE_SOURCE_PERMISSIONS)
+ add_library(utf8_range
+ ../third_party/utf8_range/naive.c
+ ../third_party/utf8_range/range2-neon.c
+ ../third_party/utf8_range/range2-sse.c
+ "${CMAKE_CURRENT_BINARY_DIR}/_deps/include/upb/third_party/utf8_range/utf8_range.h"
+ )
+ set_target_properties(utf8_range PROPERTIES OUTPUT_NAME "upb-utf8_range")
+ target_include_directories(utf8_range PUBLIC
+ "$<BUILD_INTERFACE:${CMAKE_CURRENT_BINARY_DIR}/_deps/include>"
+ "$<INSTALL_INTERFACE:include>")
+
+ %(toplevel)s
+
+ set(UPB_DESCRIPTOR_PROTO "${UPB_HOST_INCLUDE_DIR}/google/protobuf/descriptor.proto")
+ if (UPB_BUILD_CODEGEN)
+ set(UPB_CODEGEN_TARGETS protoc-gen-upb protoc-gen-upbdefs protoc-gen-lua)
+
+ add_executable(protoc-gen-upbdefs
+ ../upbc/common.h
+ ../upbc/common.cc
+ ../upbc/protoc-gen-upbdefs.cc
+ )
+ target_link_libraries(protoc-gen-upbdefs PRIVATE
+ absl::flat_hash_map
+ absl::strings
+ protobuf::libprotobuf
+ protobuf::libprotoc
+ )
+
+ add_executable(protoc-gen-upb
+ ../upbc/common.h
+ ../upbc/common.cc
+ ../upbc/protoc-gen-upb.cc
+ )
+ add_dependencies(protoc-gen-upb mini_table upb)
+ target_link_libraries(protoc-gen-upb PRIVATE
+ mini_table
+ port
+ upb
+ absl::flat_hash_map
+ absl::flat_hash_set
+ absl::strings
+ protobuf::libprotobuf
+ protobuf::libprotoc
+ )
+
+ add_executable(protoc-gen-lua
+ ../upb/bindings/lua/upbc.cc
+ )
+ target_link_libraries(protoc-gen-lua PRIVATE
+ absl::strings
+ protobuf::libprotobuf
+ protobuf::libprotoc
+ )
+
+ set(PROTOC_PROGRAM "\$<TARGET_FILE:protobuf::protoc>")
+ set(PROTOC_GEN_UPB_PROGRAM "\$<TARGET_FILE:protoc-gen-upb>")
+ set(PROTOC_GEN_UPBDEFS_PROGRAM "\$<TARGET_FILE:protoc-gen-upbdefs>")
+ set(PROTOC_GEN_UPBLUA_PROGRAM "\$<TARGET_FILE:protoc-gen-lua>")
+ else()
+ find_program(PROTOC_PROGRAM protoc)
+ find_program(PROTOC_GEN_UPB_PROGRAM protoc-gen-upb)
+ find_program(PROTOC_GEN_UPBDEFS_PROGRAM protoc-gen-upbdefs)
+ find_program(PROTOC_GEN_UPBLUA_PROGRAM protoc-gen-lua)
+ endif()
+
+ set(UPB_DESCRIPTOR_SOURCES
+ "${CMAKE_CURRENT_BINARY_DIR}/google/protobuf/descriptor.upb.h"
+ "${CMAKE_CURRENT_BINARY_DIR}/google/protobuf/descriptor.upb.c"
+ "${CMAKE_CURRENT_BINARY_DIR}/google/protobuf/descriptor.upbdefs.h"
+ "${CMAKE_CURRENT_BINARY_DIR}/google/protobuf/descriptor.upbdefs.c"
+ )
+
+ unset(UPB_DESCRIPTOR_UPB_WELL_KNOWN_TYPES_LUAS)
+ unset(UPB_DESCRIPTOR_UPB_WELL_KNOWN_TYPES_HEADERS)
+ unset(UPB_DESCRIPTOR_UPB_WELL_KNOWN_TYPES_SOURCES)
+ unset(UPB_DESCRIPTOR_UPB_WELL_KNOWN_TYPES_PROTO_FILES)
+ set(UPB_DESCRIPTOR_UPB_WELL_KNOWN_TYPES_PROTO_NAMES any api duration empty
+ field_mask source_context struct timestamp type wrappers)
+ foreach(PROTO_NAME IN LISTS UPB_DESCRIPTOR_UPB_WELL_KNOWN_TYPES_PROTO_NAMES)
+ list(APPEND UPB_DESCRIPTOR_UPB_WELL_KNOWN_TYPES_PROTO_FILES
+ "${UPB_HOST_INCLUDE_DIR}/google/protobuf/${PROTO_NAME}.proto")
+ list(APPEND UPB_DESCRIPTOR_UPB_WELL_KNOWN_TYPES_LUAS
+ "${CMAKE_CURRENT_BINARY_DIR}/google/protobuf/${PROTO_NAME}_pb.lua")
+ list(APPEND UPB_DESCRIPTOR_UPB_WELL_KNOWN_TYPES_HEADERS
+ "${CMAKE_CURRENT_BINARY_DIR}/google/protobuf/${PROTO_NAME}.upb.h"
+ "${CMAKE_CURRENT_BINARY_DIR}/google/protobuf/${PROTO_NAME}.upbdefs.h")
+ list(APPEND UPB_DESCRIPTOR_UPB_WELL_KNOWN_TYPES_SOURCES
+ "${CMAKE_CURRENT_BINARY_DIR}/google/protobuf/${PROTO_NAME}.upb.c"
+ "${CMAKE_CURRENT_BINARY_DIR}/google/protobuf/${PROTO_NAME}.upbdefs.c")
+ endforeach()
+
+ add_custom_command(
+ OUTPUT ${UPB_DESCRIPTOR_SOURCES}
+ "${CMAKE_CURRENT_BINARY_DIR}/google/protobuf/descriptor_pb.lua"
+ ${UPB_DESCRIPTOR_UPB_WELL_KNOWN_TYPES_LUAS}
+ ${UPB_DESCRIPTOR_UPB_WELL_KNOWN_TYPES_HEADERS}
+ ${UPB_DESCRIPTOR_UPB_WELL_KNOWN_TYPES_SOURCES}
+ DEPENDS "${UPB_DESCRIPTOR_PROTO}" ${UPB_DESCRIPTOR_UPB_WELL_KNOWN_TYPES_PROTO_FILES}
+ COMMAND
+ "${PROTOC_PROGRAM}"
+ "-I${UPB_HOST_INCLUDE_DIR}"
+ "--plugin=protoc-gen-upb=${PROTOC_GEN_UPB_PROGRAM}"
+ "--plugin=protoc-gen-upbdefs=${PROTOC_GEN_UPBDEFS_PROGRAM}"
+ "--plugin=protoc-gen-lua=${PROTOC_GEN_UPBLUA_PROGRAM}"
+ "--upb_out=${CMAKE_CURRENT_BINARY_DIR}"
+ "--upbdefs_out=${CMAKE_CURRENT_BINARY_DIR}"
+ "--lua_out=${CMAKE_CURRENT_BINARY_DIR}"
+ "${UPB_DESCRIPTOR_PROTO}" ${UPB_DESCRIPTOR_UPB_WELL_KNOWN_TYPES_PROTO_FILES}
+ )
+
+ target_sources(descriptor_upb_proto PRIVATE ${UPB_DESCRIPTOR_SOURCES})
+ target_link_libraries(descriptor_upb_proto PUBLIC upb)
+
+ add_library(well_known_types ${UPB_DESCRIPTOR_UPB_WELL_KNOWN_TYPES_HEADERS}
+ ${UPB_DESCRIPTOR_UPB_WELL_KNOWN_TYPES_SOURCES})
+ set_target_properties(well_known_types PROPERTIES OUTPUT_NAME "upb-well_known_types")
+ target_link_libraries(well_known_types PUBLIC upb)
+
+ include(GNUInstallDirs)
+ install(
+ DIRECTORY ../upb
+ DESTINATION include
+ FILES_MATCHING
+ PATTERN "*.h"
+ PATTERN "*.hpp"
+ PATTERN "*.inc"
+ PATTERN "*.int.h"
+ )
+ install(
+ FILES
+ "${CMAKE_CURRENT_BINARY_DIR}/google/protobuf/descriptor.upb.h"
+ "${CMAKE_CURRENT_BINARY_DIR}/google/protobuf/descriptor.upbdefs.h"
+ "${CMAKE_CURRENT_BINARY_DIR}/google/protobuf/descriptor_pb.lua"
+ ${UPB_DESCRIPTOR_UPB_WELL_KNOWN_TYPES_LUAS}
+ ${UPB_DESCRIPTOR_UPB_WELL_KNOWN_TYPES_HEADERS}
+ DESTINATION include/google/protobuf
+ )
+ install(
+ FILES
+ "${CMAKE_CURRENT_BINARY_DIR}/_deps/include/upb/third_party/utf8_range/utf8_range.h"
+ DESTINATION include/upb/third_party/utf8_range
+ )
+ install(
+ DIRECTORY ../upb/bindings/lua/
+ DESTINATION share/upb/upb/bindings/lua
+ )
+ target_include_directories(upb PUBLIC $<INSTALL_INTERFACE:include>)
+ install(TARGETS
+ descriptor_upb_proto
+ well_known_types
+ utf8_range
+ %(export_targets)s
+ ${UPB_CODEGEN_TARGETS}
+ EXPORT upb-config
+ )
+ install(EXPORT upb-config NAMESPACE upb:: DESTINATION "${CMAKE_INSTALL_LIBDIR}/cmake/upb")
""")
diff --git a/third_party/upb/upb/bindings/lua/def.c b/third_party/upb/upb/bindings/lua/def.c
index 602dbaf..699c3c2 100644
--- a/third_party/upb/upb/bindings/lua/def.c
+++ b/third_party/upb/upb/bindings/lua/def.c
@@ -617,7 +617,7 @@ const upb_FileDef* lupb_FileDef_check(lua_State* L, int narg) {
static int lupb_FileDef_Dependency(lua_State* L) {
const upb_FileDef* f = lupb_FileDef_check(L, 1);
- int index = luaL_checkint(L, 2);
+ int index = luaL_checkinteger(L, 2);
const upb_FileDef* dep = upb_FileDef_Dependency(f, index);
lupb_wrapper_pushwrapper(L, 1, dep, LUPB_FILEDEF);
return 1;
@@ -631,7 +631,7 @@ static int lupb_FileDef_DependencyCount(lua_State* L) {
static int lupb_FileDef_enum(lua_State* L) {
const upb_FileDef* f = lupb_FileDef_check(L, 1);
- int index = luaL_checkint(L, 2);
+ int index = luaL_checkinteger(L, 2);
const upb_EnumDef* e = upb_FileDef_TopLevelEnum(f, index);
lupb_wrapper_pushwrapper(L, 1, e, LUPB_ENUMDEF);
return 1;
@@ -645,7 +645,7 @@ static int lupb_FileDef_enumcount(lua_State* L) {
static int lupb_FileDef_msg(lua_State* L) {
const upb_FileDef* f = lupb_FileDef_check(L, 1);
- int index = luaL_checkint(L, 2);
+ int index = luaL_checkinteger(L, 2);
const upb_MessageDef* m = upb_FileDef_TopLevelMessage(f, index);
lupb_wrapper_pushwrapper(L, 1, m, LUPB_MSGDEF);
return 1;
diff --git a/third_party/upb/upb/bindings/lua/upb.c b/third_party/upb/upb/bindings/lua/upb.c
index 3d59cdd..8e7333e 100644
--- a/third_party/upb/upb/bindings/lua/upb.c
+++ b/third_party/upb/upb/bindings/lua/upb.c
@@ -61,11 +61,13 @@
/* Lua compatibility code *****************************************************/
/* Shims for upcoming Lua 5.3 functionality. */
+#if LUA_VERSION_NUM < 503
static bool lua_isinteger(lua_State* L, int argn) {
LUPB_UNUSED(L);
LUPB_UNUSED(argn);
return false;
}
+#endif
/* Utility functions **********************************************************/
diff --git a/third_party/upb/upb/bindings/lua/upbc.cc b/third_party/upb/upb/bindings/lua/upbc.cc
index 78e1473..2d353b0 100644
--- a/third_party/upb/upb/bindings/lua/upbc.cc
+++ b/third_party/upb/upb/bindings/lua/upbc.cc
@@ -79,7 +79,7 @@ static void PrintString(int max_cols, absl::string_view* str,
} else if (ch == '\'') {
printer->PrintRaw("\\'");
max_cols--;
- } else if (isprint(ch)) {
+ } else if (isprint(static_cast<int>(static_cast<unsigned char>(ch)))) {
printer->WriteRaw(&ch, 1);
max_cols--;
} else {
diff --git a/third_party/upb/upb/internal/decode.h b/third_party/upb/upb/internal/decode.h
index 708874c..604df7e 100644
--- a/third_party/upb/upb/internal/decode.h
+++ b/third_party/upb/upb/internal/decode.h
@@ -38,7 +38,7 @@
#include "upb/decode.h"
#include "upb/internal/upb.h"
#include "upb/msg_internal.h"
-#include "third_party/utf8_range/utf8_range.h"
+#include "upb/third_party/utf8_range/utf8_range.h"
/* Must be last. */
#include "upb/port_def.inc"
diff --git a/third_party/upb/upb/text_encode.c b/third_party/upb/upb/text_encode.c
index dfb213f..a3fb230 100644
--- a/third_party/upb/upb/text_encode.c
+++ b/third_party/upb/upb/text_encode.c
@@ -295,7 +295,7 @@ static void txtenc_map(txtenc* e, const upb_Map* map, const upb_FieldDef* f) {
#define CHK(x) \
do { \
if (!(x)) { \
- return false; \
+ return NULL; \
} \
} while (0)