Commit Graph

103 Commits

Author SHA1 Message Date
Jon Skeet
f265fb8152 Merge pull request #1401 from jskeet/enum-casing
Enum casing in C#
2016-04-20 09:01:58 +01:00
Jon Skeet
75626ed79c Add C# codegen changes to enum value names (mostly C++)
Overview of changes:
- A new C#-specific command-line option, legacy_enum_values to revert to the old behavior
- When legacy_enum_values isn't specified, we strip the enum name as a prefix, and PascalCase the value name
- A new attribute within the C# code so that we can always tell the original in-proto name

Regenerating the C# code with legacy_enum_values leads to code which still compiles and works - but
there's more still to do.
2016-04-20 03:45:59 +01:00
Jisi Liu
0de06f54bc Merge branch 'master' of github.com:google/protobuf 2016-03-30 11:43:44 -07:00
Jisi Liu
3b3c8abb96 Integrate google internal changes. 2016-03-30 11:39:59 -07:00
Thomas Van Lenten
79a23c435c Shrink ObjC overhead (generated size and some runtime sizes)
NOTE: This is a binary breaking change as structure sizes have changed size
and/or order.

- Drop capturing field options, no other options were captured and other mobile
  targeted languages don't try to capture this sort information (saved 8
  bytes for every field defined (in static data and again in field descriptor
  instance size data).
- No longer generate/compile in the messages/enums in descriptor.proto. If
  developers need it, they should generate it and compile it in. Reduced the
  overhead of the core library.
- Compute the number of has_bits actually needs to avoid over reserving.
- Let the boolean single fields store via a has_bit to avoid storage, makes
  the common cases of the instance size smaller.
- Reorder some flags and down size the enums to contain the bits needed.
- Reorder the items in the structures to manually ensure they are are packed
  better (especially when generating 64bit code - 8 bytes for every field,
  16 bytes for every extension, instance sizes 8 bytes also).
- Split off the structure initialization so when the default is zero, the
  generated static storage doesn't need to reserve the space. This is batched
  at the message level, so all the fields for the message have to have zero
  defaults to get the saves. By definition all proto3 syntax  files fall into
  this case but it also saves space for the proto2 that use the standard
  defaults. (saves 8 bytes of static data for every field that had a zero
  default)
- Don't track the enums defined by a message. Nothing in the runtime needs it
  and it was just generation and runtime overhead. (saves 8 bytes per enum)
- Ensure EnumDescriptors are started up threadsafe in all cases.
- Split some of the Descriptor initialization into multiple methods so the
  generated code isn't padded with lots of zero/nil args.
- Change how oneof info is feed to the runtime enabling us to generate less
  static data (8 bytes saved per oneof for 64bit).
- Change how enum value informat is capture to pack the data and only decode
  it if it ends up being needed. Avoids padding issues causing bloat of 64bit,
  and removes the needs for extra pointers in addition to the data (just the
  data and one pointer now).
2016-03-17 10:04:21 -04:00
Thomas Van Lenten
1bf4b38f29 Fix up handing of fields with leading names that should be all caps.
Add a compile test to confirm things are working as expected.
2016-03-08 09:29:49 -05:00
Josh Haberman
35227b4f31 Removed the generated Ruby file from Makefile.am. 2016-03-03 23:52:31 -08:00
Jon Skeet
7762f163a4 Rename Preconditions to ProtoPreconditions
(Generated code changes in next commit.)
2016-02-04 14:50:43 +00:00
Jon Skeet
a3ea9d1203 Rename GeneratedCodeInfo to GeneratedClrTypeInfo
Recently, descriptor.proto gained a GeneratedCodeInfo message, which means the generated code conflicts with our type.
Unfortunately this affects codegen as well, although this is a part of the public API which is very unlikely to affect hand-written code.

