Commit 320d024
authored
feat: add compat.re2 2022-04-01 + a
* feat: add compat.re2 2022-04-01 + a `upb` feature on compat.protobuf
The index-side half of gRPC's P1: with these, a future grpc-m adaptation
repo has to vendor only gRPC's own source.
Before writing either, the biggest unknown was settled by compiling gRPC
1.83.0 TUs directly with mcpp's gcc@16.1.0 — no patches, no configure, no
codegen, include paths only:
OK src/core/lib/slice/slice.cc
OK src/core/lib/surface/call.cc (one of core's heaviest)
OK src/core/lib/promise/activity.cc
OK src/core/ext/upb-gen/google/protobuf/any.upb_minitable.c
OK src/cpp/common/channel_arguments.cc
OK src/cpp/client/channel_cc.cc (the C++ API layer)
and the SSL layer 4/4 against compat.openssl 3.5.1's headers rather than
BoringSSL. gRPC's tree also has no .h.in / config.h.cmake at all, confirming
it needs no configure step.
compat.re2 is pinned to 2022-04-01 because that IS gRPC 1.83.0's pin (its
third_party/re2 submodule is commit 0c5616d == that tag) and gRPC's xds
matchers are written against this API — RE2 swapped re2::StringPiece for
absl::string_view in its 2023 releases, so a newer one is not a drop-in.
Sources follow upstream's RE2_SOURCES: all of re2/*.cc (upstream keeps tests
one level down in re2/testing/) plus util/rune.cc and util/strutil.cc named
individually, because the other TUs in util/ define main() — a dependency's
objects all enter the consumer's link — and util/pcre.cc would drag in libpcre.
The `upb` feature needs no new download: upb has lived in protobuf's own
tarball since v22. Two things there are not guesswork:
* upb/**/*.c CANNOT be globbed. It pulls 14 extra files including TWO
ALTERNATIVE BUILDS of the descriptor tables (upb/reflection/stage0/ and
upb/reflection/cmake/); compiling more than one is a duplicate-symbol
failure. Hence a transcription of libupb_srcs (63 files).
* descriptor.upb_minitable.c must be added ON TOP of that list even though
it is not in it — upstream's cmake/libupb.cmake adds exactly that file as
bootstrap_sources, because the whole reflection layer reaches the
descriptor tables through upb/reflection/descriptor_bootstrap.h. Omitting
it compiles fine and fails only at link time.
include_dirs gains the tarball root and the bootstrap dir. Those are
unconditional because `features` can gate sources/defines/deps but NOT include
dirs, and the feature's own TUs need them; both are additive rather than
shadowing (the root supplies only upb/…, since protobuf's C++ headers live
under src/, and the bootstrap dir supplies google/protobuf/descriptor.upb*.h,
a different file name from the C++ descriptor.h beside it).
Verified cold with the pinned mcpp 2026.8.3.3, gcc@16.1.0,
MCPP_INDEX_MIRROR=GLOBAL, MCPP_BUILD_CACHE=local, target/ removed first:
abseil test result ok. 1 passed; 0 failed (17.84s)
protobuf test result ok. 1 passed; 0 failed (40.88s)
protobuf-gzip test result ok. 1 passed; 0 failed (51.99s)
protobuf-upb test result ok. 1 passed; 0 failed (70.20s)
re2 test result ok. 1 passed; 0 failed ( 2.35s)
The first three are regressions: this change touches compat.protobuf's
include_dirs, so the existing members had to be re-checked.
Object counts verified: re2 links 23 .o (22 sources + the test);
protobuf-upb links 296 = 151 abseil + 80 protobuf + 64 upb + 1 test. The upb
feature was verified negatively too — reverting the member to a bare
`protobuf = "35.1"` drops it to exactly 232 and fails the link with undefined
upb_Arena_Init / upb_Decode / upb_DefPool_Free AND
google__protobuf__FileDescriptorProto_msg_init, which is precisely the
bootstrap descriptor table the second bullet above is about.
The upb test drives BOTH runtimes over the same bytes: the C++ runtime builds
and serializes a FileDescriptorProto, then upb parses it, loads it into a
upb_DefPool and answers reflection queries — and asserts that a name never
declared does NOT resolve.
CN mirror published and closed-loop checked: mcpp-res/re2@2022-04-01 returns
http=200 and is byte-identical to GLOBAL.
* fix(re2): define NOMINMAX on windows — <windows.h> ate Regexp::min()/max()
CI's windows leg failed with
re2/regexp.cc:389: error: too few arguments provided to function-like macro invocation
re2/regexp.cc:389: error: reference to non-static member function must be called
which is not the usual std::min/std::max collision. RE2's util/mutex.h includes
<windows.h>, and its min/max function-like macros then eat RE2's OWN accessors:
regexp.cc compares `a->min() == b->min()` and `a->max() == b->max()` on Regexp.
Upstream's CMake never spells NOMINMAX out because a CMake consumer normally
sets it project-wide; in the index each package carries its own flags.
linux re-verified (test result ok); the windows path is only checkable in CI.upb feature on compat.protobuf (#148)1 parent 163bce4 commit 320d024
10 files changed
Lines changed: 557 additions & 3 deletions
File tree
- .agents/docs
- pkgs/c
- tests/examples
- protobuf-upb
- tests
- re2
- tests
Lines changed: 123 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 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 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
39 | 39 | | |
40 | 40 | | |
41 | 41 | | |
42 | | - | |
| 42 | + | |
43 | 43 | | |
44 | 44 | | |
45 | 45 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
36 | 36 | | |
37 | 37 | | |
38 | 38 | | |
39 | | - | |
| 39 | + | |
40 | 40 | | |
41 | 41 | | |
42 | 42 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
43 | 43 | | |
44 | 44 | | |
45 | 45 | | |
| 46 | + | |
46 | 47 | | |
47 | 48 | | |
48 | 49 | | |
49 | 50 | | |
| 51 | + | |
50 | 52 | | |
51 | 53 | | |
52 | 54 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
76 | 76 | | |
77 | 77 | | |
78 | 78 | | |
79 | | - | |
| 79 | + | |
| 80 | + | |
| 81 | + | |
| 82 | + | |
| 83 | + | |
| 84 | + | |
| 85 | + | |
| 86 | + | |
| 87 | + | |
| 88 | + | |
| 89 | + | |
| 90 | + | |
| 91 | + | |
| 92 | + | |
80 | 93 | | |
81 | 94 | | |
82 | 95 | | |
| |||
199 | 212 | | |
200 | 213 | | |
201 | 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 | + | |
202 | 307 | | |
203 | 308 | | |
204 | 309 | | |
| |||
0 commit comments