Commit Graph

851 Commits

Author SHA1 Message Date
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
44fdead9d2 Merge pull request #1291 from sergiocampama/devel
Adds more information to Objective C error.
2016-03-14 10:07:05 -04:00
Ben Vanik
58f07644ea Fixing compilation error when building with emscripten.
This change was previously done in //third_party in CL 108656107 but never made it to the open source project and was overwritten in an update.
2016-03-11 09:19:58 -08:00
Feng Xiao
48ebb29a8e Merge pull request #1299 from tatraian/master
Fix compiling clang/libc++ builds. (Issue: #1266)
2016-03-08 11:15:24 -08:00
Antal Tátrai
e2fb1d9822 Comment has been added to fix (issue #1266) 2016-03-08 20:01:42 +01: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
Thomas Van Lenten
36650a07cf HeaderDoc support in the library and generated sources
- Convert most of the core library headers over to HeaderDoc format.
- Switch the generated comments over to HeaderDoc.
- Create GPBCodedOutputStream_PackagePrivate and move some things into there
  that should be more internal.
2016-03-07 12:07:03 -05:00
Antal Tátrai
3cc35adb6d Fix compiling clang/libc++ builds. (Issue: #1266) 2016-03-05 09:32:59 +01:00
Josh Haberman
513875da77 Generate well-known types in Ruby extension and prune unneeded proto2 dependencies. 2016-03-03 14:08:54 -08:00
Sergio Campama
b5a35b4411 Adds more information to Objective C error when the expected objc_class_prefix option is missing. 2016-03-03 16:49:53 -03:00
Paul Yang
78105897a8 Merge pull request #1260 from legrosbuffle/master
Make cpp generated enum constants constexpr when Options::proto_h is specified
2016-03-02 10:16:20 -08:00
murgatroid99
a862b6b77f Fix CommonJS relative require generation, and test it 2016-02-24 13:44:57 -08:00
Feng Xiao
513a8a69df Merge pull request #804 from bsilver8192/master
Add atomics support for 32-bit PPC.
2016-02-22 09:27:27 -08:00
Joshua Haberman
32daf513ce Merge pull request #1215 from haberman/commonjs
Added support for CommonJS require()
2016-02-19 14:39:17 -08:00
Clement Courbet
b3d802d215 Make cpp generated enum constants constexpr when Options::proto_h is
specified.
2016-02-19 08:24:29 +01:00
Thomas Van Lenten
2480acb6d9 Support ObjC Generic Collections
- Extend GPB*ObjectDictionary to support generic syntax.
- Update the generator to output generics so the enclosed type is exposed for compiler checks.
- Use generics in a the public interfaces.
- Update the generated sources that are checked in.
2016-02-18 13:55:59 -05:00
Josh Haberman
35298f9779 Fixed definition of extensions, and added CommonJS tests to Travis. 2016-02-18 10:30:21 -08:00
Josh Haberman
77af5d04b1 Fixed nested message scopes for CommonJS. 2016-02-18 10:30:21 -08:00
Josh Haberman
e9f31ee3d7 CommonJS tests are now passing. 2016-02-18 10:30:21 -08:00
Josh Haberman
55cc3aa987 WIP. 2016-02-18 10:30:21 -08:00
Joshua Haberman
d41db75dcb Merge pull request #260 from ejsd1989/issue-#242
Removes redundant null pointer checks checks
2016-02-16 16:47:46 -08:00
Joshua Haberman
3ee2e20539 Merge pull request #1144 from dongjoon-hyun/remove_redundant_the
Remove redundant `the`.
2016-02-11 17:17:48 -08:00
Joshua Haberman
d2c7fe6bc5 Merge pull request #1194 from Photonios/master
Fixed unused parameters and extra ';'
2016-02-11 11:36:34 -08:00
Joshua Haberman
655a9d667f Merge pull request #1217 from jhump/jh/make-warning-useful
make 'no syntax' warning useful by showing which file
2016-02-11 10:43:47 -08:00
Joshua Haberman
a924e0b858 Merge pull request #1185 from kkm000/icl-fix
Fix Intel compiler warnings in include files on Windows
2016-02-10 14:12:29 -08:00
Joshua Humphries
d740bc9bd1 make 'no syntax' warning useful by showing which file 2016-02-06 08:34:08 -05: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
Dongjoon Hyun
7a9040fe7f Remove redundant the in comments. 2016-02-03 15:27:27 -08: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
Swen Kooij
37d6cf9cfe Fixed unused parameters and extra ';' 2016-01-28 11:40:07 +02:00
kkm
714b6b761b Fix Intel compiler warnings in include files on Windows 2016-01-27 14:23:36 -08:00
Feng Xiao
d0e0114f31 Refactor README.md.
Move the original README.md to src since it's talking about C++
exclusively and add a more general README.md to document how
to install protoc for all languages.
2016-01-21 17:30:45 -08:00
Brian Silverman
96c2dd5dfc Avoid upcasting uninitialized pointers
Fixes google/protobuf#693

msan flags this as being undefined behavior. I think it's triggering
because the compiler has to insert a branch to avoid changing the
pointer's value if it starts out NULL. I can't figure out if this is
actually undefined behavior or not, but it definitely seems to be a gray
area of the standard which is best avoided.
2016-01-20 23:05:25 -05:00
Feng Xiao
fe066bd514 Merge pull request #789 from motahan/solaris64_fix
Fixing compile errors on Solaris in 64-bit mode
2016-01-20 16:57:01 -08:00
John Burke
3937dedbff Fix compiler warning from repeated_field.h 2016-01-19 15:13:25 -08:00
Feng Xiao
bbe6e430f6 Merge pull request #896 from jhump/jh/fix-ioexception-vs-invalidprotobuf-exception
throw IOException instead of InvalidProtocolBufferException when appropriate
2016-01-16 20:54:31 -08:00
Joshua Humphries
60654349e7 fully qualify invocations of static methods on GeneratedMessage 2016-01-15 21:51:19 -05:00
Joshua Humphries
f3c75580e4 throw IOException instead of InvalidProtocolBufferException when appropriate 2016-01-15 21:51:19 -05:00
Jon Skeet
b1ea15f7a5 Make sure that
"valueField": null

is parsed appropriately, i.e. that it remembers that the field is set.
2016-01-15 14:18:16 +00:00
Jon Skeet
9e4f354f14 Prohibit null values in map fields
On deserialization, missing values for message types
are replaced with a "default" message.
2016-01-11 09:34:43 +00:00
Feng Xiao
8f2b622944 Fix appveyor build. 2016-01-09 00:48:49 -08:00
Feng Xiao
76195058e2 Patch internal change 111557819.
Defer calls to mutable_unknown_fields() until it is actually required to
save memory for C++ lite runtime.

Change-Id: Ica9c1fd276cdb164942d1e7b6e098c83ee3ffdc5
2016-01-06 18:10:24 -08:00
Feng Xiao
17347e3d0d Fix for Visual Studio 2008. 2015-12-30 01:18:22 -08:00
Feng Xiao
c5147e3d51 Fix a misplaced macro.
Change-Id: Ife609e073bd142d328b680c753f543bb18f4f66d
2015-12-28 16:40:39 -08:00
Feng Xiao
7a9d5825e2 Fix a compiler warning.
Change-Id: I4c4e2a4a248e4336fef735f75ff5648d8d33627e
2015-12-28 16:30:59 -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
Feng Xiao
b27f2893b2 Merge pull request #1062 from rinatz/master
Fix static non-pod type problem with dlopen
2015-12-18 17:36:14 -08:00
Kenichiro IDA
674e92d314 Initialize singleton instance by GoogleOnceInit() 2015-12-19 10:14:42 +09:00