Generated code changes in next commit.
2016-02-04 07:05:49 +00:00
Jisi Liu
5221dcbe47 Integrate from google internal.
Java files are moved to un-do the hack in the prevous commit, which
moved the java files to the original position for integration.
2016-01-29 13:51:05 -08:00
Feng Xiao
ea956761cc Fix tests broken by the Java directory change.
Change-Id: I39c4eadbd28164cfd83aa2d1d8b6dfe8286db803
2016-01-14 14:29:51 -08:00
Feng Xiao
64d865210f Update README.md and remove INSTALL.txt
Added instructions on what tools to install to compile protobuf from
source. Removed the INSTALL.txt file because it's just a simple copy of
the autoconf documentation and confuses users.

Change-Id: I6fd8aa13495f1238fe5c62451b95ad480b1c4bed
2016-01-06 18:25:25 -08:00
Feng Xiao
b7610f129d Add missing files to EXTRA_DIST.
Also delete some unused files.
2015-12-28 14:18:49 -08:00
Feng Xiao
d217808417 Merge branch master into v3.0.0-beta-2 2015-12-21 00:34:19 -08:00
Thomas Van Lenten
d6590d6534 Drop all use of OSSpinLock
Apple engineers have pointed out that OSSpinLocks are vulnerable to live locking
on iOS in cases of priority inversion:
. http://mjtsai.com/blog/2015/12/16/osspinlock-is-unsafe/
. https://lists.swift.org/pipermail/swift-dev/Week-of-Mon-20151214/000372.html

- Use a dispatch_semaphore_t within the extension registry.
- Use a dispatch_semaphore_t for protecting autocreation within messages.
- Drop the custom/internal GPBString class since we don't have really good
  numbers to judge the locking replacements and it isn't required. We can
  always bring it back with real data in the future.
2015-12-17 16:05:50 -05:00
Feng Xiao
1c10aca679 Add new files to Makefile.am 2015-12-14 14:04:09 -08:00
Feng Xiao
e841bac4fc Down-integrate from internal code base. 2015-12-11 17:10:28 -08:00
Thomas Van Lenten
a20d0b6cd4 Fix dist_clean and maintainer-clean to get more generated files. 2015-12-10 15:34:34 -05:00
Jon Skeet
c581acb562 Merge pull request #944 from jskeet/umbrella-classname
Change the way the "umbrella class" (descriptors) is named/namespaced
2015-11-19 08:48:50 +00:00
Thomas Van Lenten
42f2eee932 Cleanups of deps and ignores for conformance
- Hopefully complete the deps for other languages for the generated conformance proto sources.
- List the generated sources for cleanup by make's clean rules.
- Make the toplevel nuke the pyc files that can get created in the ObjC dir.
2015-11-16 11:29:59 -05:00
Jon Skeet
284bb452e4 Generated code changes and manual changes for previous commit. 2015-11-09 09:22:45 +00:00
Jon Skeet
0fb39c4afe Created a new exception for JSON failures.
This is only thrown directly by JsonTokenizer, but surfaces from JsonParser as well. I've added doc comments to hopefully make everything clear.

The exception is actually thrown by the reader within JsonTokenizer, in anticipation of keeping track of the location within the document, but that change is not within this PR.
2015-11-05 10:40:22 +00:00
Jon Skeet
fb2488225f Implement JSON parsing in C#.
This includes all the well-known types except Any.
Some aspects are likely to require further work when the details of the JSON parsing expectations are hammered out in more detail. Some of these have "ignored" tests already.

