Commit Graph

839 Commits

Author SHA1 Message Date
Jisi Liu
b0f661181d Down-integrate from internal branch.
Change-Id: Ieb7a2c2fbf35bc2a8fa65b915a5ecb68c83863e4
2015-08-21 11:18:45 -07:00
Douglas Heriot
5021c4d885 Define GOOGLE_ATTRIBUTE_NOINLINE for MSVC. Workaround for VS2015 Release build compiler bug.
See issue #240 - MSVC in VS2015 seems to inline a function it shouldn't. My original workaround was to disable inlining for the whole file, but I found a way to do it on just this specific function using __declspec(noinline).
Unfortunately __declspec has to go at the start of the function declaration, while __attribute in GCC can go either before or after. I had to move lots of GOOGLE_ATTRIBUTE_NOLINE to make it compile. I have not yet tested this change with GCC.

Will there be other side effects of defining this, given it wasn't previously?

I also noticed a few functions marked with both the 'inline' keyword, and GOOGLE_ATTRIBUTE_NOINLINE - huh? Is there an explanation for this, or is it an oversight?
2015-08-22 02:05:40 +10:00
Jon Skeet
0cb84ee31f Merge pull request #720 from jtattermusch/csharp_fixes
C# fix for TypeInitializer exception.
2015-08-14 22:12:02 +01:00
Jan Tattermusch
fa2fe35dec fix type initialization problem with FileDescriptor 2015-08-14 13:38:34 -07:00
Paul Yang
5c370cc55f Merge pull request #571 from thomasvl/validation_support
Add support for a file listing expected package to objc prefixes for validation.
2015-08-14 13:06:43 -07:00
Thomas Van Lenten
4e43931eaf Add support for a file listing expected package to objc prefixes for validation.
- Add a env var to pass a set of expected prefixes for validation.
- Report warnings/errors based on the expected prefixes vs. the data in the files compiled.
- Use some helpers from common directory.
2015-08-14 13:34:51 -04:00
Jon Skeet
a39ababb7c Allow public access to descriptor.proto as a dependency.
With this in place, generating APIs on github.com/google/googleapis works - previously annotations.proto failed.
Currently there's no access to the annotations (stored as extensions) but we could potentially expose those at a later date.
2015-08-13 12:01:41 +01:00
Feng Xiao
bd11198f69 Fix map fields parsing.
Change-Id: If61e16cea84492474a71bbfe985131ec980b0b0a
2015-08-11 17:19:54 -07:00
Jan Tattermusch
5980629933 Merge pull request #700 from jskeet/remove-packed-hack
Remove our own version of MakeTag now that the main one is fixed.
2015-08-08 11:51:40 -07:00
Jon Skeet
cac4531323 Merge pull request #694 from jskeet/groups
Fix groups handling in C#
2015-08-08 07:24:57 +01:00
Jon Skeet
93bdf36f8b Remove our own version of MakeTag now that the main one is fixed.
"Tested" by regenerating code and observing that there are no changes.
2015-08-07 13:45:56 +01:00
Paul Yang
b76b76ba4f Merge pull request #645 from zsurocking/master
Down integrate. Generate a package name suffix ".nano" for nano messages
2015-08-06 18:12:35 -07:00
Bo Yang
5e47a68b32 Remove unused .pb.h #includes. 2015-08-06 11:23:50 -07:00
Jon Skeet
e7f88ff129 Skip groups properly.
Now the generated code doesn't need to check for end group tags, as it will skip whole groups at a time.
Currently it will ignore extraneous end group tags, which may or may not be a good thing.
Renamed ConsumeLastField to SkipLastField as it felt more natural.
Removed WireFormat.IsEndGroupTag as it's no longer useful.

This mostly fixes issue 688.

(Generated code changes coming in next commit.)
2015-08-06 11:40:32 +01:00
Jon Skeet
ff334a60eb Change ReadTag and PeekTag to just use 0 as a return value for "end of stream", rather than using an awkward out parameter.
This simplifies quite a lot of code.

Generated code in next commit.
2015-08-05 11:23:38 +01:00
Jon Skeet
9df2defa29 Consume unknown fields when parsing.
This is expected to be the cause of the conformance test failures.
Generated code in next commit.
2015-08-05 07:09:41 +01:00
Xiao Hang
9fd0f1526f Merge remote-tracking branch 'upstream/master' 2015-08-04 15:07:44 -07:00
Feng Xiao
dc80689af3 Merge pull request #653 from airtimemedia/master
Various compilation fixes
2015-08-03 10:19:32 -07:00
Nobuaki Sukegawa
992531723c Fix gcc C++11 build 2015-08-01 12:51:40 +09:00
Paul Yang
bfbf35da9e Merge pull request #643 from yukawa/fix_win_unicode_build
Fix build failure on Windows when Unicode build is enabled.
2015-07-31 11:36:51 -07:00
Jon Skeet
f994cfe808 Handle field names of "descriptor" and "types". 2015-07-31 07:00:25 +01:00
Yohei Yukawa
8c27eea686 Fix build failure on Windows when Unicode build is enabled.
This is a follow up CL for e9abc404df,
which breaks build when UNICODE macro is defined.

