Commit Graph

4602 Commits

Author SHA1 Message Date
Jie Luo
ae220cda61 Add auto detect for generated code of WKT protos, addressbook.proto and conformance.proto 2017-03-10 10:44:20 -08:00
Feng Xiao
03c8c8be6d Update comments for setSizeLimit. 2017-03-09 17:24:42 -08:00
Jisi Liu
a1bb147e96 Merge pull request #2825 from pherl/javawarning
Cherry-pick changes from javalite branch to also fix Java warnings in the master branch
2017-03-09 17:13:55 -08:00
Feng Xiao
1ece7c09af Add missing thread dependency in cmake. 2017-03-09 17:02:17 -08:00
Jisi Liu
009e491bd7 Fix GeneratedMessageV3 warnings. 2017-03-09 16:56:18 -08:00
Feng Xiao
da003550e8 Merge pull request #2809 from xfxyjwf/i2464
Make JsonFormat locale independent.
2017-03-09 16:38:59 -08:00
Feng Xiao
61e87f3d41 Use per-type table to lookup JSON name.
Different fields from different messages can map to the same JSON name
and the original global lookup table is only capable of mapping one of
such fields. This change converts the global table to per-type tables
so fields from different messages won't conflict.
2017-03-09 16:30:15 -08:00
Jisi Liu
7c7534413a Fix lint warnings in the javalite branch. 2017-03-09 16:26:55 -08:00
Joshua Haberman
cad6a51a30 Merge pull request #2819 from haberman/pythonexcept
update_failure_list.py: fixed Python "raise" statement.
2017-03-09 14:58:01 -08:00
Josh Haberman
3e6245e5d7 update_failure_list.py: fixed Python "raise" statement. 2017-03-09 14:48:28 -08:00
Feng Xiao
075475f834 Don't expose gson exceptions in JsonFormat. 2017-03-09 14:42:45 -08:00
Adam Cozzette
bbfb9d52da Merge pull request #2804 from acozzette/ruby-memcpy
Ruby: wrap calls to memcpy so that gem is compatible with pre-2.14 glibc
2017-03-09 14:30:50 -08:00
Feng Xiao
8e465dcf46 Merge pull request #2810 from xfxyjwf/i1994
Avoid redundant type casts for oneof bytes fields.
2017-03-09 13:57:34 -08:00
Feng Xiao
af2d5f5ad3 Merge pull request #2775 from xfxyjwf/fixmajor
Undef major/minor if they are defined as macro.
2017-03-09 13:50:31 -08:00
Jisi Liu
9afacb44a3 Merge pull request #2814 from pherl/javadeprecate
Add annotations for deprecated messages in Java
2017-03-09 13:50:19 -08:00
Jisi Liu
baceff7c9c Add annotations for deprecated messages in Java 2017-03-09 11:51:58 -08:00
Adam Cozzette
9fa40314fc Ruby: wrap calls to memcpy so that gem is compatible with pre-2.14 glibc
This commit adds a __wrap_memcpy function and a linker flag to use that
in place of memcpy for our Ruby gem C extension. This allows us to
always use the 2.2.5 version of memcpy, making it possible to use the
gem on distributions with pre-2.14 versions of glibc.

Before this change:
$ objdump -T protobuf_c.so | grep memcpy
0000000000000000      DF *UND*  0000000000000000  GLIBC_2.3.4 __memcpy_chk
0000000000000000      DF *UND*  0000000000000000  GLIBC_2.14  memcpy

After:
$ objdump -T protobuf_c.so | grep memcpy
0000000000000000      DF *UND*  0000000000000000  GLIBC_2.2.5 memcpy
0000000000000000      DF *UND*  0000000000000000  GLIBC_2.3.4 __memcpy_chk
0000000000042450 g    DF .text  0000000000000005  Base __wrap_memcpy

This is based on gRPC's solution to a similar problem:
5098508d2d/src/core/lib/support/wrap_memcpy.c

