Commit Graph

839 Commits

Author SHA1 Message Date
Kal Conley
a52539a32d Fix some narrowing implicit casts [NFC] 2015-11-28 20:22:25 -08:00
Craig Donner
8e869f7627 Adds support for buliding protobuf with emscripten; we just needed the proper platform define used in the right place. 2015-11-24 15:07:18 -08:00
Jon Skeet
72ec33676f Tidy up reflection in advance of attempting to implement DynamicMessage.
There are corner cases where MessageDescriptor.{ClrType,Parser} will return null, and these are now documented. However, normally they *should* be implemented, even for descriptors of for dynamic messages. Ditto FieldDescriptor.Accessor.
We'll still need a fair amount of work to implement dynamic messages, but this change means that the public API will be remain intact.

Additionally, this change starts making use of C# 6 features in the files that it touches. This is far from exhaustive, and later PRs will have more.

Generated code changes coming in the next commit.
2015-11-22 16:25:44 +00:00
Jon Skeet
a6361a124a Rename "umbrella" to "reflection" consistently.
This changes csharp_names.h, which will require a corresponding change in GRPC.
2015-11-19 13:05:17 +00:00
Jon Skeet
2a15051a1e Introduce a Parser property into MessageDescriptor, and populate it from generated types.
Generated code coming in next commit - in a subsequent PR I want to do a bit of renaming and redocumenting around this, in anticipation of DynamicMessage.
2015-11-19 08:50:28 +00: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
2a91c64f49 Reorder the checks so anything in the expected file is an implicit whitelisting.
In the old flow, any 2 char prefix in the expected file was still generating a
warning about being a poor prefix. Now we check the expected file first, so
anything expected is let through.
2015-11-17 16:48:59 -05:00
Jon Skeet
61a50b9e6b Change how the reflection descriptor class is generated.
Instead of having a Proto nested namespace to avoid conflicts between the descriptor-holding static class and message classes, just append "Reflection" to the name.
Generated code changes (and corresponding manual changes) in following commit.
2015-11-09 09:22:43 +00:00
Jon Skeet
f4f601bd47 Stop removing all blank lines in doc comments.
This fixes issue #832.

Generated code changes in next commit.
2015-11-06 18:38:16 +00:00
Doug Kwan
2a50e67c78 Add support for POWER Linux 2015-11-03 14:49:42 -08:00
Feng Xiao
9659ea9e56 Fix compilation errors when built internally.
1. mathlimits.h must be included before the inclusion of cmath (which
     gtest/gtest.h seems to include).
  2. hash function for StringPiece doesn't work.

Change-Id: I358a25d941a25b10b39fe76780eda41557699811
2015-11-02 12:39:27 -08:00
Benjamin Barenblat
a2ce9cb9ea Correct spelling 2015-10-30 14:05:24 -04:00
Bruce Dawson
86ba70ec41 Get VS 2015 to use const int definitions
VC++ up to VS 2015 RTM does not require explicit storage allocation for
static const integers declared in classes. VS 2015 Update 1 requires
these storage definitions in some cases. It's unclear exactly what
cases - simple tests work with and without the explicit storage
allocation.

Many previous versions of VC++ have theoretically *allowed* a
definition to supply storage, but tests on VC++ 2013 show that this
doesn't actually work correctly - it leads to duplicate definition
errors in Chromium. So, the change is scoped to VS 2015 only.

This change also updates the generated files to match the new generator.

