This is part of the Printer::Emit() migration, since it allows us to drop some relatively complex logic out of ClassVars/FieldVars, which is an impediment to further migration of message.cc.
The factored-out logic is not the prettiest, but cleaning it up further will require more refactors throughout the compiler.
This CL also changes std::initializer_lists in Printer's interface into absl::Spans, which were not available when the new Printer API was designed, but which are necessary for the new API to work with Printer.
PiperOrigin-RevId: 496441433
--
3eac250226 by Josh Humphries <jhumphries@buf.build>:
add check for custom JSON name conflicts
- also, include check for default JSON name conflicts even in proto2
files (but only warn)
- if custom JSON name conflicts with other default name, only a
warning in proto2
--
b23b387169 by Josh Humphries <jhumphries@buf.build>:
update existing test expectations and add new tests
--
aa34e0ed2f by Josh Humphries <jhumphries@buf.build>:
JSON -> Json
--
fdaa464962 by Josh Humphries <jhumphries@buf.build>:
address review feedback wrt absl string functions
also moves helpers into anonymous namespace
--
6d5f2fc93f by Josh Humphries <jhumphries@buf.build>:
apply clang-format changes; change really long pair type to auto
--
81b5cbe26e by Josh Humphries <jhumphries@buf.build>:
address review feedback
--
8fa8b10e09 by Josh Humphries <jhumphries@buf.build>:
return struct instead of using out param
--
b405717f88 by Josh Humphries <jhumphries@buf.build>:
address review feedback
COPYBARA_INTEGRATE_REVIEW=https://github.com/protocolbuffers/protobuf/pull/10750 from jhump:jh/custom-json-name-validation b405717f88
PiperOrigin-RevId: 496041006
This can be deleted once we automatically re-generate these files, but until then it will make the process easier for google-based workflows.
PiperOrigin-RevId: 495974945
This was removed in
cbd1adc6cf,
but it’s still present in the released versions of Protocol Buffers, and since
it’s a public target it’s part of the public API.
PiperOrigin-RevId: 495828746
This patch fixes a compilation bug introduced in 821b0732f2.
When the `constinit` keyword is available (such as in C++20), putting the `alignas` attribute after `ABSL_CONST_INIT` is an error:
```
ERROR: /home/widders/.cache/bazel/_bazel_widders/25f0d335ca0e01a2fd74c60e90175e8f/external/com_google_protobuf/src/google/protobuf/compiler/java/BUILD.bazel:44:11: Compiling src/google/protobuf/compiler/java/generator_factory.cc failed: (Exit 1): clang failed: error executing command /usr/lib/llvm-16/bin/clang -U_FORTIFY_SOURCE -fstack-protector -Wall -Wthread-safety -Wself-assign -Wunused-but-set-parameter -Wno-free-nonheap-object -fcolor-diagnostics -fno-omit-frame-pointer -g0 ... (remaining 64 arguments skipped)
Use --sandbox_debug to see verbose messages from the sandbox and retain the sandbox build root for debugging
In file included from external/com_google_protobuf/src/google/protobuf/compiler/java/generator_factory.cc:35:
In file included from bazel-out/k8-opt-exec-2B5CBBC6/bin/external/com_google_protobuf/src/google/protobuf/compiler/java/_virtual_includes/java/google/protobuf/compiler/java/context.h:38:
In file included from bazel-out/k8-opt-exec-2B5CBBC6/bin/external/com_google_protobuf/src/google/protobuf/compiler/java/_virtual_includes/names_internal/google/protobuf/compiler/java/helpers.h:45:
In file included from bazel-out/k8-opt-exec-2B5CBBC6/bin/external/com_google_protobuf/src/google/protobuf/_virtual_includes/protobuf_nowkt/google/protobuf/descriptor.pb.h:25:
In file included from bazel-out/k8-opt-exec-2B5CBBC6/bin/external/com_google_protobuf/src/google/protobuf/_virtual_includes/protobuf_lite/google/protobuf/arena.h:53:
bazel-out/k8-opt-exec-2B5CBBC6/bin/external/com_google_protobuf/src/google/protobuf/_virtual_includes/protobuf_lite/google/protobuf/arena_impl.h:584:19: error: an attribute list cannot appear here
ABSL_CONST_INIT alignas(
^~~~~~~~
1 error generated.
```
Therefore, it should be ordered as
1. always attribute-like (`alignas`)
2. sometimes attributes (`ABSL_CONST_INIT`, which may be a lifetime specifier or an attribute)
3. lifetime specifiers (`static`)
4. type etc.
Where it currently is it may be in the midst of lifetime specifiers, and if it is moved to the right it syntactically applies to the type rather than the whole declaration which is also invalid.
If this ordering could not be resolved for all cases it could also be moved to the end, after the name being declared, but we don't need to do that here.
Closes#11248
COPYBARA_INTEGRATE_REVIEW=https://github.com/protocolbuffers/protobuf/pull/11248 from mumbleskates:alignas-fix 496af774f8
PiperOrigin-RevId: 495739359
- Update Skip() to reflect the actual behavior when skipping to / beyond EOS
- Move a paragraph for BackUp() that was wrongly added to ZeroCopyInputStream insteaf of ZeroCopyOutputStream
PiperOrigin-RevId: 495682331
This is out of our public support matrix (https://github.com/google/oss-policies-info) and was only left around for technical reasons that no longer exist.
PiperOrigin-RevId: 495600566
This bumps us to gcc 6 (rather than 4.8), which fully supports C++14, and migrates the Python tests to our Bazel-based system. C#, PHP, and Ruby will remain on CMake + alternate build system for now.
PiperOrigin-RevId: 495501807