This fixes issue #2783.
2017-03-09 10:03:22 -08:00
Feng Xiao
c31154316b Avoid redundant type casts for oneof bytes fields. 2017-03-08 17:34:38 -08:00
Feng Xiao
4ae8656b6d Make JsonFormat locale independent. 2017-03-08 16:56:43 -08:00
Feng Xiao
fa1788026c Merge pull request #2602 from GreatFruitOmsk/issue-2428
Method Builder#clone() has been changed to bypass Java 1.6 compiler issue.
2017-03-08 15:28:34 -08:00
Jie Luo
920af75d1c Fix Bad Link for Common Lisp 2017-03-08 15:24:04 -08:00
Paul Yang
dd8d5f57d7 Rename encode/decode to serializeToString/mergeFromString (#2795)
This better shows the semantic of the API. For already setted fields,
mergeFromString do replacement for singular fields and appending for
repeated fields.
2017-03-08 14:31:34 -08:00
Emmanuel Odeke
769b693564
compiler/cli: PrintHelpText prints to stdout instead of stderr
Fixes #698.

PrintHelpText now prints to standard output instead of to standard error.
The purpose of this CL is to make it easy for users to grep for matches
otherwise stderr output has to be awkwardly redirectly to stdout
using this shell trick  `2>&1`, for example
```shell
protoc --help 2>&1 | grep cpp
```

of which we shouldn't be making users have to work that hard just to
get use of --help.

+ Exhibits:
* Before:
```shell
$ protoc --help | grep cpp
Usage: protoc [OPTION] PROTO_FILES
Parse PROTO_FILES and generate output based on the options given:
  -IPATH, --proto_path=PATH   Specify the directory in which to search
for
                              imports.  May be specified multiple times;
                              directories will be searched in order.  If
not
                              given, the current working directory is
used.
  --version                   Show version info and exit.
  -h, --help                  Show this text and exit.
  --encode=MESSAGE_TYPE       Read a text-format message of the given
type
                              from standard input and write it in binary
                              to standard output.  The message type must
                              be defined in PROTO_FILES or their
imports.
  --decode=MESSAGE_TYPE       Read a binary message of the given type
from
                              standard input and write it in text format
                              to standard output.  The message type must
                              be defined in PROTO_FILES or their
imports.
  --decode_raw                Read an arbitrary protocol message from
                              standard input and write the raw tag/value
                              pairs in text format to standard output.
No
                              PROTO_FILES should be given when using
this
                              flag.
  -oFILE,                     Writes a FileDescriptorSet (a protocol
buffer,
    --descriptor_set_out=FILE defined in descriptor.proto) containing
all of
                              the input files to FILE.
  --include_imports           When using --descriptor_set_out, also
include
                              all dependencies of the input files in the
                              set, so that the set is self-contained.
  --include_source_info       When using --descriptor_set_out, do not
strip
                              SourceCodeInfo from the
FileDescriptorProto.
                              This results in vastly larger descriptors
that
                              include information about the original
                              location of each decl in the source file
as
                              well as surrounding comments.
  --dependency_out=FILE       Write a dependency output file in the
format
                              expected by make. This writes the
transitive
                              set of input file paths to FILE
  --error_format=FORMAT       Set the format in which to print errors.
                              FORMAT may be 'gcc' (the default) or
'msvs'
                              (Microsoft Visual Studio format).
  --print_free_field_numbers  Print the free field numbers of the
messages
                              defined in the given proto files. Groups
share
                              the same field number space with the
parent
                              message. Extension ranges are counted as
                              occupied fields numbers.

  --plugin=EXECUTABLE         Specifies a plugin executable to use.
                              Normally, protoc searches the PATH for
                              plugins, but you may specify additional
                              executables not in the path using this
flag.
                              Additionally, EXECUTABLE may be of the
form
                              NAME=PATH, in which case the given plugin
name
                              is mapped to the given executable even if
                              the executable's own name differs.
  --cpp_out=OUT_DIR           Generate C++ header and source.
  --csharp_out=OUT_DIR        Generate C# source file.
  --java_out=OUT_DIR          Generate Java source file.
  --javanano_out=OUT_DIR      Generate Java Nano source file.
  --js_out=OUT_DIR            Generate JavaScript source.
  --objc_out=OUT_DIR          Generate Objective C header and source.
  --python_out=OUT_DIR        Generate Python source file.
  --ruby_out=OUT_DIR          Generate Ruby source file.
```

* After:
```shell
$ protoc --help | grep cpp
  --plugin=EXECUTABLE         Specifies a plugin executable to use.
                              Normally, protoc searches the PATH for
                              plugins, but you may specify additional
                              executables not in the path using this
flag.
                              Additionally, EXECUTABLE may be of the
form
                              NAME=PATH, in which case the given plugin
name
                              is mapped to the given executable even if
                              the executable's own name differs.
  --cpp_out=OUT_DIR           Generate C++ header and source.
  --csharp_out=OUT_DIR        Generate C# source file.
  --java_out=OUT_DIR          Generate Java source file.
  --javanano_out=OUT_DIR      Generate Java Nano source file.
  --js_out=OUT_DIR            Generate JavaScript source.
  --objc_out=OUT_DIR          Generate Objective C header and source.
  --python_out=OUT_DIR        Generate Python source file.
  --ruby_out=OUT_DIR          Generate Ruby source file.
```
2017-03-08 11:42:11 -07:00
Feng Xiao
2b7430d96a Merge pull request #2793 from keveman/master
Removed a stray return statement, causing compilation error.
2017-03-07 14:22:57 -08:00
Jisi Liu
f6d8c83384 Merge pull request #2613 from aausch/fix_memory_leak
optimization and quick workaround to memory leak
2017-03-06 16:48:54 -08:00
Manjunath Kudlur
21b58b51fe Removed a stray return statement, causing compilation error. 2017-03-06 15:50:26 -08:00
Adam Cozzette
651ba62ab5 JS: ensure that extension values are serialized even if they're falsy
There was a bug where for JavaScript we would only serialize an
extension value if it evaluated as truthy, which meant that values like
0 would get silently dropped (even in proto2, where field presence is
significant). This fixes issue #2605, and takes care of the output of
toObject() in addition to the binary format.
2017-03-06 15:37:40 -08:00
Jie Luo
06f9f609e1 Detect if Descriptor.cs changes for csharp
Merge pull request #2788 from anandolee/master
2017-03-06 15:33:41 -08:00
Josh Haberman
f873d3213c Added JavaScript conformance tests. All tests pass! 2017-03-06 10:42:27 -08:00
Josh Haberman
27b1f2b477 WIP. 2017-03-06 10:42:27 -08:00
Feng Xiao
0c0a8879c3 Merge pull request #2751 from keveman/master
Added a header only cc_library target for the protobuf library.
2017-03-06 10:41:19 -08:00
Adam Cozzette
008ff033ef Merge pull request #2784 from acozzette/log-2-floor-int
Return uint32 from Log2FloorNonZero64
2017-03-03 07:06:15 -08:00
Manjunath Kudlur
6837b2dcb7 Added comment explaining the protobuf_headers target. 2017-03-02 18:02:05 -08:00
Jie Luo
af13bff3c7 Detect if Descriptor.cs changes for csharp 2017-03-02 17:15:58 -08:00
Feng Xiao
8610d0a9dd Merge pull request #2755 from xfxyjwf/rubycomp
Add Ruby compatibilty test against 3.0.0.
2017-03-02 14:33:02 -08:00
Thomas Van Lenten
352526c214 Merge pull request #2785 from thomasvl/threading_race
Handing threading race resolving methods.
2017-03-02 17:14:52 -05:00
Thomas Van Lenten
2d1c5e26cb Handing threading race resolving methods.
- Don't prune the extension registry as that can lead to failures when two
  threads are racing.
- If adding the method fails, check and see if it already is bound to decide
  the return result. Deals with threading races binding the methods.
2017-03-02 16:34:11 -05:00
Adam Cozzette
938206d66c Return uint32 from Log2FloorNonZero64
A uint32 is big enough to hold any return value from that function, and
doing it this way prevents compiler warnings in coded_stream.h about
narrowing a uint64 to a uint32.
2017-03-02 11:31:38 -08:00
Adam Cozzette
a7e3b0ab01 Merge pull request #2774 from acozzette/closure-builder
Use closurebuilder.py in favor of calcdeps.py for compiling JavaScript
2017-03-02 08:47:20 -08:00
Sergio Campamá
8b182cc455 Disable static analyzer for message semaphore creation (#2748)
Disable static analyzer for message semaphore creation
2017-03-01 14:00:56 -05:00
Matt Hauck
6011d7ca4c Fix gcc 4.1 build (#1035) (#1913)
* Fix gcc 4.1.2 compilation of map_field_inl.h

Fixes "error: object missing in reference to '...'" errors from #1035

* Disable 64-bit map keys on gcc <= 4.1

* Add missing case statements
2017-03-01 10:45:43 -08:00
Matt Hauck
25ecd559cc Change hint type to const void* (#2568)
This is both more correct, and the build fails on AIX without it
2017-03-01 10:43:28 -08:00
Paul Yang
bcbaabe53a Add mergeFrom method on Message (#2766)
This method merges the contents of the specified message into the
current message. Singular fields that are set in the specified message
overwrite the corresponding fields in the current message.  Repeated
fields are appended. Map fields key-value pairs are overritten.
Singular/Oneof sub-messages are recursively merged. All overritten
sub-messages are deep-copied.
2017-03-01 10:39:48 -08:00
Adam Cozzette
671e075c5e Use closurebuilder.py in favor of calcdeps.py for compiling JavaScript
There are two motivations for this:
1) calcdeps.py is deprecated and replaced by closurebuilder.py.
2) As part of this I was able to tweak things so that the Closure
compiler does not attempt to examine every .js file in the tree under
js/. This makes it possible to put compatibility tests and related files
in a subdirectory without them getting mixed up with the main .js files
we care about.
2017-03-01 07:43:11 -08:00
Adam Cozzette
7339fc04c4 Merge pull request #2674 from acozzette/js-test-cleanup
Removed log statement from writer_test.js
2017-03-01 07:11:33 -08:00
Feng Xiao
b7f25d42d3 Undef major/minor if they are defined as macro. 2017-02-28 18:13:04 -08:00
Adam Cozzette
aff9d9d39c Removed log statement from writer_test.js
This tweak makes the test output a bit easier to read because it cuts
out a lot of unnecessary logging.
2017-02-28 13:49:56 -08:00
Jisi Liu
5274d6ee31 Merge pull request #2770 from xfxyjwf/fixcmake
Remove the use of C++11 features.
2017-02-28 10:57:41 -08:00
Feng Xiao
83b0cc9ba6 Merge pull request #2772 from sschuberth/master
Fix links to the license in meta-data
2017-02-28 10:52:02 -08:00
Jie Luo
606cb7ed2c There might be duplicated enum values when allow_alias is true. Add PreferredAlias into OriginalNameAttribute to remove the duplication (#2727) 2017-02-28 10:51:19 -08:00