Commit Graph

900 Commits

Author SHA1 Message Date
Kenichiro IDA
894d18fba4 Alter FileDescriptorTables::kEmpty to GetEmptyInstance() 2015-12-17 01:46:48 +09:00
Jon Skeet
aabc6c411a Make ToString() valid without a type registry
This addresses issue #1008, by creating a JsonFormatter which is private and only different
to JsonFormatter.Default in terms of reference equality.

Other plausible designs:

- The same, but expose the diagnostic-only formatter
- Add something to settings to say "I don't have a type registry at all"
- Change the behaviour of JsonFormatter.Default (bad idea IMO, as we really *don't* want the result of this used as regular JSON to be parsed)

Note that just trying to find a separate fix to issue #933 and using that to override Any.ToString() differently wouldn't work for messages that *contain* an Any.

Generated code changes follow in the next commit.
2015-12-15 09:23:38 +00:00
Feng Xiao
85c4c36c82 Remove the usage of C++11 override.
[skip appveyor]

Change-Id: I700f70e734abb6264db29369ecf227a9e1f783e7
2015-12-14 14:49:44 -08:00
Feng Xiao
e841bac4fc Down-integrate from internal code base. 2015-12-11 17:10:28 -08:00
Feng Xiao
9cbf40873d Merge pull request #1025 from Yangqing/master
Arena type traits standardization.
2015-12-09 16:58:18 -08:00
Yangqing Jia
031558bd36 Minor changes to match the internal version 2015-12-09 15:25:02 -08:00
Feng Xiao
723010dc54 Merge pull request #1033 from c0nk/wip-implicit-cast-fix
Fix narrowing implicit cast in generated message [NFC]
2015-12-09 13:40:38 -08:00
Kal Conley
f42a68df54 Fix narrowing implicit cast in generated message [NFC] 2015-12-08 23:12:06 -08:00
Bo Yang
1f0286a404 Use angle bracket for well known type proto header. 2015-12-08 14:43:45 -08:00
Yangqing Jia
bbf64cee3d Arena type traits standardization.
This is adapted from the branch of @xfxyjwf at:

494716a682

and should solve the protobuf compilation problem against nvcc.

Tested against nvcc 6.5 and 7.0.
2015-12-05 18:36:18 -08:00
Thomas Van Lenten
536059e569 Tweak the error message as the generate is in the core binary these days. 2015-12-02 14:43:29 -05:00
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
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