protoc has explicitly called MBCS version of APIs / funcsions
rather than UTF-16 (wchar_t) version of them regardless of
UNICODE macro definition (and it indeed works as expected).
Hence it makes sense to call GetModuleFileNameA explicitly.
2015-07-30 18:10:17 -07:00
Jan Tattermusch
43a2dee708 refactor umbrella class helpers 2015-07-30 14:54:09 -07:00
Jan Tattermusch
12febd0a76 Merge pull request #632 from google/csharp-experimental
Merge C# proto3 from csharp-experimental to master
2015-07-30 14:51:11 -07:00
Tom Hughes
c6095505dc Move pthread include.
Based on pull request feedback. See commit 60c5222 for why the pthread
header is necessary.
2015-07-30 09:30:31 -07:00
Jon Skeet
3980cf9df1 Prohibit null values for string/bytes fields in generated code. 2015-07-30 13:36:46 +01:00
Jon Skeet
f03271665f More freezing tidy-up; generated code in next commit. 2015-07-30 13:15:45 +01:00
Jan Tattermusch
3783d9a8ad remove the freeze API 2015-07-29 20:26:20 -07:00
Paul Yang
c6dffbcb4f Merge pull request #652 from TeBoring/objectivec
Move the definition of GOOGLE_FALLTHROUGH_INTENDED to port.h
2015-07-29 15:20:47 -07:00
Xiao Hang
801e92007f Generate a package name suffix ".nano" for nano messages
Also introducing an option javanano_use_deprecated_package to allow users to disable the suffix
2015-07-29 15:10:56 -07:00
teboring
5da3fb0666 Move the definition of GOOGLE_FALLTHROUGH_INTENDED to port.h 2015-07-29 14:34:52 -07:00
Tom Hughes
93ba933363 Remove unused private fields.
Fixes compilation when -Wunused-private-field is enabled (e.g., when
using -Wall).
2015-07-29 14:27:05 -07:00
Tom Hughes
56327ecc02 Fix compilation error when using C++11.
The issue occurs when the template type deduction results in NodeType
being const.

Shortened version of compile error:

no matching function for call to 'operator new'
      new (p) NodeType(std::forward<Args>(args)...);

candidate function not viable: no known conversion from 'const
std::__1::basic_string<char, std::__1::char_traits<char>,
std::__1::allocator<char> > *' to 'void *' for 2nd argument; take the
address of the argument with &
inline __attribute__ ((__visibility__("hidden"), __always_inline__))
void* operator new (std::size_t, void* __p) noexcept {return __p;}
2015-07-29 13:00:06 -07:00
LitingLin
67d51ac4f8 Windows is always little-endian. 2015-07-30 02:35:39 +08:00
LitingLin
224010c775 A bug about PROTOBUF_LITTLE_ENDIAN remain undefined on MSVC x64 2015-07-30 01:51:11 +08:00
Tom Hughes
60c5222287 Include pthread.h when using GOOGLE_PROTOBUF_NO_THREADLOCAL.
When GOOGLE_PROTOBUF_NO_THREADLOCAL is defined, classes that depend on
pthread functions are included (such as ThreadLocalStorage).
2015-07-28 16:16:16 -07:00
Nico Weber
58b2decb7b Remove two unused functions. 2015-07-25 19:37:52 -07:00
Jon Skeet
e2368c9022 Fix attribute mistake and regenerate code. 2015-07-22 13:47:16 +01:00
Jon Skeet
4668c3dc39 Remove the usage of attributes for field/method discovery.
Instead, introduce GeneratedCodeInfo which passes in what we need, and adjust the codegen to take account of this.
2015-07-22 11:38:22 +01:00
Jon Skeet
53c399a1d6 Revamp to reflection.
Changes in brief:
1. Descriptor is now the entry point for all reflection.
2. IReflectedMessage has gone; there's now a Descriptor property in IMessage, which is explicitly implemented (due to the static property).
3. FieldAccessorTable has gone away
4. IFieldAccessor and OneofFieldAccessor still exist; we *could* put the functionality straight into FieldDescriptor and OneofDescriptor... I'm unsure about that.
5. There's a temporary property MessageDescriptor.FieldAccessorsByFieldNumber to make the test changes small - we probably want this to go away
6. Discovery for delegates is now via attributes applied to properties and the Clear method of a oneof

I'm happy with 1-3.
4 I'm unsure about - feedback welcome.
5 will go away
6 I'm unsure about, both in design and implementation. Should we have a ProtobufMessageAttribute too? Should we find all the relevant attributes in MessageDescriptor and pass them down, to avoid an O(N^2) scenario?

Generated code changes coming in the next commit.
2015-07-21 12:59:40 +01:00
Jon Skeet
2ee4b56655 Merge pull request #629 from google/master
Integrate changes from upstream/master into csharp-experimental
2015-07-21 12:58:43 +01:00
Jisi Liu
d119a27549 Merge pull request #621 from nico/staticass
Let GOOGLE_COMPILE_ASSERT use static_assert if available.
2015-07-20 17:36:00 -07:00
Joshua Haberman
aba42edd8c Merge pull request #604 from haberman/ruby-conformance
Added Ruby to conformance tests.
2015-07-20 11:06:17 -07:00
Jisi Liu
58035596e7 Merge pull request #622 from pherl/splitheaders
Addming missing includes in stubs headers.
2015-07-17 15:40:42 -07:00
Jisi Liu
51053120db Addming missing includes in stubs headers.
This is to prepare removing those additional headers in common.h

Change-Id: I707d6d8eaf193eb28195a827c7fec738b968ab3e
2015-07-17 15:40:03 -07:00
Nico Weber
56a90a2081 Let GOOGLE_COMPILE_ASSERT use static_assert if available.
The motivation is that gcc 4.8+ and clang trunk warn on unused local
typedefs, which COMPILE_ASSERT adds. After this change, the warning
will be happy at least in C++11 builds. static_assert also produces a
slighly nicer diagnostic than the typedef method.

