There are 4 different feature sets for every descriptor:
* Runtime/resolved - Used to make runtime decisions
* Source/resolved - Used to make codegen decisions
* Runtime/raw - Used to reason about the original proto file during runtime
* Source/raw - Used to validate features during codegen
All of these will need to be shipped to code generators. While C++ generators can use the C++ runtime to reconstruct these, they won't end up in the FileDescriptorProtos we send to runtimes. Similarly, non-C++ generators wouldn't be able to get them without duplicating our feature resolution logic. This change adds a helper that allows us to bundle all of these into the protos we send to generators.
PiperOrigin-RevId: 547849243
The `unittest_proto3_bad_macros.proto` test is failing on FreeBSD due to the GID_MAX/UID_MAX macros. This is because `port_def.inc` is missing these entries (as well as TRUE/FALSE) for FreeBSD. This PR adds those missing macros.
See compile errors below:
```
[ 87%] Building CXX object CMakeFiles/tests.dir/src/google/protobuf/unittest_preserve_unknown_enum2.pb.cc.o
[ 87%] Building CXX object CMakeFiles/tests.dir/src/google/protobuf/unittest_proto3.pb.cc.o
[ 87%] Building CXX object CMakeFiles/tests.dir/src/google/protobuf/unittest_proto3_arena.pb.cc.o
[ 87%] Building CXX object CMakeFiles/tests.dir/src/google/protobuf/unittest_proto3_arena_lite.pb.cc.o
[ 88%] Building CXX object CMakeFiles/tests.dir/src/google/protobuf/unittest_proto3_bad_macros.pb.cc.o
In file included from /usr/home/jpb/protobuf/src/google/protobuf/unittest_proto3_bad_macros.pb.cc:4:
/usr/home/jpb/protobuf/src/google/protobuf/unittest_proto3_bad_macros.pb.h:71:15: error: expected unqualified-id
constexpr GID GID_MAX = static_cast<GID>(0);
^
/usr/include/sys/limits.h:85:18: note: expanded from macro 'GID_MAX'
#define GID_MAX UINT_MAX /* max value for a gid_t */
^
/usr/include/sys/limits.h:59:18: note: expanded from macro 'UINT_MAX'
#define UINT_MAX __UINT_MAX /* max value for an unsigned int */
^
/usr/include/x86/_limits.h:58:20: note: expanded from macro '__UINT_MAX'
#define __UINT_MAX 0xffffffff /* max value for an unsigned int */
^
In file included from /usr/home/jpb/protobuf/src/google/protobuf/unittest_proto3_bad_macros.pb.cc:4:
/usr/home/jpb/protobuf/src/google/protobuf/unittest_proto3_bad_macros.pb.h:102:15: error: expected unqualified-id
constexpr UID UID_MAX = static_cast<UID>(0);
^
/usr/include/sys/limits.h:86:18: note: expanded from macro 'UID_MAX'
#define UID_MAX UINT_MAX /* max value for a uid_t */
^
/usr/include/sys/limits.h:59:18: note: expanded from macro 'UINT_MAX'
#define UINT_MAX __UINT_MAX /* max value for an unsigned int */
^
/usr/include/x86/_limits.h:58:20: note: expanded from macro '__UINT_MAX'
#define __UINT_MAX 0xffffffff /* max value for an unsigned int */
^
2 errors generated.
gmake[2]: *** [CMakeFiles/tests.dir/build.make:2038: CMakeFiles/tests.dir/src/google/protobuf/unittest_proto3_bad_macros.pb.cc.o] Error 1
gmake[1]: *** [CMakeFiles/Makefile2:1178: CMakeFiles/tests.dir/all] Error 2
gmake: *** [Makefile:146: all] Error 2
```
Closes#13303
COPYBARA_INTEGRATE_REVIEW=https://github.com/protocolbuffers/protobuf/pull/13303 from jbloggz:freebsd_macro_fix 12d6baf35a
PiperOrigin-RevId: 547820047
Unblocks execution of these tests on JRuby FFI.
Automated reformatting of WORKSPACE with documentary comment to ease future debugging of JRuby tests locally.
Closes#13293
COPYBARA_INTEGRATE_REVIEW=https://github.com/protocolbuffers/protobuf/pull/13293 from JasonLunn:object_cache_test_update 7db211a342
PiperOrigin-RevId: 547614702
This will be used for tracking the unresolved feature sets from the original proto file. Notable use-cases for this include:
* Code generators that need to validate their own features
* Runtimes that need to be able to accurately round-trip the original protos
PiperOrigin-RevId: 547610367
These are invalid for UPB which uses immutable string views.
This also adjusts some docs:
- removes a promise in the language of `truncate`
that no reallocation will occur.
- removes language about DerefMut and replaces the `&mut Vec<u8>` analogy
PiperOrigin-RevId: 547603918
MSVC compilers generate warnings that the default destructor is implicitly deleted, which causes errors on /W1. While this is a pedantic warning (error), we can easily make the deletion explicit to avoid these warnings.
PiperOrigin-RevId: 547548886
This CLs adds internally visible arena enabled constructors and copy constructors to ImplicitWeakMessage and WeakRepeatedPtrField.
PiperOrigin-RevId: 547544297
This change adds an arena enabled constructor guarded by `InternalVisibility`. It also moves the existing constructor inline as it's trivial, and implements the default constructor in terms of the (future private) arena constructor.
PiperOrigin-RevId: 547529474
There are whatespace changes because I couldn't get some of the
generated CPreProcessor things to line up in the exact same way.
PiperOrigin-RevId: 547188309
None of these methods are necessary for users to use Optional, but they
are particularly useful and mirror the methods inside of
std::collections::hash_map::Entry.
PiperOrigin-RevId: 547038832
Minor updates to how comments are output to have a method
so folks can directly call Emit to handle multline things correctly.
PiperOrigin-RevId: 546921123