Note that the choice *not* to use Json.NET was made for two reasons:
- Going from 0 dependencies to 1 dependency is a big hit, and there's not much benefit here
- Json.NET parses more leniently than we'd want; accommodating that would be nearly as much work as writing the tokenizer
This only really affects the JsonTokenizer, which could be replaced by Json.NET. The JsonParser code would be about the same length with Json.NET... but I wouldn't be as confident in it.
2015-11-03 19:05:11 +00:00
Jisi Liu
8d8177c757 Merge remote-tracking branch 'origin/master' into fix-author 2015-10-05 13:54:05 -07:00
Jisi Liu
46e8ff63cb Down-integrate from google internal. 2015-10-05 11:59:43 -07:00
Thomas Van Lenten
ad2d5c926b Support enum forward decls in Objective C++
NS_ENUM changes defintion in Objective C++ based on the C++ spec being
compiled with, special case the one situation where it wouldn't support doing a
forward decl for the enum.
2015-10-01 09:03:30 -04:00
Jon Skeet
e50461d809 Pack/Unpack implementation for Any.
We still need the JSON representation, which relies on something like a DescriptorPool to fetch message types from based on the type URL. That will come a bit later.
(The DescriptorPool comment in this commit is just a note which will prove useful if we use DescriptorPool itself.)
2015-09-04 12:43:26 +01:00
Feng Xiao
fcdcf88d8a Fix merge conflict. 2015-08-26 20:35:35 -07:00
Feng Xiao
f900837afa Merge pull request #756 from TeBoring/beta-1
Add distribution for objc
2015-08-26 20:34:13 -07:00
Feng Xiao
a3312983d6 Update Makefile.am to include missing files. 2015-08-26 20:29:01 -07:00
Feng Xiao
99e1868586 Add missing files in dist. 2015-08-26 20:19:05 -07:00
Bo Yang
1c81d0f8be Add distribution for objc 2015-08-26 18:15:39 -07:00
Jisi Liu
4008100e37 Add bazel build/workspace into distribution.
Change-Id: I96fbe5c84a04f5d95c5484002404fc975f2abd21
2015-08-26 17:48:08 -07:00
Feng Xiao
b192ba87f7 Merge remote-tracking branch 'origin/master' into beta-1 2015-08-25 20:24:43 -07:00
Bo Yang
ff7bdad231 Fix bugs on windows 2015-08-25 17:58:48 -07:00
Dan O'Reilly
4a0129f680 Remove ez_setup.py from Makefile.am
Signed-off-by: Dan O'Reilly <oreilldf@gmail.com>
2015-08-20 15:33:01 -04:00
Jon Skeet
0f370b468b Remove a redundant layer of directory hierarchy. 2015-08-03 11:29:59 +01:00
Jan Tattermusch
e61b528b5a Update Makefile.am 2015-08-02 14:27:01 -07:00
Jon Skeet
68380f0f66 Rename ThrowHelper to Preconditions and make it public - we'll want to use it from the generated code soon.
Additionally, change it to return the value passed, and make it generic with a class constraint.
A separate method doesn't have the class constraint, for more unusual scenarios.
2015-07-30 13:36:45 +01:00
Jan Tattermusch
3783d9a8ad remove the freeze API 2015-07-29 20:26:20 -07:00
Jon Skeet
43d64b4f54 Fix typo in Makefile.am 2015-07-22 14:32:27 +01:00
Jon Skeet
17fd398e1a Fix file lists for C# 2015-07-22 11:40:52 +01:00
Jon Skeet
86cf61d448 Updated csharp_EXTRA_DIST for Travis 2015-07-17 10:14:29 +01:00
Jan Tattermusch
271cba2871 updated csharp_EXTRA_DIST 2015-07-16 11:25:16 -07:00
Jisi Liu
e6484d306d Fix distcheck.
Change-Id: I74e2d5958b5e7b15d10e5a6468bca917323b9739
2015-06-18 11:24:07 -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
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
Feng Xiao
e96ff30120 Down-integrate from internal code base.
[ci skip]

Change-Id: I9391c09640e0b0b2b21c45a97a1fc91814d95c5d
2015-06-15 18:24:01 -07:00
Jisi Liu
80da6d3727 Remove the file from Makefile.am
Change-Id: I2015df2409aa95401af658b40023c8f9b9d75068
2015-06-13 11:22:31 -07:00
Thomas Van Lenten
0f2b4a0e82 Update podspec for files that can build now, rename assets to not need @ in the name. 2015-06-10 14:30:59 -04:00