eb93e8bc43
did the same change in re2.
2015-07-17 14:18:36 -07:00
Jisi Liu
798ed10e7a Merge pull request #613 from pherl/splitheaders
Split up common.h headers
2015-07-17 13:57:59 -07:00
Jie Luo
7648852550 Merge pull request #601 from anandolee/master
ignore UTF-8 BOM
2015-07-17 13:23:29 -07:00
Jisi Liu
4dde2a87a9 Merge branch 'master' of github.com:google/protobuf into splitheader
Change-Id: I5f6cbc2430200e3751ad754cc7ae604338db6f91
2015-07-17 11:36:29 -07:00
Jisi Liu
7b216119ee Update make file for extra headers.
Change-Id: Ifbc415755266ba3d0ffa5661fcd7c7d2e3b32a22
2015-07-17 11:34:33 -07:00
Jon Skeet
0f442a7533 Merge pull request #611 from jskeet/csharp-wrappers
C# wrapper types
2015-07-17 07:29:50 +01:00
Jon Skeet
34878cb14e Fixes from PR review. 2015-07-17 06:41:46 +01:00
Jan Tattermusch
fa544f4835 Merge pull request #586 from jtattermusch/csharp_names_export
Export c# naming routines publicly
2015-07-16 17:33:56 -07:00
Jisi Liu
4e694f7b23 Split up common.h headers
Change-Id: I223783111d743aa5193bf70fa1b9b54c7b4389c3
2015-07-16 16:49:38 -07:00
Josh Haberman
181c7f2636 Added Ruby to conformance tests.
This involved fixing a few important bugs in the
Ruby implementation -- mostly cases of mixing
upb field types and descriptor types (upb field
types do not distinguish between int/sint/fixed/sfixed
like descriptor types do).

Also added protobuf-specific exceptions so parse
errors can be caught specifically.

Change-Id: Ib49d3db976900b2c6f3455c8b88af52cfb86e036
2015-07-16 12:25:55 -07:00
Jie Luo
b2d2cf8b48 ignore UTF-8 BOM if it is in the begining of a proto file 2015-07-16 11:59:21 -07:00
Jon Skeet
8a0312b201 First pass at wrapper types.
- We do still generate the message types, as otherwise reflection breaks, even though it doesn't actually use those types.
- JSON handling hasn't been implemented yet
2015-07-16 17:03:06 +01:00
Jon Skeet
b2ac868493 First part of implementing wrapper types. Not ready yet! 2015-07-16 09:36:30 +01:00
Jan Tattermusch
11002e70c6 Merge remote-tracking branch 'upstream/master' into csharp-experimental 2015-07-15 20:33:59 -07:00
Jon Skeet
db52c9dd58 Address requested change from code review. 2015-07-15 22:04:45 +01:00
Jon Skeet
541b442b99 Don't create nested types (or field accessors) for map types.
I'm sure I've implemented this before, but somehow it's been lost in a maze of twisty little branches, all alike.
2015-07-15 22:04:45 +01:00
Rob Earhart
2f4fb642a3 Install missing headers
Install google/protobuf/stubs/status.h, and google/protobuf/stubs/stringpiece.h -- these are required in order to include google/protobuf/util/type_resolver.h.

Install google/protobuf/stubs/bytestream.h -- this is required in order to include google/protobuf/util/json_util.h.
2015-07-14 17:17:52 -07:00
Jon Skeet
739d13d5d1 Generate the well-known types in C#
This involves:
- Specifying a namespace in each proto (including ones we'd previously missed)
- Updating the generation script
- Changing codegen to implement IReflectedMessage.Fields explicitly (a good thing anyway)
- Changing reflection tests to take account of the explicit interface implementation

Non-generated code in this commit; generated code to follow
2015-07-14 14:26:31 +01:00
Jon Skeet
9c888fa3a2 Changing reflection namespace (part 3)
Change the C# namespace in descriptor.proto to Google.Protobuf.Reflection.
This then means changing where the generated code lives, which means updating the project file...

It also involves regenerating the C++ - which has updated the well-known types as well,
for no terribly obvious reason...
2015-07-14 11:13:52 +01:00
Jon Skeet
9f37de960f Changing reflection namespace (part 1)
- Move types into Google.Protobuf.Reflection
- Change codegen to reflect that in generated types

Generated code changes coming in part 2
2015-07-14 10:24:52 +01:00
Jon Skeet
8482b6c462 Convert package name to PascalCase for C# namespace
Fixes issue 312.
2015-07-14 09:52:35 +01:00
Jan Tattermusch
cacbedf04e export c# naming routines publicly 2015-07-10 13:40:34 -07:00
Jon Skeet
ef3464dff6 Oneof reflection support. (Generated code changes in next commit.) 2015-07-10 14:04:53 +01:00
Jon Skeet
5b9288e47d Use the new JsonFormatter to implement ToString on generated messages. 2015-07-10 11:42:56 +01:00
Bo Yang
9f563bd0d8 Internal local modifications. 2015-07-09 12:39:52 -07:00
Jon Skeet
493e3db985 Codegen changes to support descriptor runtime changes
- Add a partial method called by all constructors
- Generate internal classes for descriptor.proto (only)
- Forbid proto2 descriptors except for descriptor.proto
2015-07-09 08:26:04 +01:00
Jon Skeet
78ea98f56f Implement reflection properly for fields.
- FieldAccessorTable is now non-generic
- We don't have a static field per message type in the umbrella class. (Message descriptors are accessed via the file descriptor.)
- Removed the "descriptor assigner" complication from the descriptor fixup; without extensions, we don't need it
- MapField implements IDictionary (more tests would be good...)
- RepeatedField implements IList (more tests would be good)
- Use expression trees to build accessors. (Will need to test this on various platforms... probably need a fallback strategy just using reflection directly.)
- Added FieldDescriptor.IsMap
- Added tests for reflection with generated messages

Changes to generated code coming in next commit.
2015-07-09 08:24:49 +01:00
George Redivo
7ad8690c5d Fix GOOGLE_PROTOBUF_ATOMICOPS_ERROR syntax error
It's not possible to define "#error" inside a define.
It causes 'error: stray ‘#’ in program' compilation error.

Now the define GOOGLE_PROTOBUF_ATOMICOPS_ERROR is the error message
and it's used along the code together "#error".
2015-07-06 16:56:41 -03:00
Paul Yang
0a27430bd4 Merge pull request #500 from TeBoring/temp
Implement parsing for proto3 primitive repeated fields.
2015-07-01 14:35:19 -07:00
Feng Xiao
ec7bbc76be Merge pull request #551 from ostrovsky/master
MinGW64+MSYS2 compilation issues
2015-07-01 10:36:30 -07:00
Karol Ostrovsky
ee35402244 MinGW64+MSYS2 compilation issues and portable isnan using MathLimits 2015-07-01 10:09:41 +02:00
Paul Yang
eb162dad5f Merge pull request #458 from xfxyjwf/memory_leak
Delete default UnknownFieldSet when shuting down.
2015-06-30 16:45:22 -07:00
Jon Skeet
38d8d3948a Remove unused code in C# codegen 2015-06-30 18:43:57 +01:00
Jon Skeet
f2a27cc2c7 First pass (not yet compiling) at removing all the array handling code from Coded*Stream.
Prod code works, but some tests are broken. Obviously those need fixing, then more tests,
and review benchmarks.
2015-06-30 13:20:30 +01:00
Matt Giuca
43dcbbfec7 Fix "sometimes-uninitialized" warning on Windows Clang. 2015-06-30 17:23:26 +10:00
Jon Skeet
8d83f8d13e Fix for doubly-nested types - issue #307.
No specific test case - if the generated code compiles, the issue is fixed :)
2015-06-29 09:27:54 +01:00
Jon Skeet
fb77cc9d9f More cleanup, based around searches for "Google.ProtocolBuffers"
- Remove some old proto2-based C#-only messages
- Remove the "build" directory which only contained out-of-date files
- Remove the csharp_namespace option from proto2 messages
- Change "Google.ProtocolBuffers" to "Google.Protobuf" in other messages
2015-06-26 20:13:07 +01:00
Jon Skeet
c12833104f Tweaks and more tests for maps
- Change the default message hash code to 1 to be consistent with other code
- Change the empty list/map hash code to 0 as "empty map" is equivalent to "no map"
- Removed map fields from unittest_proto3.proto
- Created map_unittest_proto3.proto which is like map_unittest.proto but proto3-only
- Fixed factory methods in FieldCodec highlighted by using all field types :)
- Added tests for map serialization:
  - Extra fields within entries
  - Entries with value then key
  - Non-contiguous entries for the same map
  - Multiple entries for the same key