TL;DR - this change is necessary in order for Chromium to build with
VS 2015 Update 1.
2015-10-29 13:04:18 -07:00
Jan Tattermusch
d4569d1f5e Merge pull request #908 from jskeet/oneof-equality
Use oneof case in equality tests
2015-10-24 11:41:00 -07:00
Jon Skeet
964627ece0 Include the oneof-case in equality and hash code generated code.
The included C# test will fail until the regenerated code is used, which is in the next commit.
2015-10-24 06:45:20 +01:00
Matthew Wu
187cfc5700 Change the #include for any.h to use angle brackets instead of quotes, to be consistent with other protobuf library includes. 2015-10-22 16:09:56 -07:00
Feng Xiao
5314ad1b21 Merge pull request #783 from podsvirov/topic-cmake-project
Improved CMake project
2015-10-16 14:08:38 -07:00
Jan Tattermusch
d8a926ebf2 Merge pull request #824 from jtattermusch/expose_get_output_file
Expose GetOutputFile in csharp_names.h
2015-10-14 07:40:36 -07:00
Feng Xiao
8894d1febf Merge pull request #875 from tkarls/return_correct_bool_type_from_map
Changed return type from int32 to bool in function returning a bool
2015-10-13 16:52:50 -07:00
Thomas Karlsson
59906e81d8 Changed argument typ to uint32 in set function that sets an uint32 value 2015-10-13 13:35:07 +02:00
Thomas Karlsson
b7996f0929 Changed return type from int32 to bool in function returning a bool 2015-10-13 13:20:32 +02:00
Paul Yang
49f24afb45 Merge pull request #815 from TeBoring/third-party
Use std::get where it's available
2015-10-09 12:38:31 -07:00
Hamdi Sahloul
4ead55c370 Use static cast
Used static cast to improve initalization compatibility with MSVC2010
2015-10-09 05:10:30 +09:00
Hamdi Sahloul
4c4aae87d5 VS2010 compatibility of address initalization
VS2010 cannot compile json_util_test.cc since it assumes NULL as a zero (int), and therefore cannot convert into to char*
2015-10-09 00:21:26 +09:00
Jisi Liu
5f6a1d3dbb Remove duplicated header file 2015-10-06 13:58:41 -07:00
Jisi Liu
61871a02d4 fix stringpiece test to use portable hash set. 2015-10-05 15:05:50 -07:00
Jisi Liu
e8c3c54b3f Adding back three missing export macros. 2015-10-05 14:39:10 -07: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
Bo Yang
7c14dc837b Down-integrate internal bug fixing changes. 2015-10-04 13:22:54 -07:00
Jon Skeet
67dd42c50d First pass at generating XML documentation from .proto comments.
This could be tidied up significantly, and at some point we will want to parse the markdown and generate more appropriate XML - but this is definitely better than nothing.

Generated code changes coming in next commit.
2015-10-01 10:36:58 +01:00
Jon Skeet
6bbbdfa24c Fix typo in oneof case enum comment 2015-09-30 06:59:38 +01:00
Jon Skeet
1351d20c31 Move the summary comments above the attributes.
(Generated code changes coming next...)
2015-09-29 14:34:05 +01:00
Jon Skeet
2212f56bcd Added documentation to generated code.
There are now summaries for:
- The Types nested class (which holds nested types)
- The file descriptor class for each proto
- The enum generated for each oneof

(Also fixed two typos.)

Generated code in next commit.
2015-09-29 13:37:15 +01:00
Feng Xiao
0e5686a707 Merge pull request #727 from AustinSchuh/arena_bounds_fix
Handled blocks being too small in arena.cc
2015-09-24 17:41:45 -07:00
Jan Tattermusch
c31f11deb4 expose GetOutputFile in csharp_names.h 2015-09-23 15:12:17 -07:00
Jan Tattermusch
97a1c1e08d Merge pull request #785 from jskeet/csharp-directories
Generate C# directory hierarchy with new option
2015-09-23 14:31:31 -07:00
Konstantin Podsvirov
e301946ca4 Simplify testing from CMake project to "check" target 2015-09-17 12:08:47 +03:00
Konstantin Podsvirov
2fa0439b00 Improved testing from CMake project 2015-09-15 15:01:05 +03:00
0xAAE
d41a3d630c Add GOOGLE_ATTRIBUTE_NOINLINE to GetArena() and GetMaybeArenaPointer() methods. This is to avoid "unresolved link" errors in MSVC 2015 during Release build 2015-09-15 01:46:28 +03:00
Feng Xiao
fbabf987e6 Merge pull request #769 from pkasting/metadata
Fix compile failures building protobuf DLLs on MSVC in Chromium's cod…
2015-09-10 12:46:21 -07:00
Feng Xiao
c8c5fed544 Merge pull request #766 from pkasting/hash
Refine check for unordered_{map|set} availability.
2015-09-10 12:45:22 -07:00
Brian Silverman
ff156e4863 Add atomics support for 32-bit PPC.
This was originally submitted as a patch on the Google Code issue
tracker, but the original author didn't submit a pull request. They did,
however, give permission for somebody else to do so. I cleaned up a few
things myself and am now submitting it.

I can't find any record of what the original patch was, but there is a
copy of the discussion at
<https://groups.google.com/forum/#!topic/protobuf/SMwF5fYHIi0>.

