Commit Graph

1959 Commits

Author SHA1 Message Date
Joshua Haberman
a9f11d7d64
Updated version to 3.12.0-rc1. (#7449) 2020-04-30 15:34:10 -07:00
Thomas Van Lenten
2db0e9812a Use the new helpers from Descriptor. 2020-04-28 16:22:53 -04:00
Joshua Haberman
4b4e667435
Merge pull request #7435 from haberman/sync-stage
Integrate from Piper for C++, Java, and Python
2020-04-28 09:52:24 -07:00
Nick Presta
75553e9ec8 Update shell format in installation instructions. 2020-04-28 08:51:04 -07:00
Joshua Haberman
32e5deb1ac Sync from Piper @308829107
PROTOBUF_SYNC_PIPER
2020-04-28 08:40:38 -07:00
Thomas Van Lenten
b0e2792842 [ObjC] Generation changes around proto3 optional.
- Bump the version marker in the generated code.
- Set the flag to say clear on zero is known.
- Set clear on zero for proto3 optional fields that aren't tagged as optional.
- Also tweak the call from some C generated code to use different apis with
  better validation.
- Mark the ObjC generator as supporting the proto3 optional feature.
- Regenerate the WKTs to get the new flags.
2020-04-24 16:36:15 -04:00
Thomas Van Lenten
e9b0c92659 [ObjC] Update oneof generation for proto3 optional.
- Don't make an OneofGenerator for synthetic oneofs.
- Update the field calculations that determine if hasbits are needed to
  know about synthetic oneofs and ignore them.
2020-04-24 16:36:15 -04:00
Thomas Van Lenten
59f8dd5faf [ObjC] Move over some custom logic to Descriptor provided info.
FieldDescriptor::has_presence works as a replacement for the custom logic we
had for FieldGenerator::WantsHasProperty(), and is already proto3 optional
aware.
2020-04-24 16:36:15 -04:00
Jon Skeet
4dcafd12cb Support proto3 optional fields in the C# generator
Most changes are:

- Introducing new helpers of SupportsPresenceApi and RequiresPresenceBit. This allows calling code to be a lot clearer about what it's interested in.
- Changing most previous IsProto2 calls to use one of the two new helper methods
- Avoiding treating synthetic oneofs as regular ones
- Some slight refactoring in csharp_primitive_field to avoid code duplication
- Comments explaining what we want when, so the next maintainer doesn't need to do the detective work I did!

This change deliberately doesn't modify the API surface of any
existing code. The only change to previously-generated C# should be
making presence bits more efficient in proto2.

Once proto3 optional fields are supported, we can consider further
changes to make the proto2 and proto3 generated API surface more
consistent (e.g. adding presence API for message fields and oneofs).
2020-04-24 17:39:14 +01:00
Jon Skeet
4c9613f226 Register that the C# compiler supports proto3 presence.
(It doesn't yet, but will in the next commits...)
2020-04-24 17:39:14 +01:00
Joshua Haberman
6b759688a1
Implemented proto3 presence for Ruby. (#7406)
* WIP.

* WIP.

* Builds and runs. Tests need to be updated to test presence.

* Ruby: proto3 presence is passing all tests.

* Fixed a bug where empty messages has the wrong oneof count.
2020-04-23 12:54:25 -07:00
Joshua Haberman
81573b9256
Merge pull request #7402 from haberman/sync-stage
Integrate from Piper for C++, Java, and Python
2020-04-20 12:28:08 -07:00
Thomas Van Lenten
a8a400da5d Move to constexpr. 2020-04-20 11:31:04 -04:00
Joshua Haberman
bb30225f06 Sync from Piper @307316823
PROTOBUF_SYNC_PIPER
2020-04-19 18:01:44 -07:00
Joshua Haberman
74ad62759e Sync from Piper @306496510
PROTOBUF_SYNC_PIPER
2020-04-14 12:55:41 -07:00
Joshua Haberman
fb32b5a343 Sync from Piper @305960231
PROTOBUF_SYNC_PIPER
2020-04-10 15:57:18 -07:00
Joshua Haberman
fb12ad7a7f Fixed compile errors from lack of "override" keyword. 2020-04-08 12:35:30 -07:00
Joshua Haberman
b7742c51fd Sync from Piper @305505267
PROTOBUF_SYNC_PIPER
2020-04-08 10:30:17 -07:00
Joshua Haberman
503a2116aa Sync from Piper @305053102
PROTOBUF_SYNC_PIPER
2020-04-06 09:57:03 -07:00
Joshua Haberman
c649397029
Set execute bit on files if and only if they begin with (#!). (#7347)
* Set execute bit on files if and only if they begin with (#!).

Git only tracks the 'x' (executable) bit on each file. Prior to this
CL, our files were a random mix of executable and non-executable.
This change imposes some order by making files executable if and only
if they have shebang (#!) lines at the beginning.

We don't have any executable binaries checked into the repo, so
we shouldn't need to worry about that case.

* Added fix_permissions.sh script to set +x iff a file begins with (#!).
2020-04-01 15:28:25 -07:00
Joshua Haberman
462b928d63 Fixed build errors on MacOS. 2020-03-31 20:34:36 -07:00
Joshua Haberman
243558921f Some fixes to make the tests pass on Bazel. 2020-03-31 17:31:32 -07:00
Joshua Haberman
b99994d994 Sync from Piper @304070343
PROTOBUF_SYNC_PIPER
2020-03-31 16:25:37 -07:00
Charlie Jiang
70fc0f0275 Force to use U.S. English for Win32 error messages (#4317) 2020-03-20 08:49:47 -07:00
Joshua Haberman
4567a21004
Removed unnecessary includes of well-known types from PHP generator. (#7311)
* Removed unnecessary includes of well-known types from PHP generator.

* Changed some split calls to work properly with the Copybara import rewrites.
2020-03-18 16:29:29 -07:00
Yannic
88a3193f42 Remove check that C++ version is at least C++98 2020-03-10 13:04:59 -07:00
Yannic
edb67ec446 Fix typo 2020-03-10 13:04:59 -07:00
Yannic
8a5a242364 Add compile-time tests for RTTI to port_def.inc
This eliminates an ODR violation where users compile and install
Protobuf's C++ runtime without RTTI but do not define
GOOGLE_PROTOBUF_NO_RTTI when compiling their project with
the generated code.
2020-03-10 13:04:59 -07:00
Egor Pugin
c798ba18a9 bug: #7076 adds ERROR to windows portability files 2020-02-21 14:49:18 -08:00
wsw2016
b96241b1b7 Improves performance of json_stream_parser.cc by factor 1000
JsonStreamParser::GetNextTokenType() uses HasPrefixString a lot on StringPiece as input. For each call two std::strings are constructed, compared and destroyed. Parsing of json-files with 50-60 MB in debug mode takes minutes.
2020-02-19 11:33:46 -08:00
Rafi Kamal
0eb476b696 Merge branch 3.11.x to master 2020-02-18 16:42:47 -08:00
Yannic
f0cb9cdb95
[bazel] Move Java runtime/toolchains into //java (#7190)
* [bazel] Move Java runtime/toolchains into //java

This change moves `java_library` targets from the top-level BUILD file
into `//java/{core,lite,util}` and declares `alias` targets to point to
their new locations (hence, this is not a breaking change).

This will allow users that don't use Java to stop depending on
`@rules_java` (e.g. as requested in
https://github.com/bazelbuild/rules_scala/pull/989#issuecomment-583405161).

Note that there is no intention to deprecate + remove the top-level
targets in the foreseeable future.

* Add BUILD files in //java to java_EXTRA_DIST
2020-02-13 13:04:14 -08:00
Rafi Kamal
c74057267d
Update protobuf version (#7206) 2020-02-12 14:41:16 -08:00
Chuck Atkins
8312c36567 Intel compiler: ifdef out an incorrectly evaluated is_pod type trait 2020-02-12 13:08:59 -08:00
Yannic Bonenberger
06ae5d8042 Use PROTOBUF_RTTI from port_def.inc macro instead of checking for absence of GOOGLE_PROTOBUF_NO_RTTI macro
These were the only 2 remaining occurences of this pattern.
2020-02-12 13:08:25 -08:00
Martin Pärtel
82a057596e Destruct CodedOutputStream instead of using Trim() 2020-02-12 13:06:52 -08:00
Martin Pärtel
f6902d6afe Made protoc --descriptor_set_out deterministic.
Repeatable protoc output is useful because it's sometimes
checked into version control, and rerunning protoc should
not generate unnecessary diffs.
2020-02-12 13:06:52 -08:00
Paul Yang
537c5aa9e0
Aggregate Metadata Files (#7155) (#7194)
Instead of calling initOnce of dependencies, initialize metadata of dependencies in the same file.

Needs to pass aggregate_metadata option to protoc to trigger, e.g.:
--php_out=aggregate_metadata=foo#bar:generated_dir
For each input file, transitive dependencies (including itself), whose package name has the prefix of foo or bar, will be aggregated, in which their metadata string will be aggregated in the same internalAddGeneratedFile call. For other dependencies, initOnce is called as before.

This feature is EXPERIMENTAL. DO NOT USE!!!
2020-02-11 15:44:40 -08:00
Stephan Hartmann
32caf511c8 Fix GCC build with PROTOBUF_USE_DLLS enabled
GCC does not allow mixing __attribute__(()) syntax alignas()
syntax. Re-use approach from chromium base/compiler_specific.h
2020-02-11 14:30:57 -08:00
Paul Yang
ac70b7cfb7
Aggregate Metadata Files (#7155)
Instead of calling initOnce of dependencies, initialize metadata of dependencies in the same file.

Needs to pass aggregate_metadata option to protoc to trigger, e.g.:
--php_out=aggregate_metadata=foo#bar:generated_dir
For each input file, transitive dependencies (including itself), whose package name has the prefix of foo or bar, will be aggregated, in which their metadata string will be aggregated in the same internalAddGeneratedFile call. For other dependencies, initOnce is called as before.

This feature is EXPERIMENTAL. DO NOT USE!!!
2020-02-10 11:27:27 -08:00
Thomas Van Lenten
56c48ae592 Revisit how the WKTs are bundled with ObjC.
There are have been a few issues around people using case sensitive file systems
what Xcode/clang does when looking at the paths. In attempts to solve one set of
warnings, new warnings/errors happened in different setup. So, to hopefully put
these problem away for got, move the WKTs to be at the same level as the other
headers.

- Revert "Override CocoaPods module to lowercase (#6464)"
  This reverts commit 479ba8226b.
- Move WKTs to the objectivec directory and make the old headers shim back to
  the new locations.
- Update objectivec/generate_well_known_types.sh to check them one at a time
  and to deal with the new locations for them.

Fixes #6803
2020-02-10 12:20:05 -05:00
Rafi Kamal
345df38dd3
Update protobuf version (#7143) 2020-01-31 13:47:09 -08:00
Dave MacLachlan
302f3ea1e5 Update GOOGLE_PROTOBUF_OBJC_VERSION to 30003 2020-01-30 13:08:32 -05:00
Dave MacLachlan
f4a6b99339 Block subclassing
Add GPB_FINAL macro to block subclassing of generated ObjC classes.
2020-01-24 11:51:37 -05:00
Thomas Van Lenten
effb65d4e3 Move a few more size() > 0 calls over to !empty(). 2020-01-23 12:53:52 -05:00
Dave MacLachlan
e3c2af349f Clean up some warning messages.
- size vs empty
- unused decls
2020-01-22 14:42:57 -05:00
Dave MacLachlan
aa1d7e7c48 Change Objective C class references to using macros.
Allows easy replacing of class names in generated code using #define to redefine class names at compile time.
2020-01-21 12:12:11 -05:00
dmaclach
f4b6e4a561 Clean up use of size() > 0 to !empty() 2020-01-15 17:54:53 -05:00
dmaclach
836d81a826 Fix up parameter name so decl matches defn
className -> class_name
2020-01-15 17:53:56 -05:00
Dave MacLachlan
74956e1c15 Use references to Objective C classes instead of looking classes up by name.
This should reduce binary size slightly, small performance improvement, and improve linkage by forcing references to all used classes.

Note that this maintains backwards compatibility for sources generated by older protoc for the time being. If you want the benefits
you will need to recompile your protos with the newer protoc.
2020-01-15 15:01:53 -05:00