Changes to generated code coming in next commit
2015-06-26 10:32:23 +01:00
Jon Skeet
df44ae4413 More map tests, and various production code improvements.
Generated code in next commit.
2015-06-25 12:08:18 +01:00
Jon Skeet
0d684d3420 First pass at map support.
More tests required. Generated code in next commit.
2015-06-25 09:39:28 +01:00
Jon Skeet
d487c322de Regenerated descriptor C++ code 2015-06-25 08:22:56 +01:00
Jisi Liu
658e72d8fb fix compiler warnings.
- control reaches end of non-void function.
- remove a deprecated IsMatch.

Change-Id: Ifdeb15879bbcf591c48dc7fda1cd8994bdf87bb3
2015-06-24 14:56:58 -07:00
Jon Skeet
322ec53161 Revert the change to wire_format.h.
It seems too much code relies on the broken behaviour. See issue #493.
Instead, we reimplement MakeTag just for C#, temporarily.
2015-06-24 17:56:22 +01:00
Jon Skeet
bfee2dfe13 Implement freezing for messages and repeated fields.
Fixes issue #523.
2015-06-24 17:56:22 +01:00
Jan Tattermusch
fbd735c5d7 Merge remote-tracking branch 'upstream/master' into fix_appveyor 2015-06-24 09:00:09 -07:00
Jon Skeet
8c896b259e Implement requested changes for IMessage<T>
1) New line at end of file
2) Make IMessage<T> itself extend IEquatable<T> and IDeepCloneable<T>
2015-06-23 20:04:39 +01:00
Jon Skeet
6c1fe6ea3e Implement Clone.
Fixes issue #527.
2015-06-23 12:42:20 +01:00
Paul Yang
d3d66d7976 Merge pull request #503 from thomasvl/add_nonnill_markup
Add nonnull/nullable/null_resettable markup to ObjC library.
2015-06-19 15:58:31 -07:00
Jon Skeet
50a3a809e8 Merge remote-tracking branch 'upstream/master' into proto3-only 2015-06-19 17:35:01 +01:00
Jon Skeet
cdeda4b876 Minor cleanup.
- Make some members internal
- Remove a lot of FrameworkPortability that isn't required
- Start adding documentation comments
- Remove some more group-based members
- Not passing in "the last tag read" into Read*Array, g
2015-06-19 17:30:13 +01:00
Jisi Liu
a2b7937777 using ::isnan to avoid conflicts with std::isnan for C++11 build.
Change-Id: I057b44eff04c3b0062a4fd4307ce6e4ca1eb952b
2015-06-18 13:35:24 -07:00
Feng Xiao
e9a122eb19 Merge pull request #501 from xfxyjwf/down
Down-integrate from internal code base.
2015-06-17 13:12:11 -07:00
Feng Xiao
818c5eee08 Fix broken builds. 2015-06-17 11:19:46 -07:00
Jon Skeet
e2acd85425 Merged master 2015-06-17 15:03:47 +01:00
Jon Skeet
828b7e61d0 Use the fact that we know the tag size and bytes at codegen time to optimize. 2015-06-17 14:59:10 +01:00
Jisi Liu
78d470c7a5 Make the code independent of config.h
Now the Build tool needs to define -DHAVE_ZLIB and -DHAVE-PTHREAD rather
than providing a config.h

- Make pbconfig.h a manually written file to handle hash conditions
  according to platform related macros.
- Remove #include "config.h" from source code.
- Changed the configure.ac and Makefile.am to pass down the macros.
- Change cmake to pass down the the macros.

Change-Id: I537249d5df8fdeba189706aec436d1ab1104a4dc
2015-06-16 18:27:36 -07:00
Thomas Van Lenten
8c88957ef3 Add nonnil markup to ObjC library.
Add the clang annotations to the objc library and generated code to help with Swift bridging and compiler checks.
2015-06-16 17:04:50 -04:00
Feng Xiao
e96ff30120 Down-integrate from internal code base.
[ci skip]