Fixes google/protobuf#581
2015-09-09 18:37:33 -04:00
Brian Silverman
21f3d3777a Don't assume char is signed.
It isn't always, which causes problems when trying to put negative
values into the array with C++11.
2015-09-08 20:25:48 -04:00
Brian Silverman
133be3dc1f Use TEST_TMPDIR for writing temporary files if it's set.
Bazel expects all tests to do this.
2015-09-08 20:25:48 -04:00
kbinani
9a06c8000e Rename 'BYTE_SIZE' macro to 'GOOGLE_PROTOBUF_BYTE_SIZE'
Xcode raises warning that says "'BYTE_SIZE' macro redefined".
The original 'BYTE_SIZE' macro definition is here, for example:
'/Applications/Xcode/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.10.sdk/usr/include/mach/vm_param.h'
2015-09-04 14:00:16 +09:00
Mohamed El-Tahan
97fa4ca156 Fixing compile errors on Solaris in 64-bit mode 2015-09-02 11:34:23 -04:00
Jon Skeet
ccd76802fa Stop adding a space to the end of lines for descriptor binary data. 2015-09-01 15:35:10 +01:00
Jon Skeet
75a18a39ca Specify csharp_namespace in descriptor.proto 2015-09-01 15:29:15 +01:00
Jon Skeet
5eb1fac983 Generate a directory hierarchy based on namespace (C#)
This introduces a new C# option, base_namespace.
If the option is not specified, the behaviour is as before: no directories are generated.
If the option *is* specified, all C# namespaces must be relative to the base namespace, and the directories are generated relative to that namespace.

Example:
- Any.proto declares csharp_namespace = "Google.Protobuf.WellKnownTypes"
- We build with --csharp_out=Google.Protobuf --csharp_opt=base_namespace=Google.Protobuf
- The Any.cs file is generated in Google.Protobuf/WellKnownTypes (where it currently lives)

We need a change to descriptor.proto before this will all work (it wasn't in the right C# namespace) but that needs the other descriptors to be regenerated too. See next commit...
2015-09-01 15:05:03 +01:00
Jon Skeet
0101a59b62 Remove vestigial reference to MakeFixedTag 2015-09-01 13:27:26 +01:00
Feng Xiao
0087da9d47 Merge remote-tracking branch 'origin/master' into beta-1
Conflicts:
	src/google/protobuf/extension_set.h
2015-08-29 16:42:55 -07:00
Feng Xiao
f0640b5a04 Merge pull request #770 from pkasting/string_space
Move StringSpaceUsedIncludingSelf to lite library.
2015-08-28 14:09:00 -07:00
Feng Xiao
69ac02a216 Merge pull request #771 from pkasting/static_init_1
Remove a static initializer by removing a global of non-POD type.
2015-08-28 14:05:01 -07:00
Feng Xiao
67946e98a9 Merge pull request #569 from redivo/master
Fix GOOGLE_PROTOBUF_ATOMICOPS_ERROR syntax error
2015-08-28 13:34:35 -07:00
Austin Schuh
ad1d726cc2 Handled blocks being too small in arena.cc
When the user passed in a block which was smaller than the Block
structure, this code would blow past the end of the memory and
crash.  Check for that condition.
2015-08-28 11:10:55 -07:00
Feng Xiao
fb0af6d02e Merge pull request #768 from pkasting/time
Delete kNanosPerSecond from time.cc.
2015-08-28 10:28:44 -07:00
Peter Kasting
4f3bead537 Remove a static initializer by removing a global of non-POD type.
These are banned by the Google style guide, and Chromium has a hard
no-new-static-initializers policy preventing updating to a new version of
libprotobuf unless this is resolved.  This is the first such change, I'll need
to make at least one more in the future.

Luckily, the protobuf source tree already has an alternative to static
initializers in once.h; use that machinery instead.

I defined everything in the .cc file in a blob to replace the old implementation
rather than matching the .h layout precisely; let me know if a different
ordering is preferred.  I also eliminated the macro that used to be used here as
spelling everything out only takes one additional line, and the macro didn't
actually handle all details of using a particular member variable, just the
declaration, so it felt a bit error-prone.
2015-08-27 20:16:33 -07:00
Peter Kasting
f5a332553e It helps if you write macros correctly 2015-08-27 20:12:56 -07:00
Peter Kasting
a1be711e96 Try modifying check in hopes of passing upstream build 2015-08-27 19:59:06 -07:00
Peter Kasting
432771fa24 Review comments 2015-08-27 19:52:13 -07:00
Peter Kasting
5ea84dd335 Refine check for unordered_{map|set} availability.
It's not enough to check for C++11 language support, as it's possible for
projects to enable C++11 language and library features independently (e.g.
Chromium currently does this).  Instead, explicitly check the library version to
see if it is recent enough to include unordered_{map|set}.
2015-08-27 19:52:11 -07:00
Feng Xiao
47210ccd77 Merge pull request #746 from zmodem/fix_predict_macros2
Fix the no-op definitions of GOOGLE_PREDICT_{TRUE,FALSE}
2015-08-27 15:52:07 -07:00
Peter Kasting
5d412c47d9 Change to just not marking the class for export 2015-08-27 15:42:03 -07:00
Peter Kasting
b913cbd307 Move StringSpaceUsedIncludingSelf to lite library.
This came up because Chromium downstream modifies the lite library in a way that
requires this function, but I'm upstreaming it because based on the comments in
repeated_field.h, this ought to allow resolution of an existing hack.

I don't know enough about the protobuf code to feel confident trying to resolve
this hack myself, so I've merely updated the TODO comments.
2015-08-27 14:37:18 -07:00
Peter Kasting
6e54999773 Fix compile failures building protobuf DLLs on MSVC in Chromium's codebase.
When trying to compile the protobuf code as a DLL, and then compile other DLLs
with generated .pb.cc/h files that reference
InternalMetadataWithArena::InternalMetadataWithArena(Arena*), MSVC gives an
"unresolved external symbol" error.  This seems to be due to the function being
simultaneously exported and inline.  Moving it out-of-line fixes things.

There are other functions exported and inline as well but de-inlining them
doesn't seem to be necessary to get the build working, and I'd rather de-inline
as few functions as possible.
2015-08-27 14:30:28 -07:00
Peter Kasting
d680159527 Delete kNanosPerSecond from time.cc.
This variable is unused, and thus triggers a build warning on MSVC.
2015-08-27 14:19:51 -07:00
Peter Kasting
2e789bc246 Avoid #including system headers from inside a namespace.
port.h #includes various headers in order to define byteswap functions, but it
currently does so from inside the google::protobuf namespace.  This can cause
bizarre symbol conflicts and other build errors as these headers' contents are
then included inside this namespace.

Instead, #include the relevant headers above the namespace declarations.
2015-08-27 14:16:10 -07:00
Feng Xiao
8e102ad158 Update generated file. 2015-08-26 20:59:59 -07:00
Paul Yang
106f3eb985 Merge pull request #750 from TeBoring/beta-1
Fix bugs for objectivec
2015-08-26 16:25:56 -07:00
TeBoring
aca5a60883 Fix bugs for objectivec 2015-08-26 16:24:06 -07:00
Feng Xiao
d9f4636818 Add a TODO to clean-up the LITTLE_ENDIAN macro. 2015-08-26 22:40:41 +01:00
Feng Xiao
b47bf4c930 Assume LITTLE_ENDIAN for windows build. 2015-08-26 22:32:04 +01:00
Feng Xiao
b7bbe54321 Remove an unused typedef. 2015-08-26 13:45:30 -07:00
Feng Xiao
042bfaf67f Merge remote-tracking branch 'origin/master' into beta-1 2015-08-26 13:33:50 -07:00
Feng Xiao
b00595a3a9 Merge pull request #709 from xfxyjwf/map_bug
Fix JSON map fields parsing.
2015-08-26 13:18:04 -07:00
Jan Tattermusch
276ce8c15b add static cast to silence signedness comparison warning 2015-08-26 13:10:05 -07:00
Hans Wennborg
fcf1b57579 Fix the no-op definitions of GOOGLE_PREDICT_{TRUE,FALSE}
Updating to the current protobuf version caused the following build errors in
Chromium when using Clang on Windows:

..\..\third_party\protobuf\src\google/protobuf/stubs/fastmem.h(67,43) :  error: equality comparison with extraneous parentheses [-Werror,-Wparentheses-equality]
  if (GOOGLE_PREDICT_FALSE(n_rounded_down == 0)) {  // n <= 7
                           ~~~~~~~~~~~~~~~^~~~

The problem is that on Windows, GOOGLE_PREDICT_FALSE is #defined to nothing, so
the code expands to 'if ((n_rounded_down == 0))', which Clang warns about.

Clang would not have warned if the extra parentheses came from the macro,
but in this case they don't because the macro is just dropped.

Fix this by making the macros behave as an identity function instead of just
getting dropped.

This is closer to what these macros look like in stubs/port.h internally.
2015-08-26 11:32:08 -07:00
Feng Xiao
e72c751e4d Fix cmake build on linux. 2015-08-25 22:49:06 -07:00
Feng Xiao
c80f7c6f3c Merge pull request #742 from xfxyjwf/c11_compile
Fix compile issues with -std=c++11
2015-08-25 22:35:24 -07:00
Feng Xiao
d9ab86cdbf Fix compile issues with -std=c++11
This compiles with -std=c++11:
message Foo {
  map<string, Foo> value = 1;
}

This does not compile:
message Foo {
  map<int32, Foo> value = 1;
}

Needs to dig more into the underlying issue.
2015-08-25 22:20:47 -07:00
Jisi Liu
f9237d2bcd Merge pull request #741 from pherl/beta-1
fix "memory leaks" in protostream-object files.
2015-08-25 22:05:31 -07:00
Jisi Liu
0977815af2 fix "memory leaks" in protostream-object files.
Change-Id: I0aca56802d974cb03cb89c1a294f37068b5b9758
2015-08-25 22:01:12 -07:00
Jisi Liu
06c9dfd9a3 Merge pull request #740 from pherl/beta-1
Fix commandline interface file under heapcheck.
2015-08-25 21:11:58 -07:00
Jisi Liu
01e060f20e Fix commandline interface file under heapcheck.
The internal down-integrate script probably does not handle the
top level macros well. Moved the macro inside of the namespace
declrations to avoid down-integrate errors in the future.

Change-Id: I3790357f36b0204a2a26577805192a3a1e989df8
2015-08-25 20:53:19 -07:00
Feng Xiao
b192ba87f7 Merge remote-tracking branch 'origin/master' into beta-1 2015-08-25 20:24:43 -07:00
Feng Xiao
cf94f7b744 Merge pull request #726 from DouglasHeriot/msvc-noinline
Define GOOGLE_ATTRIBUTE_NOINLINE for MSVC. Workaround for VS2015 Release build compiler bug
2015-08-25 18:16:02 -07:00
Feng Xiao
5da0b46811 Merge pull request #734 from TeBoring/beta-1
Fix bugs on windows
2015-08-25 18:00:26 -07:00
Bo Yang
ff7bdad231 Fix bugs on windows 2015-08-25 17:58:48 -07:00
Jisi Liu
144ea00659 Merge branch 'beta-1' of github.com:google/protobuf into manual-merge 2015-08-25 17:03:49 -07:00
Jisi Liu
4c663d810e Update descriptor protos.
Change-Id: I74a73d3135ec1e0e4d52d741a77456b8e55f038f
2015-08-25 17:03:05 -07:00
Jisi Liu
db45aa117a Merge branch 'beta-1' of github.com:google/protobuf into manual-merge
Change-Id: I83a93fdb119a643fbc884e6ec3624493f6270370
2015-08-25 16:51:22 -07:00
Feng Xiao
cc5a1bfede Make the PARSER @Deprecated public.
(cherry-picking an intenral change).
2015-08-25 16:50:53 -07:00
Jisi Liu
56c4f57bb0 Merge branch 'gcc-c++11-fix' of https://github.com/nsuke/protobuf into beta-1
Manually merge pull request: https://github.com/google/protobuf/pull/674
that fixes the gcc C++11 build.
2015-08-25 16:32:01 -07:00
Jon Skeet
ca89a1a118 Change where we rename Descriptor.cs to DescriptorProtoFile.cs.
We now do this in protoc instead of the generation simpler.

Benefits:
- Generation script is simpler
- Detection is simpler as we now only need to care about one filename
- The embedded descriptor knows itself as "google/protobuf/descriptor.proto" avoiding dependency issues

This PR also makes the "invalid dependency" exception clearer in terms of expected and actual dependencies.
2015-08-25 14:32:28 +01:00
Feng Xiao
839b180dba Cherry-pick Java utf8 change. 2015-08-24 11:25:15 -07:00
Feng Xiao
b17ec3ca11 Down-integrate from internal code base. 2015-08-23 17:50:38 -07:00
Feng Xiao
eee38b0c01 Down-integrate from google3. 2015-08-22 18:25:48 -07:00
Tamir Duberstein
322d8939fc Remove Python 2.5 cruft 2015-08-22 12:54:31 -04:00
Jisi Liu
c3bc155ace Merge branch 'master' of github.com:google/protobuf
Change-Id: If3fb07754a734bae610d95124528e073515ac525
2015-08-21 11:44:49 -07:00