Change-Id: I9391c09640e0b0b2b21c45a97a1fc91814d95c5d
2015-06-15 18:24:01 -07:00
Bo Yang
a269a6d397 Implement parsing for proto3 primitive repeated fields. Previously, for
proto3 primitive repeated fields, packed data cannot be parsed if
definition is unpacked. Neither is the other way.
2015-06-15 17:19:35 -07:00
Feng Xiao
4479076bbd Merge pull request #488 from AustinSchuh/ruby_test_fix
Modified FindRubyTestDir to use GOOGLE_THIRD_PARTY_PROTOBUF
2015-06-15 16:31:17 -07:00
Jisi Liu
cf141287ea Merge pull request #495 from pherl/master
Make pbconfig.h independent of config.h
2015-06-13 08:44:19 -07:00
Jisi Liu
f48dca5044 Make pbconfig.h independent of config.h
Change-Id: I31ead985b4ac5b02fb7558d34c1da19fd837b50a
2015-06-13 00:01:09 -07:00
Feng Xiao
54a4cccb97 Merge pull request #481 from Qartar/master
Workaround for MSVC's string literal compiler limit.
2015-06-12 14:56:02 -07:00
Qartar
2fe6d7bc57 Workaround for MSVC's string literal compiler limit.
Escape characters don't count for string literal size, no need to pre-generate escape string.

Added unit test to touch enormous cpp generated descriptor.

Updated makefile to include enormous_descriptor.proto

Fixed language compatibility error.
2015-06-12 13:23:09 -07:00
Jon Skeet
a8dae140c6 Fix oneof generator - forgot to provide variables... 2015-06-12 13:11:16 +01:00
Jon Skeet
5a33827eec Move Count checks into the serialization code
I wouldn't expect this to affect anything, but it appears to.
2015-06-12 11:52:14 +01:00
Tamir Duberstein
66463d7e4b Give descriptor.proto a go package
This is currently done in golang/protobuf using `sed`. This change
should simplify things.
2015-06-12 06:40:18 -04:00
Jon Skeet
1b71db1180 Optimization of CalculateSize: avoid foreach over empty lists. 2015-06-12 11:19:50 +01:00
Jon Skeet
4352744859 Use Length to check string/bytes fields for emptiness - it's faster than an equality check. 2015-06-12 11:18:37 +01:00
Jon Skeet
8fcde2cabd Fix oneof behaviour in the face of default values. 2015-06-12 11:17:07 +01:00
Jon Skeet
96ddf01aed Coded*Stream streamlining.
Remove ICodedInputStream and ICodedOutputStream, and rewrite CodedInputStream and CodedOutputStream to be specific to the binary format. If we want to support text-based formats, that can be a whole different serialization mechanism.
2015-06-12 09:53:12 +01:00
Jon Skeet
39aaf21d51 Reimplement enums as int values, and get rid of EnumHelper.
This makes repeated fields really awkward at the moment - but when we reimplement RepeatedField<T> to be backed by an array, we can cast the array directly...
2015-06-11 21:15:36 +01:00
Austin Schuh
1ecef1a2f5 Modified FindRubyTestDir to use GOOGLE_THIRD_PARTY_PROTOBUF 2015-06-10 23:33:07 -07:00
Paul Yang
fb466c13a7 Merge pull request #480 from thomasvl/objc_beta_drop
Beta quality drop of Objective C Support.
2015-06-09 17:17:45 -07:00
Jon Skeet
e38294a62d First pass at the mutable API. Quite a bit more to do - in particular, it's pretty slow right now. 2015-06-09 19:30:44 +01:00
Austin Schuh
fd73235f6b Refactored threadlocal logic.
Refactored the threadlocal logic for Android and IOS into logic in
platform_macro.h which computes a GOOGLE_PROTOBUF_NO_THREADLOCAL
define which is then used elsewhere.  This allows new platforms
without THREADLOCAL to be easily defined.
2015-06-08 18:49:16 -07:00
Thomas Van Lenten
d846b0b059 Beta quality drop of Objective C Support.
- Add more to the ObjC dir readme.
- Merge the ExtensionField and ExtensionDescriptor to reduce overhead.
- Fix an initialization race.
- Clean up the Xcode schemes.
- Remove the class/enum filter.
- Remove some forced inline that were bloating things without proof of performance wins.
- Rename some internal types to avoid conflicts with the well know types protos.
- Drop the use of ApplyFunctions to the compiler/optimizer can do what it wants.
- Better document some possible future improvements.
- Add missing support for parsing repeated primitive fields in packed or unpacked forms.
- Improve -hash.
- Add *Count for repeated and map<> fields to avoid auto create when checking for them being set.
2015-06-08 17:17:22 -04:00
Feng Xiao
b9baa47eaf Merge pull request #468 from AustinSchuh/unsigned_proto
Marked another compiler literal unsigned.
2015-06-06 00:40:51 -07:00
Austin Schuh
307af628e6 Marked another compiler literal unsigned.
When compiling a protobuf with gcc 4.1.2 for powerpc, I ran into
another of the following warning message:

INFO: From Compiling my_proto.pb.cc powerpc-603e-linux-gcc:
bazel-out/local_linux-dbg/genfiles/my_proto.pb.cc: In member
   function `virtual void MyProto::Clear()':
   bazel-out/local_linux-dbg/genfiles/my_proto.pb.cc:223: warning: this
      decimal constant is unsigned only in ISO C90

The line in the proto file that was triggering it was:

  if (_has_bits_[24 / 32] & 4278190080) {
    ZR_(field1_, field2_);
  }

_has_bits_ is a uint32.  The constant mask should therefore be
unsigned.  This change updates the constant to be generated as
unsigned.
2015-06-05 22:46:01 -07:00
Austin Schuh
f4c8627edb Fixed bug in GOOGLE_PREDICT_FALSE.
The GOOGLE_PREDICT_FALSE macro is both incorrect, and doesn't match
the macro definition in glog, which causes conflicts when including
both libraries.  This commit fixes that by making it identical to
what is in glog.
2015-06-05 18:49:25 -07:00
Jon Skeet
f52426827e First stab at new proto3-only code generator 2015-06-05 20:44:05 +01:00
Jie Luo
8fe039a69a Merge pull request #462 from anandolee/master
Migrate writer to printer for C#
2015-06-04 16:15:23 -07:00
Feng Xiao
42f109d7bc Merge pull request #457 from xfxyjwf/cmake
Add cmake support.
2015-06-04 13:35:45 -07:00
Jie Luo
90da3514cd Migrate writer to io::Printer for C# 2015-06-04 11:39:13 -07:00
Feng Xiao
96f1d4ada2 Merge pull request #453 from bakineggs/master
Add protoc path detection for Mac OS
2015-06-03 11:20:08 -07:00
Feng Xiao
37df4b65a4 Delete default UnknownFieldSet when shuting down. 2015-06-02 22:26:00 -07:00
Feng Xiao
dbcfc5e202 Merge pull request #444 from xfxyjwf/vs2010_fix
Fix two issues on vs2010.
2015-06-02 21:32:41 -07:00
Dan Barry
0af3ed5189 Add protoc path detection for Mac OS 2015-06-02 17:11:35 -07:00
Feng Xiao
69433f3810 Merge pull request #305 from ezegomez/master
Fix unittest in i386
2015-06-02 10:53:03 -07:00
Jan Tattermusch
ad174e0391 Merge pull request #441 from anandolee/master
Change the C# enum generator inherit from primitive generator
2015-06-01 12:31:18 -07:00
Feng Xiao
4333edb340 Add cmake support. 2015-05-31 02:28:34 -07:00
Feng Xiao
93d6838ab5 Call copy() only if there is something to copy.
RepeatedField::begin()/end() will return NULL when the content is empty.
Passing these NULL values to std::copy() will result in runtime complains
from some compilers (e.g., vs2010).
2015-05-31 00:15:55 -07:00
Feng Xiao
5a9be2c6f6 Fix MapAllocator::destroy() bug.
destroy() should always call the destructor because the caller may rely on
the destructor to do clean-ups.
2015-05-31 00:14:23 -07:00
Jie Luo
a21a2cf7d3 Change the C# enum generator inherit from primitive generator 2015-05-29 18:07:18 -07:00
Jie Luo
802e1848ad Merge pull request #404 from anandolee/master
Add oneof support for c#
2015-05-29 17:19:46 -07:00
Jie Luo
f7b417ddfe Add oneof support for C# 2015-05-29 13:29:30 -07:00
unknown
ca1c252923 Fixes on visual studio 2008 2015-05-27 17:33:10 -07:00
Feng Xiao
b11d6fe515 Replace "\\" with "/" for windows path names. 2015-05-26 21:33:46 -07:00
TeBoring
9250fbaead In std11, on mac, operator new doesn't take right reference. 2015-05-26 15:50:06 -07:00
Paul Yang
850fe8bfc6 Merge pull request #430 from xfxyjwf/std11_fix
Make MapAllocator work with C++11.
2015-05-26 14:38:10 -07:00
Feng Xiao
bdd105d978 Make MapAllocator work with C++11.
Change-Id: I0e1d9e248403631cb57ebed5231e85d19b9bb3df
2015-05-26 14:34:53 -07:00
Paul Yang
1b540d5729 Merge pull request #429 from xfxyjwf/std11_fix
Remove std::is_trivially_default_constructible.
2015-05-26 14:24:59 -07:00
Bo Yang
83d334f713 When doing make distcheck, a src/google/protobuf/compiler/ruby is created to
put built libraries. This directory hides the one that contains
ruby_generated_code.proto and ruby_generated_code.rb.
2015-05-26 14:13:53 -07:00
Feng Xiao
da0afba8f8 Remove std::is_trivially_default_constructible.
This type_traits is only added after g++ 5.1.0 but we need to support g++ 4+.
2015-05-26 13:54:47 -07:00
Bo Yang
3a5455b34b uint64 has non-trivial destructor on 32-bit windows. This cause arena
allocator to allocate memory twice for uint64.
2015-05-26 13:12:16 -07:00
Jorge Canizales
0d3b36ad54 Adds objectivec_helpers.h to the headers installed by make. 2015-05-26 10:46:09 -07:00
Feng Xiao
4e0c46f93d Explicitly call destructor of Mutex to release resources.
Change-Id: I808f4a3689e723d4490aa9ba6f1c14e3936ddcec
2015-05-25 19:04:00 -07:00
Feng Xiao
72f17c4367 Make hash_map forward constructor parameters to its base class.
We use a custom allocator for map fields and this allocator must be
passed correctly to hash_map to make sure it's allocated properly
with our custom allocator.

Change-Id: Ie59fa24bf11ff28ffd0fa870e24e456c66b2b9c5
2015-05-25 18:18:29 -07:00
Bo Yang
a9332e201d Copy two data files from ruby/tests to src/google/compiler/ruby. Tests in src/google/compiler/ruby depend on these two files, but they were missed in language distributions other than ruby 2015-05-25 16:04:36 -07:00
Bo Yang
cf603a9dfa Fix bugs on windows. 2015-05-24 23:03:05 -07:00
Bo Yang
f87e5b7e74 Fix C2385: accessing parent classes' member without specifying is ambiguous. 2015-05-24 00:13:26 -07:00
Feng Xiao
55df12194f Merge pull request #341 from yukawa/fix-undef-GOOGLE_PROTOBUF_MISSING_HASH
Undef GOOGLE_PROTOBUF_MISSING_HASH after it is used.
2015-05-22 15:56:34 -07:00
Paul Yang
48f95941bc Merge pull request #410 from thomasvl/objc_alpha2_drop
Objective C Second Alpha Drop
2015-05-22 14:12:15 -07:00
Thomas Van Lenten
1dcc329427 Objective C Second Alpha Drop
- Style fixups in the code.
- map<> serialization fixes and more tests.
- Autocreation of map<> fields (to match repeated fields).
- @@protoc_insertion_point(global_scope|imports).
- Fixup proto2 syntax extension support.
- Move all startup code to +initialize so it happen on class usage and not app startup.
- Have generated headers use forward declarations and move imports into generated code, reduces what is need at compile time to speed up compiled and avoid pointless rippling of rebuilds.
2015-05-22 14:27:31 -04:00
Paul Yang
d94e65afda Merge pull request #413 from TeBoring/master
down-integrate internal changes
2015-05-21 20:11:26 -07:00
Bo Yang
5db217305f down-integrate internal changes 2015-05-21 19:32:02 -07:00
Paul Yang
e1000189bf Merge pull request #411 from xfxyjwf/master
Add default import paths for descriptor.proto and well-known protos.
2015-05-21 18:45:23 -07:00
Feng Xiao
1aacb4fbbf Include well-known types in Java runtime.
Change-Id: I816fe2fac7fccbcd96dd8510c7c9b5e7996aeadc
2015-05-21 17:28:05 -07:00
Feng Xiao
e9abc404df Add default import paths for descriptor.proto and other well-known types to protoc.
Change-Id: I4afa295de4c8ed2a4cd0919cf84aedcd1327d9a5
2015-05-21 16:45:47 -07:00
Paul Yang
c3480926f9 Merge pull request #402 from thomasvl/objc_on_win
Getting the ObjC generator building on Windows.
2015-05-21 11:20:15 -07:00
Austin Schuh
e826837f7e Marked compiler literal unsigned.
When compiling a protobuf with gcc 3.3.2 for powerpc, I ran into the
following warning message:

INFO: From Compiling my_proto.pb.cc powerpc-603e-linux-gcc:
bazel-out/local_linux-dbg/genfiles/my_proto.pb.cc: In member
   function `virtual void MyProto::Clear()':
   bazel-out/local_linux-dbg/genfiles/my_proto.pb.cc:223: warning: this
      decimal constant is unsigned only in ISO C90

The line in the proto file that was triggering it was:

  if (_has_bits_[24 / 32] & 4278190080) {
    ZR_(field1_, field2_);
  }

_has_bits_ is a uint32.  The constant mask should therefore be
unsigned.  This change updates the constant to be generated as
unsigned.
2015-05-19 23:22:20 -07:00
Thomas Van Lenten
ce55ff9441 Getting the ObjC generator building on Windows.
Remove the ClassList support (maybe bring it back in the future).
Trim the includes to hopefully get a working Window build.
Add some more returns after switches for compilers that warn even when all values of the enum are handled.
Use ghtonl instead of htonl.
Change the use of [u]int(8,32)_t within the ObjC generator code to [u]int(8,32) to match the rest of the compiler.
Add objective-c generator files to Visual Studio project.
2015-05-19 20:25:19 -04:00
Thomas Van Lenten
ffa2e377f3 Post csharp landing fixup.
Re-add the objc prefix that got removed by accident.
Regenerate the generated descriptors (C++ and ObjC).
2015-05-18 12:57:33 -04:00
Jie Luo
aa8c951ef5 Merge pull request #384 from google/csharp
Merge protobuf C# into master (only C# proto2 is supported)
2015-05-14 14:54:36 -07:00
Jan Tattermusch
4111310830 Merge branch 'master' of github.com:google/protobuf into integrate_from_master 2015-05-13 13:35:02 -07:00
Jon Skeet
998b5ba20d Remove the C#-specific field_presence_test.proto, using unittest_no_field_presence.proto instead.
This is the start of establishing a C# namespace of "Google.ProtocolBuffers.TestProtos.Proto3" for proto3-syntax protos.
We could optionally split the directory structure as well into Proto2 and Proto3 for clarity.
2015-05-13 17:34:02 +01:00
Feng Xiao
33c92803d5 Include generated code of well-known types in protobuf C++ runtime.
Change-Id: I23dee1c1d27b6440658680e9c273b6250213123c
2015-05-11 13:47:41 -07:00
Feng Xiao
de5d45500c Merge branch 'gerrit' to 'master' 2015-05-07 14:07:30 -07:00
Feng Xiao
03e170446b Merge pull request #101 from fizbin/fix_large_proto_java_code
Fix java compilation issues when processing large .proto files
2015-05-07 10:28:52 -07:00
Jon Skeet
8172561995 Regenerate descriptor.pb.cc after csharp_namespace change 2015-05-07 09:14:00 +01:00
Paul Yang
b89de5f6e0 Merge pull request #331 from thomasvl/objc_alpha1_drop
Objective C compiler plugin and runtime
2015-05-06 17:32:07 -07:00
Tamir Duberstein
9d9d0b70de Don't hard-code the python path 2015-05-06 17:02:57 -04:00
Jon Skeet
7879f82ddc Add C# namespace to .proto files (e.g. descriptors, unit tests) 2015-05-06 19:07:14 +01:00
Thomas Van Lenten
30650d81d9 Alpha 1 drop of Google's Objective C plugin and runtime support for protobufs. 2015-05-06 13:19:14 -04:00
Yohei Yukawa
cf9f603e8d Undef GOOGLE_PROTOBUF_MISSING_HASH after it is used.
This is a follow up CL for df184fba00
(Id937e25bbb35968ee76c92bd4a8ce6247408c443), which added
  #undef GOOGLE_PROTOBUF_MISSING_HASH
where GOOGLE_PROTOBUF_MISSING_HASH macro is never defined.

With this CL, GOOGLE_PROTOBUF_MISSING_HASH macro will be cleaned up
after it is used.
2015-05-04 01:25:52 -07:00
Jie Luo
d9e3063eb0 Remove ClsCompliant declarations from C# code 2015-05-01 14:08:23 -07:00
Jisi Liu
0e122ce8c5 Merge pull request #315 from brianduff/sync_from_aosp
Sync nanoproto from AOSP
2015-04-29 10:44:35 -07:00
Jeff Davidson
9d546c85bd Generate a CREATOR for each Parcelable message.
This is less ideal from a dex count perspective because it requires a
new variable for each message, and because most apps have proguard
rules that will ensure that CREATOR classes are retained.

However, it is required to be able to use nano protos inside of AIDL
files, as the autogenerated AIDL code fails to compile otherwise. This
is a substantial benefit as it allows for backwards-compatible
parameters and return types in AIDL methods along the lines of
safeparcel.

Bug: 19084705
Change-Id: I66a2c0424b96cf8ff6b631b186cc4f9407dfc1f4
2015-04-28 13:12:37 -07:00
Brian Duff
a69b461e1e Inline unknownFieldData{Equals,HashCode} to generated code.
It turns out dex (apparently) was inlining these protected final
methods from ExtendableMessageNano into every message class. Removing
these methods from the base class and inlining their code reduces
the method count by 2 methods / message when the store_unknown_fields
option is on.

Change-Id: I0aa09f2016d39939c4c8b8219601793b8fab301f
2015-04-28 13:02:33 -07:00
Brian Duff
dac7e02d2b Expose generate_clear as an option.
I wasn't able to get the clear() method to inline into the
constructor when optimizations are on in proguard. As a result,
every message has an extra superfluous kept method assuming the
app never uses clear() directly.

There are a couple of instances where setting this option false is
necessary in order to get code dexing successfully without hitting
the method limit, e.g. https://goto.google.com/tltzq

In this example, I tried turning on the method/inlining/unique and
method/inlining/short optimizations before resorting to adding the
generate_clear option, but the method count did not decrease. The
clear() methods were contributing over a thousand extra methods.

Change-Id: If6a9651d6a59cdf70b1040d8248779710ac73105
2015-04-28 13:01:48 -07:00
Jeff Davidson
ec19be2f3c Generate @IntDef annotations for nanoproto enums.
@IntDef is a support library annotation which allows build tools to
determine the valid set of values for a given integer field when that
field is intended to be restricted like an enum. This avoids the
overhead of enums while still allowing for compile-time type checking
in most circumstances.

Change-Id: Iee02e0b49a8e069f6456572f538e0a0d301fdfd5
2015-04-28 13:01:12 -07:00
Brian Duff
d099a88685 Add clone() method support for nano.
Upstreamed from Another Place (cr/57247854).

Change-Id: I2aaf59544c0f5ae21a51891d8a5eeda1dc722c90
2015-04-28 12:42:55 -07:00
Brian Duff
fb96026b8d When no clear() is generated, still initialize fields.
https://android-review.googlesource.com/#/c/67890/ removed field
initialization from the ctor, making it just call clear() instead.

When I added the generate_clear option back (as part of the reftypes
compat mode) in https://android-review.googlesource.com/#/c/109530/,
I forgot to ensure that what clear() used to do was inlined in the
constructor.

This change fixes NPEs that are happening for users of
reftypes_compat_mode who rely on unset repeated fields being empty
arrays rather than null.

Change-Id: Idb58746c60f4a4054b7ebb5c3b0e76b16ff88184
2015-04-28 12:28:05 -07:00
Brian Duff
ec2f244554 Fix bug with large extension field numbers.
Previously, extensions with field numbers greater than 268435455 would
result in a compile time error in generated code that looks something
like this:

Foo.java:3178: error: integer number too large: 3346754610
                3346754610);

This is because we were trying to represent the tag number (an
unsigned int) using a java int constant, but java int constants are
signed, and can't exceed Integer.MAX_VALUE.

Fixed by declaring it as a long instead, and casting it down to an
int in the implementation. This is safe, because the tag value always
fits in 32 bis.

Change-Id: If2017bacb4e20af667eaeaf9b65ddc2c30a7709f
2015-04-28 11:42:01 -07:00
Bo Yang
46bd60b92f Modify directory to use in test
Change-Id: Iede1dc4e70427663e0d3c5304fa86b3aebf492b7
2015-04-27 17:44:45 -07:00
Bo Yang
9a12185323 Handle un-handled cases of TestOneof2 in unittest
Change-Id: I8f082ee3117ed873ab472a539867ff7cae58e8fd
2015-04-27 14:47:04 -07:00
Jie Luo
5a811ac6f9 fix bug for Field Presence 2015-04-27 14:27:21 -07:00
Jie Luo
856ced5d76 Field Presence: remove has methods for optional non-message fields in proto3 2015-04-27 14:00:47 -07:00
Ezequiel Lara Gomez
fb28d73204 Fix unittest in i386 2015-04-27 09:35:27 +01:00
Bo Yang
d6c9f644ac internal changes
Change-Id: I66f216c70a19f44637090878d7e442d4d0f8991b
2015-04-24 18:09:55 -07:00
Feng Xiao
7ddbf87008 Include well-known type protos in "make install". 2015-04-23 20:23:58 -07:00
Feng Xiao
ca9d1a053a Include all well-known type protos.
Change-Id: I122f1cee71a8a739ea603e52582cb0fa9698f0ed
2015-04-20 11:30:31 -07:00
Jie Luo
7646eec9ce Merge pull request #288 from jtattermusch/csharp_protobuf_reviewed
C# protocol buffers (initial pull request)
2015-04-17 17:29:39 -07:00
Jan Tattermusch
7eaf438031 forgot to include header files into automake template 2015-04-17 16:51:43 -07:00
Jan Tattermusch
8e190d498c temporarily removing csharp_umbrella_namespace file option 2015-04-17 11:07:02 -07:00